From 6336ab07c764921404674b99e157568965eef706 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Ass=C3=A9nat?= Date: Sat, 23 Nov 2013 02:26:37 +0000 Subject: [PATCH] Fix keyboard descriptor Auto-detection at startup --- dc_pad.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/dc_pad.c b/dc_pad.c index 6aefb90..ed57b4c 100644 --- a/dc_pad.c +++ b/dc_pad.c @@ -155,12 +155,12 @@ static const unsigned char dcKeyboardReport[] PROGMEM = { 0x95, 0x06, // Report Count(6) 0x75, 0x08, // Report Size(8) 0x15, 0x00, // Logical Minimum (0) - 0x25, 0x8B, // Logical maximum (139) + 0x26, 0xFF, 0x00, // Logical maximum (255) // Key array // 0x05, 0x07, // Usage Page (key Codes) 0x19, 0x00, // Usage Minimum(0) - 0x29, 0x8B, // Usage Maximum(139) + 0x29, 0xFF, // Usage Maximum(255) 0x81, 0x00, // Input (Data, Array) 0xc0, // END_COLLECTION @@ -271,8 +271,13 @@ static void setConnectedDevice(uint16_t func) static void dcInit(void) { + setConnectedDevice(DEFAULT_FUNCTION); + + /* Try to detect the exact peripheral before continuing. The allows + * the adapter to enumerate as the correct device right away. */ + dcUpdate(); + dcUpdate(); dcUpdate(); - setConnectedDevice(DEFAULT_FUNCTION); } #define MAX_ERRORS 100