Magellan Linux

Annotation of /trunk/usbip/patches/usbip-0.1.7-bind-parseable-output.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1539 - (hide annotations) (download)
Mon Sep 19 19:06:00 2011 UTC (12 years, 9 months ago) by niro
File size: 1751 byte(s)
-added --list2 patch
1 niro 1539 diff -Naur usbip-0.1.7/src/cmd/bind-driver.c usbip-0.1.7-magellan/src/cmd/bind-driver.c
2     --- usbip-0.1.7/src/cmd/bind-driver.c 2009-01-13 18:10:51.000000000 +0100
3     +++ usbip-0.1.7-magellan/src/cmd/bind-driver.c 2011-09-19 22:42:27.000000000 +0200
4     @@ -16,6 +16,7 @@
5     {"usbip", required_argument, NULL, 'u'},
6     {"other", required_argument, NULL, 'o'},
7     {"list", no_argument, NULL, 'l'},
8     + {"list2", no_argument, NULL, 'L'},
9     {"help", no_argument, NULL, 'h'},
10     #if 0
11     {"allusbip", no_argument, NULL, 'a'},
12     @@ -378,6 +379,49 @@
13     return 0;
14     }
15    
16     +static int show_devices2(void)
17     +{
18     + DIR *dir;
19     +
20     + dir = opendir("/sys/bus/usb/devices/");
21     + if (!dir)
22     + g_error("opendir: %s", strerror(errno));
23     +
24     + for (;;) {
25     + struct dirent *dirent;
26     + char *busid;
27     +
28     + dirent = readdir(dir);
29     + if (!dirent)
30     + break;
31     +
32     + busid = dirent->d_name;
33     +
34     + if (is_usb_device(busid)) {
35     + char name[100] = {'\0'};
36     + char driver[100] = {'\0'};
37     + int conf, ninf = 0;
38     + int i;
39     +
40     + conf = read_bConfigurationValue(busid);
41     + ninf = read_bNumInterfaces(busid);
42     +
43     + getdevicename(busid, name, sizeof(name));
44     +
45     + printf("busid=%s#usbid=%s#", busid, name);
46     +
47     + for (i = 0; i < ninf; i++) {
48     + getdriver(busid, conf, i, driver, sizeof(driver));
49     + printf("%s:%d.%d=%s#", busid, conf, i, driver);
50     + }
51     + printf("\n");
52     + }
53     + }
54     +
55     + closedir(dir);
56     +
57     + return 0;
58     +}
59    
60     #if 0
61     static int export_to(char *host, char *busid) {
62     @@ -533,6 +577,9 @@
63     case 'l' :
64     cmd = cmd_list;
65     break;
66     + case 'L' :
67     + cmd = cmd_list2;
68     + break;
69     case 'a' :
70     cmd = cmd_allusbip;
71     break;
72     @@ -569,6 +616,9 @@
73     case cmd_list:
74     show_devices();
75     break;
76     + case cmd_list2:
77     + show_devices2();
78     + break;
79     #if 0
80     case cmd_allusbip:
81     allusbip();