Changeset 3623
- Timestamp:
- 10/18/10 23:46:14 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/utils/list_smargo.c
r2593 r3623 19 19 20 20 #include <stdio.h> 21 #include <stdlib.h> 21 22 #include <sys/types.h> 22 23 #include <string.h> … … 25 26 #define FALSE 0 26 27 #define TRUE 1 28 29 int out_endpoint; 27 30 28 31 static int smartreader_check_endpoint(libusb_device *usb_dev) … … 53 56 for(l=0; l<configDesc->interface[j].altsetting[k].bNumEndpoints; l++) { 54 57 tmpEndpointAddress=configDesc->interface[j].altsetting[k].endpoint[l].bEndpointAddress; 55 if((tmpEndpointAddress== 0x1) || (tmpEndpointAddress== 0x82)) 56 nb_endpoint_ok++; 58 if((tmpEndpointAddress== 0x1) || (tmpEndpointAddress== 0x81) || (tmpEndpointAddress== 0x82)) 59 { 60 if(tmpEndpointAddress == 0x1 || tmpEndpointAddress==out_endpoint) 61 { 62 nb_endpoint_ok++; 63 } 64 } 57 65 } 58 66 } … … 91 99 devid=libusb_get_device_address(dev); 92 100 libusb_get_string_descriptor_ascii(handle,desc.iSerialNumber,iserialbuffer,sizeof(iserialbuffer)); 93 printf("bus %03d, device %03d : %04x:%04x Smartreader (Device=%03d:%03d Serial=%s)\n",101 printf("bus %03d, device %03d : %04x:%04x Smartreader (Device=%03d:%03d EndPoint=0x%2X Serial=%s)\n", 94 102 busid, devid, 95 103 desc.idVendor, desc.idProduct, 96 busid, devid, iserialbuffer);104 busid, devid, out_endpoint, iserialbuffer); 97 105 } 98 106 … … 103 111 } 104 112 105 int main( void)113 int main(int argc, char **argv) 106 114 { 107 115 libusb_device **devs; … … 112 120 if (r < 0) 113 121 return r; 122 123 out_endpoint=0x82; 124 if(argc==2) { 125 sscanf(argv[1],"%x",&out_endpoint); 126 } 127 else 128 out_endpoint=0x82; 114 129 130 printf("Looking for smartreader with an out endpoint = %02x :\n",out_endpoint); 131 115 132 cnt = libusb_get_device_list(NULL, &devs); 116 if (cnt < 0) 133 if (cnt < 0) 117 134 return (int) cnt; 135 118 136 119 137 print_devs(devs); 120 138 libusb_free_device_list(devs, 1); 121 139
Note:
See TracChangeset
for help on using the changeset viewer.