Keep on going with my usb fx2 linux driver
I had the following code to the probe method :
1: void printHelper (char *pValueToPrint , char * description )2: {3: if (pValueToPrint != NULL )
4: {5: printk(KERN_INFO "%s :%s",description,pValueToPrint);
6: }7: }8: static int ml_probe(struct usb_interface *interface, const struct usb_device_id *id)9: {10: char *product;
11: char *manufacturer;
12: char *serial;
13: /* called when a USB device is connected to the computer. */
14: printk(KERN_INFO "ml_probe");
15: struct usb_device *udev = interface_to_usbdev(interface);
16:17:18: /* static strings from the device */
19: product = udev->product;20: printHelper (product , "product");
21:22: manufacturer = udev->manufacturer;23: printHelper (manufacturer , "manufacturer");
24:25: serial = udev->serial;26: printHelper (serial , "serial");
27:28: return 0;
29:30: }
and the result :
[10871.554417] Initializing USB FX
[10871.554451] usbcore: registered new interface driver myFx2
[10871.554454] THE usb_register RET::0
[11033.435093] usb 1-1.1: new high-speed USB device number 4 using ehci_hcd
[11048.458267] usb 1-1.1: device descriptor read/64, error -110
[11063.585105] usb 1-1.1: device descriptor read/64, error -110
[11063.760533] usb 1-1.1: new high-speed USB device number 5 using ehci_hcd
[11078.783705] usb 1-1.1: device descriptor read/64, error -110
[11088.005908] hub 1-1:1.0: unable to enumerate USB device on port 1
[11127.297879] usb 1-1.1: new high-speed USB device number 6 using ehci_hcd
[11128.846084] ml_probe
[11128.846088] product :OSR USB-FX2 LK
[11128.846090] manufacturer :OSR.COM
The code use the method :interface_to_usbdev in order to get a usb_device form usb_interface object.Using the usb_device object the code get the usb device static report about the manufacture and the product .
Resources:
http://www.lrr.in.tum.de/Par/arch/usb/download/usbdoc/usbdoc-1.32.pdf
אין תגובות:
הוסף רשומת תגובה