From 55685bd38ccc6507aae48b3c1a2cdbc117ed5e71 Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Sat, 3 Jan 2009 12:12:12 -0800 Subject: Revert to defining the USB stuff ourselves; whether there's a or header depends on the version of the kernel (and that assumes that one of those headers is even installed, which isn't necessarily the case). --- pcap-usb-linux.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'pcap-usb-linux.c') diff --git a/pcap-usb-linux.c b/pcap-usb-linux.c index b4b8952..93c3f6d 100644 --- a/pcap-usb-linux.c +++ b/pcap-usb-linux.c @@ -60,7 +60,6 @@ static const char rcsid[] _U_ = #include #include #include -#include #ifdef HAVE_LINUX_USBDEVICE_FS_H #include #endif @@ -208,6 +207,14 @@ int usb_mmap(pcap_t* handle) #define CTRL_TIMEOUT (5*1000) /* milliseconds */ +#define USB_DIR_IN 0x80 +#define USB_TYPE_STANDARD 0x00 +#define USB_RECIP_DEVICE 0x00 + +#define USB_REQ_GET_DESCRIPTOR 6 + +#define USB_DT_DEVICE 1 + /* probe the descriptors of the devices attached to the bus */ /* the descriptors will end up in the captured packet stream */ /* and be decoded by external apps like wireshark */ @@ -216,7 +223,6 @@ static void probe_devices(int bus) { struct usbdevfs_ctrltransfer ctrl; - struct usb_device_descriptor device; struct dirent* data; int ret = 0; char buf[40]; @@ -245,8 +251,8 @@ probe_devices(int bus) ctrl.bRequest = USB_REQ_GET_DESCRIPTOR; ctrl.wValue = USB_DT_DEVICE << 8; ctrl.wIndex = 0; - ctrl.wLength = sizeof(device); - ctrl.data = &device; + ctrl.wLength = sizeof(buf); + ctrl.data = buf; ctrl.timeout = CTRL_TIMEOUT; ret = ioctl(fd, USBDEVFS_CONTROL, &ctrl); -- cgit v1.2.3