How To: Get USB cameras working through thinlinc

Hello everyone,

I’ve recently got my local camera working through thinlinc to my server so that I can use video conferencing software within my thinlinc session. The sharing of serial devices in thinlinc doesn’t work for USB webcams as they require special support. As far as I can tell there is no direct support for sharing your webcam/USB camera through thinlinc. I’m putting this guide here to help others get it working.

Assuming your client is running linux (debian) and so is your server here is the solution I came up with;

  1. Setup client with camera sharing

a. Install USBIP
: sudo apt install usbip

b. Load USBIP host kernel module
: sudo modprobe usbip_host

  Add to /etc/modules in the LTSP-buster-fat-client image.
  : usbip_host

c. Scan using usbip and take note of the BUSID
: sudo usbip list -l
Take note of the busid of the camera

d. Share camera
: sudo usbip bind --busid=
eg;
: sudo usbip bind --busid=1-2

  NOTE: The busid can change if you move around the USB slot. So
  might be best to label the slot on staff computers for 'camera'
  so it doesn't move.

e. Start daemon
: sudo usbipd

  1. Setup Server to link to camera

a. Install usbip
: sudo apt install usbip

b. Start vhci-hcd driver
: sudo modprobe vhci-hcd

  Add to /etc/modules
  : vhci-hcd

c. Connect to camera on client
: sudo usbip attach -r -b
eg;
: sudo usbip attach -r 192.168.0.77 -b 1-2

Please note that my thinlinc clients are diskless workstations which are on the LAN, for this to work remotely you would need to port forward the relevant ports back to your client so that the server could attach to the USB directly.

I hope this tutorial will help people and maybe help Cendio create a more integrated solution for this problem.

3 Likes

Thanks, @map7.

I haven’t had a chance to try/verify this yet, but it is something we get asked about occasionally, so appreciate the feedback.

I have tested zoom,skype,hangouts,jitsi and MS teams under thinlinc and they all pick up the camera.

2 Likes

To get this working nicely I’ve had to create a little wrapper which attaches and then detaches after use;

Example

#!/usr/bin/env bash

# Requirements;
# - apt package usbip
# - starting ~/bin/share_camera on the fat-client
# - vhci-hcd loaded in /etc/modules

# Examples;
#
# Start cheese
# /home/map7/bin/usbip_wrapper cheese
#
# Start zoom
# /home/map7/bin/usbip_wrapper zoom
#
# Start skype within XFCE
# /home/map7/bin/usbip_wrapper /usr/share/skypeforlinux/skypeforlinux %U


PROGRAM=$@

# Connect to camera on fat-client
sudo usbip list --remote=192.168.200.177

BUS=$(sudo usbip list --remote=192.168.200.177|grep "046d:0892"|cut --delimiter=: --fields=1|xargs|tr --delete "\n")
# grep "<device ID>" = find the line with the busid on it
# cut '-d:' -f1      = cut the first field based on delimiter ':'
# xargs              = remove whitespace
# tr -d "\n"         = delete line feed

sudo usbip attach --remote=192.168.200.177 --busid=$BUS
sleep 1
$PROGRAM
sudo usbip detach --port=00
2 Likes

Hi @map7 and thanks for sharing your knowledge in our community. : )

I wonder if you have any updates to this tutorial?

Currently I’m using ssh with X11 forwarding back to the persons workstation instead of the USBIP as I’ve found it more reliable.

EG;
$ ssh -YC zoom

Again with bandwidth this is not an issue at work, we run a 10Gbps lan and we only have 10 computers so it’s pretty good. You could however use trickle to limit bandwidth and I’ve used it in the past for wrapping other applications. Example of limiting to 1.5Mbps;

$ trickle -d 1500 ‘ssh -YC zoom’

or

$ trickle -d 1500 ‘sudo usbip attach -r 192.168.0.77 -b 1-2’

Might do the trick but I haven’t tested these two commands.

NOTE: I’ve even created a little wrapper for each program so that users can click on a zoom invitation within thinlinc and it will automatically start the zoom application on the thinclient and display that within their thinlinc desktop;

Wrapper;

#!/usr/bin/env bash
#
# Author: Michael Pope
# Date: 29/07/2021
#
# Description: This is a shell wrapper which starts zoom on staff's
# thinclient instead of LTSP. The original zoom binary is called
# /usr/bin/zoom.original

LOG="/home/$USER/zoom.log"

# Escape characters from link
printf -v link "%q" "$1"
echo $link >> ~/diagnostics.log

# Get IP address of thinclient from thinlinc session
IP=`tl-session-param /client_ip`

echo "Using the following to connect" > $LOG
echo "ssh -Y $USER@$IP zoom $link" >> $LOG

# Call zoom passing the link to my thinclient
ssh -Y $USER@$IP zoom $link

This same wrapper is used for other video conferencing programs such as skype, ms teams and jitsi (through google-chrome on the users machine).

1 Like

Hi @map7

Thank you for sharing!
What is your experience with audio during conference calls over the ThinLinc session, is it sync and working good ?

/Martin

I haven’t noticed a problem.

We have a 10Gbp link to our server and only run 6 thinlinc sessions to fast thin clients (with i7 processors and 16GB RAM) and run Logitech C720 USB cameras through a nice HP managed switch. So our system is over-specced.

If you are having issues with audio latency I would recommend using the compression ‘-YC’ flags on the ssh, measuring performance of your network using iperf, test with just one person connected to your thinlinc server on a fast client with a fast network to see if it has problems.

What OS are you using on the thin clients @map7 ?

I use Debian 10 64bit with XFCE WM over PXE boot using the LTSP software. I’ve been using it at multiple locations now for over 10 years. The build image which is created has the thinlinc client installed and it’s very easy to maintain. The LTSP team are very welcoming and have helped me a lot over the years through the IRC channel.

@map7 What version of TL server and clients were you running in 2021 and what version are you running now? Has TL 4.14 improved the process you offered above?

We’re looking to enable Zoom for our practice manager with an HP conference monitor, certified for Zoom. Running the TL client on an HP ThinPro OS T530 thin client.

Appreciate your input.

I’m using TL 4.14 on the server. I still use ssh with X11 forwarding and it’s reliable and works well. Not the ultimate solution I’m after, it would be better if Thinlinc offered this as part of the package.

The ssh solution I’m currently using will only work when at the office, when working remote we don’t have direct access to ssh back to. This could be done with port forwarding or tailscale or something but I haven’t had the need.