From efab3781c8a7bd81b40ca08d16ea1fc797230824 Mon Sep 17 00:00:00 2001 From: guy Date: Wed, 11 Oct 2006 09:22:27 +0000 Subject: From Paolo Abeni: the USB setup header is defined in the USB specification with a specific layout; use that layout. --- pcap-usb-linux.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'pcap-usb-linux.c') diff --git a/pcap-usb-linux.c b/pcap-usb-linux.c index 3626c75..f09d1fa 100644 --- a/pcap-usb-linux.c +++ b/pcap-usb-linux.c @@ -228,8 +228,8 @@ usb_read_linux(pcap_t *handle, int max_packets, pcap_handler callback, u_char *u * not mandatory, so does not count on it*/ string[ret] = 0; ret = sscanf(string, "%x %d %c %c%c:%d:%d %s%n", &tag, ×tamp, &etype, - &pipeid1, &pipeid2, &dev_addr, &ep_num, status, - &cnt); + &pipeid1, &pipeid2, &dev_addr, &ep_num, status, + &cnt); if (ret < 8) { snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, @@ -310,11 +310,11 @@ usb_read_linux(pcap_t *handle, int max_packets, pcap_handler callback, u_char *u /* try to convert to corresponding integer */ shdr = (pcap_usb_setup*)rawdata; - shdr->bmRequestType = htonl(strtol(str1, 0, 16)); - shdr->bRequest = htonl(strtol(str2, 0, 16)); - shdr->wValue = htonl(strtol(str3, 0, 16)); - shdr->wIndex = htonl(strtol(str4, 0, 16)); - shdr->wLength = htonl(strtol(str5, 0, 16)); + shdr->bmRequestType = strtoul(str1, 0, 16); + shdr->bRequest = strtoul(str2, 0, 16); + shdr->wValue = htons(strtoul(str3, 0, 16)); + shdr->wIndex = htons(strtoul(str4, 0, 16)); + shdr->wLength = htons(strtoul(str5, 0, 16)); pkth.caplen = sizeof(pcap_usb_setup); rawdata += sizeof(pcap_usb_setup); -- cgit v1.2.3