summaryrefslogtreecommitdiffstats
path: root/src/mouse.c
diff options
context:
space:
mode:
authorroot <root@lab2.panaceas.james.local>2014-11-02 18:17:44 +0000
committerroot <root@lab2.panaceas.james.local>2014-11-02 18:17:44 +0000
commit12287ff0a55f929bf840dcb4780d3f77b862c434 (patch)
tree46632674f393249e7cd74eacd7a4da00ccec540f /src/mouse.c
parent479e719a64d75374f00438498cf91ba2601a63f1 (diff)
downloadstm32_usb_kvm-12287ff0a55f929bf840dcb4780d3f77b862c434.tar.gz
stm32_usb_kvm-12287ff0a55f929bf840dcb4780d3f77b862c434.tar.bz2
stm32_usb_kvm-12287ff0a55f929bf840dcb4780d3f77b862c434.zip
fish
Diffstat (limited to 'src/mouse.c')
-rw-r--r--src/mouse.c115
1 files changed, 0 insertions, 115 deletions
diff --git a/src/mouse.c b/src/mouse.c
deleted file mode 100644
index 6e0a207..0000000
--- a/src/mouse.c
+++ /dev/null
@@ -1,115 +0,0 @@
-#include "project.h"
-
-static const uint8_t mouse_report_descriptor[] = {
- 0x05, 0x01, /* USAGE_PAGE (Generic Desktop) */
- 0x09, 0x02, /* USAGE (Mouse) */
- 0xa1, 0x01, /* COLLECTION (Application) */
- 0x09, 0x01, /* USAGE (Pointer) */
- 0xa1, 0x00, /* COLLECTION (Physical) */
- 0x05, 0x09, /* USAGE_PAGE (Button) */
- 0x19, 0x01, /* USAGE_MINIMUM (Button 1) */
- 0x29, 0x03, /* USAGE_MAXIMUM (Button 3) */
- 0x15, 0x00, /* LOGICAL_MINIMUM (0) */
- 0x25, 0x01, /* LOGICAL_MAXIMUM (1) */
- 0x95, 0x03, /* REPORT_COUNT (3) */
- 0x75, 0x01, /* REPORT_SIZE (1) */
- 0x81, 0x02, /* INPUT (Data,Var,Abs) */
- 0x95, 0x01, /* REPORT_COUNT (1) */
- 0x75, 0x05, /* REPORT_SIZE (5) */
- 0x81, 0x01, /* INPUT (Cnst,Ary,Abs) */
- 0x05, 0x01, /* USAGE_PAGE (Generic Desktop) */
- 0x09, 0x30, /* USAGE (X) */
- 0x09, 0x31, /* USAGE (Y) */
- 0x09, 0x38, /* USAGE (Wheel) */
- 0x15, 0x81, /* LOGICAL_MINIMUM (-127) */
- 0x25, 0x7f, /* LOGICAL_MAXIMUM (127) */
- 0x75, 0x08, /* REPORT_SIZE (8) */
- 0x95, 0x03, /* REPORT_COUNT (3) */
- 0x81, 0x06, /* INPUT (Data,Var,Rel) */
- 0xc0, /* END_COLLECTION */
- 0x09, 0x3c, /* USAGE (Motion Wakeup) */
- 0x05, 0xff, /* USAGE_PAGE (Vendor Defined Page 1) */
- 0x09, 0x01, /* USAGE (Vendor Usage 1) */
- 0x15, 0x00, /* LOGICAL_MINIMUM (0) */
- 0x25, 0x01, /* LOGICAL_MAXIMUM (1) */
- 0x75, 0x01, /* REPORT_SIZE (1) */
- 0x95, 0x02, /* REPORT_COUNT (2) */
- 0xb1, 0x22, /* FEATURE (Data,Var,Abs,NPrf) */
- 0x75, 0x06, /* REPORT_SIZE (6) */
- 0x95, 0x01, /* REPORT_COUNT (1) */
- 0xb1, 0x01, /* FEATURE (Cnst,Ary,Abs) */
- 0xc0 /* END_COLLECTION */
-};
-
-static const struct
-{
- struct usb_hid_descriptor hid_descriptor;
- struct
- {
- uint8_t bReportDescriptorType;
- uint16_t wDescriptorLength;
- } __attribute__ ((packed)) hid_report;
-} __attribute__ ((packed)) mouse_function =
-{
- .hid_descriptor =
- {
- .bLength = sizeof (mouse_function),.bDescriptorType = USB_DT_HID,.bcdHID =
- 0x0100,.bCountryCode = 0,.bNumDescriptors = 1,}
- ,.hid_report =
- {
- .bReportDescriptorType = USB_DT_REPORT,.wDescriptorLength =
- sizeof (mouse_report_descriptor),}
-,};
-
-const struct usb_endpoint_descriptor mouse_endpoint = {
- .bLength = USB_DT_ENDPOINT_SIZE,
- .bDescriptorType = USB_DT_ENDPOINT,
- .bEndpointAddress = 0x82,
- .bmAttributes = USB_ENDPOINT_ATTR_INTERRUPT,
- .wMaxPacketSize = 4,
- .bInterval = 0x20,
-};
-
-const struct usb_interface_descriptor mouse_iface = {
- .bLength = USB_DT_INTERFACE_SIZE,
- .bDescriptorType = USB_DT_INTERFACE,
- .bInterfaceNumber = 1,
- .bAlternateSetting = 0,
- .bNumEndpoints = 1,
- .bInterfaceClass = USB_CLASS_HID,
- .bInterfaceSubClass = 1, /* boot */
- .bInterfaceProtocol = 2, /* mouse */
- .iInterface = 0,
-
- .endpoint = &mouse_endpoint,
-
- .extra = &mouse_function,
- .extralen = sizeof (mouse_function),
-};
-
-
-void
-mouse_get_descriptor (uint8_t ** buf, uint16_t * len)
-{
-
- /* Handle the HID report descriptor. */
- *buf = (uint8_t *) mouse_report_descriptor;
- *len = sizeof (mouse_report_descriptor);
-}
-
-void
-mouse_test (void)
-{
- static int c = 1;
- uint8_t buf[4] = { 0, 0, 0, 0 };
-
- buf[0] = c & 7;
-
- buf[1] = c & 8 ? -1 : 1;
- buf[2] = c & 16 ? -1 : 1;
- buf[3] = c & 32 ? -1 : 1;
-
- c++;
-
- usbd_ep_write_packet (usbd_dev, 0x82, buf, 4);
-}