diff options
author | Guy Harris <guy@alum.mit.edu> | 2009-11-03 14:50:40 -0800 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2009-11-03 14:50:40 -0800 |
commit | 62b9af0706d54cd4e44f40f0da057e04d7b14ec5 (patch) | |
tree | cefa292282bdbf1d339f067b90bf33479227ef16 | |
parent | 6b414c082f0079664c0535963108ae4a648dba47 (diff) |
From Márton Németh:
The usbmon text interface was moved from
/sys/kernel/debug/usbmon to /sys/kernel/debug/usb/usbmon as of
patch
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=f49ce96f11112a84c16ac217490ebd6f8d9a8977 .
Please add this new directory also into the search list when
finding USB devices.
Get rid of older address for Gisle Vanem; convert Love's address to
UTF-8 (as it is in the tcpdump CREDITS file).
-rw-r--r-- | CREDITS | 4 | ||||
-rw-r--r-- | pcap-usb-linux.c | 41 |
2 files changed, 34 insertions, 11 deletions
@@ -42,7 +42,6 @@ Additional people who have contributed patches: Gianluca Varenni <varenni at netgroup-serv dot polito dot it> Gilbert Hoyek <gil_hoyek at hotmail dot com> Gisle Vanem <gvanem at broadpark dot no> - Gisle Vanem <giva at bgnett dot no> Graeme Hewson <ghewson at cix dot compulink dot co dot uk> Greg Stark <gsstark at mit dot edu> Greg Troxel <gdt at ir dot bbn dot com> @@ -71,7 +70,7 @@ Additional people who have contributed patches: Krzysztof Halasa <khc at pm dot waw dot pl> Lorenzo Cavallaro <sullivan at sikurezza dot org> Loris Degioanni <loris at netgroup-serv dot polito dot it> - Love Hörnquist-Åstrand <lha at stacken dot kth dot se> + Love Hörnquist-Ã…strand <lha at stacken dot kth dot se> Luis Martin Garcia <luis dot mgarc at gmail dot com> Maciej W. Rozycki <macro at ds2 dot pg dot gda dot pl> Marcus Felipe Pereira <marcus at task dot com dot br> @@ -79,6 +78,7 @@ Additional people who have contributed patches: Mark Pizzolato <List-tcpdump-workers at subscriptions dot pizzolato dot net> Markus Mayer <markus_mayer at sourceforge dot net> Martin Husemann <martin at netbsd dot org> + Márton Németh <nm127 at freemail dot hu> Matthew Luckie <mjl at luckie dot org dot nz> Max Laier <max at love2party dot net> Mike Frysinger <vapier at gmail dot com> diff --git a/pcap-usb-linux.c b/pcap-usb-linux.c index bcbe45a..fea527f 100644 --- a/pcap-usb-linux.c +++ b/pcap-usb-linux.c @@ -65,7 +65,8 @@ static const char rcsid[] _U_ = #endif #define USB_IFACE "usbmon" -#define USB_TEXT_DIR "/sys/kernel/debug/usbmon" +#define USB_TEXT_DIR_OLD "/sys/kernel/debug/usbmon" +#define USB_TEXT_DIR "/sys/kernel/debug/usb/usbmon" #define SYS_USB_BUS_DIR "/sys/bus/usb/devices" #define PROC_USB_BUS_DIR "/proc/bus/usb" #define USB_LINE_LEN 4096 @@ -354,10 +355,21 @@ usb_activate(pcap_t* handle) handle->fd = open(full_path, O_RDONLY, 0); if (handle->fd < 0) { - /* no more fallback, give it up*/ - snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, - "Can't open USB bus file %s: %s", full_path, strerror(errno)); - return PCAP_ERROR; + if (errno == ENOENT) + { + /* + * Not found at the new location; try + * the old location. + */ + snprintf(full_path, USB_LINE_LEN, USB_TEXT_DIR_OLD"/%dt", handle->md.ifindex); + handle->fd = open(full_path, O_RDONLY, 0); + } + if (handle->fd < 0) { + /* no more fallback, give it up*/ + snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, + "Can't open USB bus file %s: %s", full_path, strerror(errno)); + return PCAP_ERROR; + } } if (handle->opt.rfmon) { @@ -614,10 +626,21 @@ usb_stats_linux(pcap_t *handle, struct pcap_stat *stats) fd = open(string, O_RDONLY, 0); if (fd < 0) { - snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, - "Can't open USB stats file %s: %s", - string, strerror(errno)); - return -1; + if (errno == ENOENT) + { + /* + * Not found at the new location; try the old + * location. + */ + snprintf(string, USB_LINE_LEN, USB_TEXT_DIR_OLD"/%ds", handle->md.ifindex); + fd = open(string, O_RDONLY, 0); + } + if (fd < 0) { + snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, + "Can't open USB stats file %s: %s", + string, strerror(errno)); + return -1; + } } /* read stats line */ |