Use HID device inside container

Hi,

We’re trying to use a HID device inside a container.
Inside the container we can see it using dmesg:


usb 1-2: USB disconnect, device number 7
usb 1-2: new low-speed USB device number 8 using xhci_hcd
hid-generic 0003:07F2:0003.0006: hiddev96,hidraw0: USB HID v1.11 Device [Microcomputer Applications, Inc. KEYLOK HID Mode Dongle] on usb-0000:00:14.0-2/input0

On the host OS we can see it:

root@82ea18a:~# ls /dev/usb
hiddev0

But inside the container we do not see it:

root@3ce553889123:~# ls /dev/usb
ls: cannot access /dev/usb: No such file or directory

I also tried udevd & and udevadm trigger, but that did not work either.

From the docs:

Only support short syntax and named volumes. Bind mounts are not supported, except for as allowed by resin.io specific labels

Ideally I would like to something like this I guess?

volumes:
  - /dev/usb:/dev/usb

How should we do this?

Update: this is fixed by setting priviliged to true in the docker-compose file.

1 Like