Find the answer to your Linux question:
Results 1 to 7 of 7
Hi, Working with iMedia Linux, I plug in a gps device to one of the usb port and I need /dev/ttyUSB0 to show up. It doesn't, but it does on ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    May 2009
    Posts
    72

    Question Imedia Linux usb-serial device gps


    Hi,

    Working with iMedia Linux, I plug in a gps device to one of the usb port and I need /dev/ttyUSB0 to show up. It doesn't, but it does on my CentOS machine.

    When I plug it in I see the following lines after running dmesg:
    -usb 2-1: new full speed USB device using ohci_hcd and address 4
    -usb 2-1: configuration #1 chosen from 1 choice

    When I run lsusb it shows:
    -Bus 002 Device 004: ID 067b:aaa0 Prolific Technology, Inc.

    My goal is to be able to read the GPS device through a C++ program which already works as long as ttyUSB0 shows up.

    Any info that could help me understand the way this works would be appreciated.

    Thanks.

    olacelle

  2. #2
    Linux Guru bigtomrodney's Avatar
    Join Date
    Nov 2004
    Location
    Ireland
    Posts
    6,127
    Most device handling is done these days through HAL, hotplug and udev. You can have a look through manpages for these to get an indepth look but this article might just give you a quick overview.

    hotplug, udev and hal, oh my! (tummy.com, ltd. Journal Entry)

    It's worth noticing that device names are dynamic, so if you plug in another USB device first that may end up as /dev/ttyUSB0 and your GPS could end up as /dev/ttyUSB1

    I hope that article can get you started.

  3. #3
    Just Joined!
    Join Date
    May 2009
    Posts
    72
    Thanks bigtomrodney.
    I have read your link and some man pages on hotplug, udev and hal, but I find it all a little unclear. I'd like to know what happens from the moment I plug in my gps device. If my understanding is correct udev is the one creating the ttyUSB0 node but how exactly it does it I am not sure. I'll keep searching, any other info is welcome.

    olacelle

  4. #4
    Just Joined!
    Join Date
    May 2009
    Posts
    72
    Still no luck with hotplug/udev. I have read a good deal about them but my impression is that the problem is not there. I noticed the following differences on my 2 machines:

    dmesg on iMedia linux machine when I plug the GPS:
    -usb 2-1: new full speed USB device using ohci_hcd and address 4
    -usb 2-1: configuration #1 chosen from 1 choice

    dmesg on Centos machine:
    -usb 2-2: new full speed USB device using ohci_hcd and address 3
    -usb 2-2: configuration #1 chosen from 1 choice
    -pl2303 2-2:1.0: pl2303 converter detected
    -usb 2-2: pl2303 converter attached to ttyUSB0

    Looks like the CentOS machine is doing something more. Why? Any clue?

  5. #5
    Just Joined!
    Join Date
    May 2009
    Posts
    72
    I tried different things with my iMedia installation. I did a custom install and tried different things until I got the pl2303.ko file installed in /lib/modules/'uname -r'/kernel/drivers/usb/serial.

    Now my ttyUSB0 gets created when I hotplug my gps. My problem now is it won't do it on bootup. Somebody has an idea?

    Thank you.

  6. #6
    Just Joined!
    Join Date
    May 2009
    Posts
    72
    Sounds like the module wasn't being loaded on bootup.
    So in iMedia the startup scripts are in /etc/rcS.d.
    I create a new script called M99-local and put the following in it:
    /sbin/modprobe -s pl2303 (following other scripts format).
    Now my /dev/ttyUSB0 gets created on boot!! Whooohoooo!
    I havn't tested my program yet but it looks like I finally got what I needed.

    I hope this is gonna be of some help to someone.

    olacelle

  7. #7
    Just Joined!
    Join Date
    Jul 2013
    Posts
    1
    Thats great Olacelle. I was looking for similiar C/C++ code which can read the data from USB based GPS device. Can you help me pointing to such a code, which i could customize for my application.

    ------------------------------------------------------------



    Quote Originally Posted by olacelle View Post
    Sounds like the module wasn't being loaded on bootup.
    So in iMedia the startup scripts are in /etc/rcS.d.
    I create a new script called M99-local and put the following in it:
    /sbin/modprobe -s pl2303 (following other scripts format).
    Now my /dev/ttyUSB0 gets created on boot!! Whooohoooo!
    I havn't tested my program yet but it looks like I finally got what I needed.

    I hope this is gonna be of some help to someone.

    olacelle

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •