qemu-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-commits] [qemu/qemu] 0dbe47: usb-host: use correct altsetting in u


From: Peter Maydell
Subject: [Qemu-commits] [qemu/qemu] 0dbe47: usb-host: use correct altsetting in usb_host_ep_up...
Date: Thu, 18 Feb 2021 08:33:30 -0800

  Branch: refs/heads/master
  Home:   https://github.com/qemu/qemu
  Commit: 0dbe4768b95eef1d0fa55a5cfd6ec7a6ffa58634
      
https://github.com/qemu/qemu/commit/0dbe4768b95eef1d0fa55a5cfd6ec7a6ffa58634
  Author: Nick Rosbrook <rosbrookn@gmail.com>
  Date:   2021-02-17 (Wed, 17 Feb 2021)

  Changed paths:
    M hw/usb/host-libusb.c

  Log Message:
  -----------
  usb-host: use correct altsetting in usb_host_ep_update

In order to keep track of the alternate setting that should be used for
a given interface, the USBDevice struct keeps an array of alternate
setting values, which is indexed by the interface number. In
usb_host_set_interface, when this array is updated, usb_host_ep_update
is called as a result. However, when usb_host_ep_update accesses the
active libusb_config_descriptor, it indexes udev->altsetting with the
loop variable, rather than the interface number.

With the simple trace backend enable, this behavior can be seen:

  [...]

  usb_xhci_xfer_start 0.440 pid=1215 xfer=0x5596a4b85930 slotid=0x1 epid=0x1 
streamid=0x0
  usb_packet_state_change 1.703 pid=1215 bus=0x1 port=b'1' ep=0x0 
p=0x5596a4b85938 o=b'undef' n=b'setup'
  usb_host_req_control 2.269 pid=1215 bus=0x1 addr=0x5 p=0x5596a4b85938 
req=0x10b value=0x1 index=0xd
  usb_host_set_interface 0.449 pid=1215 bus=0x1 addr=0x5 interface=0xd alt=0x1
  usb_host_parse_config 2542.648 pid=1215 bus=0x1 addr=0x5 value=0x2 active=0x1
  usb_host_parse_interface 1.804 pid=1215 bus=0x1 addr=0x5 num=0xc alt=0x0 
active=0x1
  usb_host_parse_endpoint 2.012 pid=1215 bus=0x1 addr=0x5 ep=0x2 dir=b'in' 
type=b'int' active=0x1
  usb_host_parse_interface 1.598 pid=1215 bus=0x1 addr=0x5 num=0xd alt=0x0 
active=0x1
  usb_host_req_emulated 3.593 pid=1215 bus=0x1 addr=0x5 p=0x5596a4b85938 
status=0x0
  usb_packet_state_change 2.550 pid=1215 bus=0x1 port=b'1' ep=0x0 
p=0x5596a4b85938 o=b'setup' n=b'complete'
  usb_xhci_xfer_success 4.298 pid=1215 xfer=0x5596a4b85930 bytes=0x0

  [...]

In particular, it is seen that although usb_host_set_interface sets the
alternate setting of interface 0xd to 0x1, usb_host_ep_update uses 0x0
as the alternate setting due to using the incorrect index to
udev->altsetting.

Fix this problem by getting the interface number from the active
libusb_config_descriptor, and then using that as the index to
udev->altsetting.

Signed-off-by: Nick Rosbrook <rosbrookn@ainfosec.com>
Message-Id: <20210201213021.500277-1-rosbrookn@ainfosec.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>


  Commit: 6ba5a437ad48f10931592f649b5b7375968f362d
      
https://github.com/qemu/qemu/commit/6ba5a437ad48f10931592f649b5b7375968f362d
  Author: Gerd Hoffmann <kraxel@redhat.com>
  Date:   2021-02-17 (Wed, 17 Feb 2021)

  Changed paths:
    M hw/usb/pcap.c

  Log Message:
  -----------
  usb/pcap: set flag_setup

Without that wireshark complains about invalid control setup data
for non-control transfers.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Message-Id: <20210216144939.841873-1-kraxel@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>


  Commit: b826fb8002e6247a324a546a75eda17ac33674b9
      
https://github.com/qemu/qemu/commit/b826fb8002e6247a324a546a75eda17ac33674b9
  Author: Peter Maydell <peter.maydell@linaro.org>
  Date:   2021-02-18 (Thu, 18 Feb 2021)

  Changed paths:
    M hw/usb/host-libusb.c
    M hw/usb/pcap.c

  Log Message:
  -----------
  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>


Compare: https://github.com/qemu/qemu/compare/91416a425401...b826fb8002e6



reply via email to

[Prev in Thread] Current Thread [Next in Thread]