• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[SOLVED] USB Serial device mapping into Container
#1
Hello,

i have two USB serial devices and i want to use them in two containers. One device is a normal arduino uno and the other device is a zebra barcode scanner.
Now i tried to connect them and i dont see the /dev/ devices in my container. 

I used the following image: hilschernetpi/netpi-debian-stretch with privileged mode enabled. 

In "dmesg" i see the devices plugged in and discovered right, but no dev device.
How can i make it work?

I already looked into this thread: https://forum.hilscher.com/thread-158-page-3.html?

Do i have to map the devices manually into the container? And how can i discover the names of that devices to map them into the container.

Thanks in advance!
BR
Hannes
#2
Hello Hannes,

one thing I have to mention here about using priviledge mode on netPI. On a standard Raspberry Pi utillizing Docker in mode "priviledged" ALL /dev devices are automatically mapped. Not so with netPI. netPI includes a special version Docker mapping not ALL available host devices into the container automatically. This is because of security reasons ... else you could easily get access to the netPI SD card drive and hack netPI's security software and root system. This is what we definitively not want.

So back to your problem. Yes indeed because of my explanation above you have to map the devices manually from the beginning and start of the container. Linux maps those units to host devices called /dev/ttyUSBx if they are serial port device and x for any next device starting with 0 then 1 etc.

So you have to insert the serial devices while netPI was booting. Then you have to map /dev/ttyUSB0 and /dev/ttyUSB1 and also the bus device /dev/bus.

This should work
Armin
You never fail until you stop trying.“, Albert Einstein (1879 - 1955)

#3
(August-24th-2018, 09:34 AM)Armin@netPI Wrote: Hello Hannes,

one thing I have to mention here about using priviledge mode on netPI. On a standard Raspberry Pi utillizing Docker in mode "priviledged" ALL /dev devices are automatically mapped. Not so with netPI. netPI includes a special version Docker mapping not ALL available host devices into the container automatically. This is because of security reasons ... else you could easily get access to the netPI SD card drive and hack netPI's security software and root system. This is what we definitively not want.

So back to your problem. Yes indeed because of my explanation above you have to map the devices manually from the beginning and start of the container. Linux maps those units to host devices called /dev/ttyUSBx if they are serial port device and x for any next device starting with 0 then 1 etc.

So you have to insert the serial devices while netPI was booting. Then you have to map /dev/ttyUSB0 and /dev/ttyUSB1 and also the bus device /dev/bus.

This should work
Armin

Hi Armin,

i see. It make totally sense to not automap everything. 
I tried to map it the following way:

   

But when i try to map the devices in portainer i got the following error message:

   


I do it as you said. Plugged in the USB devices, restarted the netPI and then start a container with mapped USB devices.
What can we do next? 

BR
Hannes
#4
Thank you for your fast reaply.

I followed to what you configured and everything is fine.

I googled a little bit about Zebra Scanner for example. What I found out was that USB it not always USB under Linux ... and how devices are supported by a kernel driver when the are connected to a USB even if they are based on a simple serial communication is not always the same under Linux.

Especially with a focus on Zebra I found out that this device is not mapped as ttyUSB device but as hidraw device (Human Interface Device) as stated here https://www.kernel.org/doc/Documentation/hid/hidraw.txt

Here comes now the point where I have doubts. You should start with the Zebra device only for a test because I don't know if netPI Linux kernel has included the hidraw kernel module driver included or not. But it is worth it to test. So start netPI with Zebra only, map /dev/bus and /dev/hidraw0 and see what happens then.

Thx
Armin
You never fail until you stop trying.“, Albert Einstein (1879 - 1955)

#5
I googled for Arduino as well and found this interesting article here: https://rfc1149.net/blog/2013/03/05/what...evttyacmx/

It seems that Arduino apparently is mapped as /dev/ttyACM device and not as /dev/ttyUSB device.

So give it a try with /dev/ttyACM0.
You never fail until you stop trying.“, Albert Einstein (1879 - 1955)

#6
Hi Armin,

thank you too for the fast reply.
I tried the following:

1.:
-Connected arduino
- Restarted netPI
- Try to map /dev/ttyACM0

=> not working with same error "no such file or directory /dev/ttyACM0

2.
- Connected Zebra scanner
- Restarted netPI
- Try to map /dev/hidraw0

=> also not working with the same error "no such device"

When i used both devices on other linux computers (debian) they appeared both as "ttyACMX". I dont know why it is not working here.
The driver of the scanner is one thing, but i think the arduino should work?!

BR
Hannes
#7
Well maybe I can organize at least an Arduino here and give you feedback monday about what I found out.

Which version are you using?
You never fail until you stop trying.“, Albert Einstein (1879 - 1955)

#8
And indeed the debian on netPI is not different of others ... all the same kernel... so if those devices really are mapping to ttyACMx I am afraid of that the kernel mode driver is not available in the current netPI firmware.

I will keep you informed.
You never fail until you stop trying.“, Albert Einstein (1879 - 1955)

#9
Hey Armin,

that would be great.
This is my Firmware version:

   

BR
Hannes
#10
Hello Hannes,

I have progress by the way.

Instead of an Arduino I used any other ACM compatible device from my stock and connected it to my netPI.

I switched on the privileged mode and mapped /dev/ttyACM0 device while using the raspbian Docker image and it is working fine. See the picture.

But I am using the latest netPI Software V1.1.3.0RC3 from netPI's homepage. Maybe this is the solution.

Please update your netPI and try it again. Then it should work.

Armin


Attached Files Thumbnail(s)
   
You never fail until you stop trying.“, Albert Einstein (1879 - 1955)



Possibly Related Threads…
Thread Author Replies Views Last Post
  USB Port Mapping DSongra 5 3,873 March-10th-2022, 09:20 AM
Last Post: Armin@netPI
  TOSILOCK for CONTAINER COswald 3 2,184 July-13th-2021, 11:32 AM
Last Post: Armin@netPI
  Access to RTC from my own container application tad 1 3,521 March-19th-2021, 02:58 PM
Last Post: Armin@netPI
  [SOLVED] Starting services/commands/scripts at startup of a container Jonas.Sellmann@outlook.de 9 6,022 March-9th-2021, 08:47 AM
Last Post: WalterSchaefer
  OpenVPN container Armin@netPI 0 1,615 January-3rd-2021, 12:13 PM
Last Post: Armin@netPI
  operating Console of a container on netPI connected to Wi-Fi tethering tad 3 2,612 December-3rd-2020, 12:32 PM
Last Post: tad
  NIOT-E-NPIX-4DI4DO with netpi-netx container WalterSchaefer 3 6,478 November-25th-2020, 01:06 PM
Last Post: zen89
  missing the menu items from IO Device Configurator tad 5 3,219 November-20th-2020, 07:41 AM
Last Post: Armin@netPI
  NPIX-4DI4DO and NetPi-Nodered container issues alhammi 4 7,586 November-16th-2020, 01:35 PM
Last Post: alhammi
  Get host MAC via REST API inside container bschandra 4 3,641 November-16th-2020, 09:26 AM
Last Post: bschandra

Forum Jump:


Users browsing this thread: 1 Guest(s)