From 39044e272695c5f9c43a0560ae00ea440881d464 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 15 Jul 2015 20:17:30 +0100 Subject: from-no --- app/keyboard.c | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) (limited to 'app/keyboard.c') diff --git a/app/keyboard.c b/app/keyboard.c index 9799629..b4727a8 100644 --- a/app/keyboard.c +++ b/app/keyboard.c @@ -56,14 +56,30 @@ static const uint8_t keyboard_report_descriptor[] = { 0x95, 0x06, /* Report count (6) */ 0x75, 0x08, /* Report size (8) */ 0x15, 0x00, /* Logical minimum (0) */ - 0x25, 0x65, /* Logical maximum (101) */ + //0x25, 0x65, /* Logical maximum (101) */ + //0x25, 0x7f, /* Logical maximum (127) */ + 0x26, 0xff, 0x00, /* Logical maximum (255) */ 0x05, 0x07, /* Usage page (key codes) */ 0x19, 0x00, /* Usage minimum (0) */ 0x2A, 0xff, 0x00, /* Usage maximum (255) */ // 0x29, 0x65, /* Usage maximum (101) */ // 0x2A, 0xff, 0x03, /* Usage maximum (1023) */ 0x81, 0x00, /* Input (data, array) */ - 0xC0 /* End Collection */ + 0x05, 0x01, /* USAGE_PAGE (Generic Desktop) */ + 0x09, 0x80, /* USAGE (System Control) */ + 0xA1, 0x01, /* COLLECTION (Application) */ + 0x75, 0x02, /* REPORT_SIZE (2) */ + 0x95, 0x01, /* REPORT_COUNT (1) */ + 0x15, 0x01, /* LOGICAL_MIN (1) */ + 0x25, 0x03, /* LOGICAL_MAX (3) */ + 0x09, 0x82, /* USAGE (System Sleep) */ + 0x09, 0x81, /* USAGE (System Power Down) */ + 0x09, 0x83, /* USAGE (System Wake Up) */ + 0x81, 0x60, /* INPUT (Data Ary Abs NPrf Null) */ + 0x75, 0x06, /* REPORT_SIZE (6) */ + 0x81, 0x03, /* INPUT (Cnst Var Abs) */ + 0xc0, /* END COLLECTION */ +0xC0 /* End Collection */ }; @@ -92,7 +108,7 @@ const struct usb_endpoint_descriptor keyboard_endpoint = { .bDescriptorType = USB_DT_ENDPOINT, .bEndpointAddress = 0x81, .bmAttributes = USB_ENDPOINT_ATTR_INTERRUPT, - .wMaxPacketSize = 8, + .wMaxPacketSize = 9, .bInterval = 0x1 //0x20, }; @@ -105,7 +121,7 @@ const struct usb_interface_descriptor keyboard_iface = { .bInterfaceClass = USB_CLASS_HID, .bInterfaceSubClass = 1, /* boot */ .bInterfaceProtocol = 1, /* keyboard */ - .iInterface = 0, + .iInterface = 5, .endpoint = &keyboard_endpoint, @@ -127,7 +143,7 @@ void keyboard_test (void) { static int c = 0; - uint8_t buf[8] = { 0, 0, 0, 0, 0, 0, 0, 0 }; + uint8_t buf[9] = { 0, 0, 0, 0, 0, 0, 0, 0 ,0}; buf[0] = (c >> 1) & 7; @@ -136,5 +152,5 @@ keyboard_test (void) c++; - usbd_ep_write_packet (usbd_dev, 0x81, buf, 8); + usbd_ep_write_packet (usbd_dev, 0x81, buf, 9); } -- cgit v1.2.3