Files
OpenCellular/include/usb_hid_touchpad.h
Nicolas Boichat fb58920c9e usb_hid_touchpad: Add timestamp field to touch events
We use the unofficial, Windows 8, Relative Scan time HID usage
(Digitizer page, 0x56) to add timestamps to our HID touchpad
events.

The timestamps is a rolling, unsigned, 16-bit integer, with a
resolution of 100us (so it wraps around every 6.5s).

The host will be able to synchronize to that timestamp, resetting
an offset every time the touchpad is quiet a certain amount of
time (e.g. 1 second).

BRANCH=none
BUG=b:63685117
TEST=Flash hammer, timestamps are reported in HID descriptor.

Change-Id: Ie5d56a9df14e464d2cdcd559f550d6e3cc81961f
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/603041
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2017-08-16 06:03:49 -07:00

34 lines
762 B
C

/* Copyright 2016 The Chromium OS Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
* USB HID definitions.
*/
#ifndef __CROS_EC_USB_HID_KEYBOARD_H
#define __CROS_EC_USB_HID_KEYBOARD_H
#define USB_HID_TOUCHPAD_TIMESTAMP_UNIT 100 /* usec */
struct usb_hid_touchpad_report {
uint8_t id; /* 0x01 */
struct {
unsigned tip:1;
unsigned inrange:1;
unsigned id:4;
unsigned pressure:10;
unsigned width:12;
unsigned height:12;
unsigned x:12;
unsigned y:12;
} __packed finger[5];
uint8_t count:7;
uint8_t button:1;
uint16_t timestamp;
} __packed;
/* class implementation interfaces */
void set_touchpad_report(struct usb_hid_touchpad_report *report);
#endif