From 39044e272695c5f9c43a0560ae00ea440881d464 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 15 Jul 2015 20:17:30 +0100 Subject: from-no --- app/mouse.c | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) (limited to 'app/mouse.c') diff --git a/app/mouse.c b/app/mouse.c index 0431349..0b90f1f 100644 --- a/app/mouse.c +++ b/app/mouse.c @@ -38,7 +38,21 @@ static const uint8_t mouse_report_descriptor[] = { 0x75, 0x06, /* REPORT_SIZE (6) */ 0x95, 0x01, /* REPORT_COUNT (1) */ 0xb1, 0x01, /* FEATURE (Cnst,Ary,Abs) */ - 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 */ }; static const struct @@ -66,7 +80,7 @@ const struct usb_endpoint_descriptor mouse_endpoint = { .bDescriptorType = USB_DT_ENDPOINT, .bEndpointAddress = 0x82, .bmAttributes = USB_ENDPOINT_ATTR_INTERRUPT, - .wMaxPacketSize = 4, + .wMaxPacketSize = 5, .bInterval = 0x1, //0x20, }; @@ -79,7 +93,7 @@ const struct usb_interface_descriptor mouse_iface = { .bInterfaceClass = USB_CLASS_HID, .bInterfaceSubClass = 1, /* boot */ .bInterfaceProtocol = 2, /* mouse */ - .iInterface = 0, + .iInterface = 6, .endpoint = &mouse_endpoint, @@ -101,7 +115,7 @@ void mouse_test (void) { static int c = 1; - uint8_t buf[4] = { 0, 0, 0, 0 }; + uint8_t buf[5] = { 0, 0, 0, 0 }; buf[0] = c & 7; @@ -111,5 +125,5 @@ mouse_test (void) c++; - usbd_ep_write_packet (usbd_dev, 0x82, buf, 4); + usbd_ep_write_packet (usbd_dev, 0x82, buf, 5); } -- cgit v1.2.3