The attached patch fix the parsing of setup data fields in current
implementation of usb_read_data.
Currently the "setup header is present" field is not marked so the
relevant fields are ignored from caller.
The patch contains also a little indentation fix, always in the same
function.
/* check if this is a setup packet */
ret = sscanf(status, "%d", &dummy);
/* check if this is a setup packet */
ret = sscanf(status, "%d", &dummy);
{
/* this a setup packet, setup data can be filled with underscore if
* usbmon has not been able to read them, so we must parse this fields as
{
/* this a setup packet, setup data can be filled with underscore if
* usbmon has not been able to read them, so we must parse this fields as
if (ret < 5)
{
snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
if (ret < 5)
{
snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
- "Can't parse usb bus message '%s', too few token (expected 5 got %d)",
- string, ret);
+ "Can't parse usb bus message '%s', too few token (expected 5 got %d)",
+ string, ret);
return -1;
}
string += cnt;
return -1;
}
string += cnt;
shdr->wValue = htons(strtoul(str3, 0, 16));
shdr->wIndex = htons(strtoul(str4, 0, 16));
shdr->wLength = htons(strtoul(str5, 0, 16));
shdr->wValue = htons(strtoul(str3, 0, 16));
shdr->wIndex = htons(strtoul(str4, 0, 16));
shdr->wLength = htons(strtoul(str5, 0, 16));
+ uhdr->setup_packet = 1;
- pkth.caplen = sizeof(pcap_usb_setup);
+
+ pkth.caplen += sizeof(pcap_usb_setup);
rawdata += sizeof(pcap_usb_setup);
}
rawdata += sizeof(pcap_usb_setup);
}
+ else
+ uhdr->setup_packet = 0;
/* read urb data */
ret = sscanf(string, " %d%n", &pkth.len, &cnt);
/* read urb data */
ret = sscanf(string, " %d%n", &pkth.len, &cnt);