aboutsummaryrefslogtreecommitdiffstats
path: root/pcap-usb-linux.c
diff options
context:
space:
mode:
authorGuy Harris <gharris@steve.local>2009-01-03 12:12:12 -0800
committerGuy Harris <gharris@steve.local>2009-01-03 12:12:12 -0800
commit55685bd38ccc6507aae48b3c1a2cdbc117ed5e71 (patch)
treeba617f3faa3840cf6d43055b437f8ccd8c1402dd /pcap-usb-linux.c
parent6e26f4a0fdacb2ac21189082ab8cf07a304370cd (diff)
Revert to defining the USB stuff ourselves; whether there's a
<linux/usb_ch9.h> or <linux/usb/ch9.h> 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).
Diffstat (limited to 'pcap-usb-linux.c')
-rw-r--r--pcap-usb-linux.c14
1 files changed, 10 insertions, 4 deletions
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 <netinet/in.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
-#include <linux/usb/ch9.h>
#ifdef HAVE_LINUX_USBDEVICE_FS_H
#include <linux/usbdevice_fs.h>
#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);