Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Device address mismatch after windows hibernation when at least 2 devices are connected to same hub #105

Open
mkozaaczka opened this issue Jun 30, 2020 · 1 comment
Labels

Comments

@mkozaaczka
Copy link
Contributor

Device address mismatch after windows hibernation when at least 2 devices are connected to same hub

Scenario:

  1. Enable hibernation in windows via using following command in cmd.exe "powercfg.exe /hibernate on"
  2. Connect mouse and keyboard to same hub (same bus id)
  3. Start capture using Wireshark or USBPcapCMD for few seconds then stop it.
    Observe that device address for injected descriptors and packages that arrives to/from device are matched
    for instance:
  • keyboard - injected descriptor device address 1
  • mouse - injected descriptor device address 2 and its packages transferred to/from host have got device address 2
    Take look at attached file in zip (1.before_hibernation.pcap)
  1. Hibernate windows OS, then wake it up.
  2. When system get resumed, start again capture using Wireshark or USBPcapCMD for few seconds then stop it.
    Observe that device address for injected descriptors and packages that arrives to/from device are mismatched.
    for instance:
  • keyboard - injected descriptor device address 2
  • mouse - injected descriptor device address 1 and its packages transferred to/from host have got device address 2 -> this incorrect
    Take look at attached file in zip (2.after_hibernation.pcap)
    capture_hibernation_issue.zip
@desowin desowin added the bug label Jun 30, 2020
@desowin
Copy link
Owner

desowin commented Jun 30, 2020

I have reproduced this issue on my laptop (xHCI host controller). I have monitored the USB connection to the mouse with OpenVizsla. The device addresses in Injected descriptors (in user-space USBPcapCMD) are correct. The bug seems to be in kernel-space (USBPcapDriver).

After resuming, USBPcapDriver seems to use the address that was assigned before hibernation. In reality however, the address has changed (in fact it has changed twice; first time by BIOS and then by Windows).

I am not sure if the problem can be reproduced with EHCI host controllers. The important difference between xHCI and EHCI is that xHCI assigns addresses in hardware (OS can check this information; this is why on Linux the device number as seen by usbmon is not necessarily matching the address that was assigned to the device), while with EHCI the address is assigned by kernel software.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants