From a326a6ed8ee990acd8452adb2733a7c5f8a9963c Mon Sep 17 00:00:00 2001 From: David Madison Date: Sun, 17 Feb 2019 17:05:16 -0500 Subject: Add XInput string descriptors --- cores/arduino/USBCore.cpp | 5 +++++ cores/arduino/xinput/USB_XInput_Descriptors.cpp | 3 +++ cores/arduino/xinput/USB_XInput_Descriptors.h | 9 +++++++++ 3 files changed, 17 insertions(+) (limited to 'cores') diff --git a/cores/arduino/USBCore.cpp b/cores/arduino/USBCore.cpp index f2f5540..f239999 100644 --- a/cores/arduino/USBCore.cpp +++ b/cores/arduino/USBCore.cpp @@ -484,8 +484,13 @@ bool SendDescriptor(USBSetup& setup) char name[ISERIAL_MAX_LEN]; PluggableUSB().getShortName(name); return USB_SendStringDescriptor((uint8_t*)name, strlen(name), 0); +#else + return USB_SendStringDescriptor(STRING_SERIAL, strlen((char*)STRING_SERIAL), TRANSFER_PGM); #endif } + else if (setup.wValueL == ISECURITY) { + return USB_SendStringDescriptor(STRING_SECURITY, strlen((char*)STRING_SECURITY), TRANSFER_PGM); + } else return false; } diff --git a/cores/arduino/xinput/USB_XInput_Descriptors.cpp b/cores/arduino/xinput/USB_XInput_Descriptors.cpp index c9acd02..af8b573 100644 --- a/cores/arduino/xinput/USB_XInput_Descriptors.cpp +++ b/cores/arduino/xinput/USB_XInput_Descriptors.cpp @@ -204,4 +204,7 @@ const u8 USB_ConfigDescriptor[] = { const u16 USB_ConfigDescriptorSize = sizeof(USB_ConfigDescriptor); +const u8 STRING_SERIAL[] = "Arduino XInput AVR"; +const u8 STRING_SECURITY[] = "Xbox Security Method 3, Version 1.00, \xA9 2005 Microsoft Corporation. All rights reserved."; + #endif /* if defined(USBCON) */ diff --git a/cores/arduino/xinput/USB_XInput_Descriptors.h b/cores/arduino/xinput/USB_XInput_Descriptors.h index e8c3c24..8cb19df 100644 --- a/cores/arduino/xinput/USB_XInput_Descriptors.h +++ b/cores/arduino/xinput/USB_XInput_Descriptors.h @@ -31,10 +31,19 @@ #if defined(USBCON) +// Device Descriptor extern const DeviceDescriptor USB_DeviceDescriptor PROGMEM; + +// Config Descriptor extern const u8 USB_ConfigDescriptor[] PROGMEM; extern const u16 USB_ConfigDescriptorSize PROGMEM; +// String Descriptors +extern const u8 STRING_SERIAL[] PROGMEM; +extern const u8 STRING_SECURITY[] PROGMEM; + +#define ISECURITY 4 + #undef USB_VID #define USB_VID 0x045E -- cgit v1.2.3-18-g5258