Re: Finding vendor-product Ids through /sys/dev/char/

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

 



On Thu, 15 Apr 2010, Eric Raymond wrote:

> Greg KH <greg@xxxxxxxxx>:
> > Use libudev to get this easily.  sysfs shows this mapping, look in
> > /sys/dev/char/ for the links, or walk backward from the usb device
> > itself.
> 
> esr@snark:~/software/gpsd$ lsusb
> Bus 001 Device 014: ID 0bb4:0c01 High Tech Computer Corp. 
> Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
> Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
> Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
> Bus 004 Device 009: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port
> Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
> Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
> 
> The PL2303 is /dev/ttyUSB1, I know because I can read from it.  (/dev/ttyUSB0
> is my Googlephone, first line of output.)
> 
> esr@snark:~/software/gpsd$ ls /sys/dev/char/188\:1
> dev  device  power  subsystem  uevent
> esr@snark:~/software/gpsd$ cat /sys/dev/char/188\:1/dev
> 188:1
> esr@snark:~/software/gpsd$ ls /sys/dev/char/188\:1/device
> driver  port_number  power  subsystem  tty  uevent
> esr@snark:~/software/gpsd$ ls /sys/dev/char/188\:1/device/tty
> ttyUSB1
> 
> OK, nice to have that confirmation. But I can't find anything 
> under there that looks like 067b:2303, and even trying to list all the
> files hits a symlink loop.
> 
> esr@snark:~/software/gpsd$ cat /sys/dev/char/188\:1/device/port_number 
> 0
> esr@snark:~/software/gpsd$ cat /sys/dev/char/188\:1/device/uevent 
> DRIVER=pl2303
> esr@snark:~/software/gpsd$ ls /sys/dev/char/188\:1/device/driver/ttyUSB1
> driver  port_number  power  subsystem  tty  uevent
> esr@snark:~/software/gpsd$ cat /sys/dev/char/188\:1/device/driver/new_id
> cat: /sys/dev/char/188:1/device/driver/new_id: Permission denied
> esr@snark:~/software/gpsd$ ls -l /sys/dev/char/188\:1/device/driver/new_id
> --w------- 1 root root 4096 2010-04-15 09:58 /sys/dev/char/188:1/device/driver/new_id
> 
> Where's the vendor/product ID?

You want:

	cat /sys/dev/char/188\:1/device/../../idVendor
	cat /sys/dev/char/188\:1/device/../../idProduct

Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux