summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2014-07-06 03:38:55 -0700
committerGuy Harris <guy@alum.mit.edu>2014-07-06 03:43:52 -0700
commit75e1beae328d6b34ac78e50a9d5381c648bd420c (patch)
tree6c1be3c17d1a24dae830a60f8bcdc75de253d8bd
parent66aab2706bda40a40d5d3ddc490b23e9c4ed0634 (diff)
downloadlibpcap-75e1beae328d6b34ac78e50a9d5381c648bd420c.tar.gz
Don't build the USB probing code if we don't have <linux/usbdevice_fs.h>.
That code requires a structure from that header, so, if the header is missing, don't build it and don't call it.
-rw-r--r--pcap-usb-linux.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/pcap-usb-linux.c b/pcap-usb-linux.c
index 675c8b12..bdabf005 100644
--- a/pcap-usb-linux.c
+++ b/pcap-usb-linux.c
@@ -221,6 +221,8 @@ int usb_mmap(pcap_t* handle)
return handlep->mmapbuf != MAP_FAILED;
}
+#ifdef HAVE_LINUX_USBDEVICE_FS_H
+
#define CTRL_TIMEOUT (5*1000) /* milliseconds */
#define USB_DIR_IN 0x80
@@ -289,6 +291,7 @@ probe_devices(int bus)
}
closedir(dir);
}
+#endif /* HAVE_LINUX_USBDEVICE_FS_H */
pcap_t *
usb_create(const char *device, char *ebuf, int *is_ours)
@@ -378,7 +381,9 @@ usb_activate(pcap_t* handle)
handle->stats_op = usb_stats_linux_bin;
handle->read_op = usb_read_linux_mmap;
handle->cleanup_op = usb_cleanup_linux_mmap;
+#ifdef HAVE_LINUX_USBDEVICE_FS_H
probe_devices(handlep->bus_index);
+#endif
/*
* "handle->fd" is a real file, so "select()" and
@@ -391,7 +396,9 @@ usb_activate(pcap_t* handle)
/* can't mmap, use plain binary interface access */
handle->stats_op = usb_stats_linux_bin;
handle->read_op = usb_read_linux_bin;
+#ifdef HAVE_LINUX_USBDEVICE_FS_H
probe_devices(handlep->bus_index);
+#endif
}
else {
/*Binary interface not available, try open text interface */