One last question: On a host, the device would be owned by root:dialout In a guest, the device is root:root
In the HASS usecase, one would normally add the hass user to dialout. In the comtainer, we wouldn't want to add hass to the root group. While chowning the device to hass:hass works, a reboot reverts the ownership to root. Is there an LXD/LXC way to control permissions on a passed through device? I know I can mitigate it in some other ways, but just wondering if there's an LXD way to do this. Thanks! Lai ----- Original Message ----- From: "Stéphane Graber" <[email protected]> To: "lxc-users" <[email protected]> Sent: Friday, April 20, 2018 12:54:31 PM Subject: Re: [lxc-users] Hotplugging devices (USB Z-Wave controller) with path value On Wed, Apr 18, 2018 at 03:41:04PM -0400, Lai Wei-Hwa wrote: > To add another thing, even though I've removed the device (lxc config device > remove hass Z-Wave), it is still seen in the container: > > lai@hass:~$ lsusb > Bus 002 Device 003: ID 0624:0249 Avocent Corp. Virtual Keyboard/Mouse > Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub > Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub > Bus 005 Device 002: ID 0624:0248 Avocent Corp. Virtual Hub > Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub > Bus 001 Device 002: ID 0424:2514 Standard Microsystems Corp. USB 2.0 Hub > Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub > Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub > Bus 003 Device 002: ID 0658:0200 Sigma Designs, Inc. > Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub > > Thanks! > Lai > > > > I was trying to setup hotplugging a USB into an LXD container. I need the > path, in the container, to be /dev/ttyACM0. How can I do this? > > lai@host:~$ lxc config device add hass Z-Wave unix-char vendorid=0658 > productid=0200 path=/dev/ttyACM0 > Error: Invalid device configuration key for unix-char: productid lxc config device add hass Z-Wave unix-char path=/dev/ttyACM0 If you have multiple devices that may end up at that path, you should instead use something like: lxc config device add hass Z-Wave unix-char source=/dev/serial/by-id/usb-FTDI_FT232R_USB_UART_A60337Y1-if00-port0 path=/dev/ttyACM0 This will ensure that the device at /dev/ttyACM0 in the container is always the same one. I do this in my openhab container here where I have the following devices: usb-alarm: gid: "111" path: /dev/ttyUSB1 source: /dev/serial/by-id/usb-FTDI_FT230X_Basic_UART_DQ00AXEP-if00-port0 type: unix-char uid: "0" usb-insteon: gid: "111" path: /dev/ttyUSB0 source: /dev/serial/by-id/usb-FTDI_FT232R_USB_UART_A60337Y1-if00-port0 type: unix-char uid: "0" usb-z-wave: gid: "111" path: /dev/ttyACM0 source: /dev/serial/by-id/usb-0658_0200-if00 type: unix-char uid: "0" > > lai@host:~$ lxc config device add hass Z-Wave usb vendorid=0658 > productid=0200 path=/dev/ttyACM0 > Error: Invalid device configuration key for usb: path > > > _______________________________________________ > lxc-users mailing list > [email protected] > http://lists.linuxcontainers.org/listinfo/lxc-users > _______________________________________________ > lxc-users mailing list > [email protected] > http://lists.linuxcontainers.org/listinfo/lxc-users -- Stéphane Graber Ubuntu developer http://www.ubuntu.com _______________________________________________ lxc-users mailing list [email protected] http://lists.linuxcontainers.org/listinfo/lxc-users _______________________________________________ lxc-users mailing list [email protected] http://lists.linuxcontainers.org/listinfo/lxc-users
