Revision | 5f956a1084803d3610fb26a4abe57859116ffb46 (tree) |
---|---|
Time | 2011-05-10 00:20:12 |
Author | Yoshinori Sato <ysato@user...> |
Commiter | Yoshinori Sato |
device lookup fix
@@ -91,12 +91,17 @@ struct port_t *open_usb(unsigned short vid, unsigned short pid) | ||
91 | 91 | for (bus = busses; bus; bus = bus->next) { |
92 | 92 | for (dev = bus->devices; dev; dev = dev->next) { |
93 | 93 | if ((dev->descriptor.idVendor == vid) && |
94 | - (dev->descriptor.idProduct == pid)) | |
95 | - break; | |
94 | + (dev->descriptor.idProduct == pid)) { | |
95 | + goto found; | |
96 | + } | |
96 | 97 | } |
98 | + dev = NULL; | |
97 | 99 | } |
98 | - if (dev == NULL) | |
100 | +found: | |
101 | + if (dev == NULL) { | |
102 | + printf("USB device %04x:%04x not found\n", vid, pid); | |
99 | 103 | return NULL; |
104 | + } | |
100 | 105 | handle = usb_open(dev); |
101 | 106 | if (handle == NULL) { |
102 | 107 | puts(usb_strerror()); |