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.

2 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
1 Like