diff options
author | guy <guy> | 2006-10-11 09:22:27 +0000 |
---|---|---|
committer | guy <guy> | 2006-10-11 09:22:27 +0000 |
commit | efab3781c8a7bd81b40ca08d16ea1fc797230824 (patch) | |
tree | b7269571d3b2661de6bdfa5fc50e79b83cfb31bb /pcap-usb-linux.c | |
parent | de2b5022895bf0878287965952f9989fede5e556 (diff) |
From Paolo Abeni: the USB setup header is defined in the USB
specification with a specific layout; use that layout.
Diffstat (limited to 'pcap-usb-linux.c')
-rw-r--r-- | pcap-usb-linux.c | 14 |
1 files changed, 7 insertions, 7 deletions
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); |