dect
/
libpcap
Archived
13
0
Fork 0

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).
This commit is contained in:
Guy Harris 2009-01-03 12:12:12 -08:00
parent 6e26f4a0fd
commit 55685bd38c
1 changed files with 10 additions and 4 deletions

View File

@ -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);