usb: two bugfixes.

-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEoDKM/7k6F6eZAf59TLbY7tPocTgFAmAuVNAACgkQTLbY7tPo
 cTjEkA//YIhllChyWAmWGV871IDMG8yHNQ/ZBr9LJy0T9qdPN+keQD/Sb5/q+KCe
 JaOksJIjQxL+UD5p9jO4oMBotrW4MbeeNE3Z4KCGUn15+mFFfn7YaEVkDwjJWM9F
 JPbK8xYEMsiHbVBqdgh+eTy8HQd7RTepQDST1+7Ai1RdzhJsEZ2s1OYwnBPhLmWi
 bTq9buLd9DOHQ/X/WhvYp4J+cy+Zg5VJ6Zy2hpLzybvWgXEZxt0IFprShFKGunPw
 bKFH50wg5EHrLPVxq3P/Y0BlEzZz+Ji2GfSZKFr/KkK1j9GZA8RIS0R+mOdo4sYK
 qzEZzeJ92pwWo5FaMThoaKwqOPIVT5g+MEVCw0397rnUP+ZHMk888YYqsmKoaOVe
 EcoTzj4VuaOZdJ6n3SLJ+/5XBTR8G3aBZS4MeKIIRSiyIuIwrtu1ChZXYGA1r1Cs
 89TZdqqIlJQRgWt4yJi9MONBs+yVQ9xB6vl8rwm7PEjY5lboQGmKkMDkPML57PAk
 EErbF5vpXEM1ukGGJf28lOlxlylcmDUQOEXV9EYY9pcv2/SwxkDxD2Ayikn4QBDw
 VEgv4Q603MNaAe6/jLEqxGiRuHihRfItIw6MRQI1Ugn4YDT0gMQlxxINLns4IHan
 Tfpalh4rxZ8MM/5dJ2fkwTuYaJCE1pSlD2In1V8NvRLGqrEs9jg=
 =6O/4
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/kraxel/tags/usb-20210218-pull-request' into staging

usb: two bugfixes.

# gpg: Signature made Thu 18 Feb 2021 11:51:44 GMT
# gpg:                using RSA key A0328CFFB93A17A79901FE7D4CB6D8EED3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>" [full]
# gpg:                 aka "Gerd Hoffmann <gerd@kraxel.org>" [full]
# gpg:                 aka "Gerd Hoffmann (private) <kraxel@gmail.com>" [full]
# Primary key fingerprint: A032 8CFF B93A 17A7 9901  FE7D 4CB6 D8EE D3E8 7138

* remotes/kraxel/tags/usb-20210218-pull-request:
  usb/pcap: set flag_setup
  usb-host: use correct altsetting in usb_host_ep_update

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell 2021-02-18 15:14:09 +00:00
commit b826fb8002
2 changed files with 17 additions and 3 deletions

View File

@ -836,7 +836,7 @@ static void usb_host_ep_update(USBHostDevice *s)
struct libusb_ss_endpoint_companion_descriptor *endp_ss_comp;
#endif
uint8_t devep, type;
int pid, ep;
int pid, ep, alt;
int rc, i, e;
usb_ep_reset(udev);
@ -848,8 +848,20 @@ static void usb_host_ep_update(USBHostDevice *s)
conf->bConfigurationValue, true);
for (i = 0; i < conf->bNumInterfaces; i++) {
assert(udev->altsetting[i] < conf->interface[i].num_altsetting);
intf = &conf->interface[i].altsetting[udev->altsetting[i]];
/*
* The udev->altsetting array indexes alternate settings
* by the interface number. Get the 0th alternate setting
* first so that we can grab the interface number, and
* then correct the alternate setting value if necessary.
*/
intf = &conf->interface[i].altsetting[0];
alt = udev->altsetting[intf->bInterfaceNumber];
if (alt != 0) {
assert(alt < conf->interface[i].num_altsetting);
intf = &conf->interface[i].altsetting[alt];
}
trace_usb_host_parse_interface(s->bus_num, s->addr,
intf->bInterfaceNumber,
intf->bAlternateSetting, true);

View File

@ -127,6 +127,7 @@ static void do_usb_pcap_ctrl(FILE *fp, USBPacket *p, bool setup)
.xfer_type = usbmon_xfer_type[USB_ENDPOINT_XFER_CONTROL],
.epnum = in ? 0x80 : 0,
.devnum = dev->addr,
.flag_setup = setup ? 0 : '-',
.flag_data = '=',
.length = dev->setup_len,
};
@ -169,6 +170,7 @@ static void do_usb_pcap_data(FILE *fp, USBPacket *p, bool setup)
.xfer_type = usbmon_xfer_type[p->ep->type],
.epnum = usbmon_epnum(p),
.devnum = p->ep->dev->addr,
.flag_setup = '-',
.flag_data = '=',
.length = p->iov.size,
};