Hilscher Community Forum
USB Enumareted Device List - Printable Version

+- Hilscher Community Forum (https://forum.hilscher.com)
+-- Forum: netPI 3 - Docker featuring Industrial Raspberry Pi 3 platform (https://forum.hilscher.com/forum-1.html)
+--- Forum: Hardware (https://forum.hilscher.com/forum-4.html)
+--- Thread: USB Enumareted Device List (/thread-511.html)



USB Enumareted Device List - IBeRyUS - October-22nd-2019

Hi ,

Is there anyway to see enumareted USB devices on host side? I'm trying to connect our board through USB connection which uses CDC class. Docker image is netpi-netx-programming-examples. I tried to map /dev/ttyACM0 but I'm not so sure is it true name or not.

Any suggestions or ideas for how to access USB devices through docker containers?

Thanks.


RE: USB Enumareted Device List - Armin@netPI - October-22nd-2019

Hi there,

since on netPI there is a restricted Docker running that does not automatically map ALL host devices /dev/... into the container automatically, the only chance you have is to plug in your device in a standard raspberry pi and see which /dev/ it was mapped to. This will be the very same then as on netPI

Thx
Armin


RE: USB Enumareted Device List - IBeRyUS - October-22nd-2019

(October-22nd-2019, 11:54 AM)Armin@netPI Wrote: Hi there,

since on netPI there is a restricted Docker running that does not automatically map ALL host devices /dev/... into the container automatically, the only chance you have is to plug in your device in a standard raspberry pi and see which /dev/ it was mapped to. This will be the very same then as on netPI

Thx
Armin

Any option on web interface to see dmesg log or enumerated device list as a feature in the future?

I managed to open serial port through command line but still have problem accessing through python.


RE: USB Enumareted Device List - Armin@netPI - October-22nd-2019

Well, a device "/dev/..." in a container is as good as if you would access it on a native host. This is all managed by Docker automatically and is not related to netPI or its hardware.
The very same applies for any software that runs in a container. Python runs the same as on a native host.

These three restrictions we have on netPI

* privileged mode is not automatically adding all host devices /dev/ to a container
* volume bind mounts to rootfs is not supported
* the devices /dev,/dev/mem,/dev/sd*,/dev/dm*,/dev/mapper,/dev/mmcblk* cannot be added to a container

Others are not know by me or my team.

So to which device was your CDC device finally mapped to? How did you find it?

You say you have a problem with python. Which problem do you have?

Thx
Armin


RE: USB Enumareted Device List - IBeRyUS - October-22nd-2019

(October-22nd-2019, 12:10 PM)Armin@netPI Wrote: Well, a device "/dev/..." in a container is as good as if you would access it on a native host. This is all managed by Docker automatically and is not related to netPI or its hardware.
The very same applies for any software that runs in a container. Python runs the same as on a native host.

These three restrictions we have on netPI

*    privileged mode is not automatically adding all host devices /dev/ to a container
*    volume bind mounts to rootfs is not supported
*    the devices /dev,/dev/mem,/dev/sd*,/dev/dm*,/dev/mapper,/dev/mmcblk* cannot be added to a container

Others are not know by me or my team.

So to which device was your CDC device finally mapped to? How did you find it?

You say you have a problem with python. Which problem do you have?

Thx
Armin
I mapped /dev/ttyACM0 as /dev/ttyS0. It was same as your suggestion. Luckily your yocto build and raspbian uses same driver.

I checked image file and found out pi isn't added to dialout group and mounted /dev/ttyS0 didn't have other users access.

After adding pi to dialout group i also changed permissions of /dev/ttyS0 to 666 then everything started working.

But not able to see enumareted device is still big question mark for me to continue.


RE: USB Enumareted Device List - Armin@netPI - October-22nd-2019

Well the security restrictions of netPI are clear with the special Docker ... independent of what a user would do in a container or configure "nonsense" things in the Docker Web GUI ... in no way he would get it managed to access to any file of the host Linux. This is different with standard Docker under Raspbian for example. There you can easily volume bind a host folder into a container and "destroy it.

But it is as usual ... security against freedom. One death you have to die. We decided for security and hence you need exaclty to know which /dev/ device is present and needs to be mapped. We had similar discussions like this one under https://forum.hilscher.com/Thread-Static-mapping-of-USB-devices.

But anybody using netPI is free to use his very own SD card with his image and put aside the default SD card. You could easily take a Raspbian image and run it, install Docker additionally and use containers in "privileged" mode and you have all devices mapped always as you need it.

Thx
Armin