summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorPete Batard <pbatard@gmail.com>2010-01-15 12:35:02 +0000
committerPete Batard <pbatard@gmail.com>2010-01-15 12:35:02 +0000
commitb96e16e75ffc2b3bdd76ec5457d37d092f0a2590 (patch)
tree21ad3867b7e663edf6511c511f2ecb0f0a9a7ba6 /examples
parent8981e69c7da1c6b8c9e97510bd5b1dd137e50cdb (diff)
downloadlibusb-b96e16e75ffc2b3bdd76ec5457d37d092f0a2590.tar.gz
r80: workaround for interface macro redefinition on Windows (removes the need for #undef interface in end user sources)
Diffstat (limited to 'examples')
-rw-r--r--examples/xusb.c24
1 files changed, 11 insertions, 13 deletions
diff --git a/examples/xusb.c b/examples/xusb.c
index 3167d98..4775194 100644
--- a/examples/xusb.c
+++ b/examples/xusb.c
@@ -36,9 +36,6 @@
#ifdef OS_WINDOWS
#include <windows.h>
#define msleep(msecs) Sleep(msecs)
-#ifdef interface
-#undef interface
-#endif
#else
#include <unistd.h>
#define msleep(msecs) usleep(1000*msecs)
@@ -373,21 +370,21 @@ int test_device(uint16_t vid, uint16_t pid)
nb_ifaces = conf_desc->bNumInterfaces;
printf("num interfaces = %d\n", nb_ifaces);
for (i=0; i<conf_desc->bNumInterfaces; i++) {
- for (j=0; j<conf_desc->interface[i].num_altsetting; j++) {
+ for (j=0; j<conf_desc->usb_interface[i].num_altsetting; j++) {
printf("interface[%d].altsetting[%d]: num endpoints = %d\n",
- i, j, conf_desc->interface[i].altsetting[j].bNumEndpoints);
+ i, j, conf_desc->usb_interface[i].altsetting[j].bNumEndpoints);
printf(" Class.SubClass.Protocol: %02X.%02X.%02X\n",
- conf_desc->interface[i].altsetting[j].bInterfaceClass,
- conf_desc->interface[i].altsetting[j].bInterfaceSubClass,
- conf_desc->interface[i].altsetting[j].bInterfaceProtocol);
- if ( (conf_desc->interface[i].altsetting[j].bInterfaceClass == LIBUSB_CLASS_MASS_STORAGE)
- && ( (conf_desc->interface[i].altsetting[j].bInterfaceSubClass == 0x01)
- || (conf_desc->interface[i].altsetting[j].bInterfaceSubClass == 0x06) ) ) {
+ conf_desc->usb_interface[i].altsetting[j].bInterfaceClass,
+ conf_desc->usb_interface[i].altsetting[j].bInterfaceSubClass,
+ conf_desc->usb_interface[i].altsetting[j].bInterfaceProtocol);
+ if ( (conf_desc->usb_interface[i].altsetting[j].bInterfaceClass == LIBUSB_CLASS_MASS_STORAGE)
+ && ( (conf_desc->usb_interface[i].altsetting[j].bInterfaceSubClass == 0x01)
+ || (conf_desc->usb_interface[i].altsetting[j].bInterfaceSubClass == 0x06) ) ) {
// Mass storage devices that can use basic SCSI commands
test_scsi = -1;
}
- for (k=0; k<conf_desc->interface[i].altsetting[j].bNumEndpoints; k++) {
- endpoint = &conf_desc->interface[i].altsetting[j].endpoint[k];
+ for (k=0; k<conf_desc->usb_interface[i].altsetting[j].bNumEndpoints; k++) {
+ endpoint = &conf_desc->usb_interface[i].altsetting[j].endpoint[k];
printf(" endpoint[%d].address: %02X\n", k, endpoint->bEndpointAddress);
printf(" max packet size: %04X\n", endpoint->wMaxPacketSize);
printf(" polling interval: %02X\n", endpoint->bInterval);
@@ -483,6 +480,7 @@ int main(int argc, char** argv)
test_device(VID, PID);
libusb_exit(NULL);
+
return 0;
}