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

[Windows] Fix crash when a HID device has no input reports #205

Merged
merged 1 commit into from
Jul 17, 2020

Conversation

sigprof
Copy link
Contributor

@sigprof sigprof commented Jul 16, 2020

Description

Some devices, like the XD002 keyboard with the factory firmware, have HID report descriptors which do not declare any input reports. If such HID descriptor additionally had the vendor-defined page and usage codes which correspond to the HID console, QMK Toolbox tried to use that HID interface as a HID console, and an attempt to read the nonexistent input report caused a crash inside HidLibrary; this made using QMK Toolbox impossible when a device with such HID report descriptor is connected.

Add a check for a non-zero input report size to GetListableDevices() to prevent the attempt to use a HID interface without any input repors as a HID console.

The problematic HID report descriptor from the XD002 firmware is probably this one — it has only a single Output report defined. I did not actually have that device available for testing, so I made a device with a similar descriptor from a LUFA sample; with that device connected I reproduced a crash with the same backtrace as this one, which is fixed by the change from this PR.

Types of Changes

  • Core
  • Bugfix
  • New feature
  • Enhancement/optimization
  • Documentation

Issues Fixed or Closed by This PR

Some devices, like the XD002 keyboard with the factory firmware, have
HID report descriptors which do not declare any input reports.  If such
HID descriptor additionally had the vendor-defined page and usage codes
which correspond to the HID console, QMK Toolbox tried to use that HID
interface as a HID console, and an attempt to read the nonexistent input
report caused a crash inside HidLibrary; this made using QMK Toolbox
impossible when a device with such HID report descriptor is connected.

Add a check for a non-zero input report size to GetListableDevices() to
prevent the attempt to use a HID interface without any input repors as a
HID console.
@zvecr zvecr requested a review from a team July 16, 2020 19:47
@zvecr zvecr added the bug label Jul 16, 2020
@fauxpark
Copy link
Member

Thanks!

@fauxpark fauxpark merged commit 16717d2 into qmk:master Jul 17, 2020
@Fieel
Copy link

Fieel commented Jul 20, 2020

Thank you so much for the quick fix :)

@sigprof sigprof deleted the windows-console-no-input-reports branch January 8, 2021 13:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

QMK Toolbox does not launch if an unsupported device (XD002) is also connected
5 participants