From dc524007693a4eebc7335a334aa0f6869a8cdc1d Mon Sep 17 00:00:00 2001 From: guy Date: Mon, 24 Nov 2008 17:40:19 +0000 Subject: Roberto Mariani: put the transfer direction in the uppermost bit of the endpoint number, rather than the uppermost bit of the transfer type, when reading in text mode, just as is the case in binary mode; check the URB data length against 0 when deciding whether there's no URB tag. --- pcap-usb-linux.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'pcap-usb-linux.c') diff --git a/pcap-usb-linux.c b/pcap-usb-linux.c index f6dc705..3858e84 100644 --- a/pcap-usb-linux.c +++ b/pcap-usb-linux.c @@ -34,7 +34,7 @@ */ #ifndef lint static const char rcsid[] _U_ = - "@(#) $Header: /tcpdump/master/libpcap/pcap-usb-linux.c,v 1.24 2008-04-14 21:06:09 guy Exp $ (LBL)"; + "@(#) $Header: /tcpdump/master/libpcap/pcap-usb-linux.c,v 1.25 2008-11-24 17:40:19 guy Exp $ (LBL)"; #endif #ifdef HAVE_CONFIG_H @@ -351,7 +351,6 @@ usb_read_linux(pcap_t *handle, int max_packets, pcap_handler callback, u_char *u return -1; } uhdr->id = tag; - uhdr->endpoint_number = ep_num; uhdr->device_address = dev_addr; uhdr->bus_id = handle->md.ifindex; uhdr->status = 0; @@ -378,7 +377,7 @@ usb_read_linux(pcap_t *handle, int max_packets, pcap_handler callback, u_char *u else if (pipeid1 == 'B') urb_transfer = URB_BULK; if (pipeid2 == 'i') { - urb_transfer |= URB_TRANSFER_IN; + ep_num |= URB_TRANSFER_IN; incoming = 1; } if (etype == 'C') @@ -395,6 +394,7 @@ usb_read_linux(pcap_t *handle, int max_packets, pcap_handler callback, u_char *u return 0; uhdr->event_type = etype; uhdr->transfer_type = urb_transfer; + uhdr->endpoint_number = ep_num; pkth.caplen = sizeof(pcap_usb_header); rawdata += sizeof(pcap_usb_header); @@ -447,7 +447,7 @@ usb_read_linux(pcap_t *handle, int max_packets, pcap_handler callback, u_char *u uhdr->urb_len = urb_len; uhdr->data_flag = 1; data_len = 0; - if (uhdr->urb_len == pkth.caplen) + if (uhdr->urb_len == 0) goto got; /* check for data presence; data is present if and only if urb tag is '=' */ -- cgit v1.2.3