diff --git a/sys/bus/u4b/input/uhid.c b/sys/bus/u4b/input/uhid.c index 352205c..2080579 100644 --- a/sys/bus/u4b/input/uhid.c +++ b/sys/bus/u4b/input/uhid.c @@ -117,6 +117,8 @@ static const uint8_t uhid_xb360gp_report_descr[] = {UHID_XB360GP_REPORT_DESCR()} static const uint8_t uhid_graphire_report_descr[] = {UHID_GRAPHIRE_REPORT_DESCR()}; static const uint8_t uhid_graphire3_4x5_report_descr[] = {UHID_GRAPHIRE3_4X5_REPORT_DESCR()}; +static const uint8_t uhid_holtek_gxt18_report_descr[] = {UHID_HOLTEK_GTX18_REPORT_DESCR()}; + /* prototypes */ static device_probe_t uhid_probe; @@ -752,6 +754,22 @@ uhid_attach(device_t dev) sc->sc_repdesc_ptr = (void *)&uhid_graphire3_4x5_report_descr; sc->sc_flags |= UHID_FLAG_STATIC_DESC; } + } else if (uaa->info.idVendor == USB_VENDOR_HOLTEK) { + /* Holtek based keyboards (USB ID 04d9:a055) have the following issues: + * + * - The report descriptor specifies an excessively large number of consumer + * usages (2^15) + * - The report descriptor reports on caps/scroll/num lock key presses, but + * doesn't have an LED output usage block. + * + */ + kprintf("DEBUG: HOLTEK detected\n"); + if (uaa->info.idProduct == USB_PRODUCT_HOLTEK_GXT18) { + kprintf("DEBUG: GXT18 detected\n"); + sc->sc_repdesc_size = sizeof(uhid_holtek_gxt18_report_descr); + sc->sc_repdesc_ptr = (void *)&uhid_holtek_gxt18_report_descr; + sc->sc_flags |= UHID_FLAG_STATIC_DESC; + } } else if ((uaa->info.bInterfaceClass == UICLASS_VENDOR) && (uaa->info.bInterfaceSubClass == UISUBCLASS_XBOX360_CONTROLLER) && (uaa->info.bInterfaceProtocol == UIPROTO_XBOX360_GAMEPAD)) { diff --git a/sys/bus/u4b/input/usb_rdesc.h b/sys/bus/u4b/input/usb_rdesc.h index 23ea620..45445cc 100644 --- a/sys/bus/u4b/input/usb_rdesc.h +++ b/sys/bus/u4b/input/usb_rdesc.h @@ -274,3 +274,76 @@ 0x81, 0x01, /* INPUT (Constant) */\ 0xc0 /* END COLLECTION */\ +#define UHID_HOLTEK_GTX18_REPORT_DESCR(...) \ + /* Original report descriptor, with reduced number of consumer usages */\ + 0x05, 0x01, /* Usage Page (Desktop), */\ + 0x09, 0x80, /* usage (Sys Control), */\ + 0xa1, 0x01, /* Collection (Application), */\ + 0x85, 0x01, /* Report ID (1), */\ + 0x19, 0x81, /* Usage Minimum (Sys Power Down), */\ + 0x29, 0x83, /* Usage Maximum (Sys Wake Up), */\ + 0x15, 0x00, /* Logical Minimum (0), */\ + 0x25, 0x01, /* Logical Maximum (1), */\ + 0x95, 0x03, /* Report Count (3), */\ + 0x75, 0x01, /* Report Size (1), */\ + 0x81, 0x02, /* Input (Variable), */\ + 0x95, 0x01, /* Report Count (1), */\ + 0x75, 0x05, /* Report Size (5), */\ + 0x81, 0x01, /* Input (Constant), */\ + 0xc0, /* End Collection, */\ + 0x05, 0x0c, /* Usage Page (Consumer), */\ + 0x09, 0x01, /* Usage (Consumer Control), */\ + 0xa1, 0x01, /* Collection (Application), */\ + 0x85, 0x02, /* Report ID (2), */\ + 0x19, 0x00, /* Usage Minimum (00h), */\ + 0x2a, 0xff, 0x2f, /* Usage Maximum (0x2FFF), previously 0x7FFF */\ + 0x15, 0x00, /* Logical Minimum (0), */\ + 0x26, 0xff, 0x2f, /* Logical Maximum (0x2FFF),previously 0x7FFF*/\ + 0x95, 0x01, /* Report Count (1), */\ + 0x75, 0x10, /* Report Size (16), */\ + 0x81, 0x00, /* Input, */\ + 0xc0, /* End Collection, */\ + 0x05, 0x01, /* Usage Page (Desktop), */\ + 0x09, 0x06, /* Usage (Keyboard), */\ + 0xa1, 0x01, /* Collection (Application), */\ + 0x85, 0x03, /* Report ID (3), */\ + 0x95, 0x38, /* Report Count (56), */\ + 0x75, 0x01, /* Report Size (1), */\ + 0x15, 0x00, /* Logical Minimum (0), */\ + 0x25, 0x01, /* Logical Maximum (1), */\ + 0x05, 0x07, /* Usage Page (Keyboard), */\ + 0x19, 0xe0, /* Usage Minimum (KB Leftcontrol), */\ + 0x29, 0xe7, /* Usage Maximum (KB Right GUI), */\ + 0x19, 0x00, /* Usage Minimum (None), */\ + 0x29, 0x2f, /* Usage Maximum (KB Lboxbracket And Lbrace),*/\ + 0x81, 0x02, /* Input (Variable), */\ + 0xc0, /* End Collection, */\ + 0x05, 0x01, /* Usage Page (Desktop), */\ + 0x09, 0x06, /* Usage (Keyboard), */\ + 0xa1, 0x01, /* Collection (Application), */\ + 0x85, 0x04, /* Report ID (4), */\ + 0x95, 0x38, /* Report Count (56), */\ + 0x75, 0x01, /* Report Size (1), */\ + 0x15, 0x00, /* Logical Minimum (0), */\ + 0x25, 0x01, /* Logical Maximum (1), */\ + 0x05, 0x07, /* Usage Page (Keyboard), */\ + 0x19, 0x30, /* Usage Minimum (KB Rboxbracket And Rbrace),*/\ + 0x29, 0x67, /* Usage Maximum (KP Equals), */\ + 0x81, 0x02, /* Input (Variable), */\ + 0xc0, /* End Collection */\ + /* LED usage for the boot protocol interface */\ + 0x05, 0x01, /* Usage Page (Desktop), */\ + 0x09, 0x06, /* Usage (Keyboard), */\ + 0xa1, 0x01, /* Collection (Application), */\ + 0x05, 0x08, /* Usage Page (LED), */\ + 0x19, 0x01, /* Usage Minimum (01h), */\ + 0x29, 0x03, /* Usage Maximum (03h), */\ + 0x15, 0x00, /* Logical Minimum (0), */\ + 0x25, 0x01, /* Logical Maximum (1), */\ + 0x75, 0x01, /* Report Size (1), */\ + 0x95, 0x03, /* Report Count (3), */\ + 0x91, 0x02, /* Output (Variable), */\ + 0x95, 0x05, /* Report Count (5), */\ + 0x91, 0x01, /* Output (Constant), */\ + 0xc0 /* End Collection */\ + diff --git a/sys/bus/u4b/usbdevs b/sys/bus/u4b/usbdevs index 86698ad..4df59b1 100644 --- a/sys/bus/u4b/usbdevs +++ b/sys/bus/u4b/usbdevs @@ -2149,6 +2149,9 @@ product HIDGLOBAL CM6020 0x1784 Omnikey Cardman 6020 product HITACHI DVDCAM_DZ_MV100A 0x0004 DVD-CAM DZ-MV100A Camcorder product HITACHI DVDCAM_USB 0x001e DVDCAM USB HS Interface +/* Holtek products */ +product HOLTEK GXT18 0xa055 Trust GXT 18 + /* HP products */ product HP 895C 0x0004 DeskJet 895C product HP 4100C 0x0101 Scanjet 4100C