Shop OBEX P1 Docs P2 Docs Learn Events
PropPug on Linux - which /dev/ttyUSBn ? — Parallax Forums

PropPug on Linux - which /dev/ttyUSBn ?

prof_brainoprof_braino Posts: 4,313
edited 2014-10-27 01:21 in Propeller 1
I'm trying to talk to a propplug from a linux Mint 17-64 MATE virtual machine.

The base machine is also Mint 17-64 MATE.

I'm using minicom from a terminal window.

The base machine works fine, it see the proplug as /de/ttyUSB8

The virtual machine does not make the plopplug LEDs flash, is also thinks the its on /de/ttyUSB8

On the base machine (that works) my user is NOT in dialoup group.
On the vitrtual machine (doesn't work) my user IS member of dialout group.

So I'm confused and troubleshooting.

How can I check what /dev/ttyUSB is assingned for the prop plug on the virtual machine?

Comments

  • Heater.Heater. Posts: 21,230
    edited 2014-10-26 11:00
    Presumably as you plug in and remove the Prop Plug you can see the device /dev/ttyUSBx come and go. Where x is whatever number and may change each time.

    What virtualization software are you using? Virtual Box ?

    It's long time since I played with this but I seem to recall you have to configure the use of USB for the virtual instance on the host and install guest additions into the virtualized OS.

    As described here: http://www.dedoimedo.com/computers/virtualbox-usb.html

    The commands "lsusb" and "dmesg" are useful here.
  • prof_brainoprof_braino Posts: 4,313
    edited 2014-10-26 11:19
    Heater. wrote: »
    Presumably as you plug in and remove the Prop Plug you can see the device /dev/ttyUSBx come and go. ...

    That would be on windows, but I no longer have use windows. I have not noticed any similar messages or alerts on linux.
    The commands "lsusb" and "dmesg" are useful here.

    lsusb lists the devices, but not the /dev/ttyusbn
    lsusb -v lists the devices and tons of other stuff, but not the /dev/ttyusbn

    dmesg might be the one I need, I'll give than alook straight away
  • Heater.Heater. Posts: 21,230
    edited 2014-10-26 11:41
    Braino,

    Perhaps I should have phrased that better. When I said "...see the device /dev/ttyUSBx come and go. ..." what I had in mind was that you would run "ls /dev/ttyUSB*". Then pug in the Prop Plug. Then do the ls again. And then you should see it there.

    Or you can use dmesg or lsusb command whist inserting and removing the Prop Plug.

    I don't usually expect any alerts or such to pop up when I add and remove devices in Linux. Although on my KDE desktop I so get such pop ups for USB sticks and other external storage devices.
  • prof_brainoprof_braino Posts: 4,313
    edited 2014-10-26 11:57
    dmesg was the answer. It showed that the virtual machine was seeing /dev/ttyUSB0 (instead of ttyUSB8 on the physical machine).

    I remember that minicon used to see ttyUSB0 on previous machines, did something change in the was debian eneumerated USB devices?

    Anyway, it works now!

    I tried ls /dev/ttyUSB* but it says no such file. in the /dev directory, there are many tty0-ttyS31, but no ttyUSB anything. This always confuses me. I had similar confusion getting bluetooth to work, I could never find the device rfcomm
  • ElectrodudeElectrodude Posts: 1,658
    edited 2014-10-26 12:17
    Is there any way to make the IDs on Linux consistent, like how on OSX where they are always tty.usbserialXXXX (or something like that, I forget), where XXXX is always consistent for each device? This was really annoying me for a telemetry system I made for my school's solar car that involved two FTDI chips, one connected to a propeller and the other to an XBee. I always had to make sure I plugged things in in the right order (and I often only had one plugged in at a time) so they would get the right IDs, or it wouldn't work, because I hardcoded the path to the XBee in my logger program as /dev/ttyUSB0. It would be really nice if I don't have to deal with this problem next year (or I could just make my logger try ports until it finds the right one).
  • prof_brainoprof_braino Posts: 4,313
    edited 2014-10-26 21:21
    On windows, the USB ID would be remembered, but then after several (I think more than 9 or something) it would start to have problems and I would have to do the clean com ports batch file thing and start over again. Anything previousl assigned would be forgotten, and it would get re-assingned if it ever was plugged in again. I happened often enough I had the batch file, but seldom enough to where I'd forget how to fix it when it came up.

    I thought linux was great because what ever got plugged in would just come up on ttyUSB0. This is the first time I've had more than 1USB serial port at the same time, and the first time it showed up as ttyUSB8
  • Heater.Heater. Posts: 21,230
    edited 2014-10-27 01:21
    Back in the old days we had a fixed number of ports, serial or parallel or whatever. We would compile the drivers for those ports into the kernel and their names in /dev would be forever fixed.

    Life was good.

    Now a days everything is plug'n'play. Not just these ports but storage devices, network interfaces and so on. To go along with that we have run-time loadable kernel modules that can be loaded and unloaded as devices appear and disappear.

    So, for example, your Prop Plug that has always come up as /dev/ttyUSB0 has not been guaranteed to do so for many years. That was just a happy accident for you as you had never used more than one USB serial device.

    We now have a device manager, udev, whose job it is listen out for hot-plug events, figure out what the device is, load the appropriate driver for it and create the entry in /dev.

    Life is now complex.

    Seems that today the correct approach to this problem of devices hopping from name to name is to instruct udev to create symbolic links in /dev to particular devices according to some unique identifier on the actual device hardware. Then when plugging in a PropPlug one might get, automatically created a entry like "/dev/propplug" or whatever name you like.

    There is a nice article on how to set up these udev rules for a bunch of USB/serial adapters here:

    http://hintshop.ludvig.co.nz/show/persistent-names-usb-serial-devices/

    Still I can't account for a device coming up as /dev/ttyUSB8 when numbers 0 to 7 are free. Very odd.
Sign In or Register to comment.