Hardware Reference
In-Depth Information
Device: 002 0424:9512 class 9.0 protocol 2 device 512, manuf 0, serial 0
0.0.0 class 9
0.0.1 class 9
Device: 001 1d6b:0002 class 9.0 protocol 1 device 774, manuf 3, serial 1
0.0.0 class 9
These are easily compared by noting the device name, such as 007 , which is reported
by lsusb to be the Microsoft mouse.
1 /
∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗
2
tusb.c - Scan list of USB devices and test claim/release.
3
/
∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗
4
5 #include <stdio.h>
6 #include <stdlib.h>
7 #include <errno.h>
8 #include <usb.h>
9 #include <assert.h>
10
11 /
∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗
12
See http://libusb.sourceforge.net/doc/index.html for API
13
/
∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗
14
15 int
16 main(int argc, char
argv) {
∗∗
17 struct usb_bus
busses,
bus;
18 struct usb_device
dev;
19 struct usb_device_descriptor
desc;
20 usb_dev_handle
hdev;
21 int cx, ix, ax, rc;
22
23 usb_init();
24 usb_find_busses();
25 usb_find_devices();
26
27 busses = usb_get_busses();
28
29 for ( bus=busses; bus; bus = bus->next ) {
30 for ( dev=bus->devices; dev; dev = dev->next ) {
31 desc = &dev->descriptor;
32
33 printf("Device: %s %04x:%04x ",
34 dev->filename,
35 desc->idVendor,
36 desc->idProduct);
37 printf(" class %u.%d protocol %u",
38 desc->bDeviceClass,
39 desc->bDeviceSubClass,
Search WWH ::




Custom Search