• 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
  Static mapping of USB-devices deme 11 62 May-15th-2019, 04:02 PM
Last Post: Armin@netPI
  [SOLVED] Portainer does not start container Steres 3 201 October-16th-2018, 06:54 PM
Last Post: Armin@netPI
  netPI as USB-Device-Server based on raspbian FrankJacob 26 632 July-5th-2018, 10:13 AM
Last Post: Armin@netPI
  Write to usb Drive from container SebastianSoller 12 277 April-25th-2018, 08:16 PM
Last Post: SebastianSoller
  using of a USB memory stick inside a container for share Michael_d 2 113 March-3rd-2018, 06:19 PM
Last Post: Michael_d
  Container IP address - Network Options kimsmyth 2 163 January-30th-2018, 11:04 AM
Last Post: kimsmyth

Forum Jump:


Users browsing this thread: 1 Guest(s)