summaryrefslogtreecommitdiff
path: root/chip/stm32/usb_hid_touchpad.c
diff options
context:
space:
mode:
Diffstat (limited to 'chip/stm32/usb_hid_touchpad.c')
-rw-r--r--chip/stm32/usb_hid_touchpad.c535
1 files changed, 380 insertions, 155 deletions
diff --git a/chip/stm32/usb_hid_touchpad.c b/chip/stm32/usb_hid_touchpad.c
index 0ead660432..15dd38756f 100644
--- a/chip/stm32/usb_hid_touchpad.c
+++ b/chip/stm32/usb_hid_touchpad.c
@@ -1,4 +1,4 @@
-/* Copyright 2016 The Chromium OS Authors. All rights reserved.
+/* Copyright 2016 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -24,16 +24,16 @@
#include "usb_hid_touchpad.h"
/* Console output macro */
-#define CPRINTF(format, args...) cprintf(CC_USB, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_USB, format, ## args)
+#define CPRINTF(format, args...) cprintf(CC_USB, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_USB, format, ##args)
static const int touchpad_debug;
-static struct queue const report_queue = QUEUE_NULL(8,
- struct usb_hid_touchpad_report);
+static struct queue const report_queue =
+ QUEUE_NULL(8, struct usb_hid_touchpad_report);
static struct mutex report_queue_mutex;
-#define HID_TOUCHPAD_REPORT_SIZE sizeof(struct usb_hid_touchpad_report)
+#define HID_TOUCHPAD_REPORT_SIZE sizeof(struct usb_hid_touchpad_report)
/*
* Touchpad EP interval: Make sure this value is smaller than the typical
@@ -65,58 +65,63 @@ const struct usb_endpoint_descriptor USB_EP_DESC(USB_IFACE_HID_TOUCHPAD, 81) = {
.bInterval = HID_TOUCHPAD_EP_INTERVAL_MS /* polling interval */
};
-#define FINGER_USAGE \
- 0x05, 0x0D, /* Usage Page (Digitizer) */ \
- 0x09, 0x22, /* Usage (Finger) */ \
- 0xA1, 0x02, /* Collection (Logical) */ \
- 0x09, 0x47, /* Usage (Confidence) */ \
- 0x09, 0x42, /* Usage (Tip Switch) */ \
- 0x09, 0x32, /* Usage (In Range) */ \
- 0x15, 0x00, /* Logical Minimum (0) */ \
- 0x25, 0x01, /* Logical Maximum (1) */ \
- 0x75, 0x01, /* Report Size (1) */ \
- 0x95, 0x03, /* Report Count (3) */ \
- 0x81, 0x02, /* Input (Data,Var,Abs) */ \
- 0x09, 0x51, /* Usage (0x51) Contact identifier */ \
- 0x75, 0x04, /* Report Size (4) */ \
- 0x95, 0x01, /* Report Count (1) */ \
- 0x25, 0x0F, /* Logical Maximum (15) */ \
- 0x81, 0x02, /* Input (Data,Var,Abs) */ \
- 0x05, 0x0D, /* Usage Page (Digitizer) */ \
- /* Logical Maximum of Pressure */ \
- 0x26, (CONFIG_USB_HID_TOUCHPAD_LOGICAL_MAX_PRESSURE & 0xFF), \
- (CONFIG_USB_HID_TOUCHPAD_LOGICAL_MAX_PRESSURE >> 8), \
- 0x75, 0x09, /* Report Size (9) */ \
- 0x09, 0x30, /* Usage (Tip pressure) */ \
- 0x81, 0x02, /* Input (Data,Var,Abs) */ \
- 0x26, 0xFF, 0x0F, /* Logical Maximum (4095) */ \
- 0x75, 0x0C, /* Report Size (12) */ \
- 0x09, 0x48, /* Usage (WIDTH) */ \
- 0x81, 0x02, /* Input (Data,Var,Abs) */ \
- 0x09, 0x49, /* Usage (HEIGHT) */ \
- 0x81, 0x02, /* Input (Data,Var,Abs) */ \
- 0x05, 0x01, /* Usage Page (Generic Desktop Ctrls) */ \
- 0x75, 0x0C, /* Report Size (12) */ \
- 0x55, 0x0E, /* Unit Exponent (-2) */ \
- 0x65, 0x11, /* Unit (System: SI Linear, Length: cm) */ \
- 0x09, 0x30, /* Usage (X) */ \
- 0x35, 0x00, /* Physical Minimum (0) */ \
- 0x26, (CONFIG_USB_HID_TOUCHPAD_LOGICAL_MAX_X & 0xff), \
- (CONFIG_USB_HID_TOUCHPAD_LOGICAL_MAX_X >> 8), \
- /* Logical Maximum */ \
- 0x46, (CONFIG_USB_HID_TOUCHPAD_PHYSICAL_MAX_X & 0xff), \
- (CONFIG_USB_HID_TOUCHPAD_PHYSICAL_MAX_X >> 8), \
- /* Physical Maximum (tenth of mm) */ \
- 0x81, 0x02, /* Input (Data,Var,Abs) */ \
- 0x26, (CONFIG_USB_HID_TOUCHPAD_LOGICAL_MAX_Y & 0xff), \
- (CONFIG_USB_HID_TOUCHPAD_LOGICAL_MAX_Y >> 8), \
- /* Logical Maximum */ \
- 0x46, (CONFIG_USB_HID_TOUCHPAD_PHYSICAL_MAX_Y & 0xff), \
- (CONFIG_USB_HID_TOUCHPAD_PHYSICAL_MAX_Y >> 8), \
- /* Physical Maximum (tenth of mm) */ \
- 0x09, 0x31, /* Usage (Y) */ \
- 0x81, 0x02, /* Input (Data,Var,Abs) */ \
- 0xC0 /* End Collection */
+#define FINGER_USAGE \
+ 0x05, 0x0D, /* Usage Page (Digitizer) */ \
+ 0x09, 0x22, /* Usage (Finger) */ \
+ 0xA1, 0x02, /* Collection (Logical) */ \
+ 0x09, 0x47, /* Usage (Confidence) */ \
+ 0x09, 0x42, /* Usage (Tip Switch) */ \
+ 0x09, 0x32, /* Usage (In Range) */ \
+ 0x15, 0x00, /* Logical Minimum (0) */ \
+ 0x25, 0x01, /* Logical Maximum (1) */ \
+ 0x75, 0x01, /* Report Size (1) */ \
+ 0x95, 0x03, /* Report Count (3) */ \
+ 0x81, 0x02, /* Input (Data,Var,Abs) */ \
+ 0x09, 0x51, /* Usage (0x51) Contact identifier */ \
+ 0x75, 0x04, /* Report Size (4) */ \
+ 0x95, 0x01, /* Report Count (1) */ \
+ 0x25, 0x0F, /* Logical Maximum (15) */ \
+ 0x81, 0x02, /* Input (Data,Var,Abs) */ \
+ 0x05, 0x0D, /* Usage Page (Digitizer) */ /* Logical \
+ Maximum of \
+ Pressure */ \
+ 0x26, (CONFIG_USB_HID_TOUCHPAD_LOGICAL_MAX_PRESSURE & 0xFF), \
+ (CONFIG_USB_HID_TOUCHPAD_LOGICAL_MAX_PRESSURE >> 8), 0x75, \
+ 0x09, /* Report Size (9) */ \
+ 0x09, 0x30, /* Usage (Tip pressure) */ \
+ 0x81, 0x02, /* Input (Data,Var,Abs) */ \
+ 0x26, 0xFF, 0x0F, /* Logical Maximum (4095) */ \
+ 0x75, 0x0C, /* Report Size (12) */ \
+ 0x09, 0x48, /* Usage (WIDTH) */ \
+ 0x81, 0x02, /* Input (Data,Var,Abs) */ \
+ 0x09, 0x49, /* Usage (HEIGHT) */ \
+ 0x81, 0x02, /* Input (Data,Var,Abs) */ \
+ 0x05, 0x01, /* Usage Page (Generic Desktop Ctrls) */ \
+ 0x75, 0x0C, /* Report Size (12) */ \
+ 0x55, 0x0E, /* Unit Exponent (-2) */ \
+ 0x65, 0x11, /* Unit (System: SI Linear, Length: cm) */ \
+ 0x09, 0x30, /* Usage (X) */ \
+ 0x35, 0x00, /* Physical Minimum (0) */ \
+ 0x26, (CONFIG_USB_HID_TOUCHPAD_LOGICAL_MAX_X & 0xff), \
+ (CONFIG_USB_HID_TOUCHPAD_LOGICAL_MAX_X >> 8), /* Logical \
+ Maximum */ \
+ 0x46, (CONFIG_USB_HID_TOUCHPAD_PHYSICAL_MAX_X & 0xff), \
+ (CONFIG_USB_HID_TOUCHPAD_PHYSICAL_MAX_X >> 8), /* Physical \
+ Maximum \
+ (tenth of \
+ mm) */ \
+ 0x81, 0x02, /* Input (Data,Var,Abs) */ \
+ 0x26, (CONFIG_USB_HID_TOUCHPAD_LOGICAL_MAX_Y & 0xff), \
+ (CONFIG_USB_HID_TOUCHPAD_LOGICAL_MAX_Y >> 8), /* Logical \
+ Maximum */ \
+ 0x46, (CONFIG_USB_HID_TOUCHPAD_PHYSICAL_MAX_Y & 0xff), \
+ (CONFIG_USB_HID_TOUCHPAD_PHYSICAL_MAX_Y >> 8), /* Physical \
+ Maximum \
+ (tenth of \
+ mm) */ \
+ 0x09, 0x31, /* Usage (Y) */ \
+ 0x81, 0x02, /* Input (Data,Var,Abs) */ \
+ 0xC0 /* End Collection */
/*
* HID: Report Descriptor
@@ -125,10 +130,10 @@ const struct usb_endpoint_descriptor USB_EP_DESC(USB_IFACE_HID_TOUCHPAD, 81) = {
*/
static const uint8_t report_desc[] = {
/* Touchpad Collection */
- 0x05, 0x0D, /* Usage Page (Digitizer) */
- 0x09, 0x05, /* Usage (Touch Pad) */
- 0xA1, 0x01, /* Collection (Application) */
- 0x85, REPORT_ID_TOUCHPAD, /* Report ID (1, Touch) */
+ 0x05, 0x0D, /* Usage Page (Digitizer) */
+ 0x09, 0x05, /* Usage (Touch Pad) */
+ 0xA1, 0x01, /* Collection (Application) */
+ 0x85, REPORT_ID_TOUCHPAD, /* Report ID (1, Touch) */
/* Finger 0 */
FINGER_USAGE,
/* Finger 1 */
@@ -140,52 +145,52 @@ static const uint8_t report_desc[] = {
/* Finger 4 */
FINGER_USAGE,
/* Contact count */
- 0x05, 0x0D, /* Usage Page (Digitizer) */
- 0x09, 0x54, /* Usage (Contact count) */
- 0x25, MAX_FINGERS, /* Logical Maximum (MAX_FINGERS) */
- 0x75, 0x07, /* Report Size (7) */
- 0x95, 0x01, /* Report Count (1) */
- 0x81, 0x02, /* Input (Data,Var,Abs) */
+ 0x05, 0x0D, /* Usage Page (Digitizer) */
+ 0x09, 0x54, /* Usage (Contact count) */
+ 0x25, MAX_FINGERS, /* Logical Maximum (MAX_FINGERS) */
+ 0x75, 0x07, /* Report Size (7) */
+ 0x95, 0x01, /* Report Count (1) */
+ 0x81, 0x02, /* Input (Data,Var,Abs) */
/* Button */
- 0x05, 0x01, /* Usage Page(Generic Desktop Ctrls) */
- 0x05, 0x09, /* Usage (Button) */
- 0x19, 0x01, /* Usage Minimum (0x01) */
- 0x29, 0x01, /* Usage Maximum (0x01) */
- 0x15, 0x00, /* Logical Minimum (0) */
- 0x25, 0x01, /* Logical Maximum (1) */
- 0x75, 0x01, /* Report Size (1) */
- 0x95, 0x01, /* Report Count (1) */
- 0x81, 0x02, /* Input (Data,Var,Abs) */
+ 0x05, 0x01, /* Usage Page(Generic Desktop Ctrls) */
+ 0x05, 0x09, /* Usage (Button) */
+ 0x19, 0x01, /* Usage Minimum (0x01) */
+ 0x29, 0x01, /* Usage Maximum (0x01) */
+ 0x15, 0x00, /* Logical Minimum (0) */
+ 0x25, 0x01, /* Logical Maximum (1) */
+ 0x75, 0x01, /* Report Size (1) */
+ 0x95, 0x01, /* Report Count (1) */
+ 0x81, 0x02, /* Input (Data,Var,Abs) */
/* Timestamp */
- 0x05, 0x0D, /* Usage Page (Digitizer) */
- 0x55, 0x0C, /* Unit Exponent (-4) */
- 0x66, 0x01, 0x10, /* Unit (Seconds) */
- 0x47, 0xFF, 0xFF, 0x00, 0x00, /* Physical Maximum (65535) */
- 0x27, 0xFF, 0xFF, 0x00, 0x00, /* Logical Maximum (65535) */
- 0x75, 0x10, /* Report Size (16) */
- 0x95, 0x01, /* Report Count (1) */
- 0x09, 0x56, /* Usage (0x56, Relative Scan Time) */
- 0x81, 0x02, /* Input (Data,Var,Abs) */
-
- 0x85, REPORT_ID_DEVICE_CAPS, /* Report ID (Device Capabilities) */
- 0x09, 0x55, /* Usage (Contact Count Maximum) */
- 0x09, 0x59, /* Usage (Pad Type) */
- 0x25, 0x0F, /* Logical Maximum (15) */
- 0x75, 0x08, /* Report Size (8) */
- 0x95, 0x02, /* Report Count (2) */
- 0xB1, 0x02, /* Feature (Data,Var,Abs) */
+ 0x05, 0x0D, /* Usage Page (Digitizer) */
+ 0x55, 0x0C, /* Unit Exponent (-4) */
+ 0x66, 0x01, 0x10, /* Unit (Seconds) */
+ 0x47, 0xFF, 0xFF, 0x00, 0x00, /* Physical Maximum (65535) */
+ 0x27, 0xFF, 0xFF, 0x00, 0x00, /* Logical Maximum (65535) */
+ 0x75, 0x10, /* Report Size (16) */
+ 0x95, 0x01, /* Report Count (1) */
+ 0x09, 0x56, /* Usage (0x56, Relative Scan Time) */
+ 0x81, 0x02, /* Input (Data,Var,Abs) */
+
+ 0x85, REPORT_ID_DEVICE_CAPS, /* Report ID (Device Capabilities) */
+ 0x09, 0x55, /* Usage (Contact Count Maximum) */
+ 0x09, 0x59, /* Usage (Pad Type) */
+ 0x25, 0x0F, /* Logical Maximum (15) */
+ 0x75, 0x08, /* Report Size (8) */
+ 0x95, 0x02, /* Report Count (2) */
+ 0xB1, 0x02, /* Feature (Data,Var,Abs) */
/* Page 0xFF, usage 0xC5 is device certificate. */
- 0x06, 0x00, 0xFF, /* Usage Page (Vendor Defined) */
- 0x85, REPORT_ID_DEVICE_CERT, /* Report ID (Device Certification) */
- 0x09, 0xC5, /* Usage (Vendor Usage 0xC5) */
- 0x15, 0x00, /* Logical Minimum (0) */
- 0x26, 0xFF, 0x00, /* Logical Maximum (255) */
- 0x75, 0x08, /* Report Size (8) */
- 0x96, 0x00, 0x01, /* Report Count (256) */
- 0xB1, 0x02, /* Feature (Data,Var,Abs) */
-
- 0xC0, /* End Collection */
+ 0x06, 0x00, 0xFF, /* Usage Page (Vendor Defined) */
+ 0x85, REPORT_ID_DEVICE_CERT, /* Report ID (Device Certification) */
+ 0x09, 0xC5, /* Usage (Vendor Usage 0xC5) */
+ 0x15, 0x00, /* Logical Minimum (0) */
+ 0x26, 0xFF, 0x00, /* Logical Maximum (255) */
+ 0x75, 0x08, /* Report Size (8) */
+ 0x96, 0x00, 0x01, /* Report Count (256) */
+ 0xB1, 0x02, /* Feature (Data,Var,Abs) */
+
+ 0xC0, /* End Collection */
};
/* A 256-byte default blob for the 'device certification status' feature report.
@@ -195,59 +200,281 @@ static const uint8_t report_desc[] = {
static const uint8_t device_cert_response[] = {
REPORT_ID_DEVICE_CERT,
- 0xFC, 0x28, 0xFE, 0x84, 0x40, 0xCB, 0x9A, 0x87,
- 0x0D, 0xBE, 0x57, 0x3C, 0xB6, 0x70, 0x09, 0x88,
- 0x07, 0x97, 0x2D, 0x2B, 0xE3, 0x38, 0x34, 0xB6,
- 0x6C, 0xED, 0xB0, 0xF7, 0xE5, 0x9C, 0xF6, 0xC2,
- 0x2E, 0x84, 0x1B, 0xE8, 0xB4, 0x51, 0x78, 0x43,
- 0x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 0x53,
+ 0x2D,
+ 0x86,
+ 0x7E,
+ 0xA7,
+ 0x5A,
+ 0xC5,
+ 0xD3,
+ 0x7D,
+ 0x98,
+ 0xBE,
+ 0x31,
+ 0x48,
+ 0x1F,
+ 0xFB,
+ 0xDA,
+ 0xAF,
+ 0xA2,
+ 0xA8,
+ 0x6A,
+ 0x89,
+ 0xD6,
+ 0xBF,
+ 0xF2,
+ 0xD3,
+ 0x32,
+ 0x2A,
+ 0x9A,
+ 0xE4,
+ 0xCF,
+ 0x17,
+ 0xB7,
+ 0xB8,
+ 0xF4,
+ 0xE1,
+ 0x33,
+ 0x08,
+ 0x24,
+ 0x8B,
+ 0xC4,
+ 0x43,
+ 0xA5,
+ 0xE5,
+ 0x24,
+ 0xC2,
};
/* Device capabilities feature report. */
static const uint8_t device_caps_response[] = {
REPORT_ID_DEVICE_CAPS,
- MAX_FINGERS, /* Contact Count Maximum */
- 0x00, /* Pad Type: Depressible click-pad */
+ MAX_FINGERS, /* Contact Count Maximum */
+ 0x00, /* Pad Type: Depressible click-pad */
};
-const struct usb_hid_descriptor USB_CUSTOM_DESC_VAR(USB_IFACE_HID_TOUCHPAD,
- hid, hid_desc_tp) = {
+const struct usb_hid_descriptor USB_CUSTOM_DESC_VAR(USB_IFACE_HID_TOUCHPAD, hid,
+ hid_desc_tp) = {
.bLength = 9,
.bDescriptorType = USB_HID_DT_HID,
.bcdHID = 0x0100,
.bCountryCode = 0x00, /* Hardware target country */
.bNumDescriptors = 1,
- .desc = {{
- .bDescriptorType = USB_HID_DT_REPORT,
- .wDescriptorLength = sizeof(report_desc)
- }}
+ .desc = { { .bDescriptorType = USB_HID_DT_REPORT,
+ .wDescriptorLength = sizeof(report_desc) } }
};
static usb_uint hid_ep_buf[DIV_ROUND_UP(HID_TOUCHPAD_REPORT_SIZE, 2)] __usb_ram;
@@ -258,8 +485,8 @@ static usb_uint hid_ep_buf[DIV_ROUND_UP(HID_TOUCHPAD_REPORT_SIZE, 2)] __usb_ram;
*/
static void write_touchpad_report(struct usb_hid_touchpad_report *report)
{
- memcpy_to_usbram((void *) usb_sram_addr(hid_ep_buf),
- report, sizeof(*report));
+ memcpy_to_usbram((void *)usb_sram_addr(hid_ep_buf), report,
+ sizeof(*report));
/* enable TX */
STM32_TOGGLE_EP(USB_EP_HID_TOUCHPAD, EP_TX_MASK, EP_TX_VALID, 0);
@@ -289,8 +516,7 @@ static void hid_touchpad_process_queue(void)
now = __hw_clock_source_read() / USB_HID_TOUCHPAD_TIMESTAMP_UNIT;
if (usb_is_suspended() ||
- (STM32_USB_EP(USB_EP_HID_TOUCHPAD) & EP_TX_MASK)
- == EP_TX_VALID) {
+ (STM32_USB_EP(USB_EP_HID_TOUCHPAD) & EP_TX_MASK) == EP_TX_VALID) {
usb_wake();
/* Let's trim old events from the queue, if any. */
@@ -307,8 +533,8 @@ static void hid_touchpad_process_queue(void)
queue_peek_units(&report_queue, &report, 0, 1);
- delta = (int)((uint16_t)(now - report.timestamp))
- * USB_HID_TOUCHPAD_TIMESTAMP_UNIT;
+ delta = (int)((uint16_t)(now - report.timestamp)) *
+ USB_HID_TOUCHPAD_TIMESTAMP_UNIT;
if (touchpad_debug)
CPRINTS("evt t=%d d=%d", report.timestamp, delta);
@@ -345,8 +571,8 @@ void set_touchpad_report(struct usb_hid_touchpad_report *report)
/* USB/EP ready and nothing in queue, just write the report. */
if (!usb_is_suspended() &&
- (STM32_USB_EP(USB_EP_HID_TOUCHPAD) & EP_TX_MASK) != EP_TX_VALID
- && queue_count(&report_queue) == 0) {
+ (STM32_USB_EP(USB_EP_HID_TOUCHPAD) & EP_TX_MASK) != EP_TX_VALID &&
+ queue_count(&report_queue) == 0) {
write_touchpad_report(report);
mutex_unlock(&report_queue_mutex);
return;
@@ -385,7 +611,7 @@ static void hid_touchpad_event(enum usb_ep_event evt)
hid_reset(USB_EP_HID_TOUCHPAD, hid_ep_buf,
HID_TOUCHPAD_REPORT_SIZE, NULL, 0);
else if (evt == USB_EVENT_DEVICE_RESUME &&
- queue_count(&report_queue) > 0)
+ queue_count(&report_queue) > 0)
hook_call_deferred(&hid_touchpad_process_queue_data, 0);
}
@@ -393,8 +619,7 @@ USB_DECLARE_EP(USB_EP_HID_TOUCHPAD, hid_touchpad_tx, hid_touchpad_tx,
hid_touchpad_event);
static int get_report(uint8_t report_id, uint8_t report_type,
- const uint8_t **buffer_ptr,
- int *buffer_size)
+ const uint8_t **buffer_ptr, int *buffer_size)
{
switch (report_id) {
case REPORT_ID_DEVICE_CAPS: