gpsd-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [gpsd-dev] 3.10 release objectives


From: Andy Walls
Subject: Re: [gpsd-dev] 3.10 release objectives
Date: Wed, 16 Oct 2013 19:26:54 -0400

On Wed, 2013-10-16 at 14:46 -0700, Gary E. Miller wrote:
[snip]
> > Gary Miller: please decide and say whether you have a reasonable
> > chance of being able to do libusb integration within the next week
> > (addressing our only current tracker bug).  If not, we'll let that fix
> > slide to 3.11.
> 
> 
> If someone can tell me how to pass a device (/dev/ttySUB0) to libusb
> and get back the USB vendorID and productID it will be easy to fix.

libusb can't do that.

The solution is very OS specific.  AFAICT libusb-1.x doesn't have a
cross-platform (or any-platform) solution to answer that question.

On a Linux box using udev, udevadm can answer the question:

# udevadm info -q property -n /dev/ttyUSB0 | grep _ID
ID_MODEL_ID=2303
ID_VENDOR_ID=067b
(that's a Prolific PL2303 USB-Serial converter.)

An strace of the above udevadm command on my Linux box shows that it is
doing something analogous to this:

# ls -al /dev/ttyUSB0
crw-rw----. 1 root dialout 188, 0 Oct 16 19:01 /dev/ttyUSB0

# cat /sys/dev/char/188:0/uevent
MAJOR=188
MINOR=0
DEVNAME=ttyUSB0

# cat /run/udev/data/c188:0
S:serial/by-id/usb-Prolific_Technology_Inc._USB-Serial_Controller_D-if00-port0
S:serial/by-path/pci-0000:00:13.1-usb-0:3:1.0-port0
I:1420443218
E:ID_BUS=usb
E:ID_MM_CANDIDATE=1
E:ID_MODEL=USB-Serial_Controller_D
E:ID_MODEL_ENC=USB-Serial\x20Controller\x20D
E:ID_MODEL_FROM_DATABASE=PL2303 Serial Port
E:ID_MODEL_ID=2303
E:ID_PATH=pci-0000:00:13.1-usb-0:3:1.0
E:ID_PATH_TAG=pci-0000_00_13_1-usb-0_3_1_0
E:ID_REVISION=0400
E:ID_SERIAL=Prolific_Technology_Inc._USB-Serial_Controller_D
E:ID_TYPE=generic
E:ID_USB_DRIVER=pl2303
E:ID_USB_INTERFACES=:ff0000:
E:ID_USB_INTERFACE_NUM=00
E:ID_VENDOR=Prolific_Technology_Inc.
E:ID_VENDOR_ENC=Prolific\x20Technology\x20Inc.\x20
E:ID_VENDOR_FROM_DATABASE=Prolific Technology, Inc.
E:ID_VENDOR_ID=067b
G:systemd

>I've not had a lot of luck learning the libusb functions.

I wrote a small utility using libusb to talk to a device once.  IIRC,
the only thing libusb could do, OS-wise, was detach the kernel's driver
and reattach the kernel's driver.

Regards,
Andy

> RGDS
> GARY





reply via email to

[Prev in Thread] Current Thread [Next in Thread]