Detect host OS based on USB fingerprint (#18463)

Co-authored-by: Drashna Jaelre <drashna@live.com>
Co-authored-by: Nick Brassel <nick@tzarc.org>
This commit is contained in:
Ruslan Sayfutdinov
2022-12-08 16:45:30 +00:00
committed by GitHub
parent e06f50c489
commit 85ee55ff3b
15 changed files with 448 additions and 7 deletions

View File

@ -45,6 +45,10 @@
# include "joystick.h"
#endif
#ifdef OS_DETECTION_ENABLE
# include "os_detection.h"
#endif
// clang-format off
/*
@ -1092,7 +1096,7 @@ const USB_Descriptor_String_t PROGMEM SerialNumberString = {
* is called so that the descriptor details can be passed back and the appropriate descriptor sent back to the
* USB host.
*/
uint16_t get_usb_descriptor(const uint16_t wValue, const uint16_t wIndex, const void** const DescriptorAddress) {
uint16_t get_usb_descriptor(const uint16_t wValue, const uint16_t wIndex, const uint16_t wLength, const void** const DescriptorAddress) {
const uint8_t DescriptorType = (wValue >> 8);
const uint8_t DescriptorIndex = (wValue & 0xFF);
const void* Address = NULL;
@ -1134,6 +1138,9 @@ uint16_t get_usb_descriptor(const uint16_t wValue, const uint16_t wIndex, const
break;
#endif
}
#ifdef OS_DETECTION_ENABLE
process_wlength(wLength);
#endif
break;
case HID_DTYPE_HID: