summaryrefslogtreecommitdiffstats
path: root/tmk_core/protocol
diff options
context:
space:
mode:
Diffstat (limited to 'tmk_core/protocol')
-rw-r--r--tmk_core/protocol/chibios/usb_main.c13
-rw-r--r--tmk_core/protocol/lufa/lufa.c2
-rw-r--r--tmk_core/protocol/usb_descriptor.c10
-rw-r--r--tmk_core/protocol/usb_descriptor.h2
-rw-r--r--tmk_core/protocol/vusb/vusb.c7
5 files changed, 23 insertions, 11 deletions
diff --git a/tmk_core/protocol/chibios/usb_main.c b/tmk_core/protocol/chibios/usb_main.c
index 62a11faff7..5d36900bdd 100644
--- a/tmk_core/protocol/chibios/usb_main.c
+++ b/tmk_core/protocol/chibios/usb_main.c
@@ -111,9 +111,10 @@ uint8_t extra_report_blank[3] = {0};
static const USBDescriptor *usb_get_descriptor_cb(USBDriver *usbp, uint8_t dtype, uint8_t dindex, uint16_t wIndex) {
(void)usbp;
static USBDescriptor desc;
- uint16_t wValue = ((uint16_t)dtype << 8) | dindex;
- desc.ud_string = NULL;
- desc.ud_size = get_usb_descriptor(wValue, wIndex, (const void **const) & desc.ud_string);
+ uint16_t wValue = ((uint16_t)dtype << 8) | dindex;
+ uint16_t wLength = ((uint16_t)usbp->setup[7] << 8) | usbp->setup[6];
+ desc.ud_string = NULL;
+ desc.ud_size = get_usb_descriptor(wValue, wIndex, wLength, (const void **const) & desc.ud_string);
if (desc.ud_string == NULL)
return NULL;
else
@@ -585,7 +586,8 @@ static uint16_t get_hword(uint8_t *p) {
*/
static uint8_t set_report_buf[2] __attribute__((aligned(4)));
-static void set_led_transfer_cb(USBDriver *usbp) {
+
+static void set_led_transfer_cb(USBDriver *usbp) {
if (usbp->setup[6] == 2) { /* LSB(wLength) */
uint8_t report_id = set_report_buf[0];
if ((report_id == REPORT_ID_KEYBOARD) || (report_id == REPORT_ID_NKRO)) {
@@ -665,8 +667,7 @@ static bool usb_request_hook_cb(USBDriver *usbp) {
if ((usbp->setup[4] == KEYBOARD_INTERFACE) && (usbp->setup[5] == 0)) { /* wIndex */
keyboard_protocol = ((usbp->setup[2]) != 0x00); /* LSB(wValue) */
#ifdef NKRO_ENABLE
- keymap_config.nkro = !!keyboard_protocol;
- if (!keymap_config.nkro && keyboard_idle) {
+ if (!keyboard_protocol && keyboard_idle) {
#else /* NKRO_ENABLE */
if (keyboard_idle) {
#endif /* NKRO_ENABLE */
diff --git a/tmk_core/protocol/lufa/lufa.c b/tmk_core/protocol/lufa/lufa.c
index 8f36e02b9a..99f7d31287 100644
--- a/tmk_core/protocol/lufa/lufa.c
+++ b/tmk_core/protocol/lufa/lufa.c
@@ -901,5 +901,5 @@ void protocol_post_task(void) {
}
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint16_t wIndex, const void **const DescriptorAddress) {
- return get_usb_descriptor(wValue, wIndex, DescriptorAddress);
+ return get_usb_descriptor(wValue, wIndex, USB_ControlRequest.wLength, DescriptorAddress);
}
diff --git a/tmk_core/protocol/usb_descriptor.c b/tmk_core/protocol/usb_descriptor.c
index 99c52952a0..5ab9e3ff4f 100644
--- a/tmk_core/protocol/usb_descriptor.c
+++ b/tmk_core/protocol/usb_descriptor.c
@@ -45,8 +45,9 @@
# include "joystick.h"
#endif
-// TODO: wb32 support defines ISO macro which breaks PRODUCT stringification
-#undef ISO
+#ifdef OS_DETECTION_ENABLE
+# include "os_detection.h"
+#endif
// clang-format off
@@ -1095,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;
@@ -1137,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:
diff --git a/tmk_core/protocol/usb_descriptor.h b/tmk_core/protocol/usb_descriptor.h
index bc5e84e586..ed84f4c9ab 100644
--- a/tmk_core/protocol/usb_descriptor.h
+++ b/tmk_core/protocol/usb_descriptor.h
@@ -308,4 +308,4 @@ enum usb_endpoints {
#define JOYSTICK_EPSIZE 8
#define DIGITIZER_EPSIZE 8
-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);
diff --git a/tmk_core/protocol/vusb/vusb.c b/tmk_core/protocol/vusb/vusb.c
index 2d17761978..b3eeff9e01 100644
--- a/tmk_core/protocol/vusb/vusb.c
+++ b/tmk_core/protocol/vusb/vusb.c
@@ -44,6 +44,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
# include "ring_buffer.h"
#endif
+#ifdef OS_DETECTION_ENABLE
+# include "os_detection.h"
+#endif
+
#define NEXT_INTERFACE __COUNTER__
/*
@@ -1013,6 +1017,9 @@ USB_PUBLIC usbMsgLen_t usbFunctionDescriptor(struct usbRequest *rq) {
break;
#endif
}
+#ifdef OS_DETECTION_ENABLE
+ process_wlength(rq->wLength.word);
+#endif
break;
case USBDESCR_HID:
switch (rq->wValue.bytes[0]) {