summaryrefslogtreecommitdiff
path: root/src/class/hid/hid.h
diff options
context:
space:
mode:
authorJay <[email protected]>2024-12-23 22:03:37 +0900
committerJay <[email protected]>2024-12-23 22:03:37 +0900
commit15b1623aa3b677100cb7e81bf05f0c3b481d355b (patch)
tree02949b94a96e2073a82dbb6dfbbc581bc1c02bb0 /src/class/hid/hid.h
parent7c1afa837a28c7bd5210f57eda4afba4e171cad4 (diff)
add hid stylus pen device.
this works with android, for bypassing that absmouse does not support android. note that, to hide cursor on android for every touch signal, find cursor option in android settings menu. references: 1. https://stackoverflow.com/questions/28536602/hid-digitizer-descriptor-doesnt-perform-well-with-landscape-orientation 2. https://github.com/jonathanedgecombe/absmouse/blob/master/src/AbsMouse.cpp
Diffstat (limited to 'src/class/hid/hid.h')
-rw-r--r--src/class/hid/hid.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/class/hid/hid.h b/src/class/hid/hid.h
index db9a500ee..fb27c0d0e 100644
--- a/src/class/hid/hid.h
+++ b/src/class/hid/hid.h
@@ -326,6 +326,29 @@ typedef enum
/// @}
//--------------------------------------------------------------------+
+// Digitizer Stylus Pen
+//--------------------------------------------------------------------+
+/** \addtogroup ClassDriver_HID_Stylus Stylus
+ * @{ */
+
+// Standard Stylus Pen Report.
+typedef struct TU_ATTR_PACKED
+{
+ uint8_t attr; /**< Attribute mask for describing current status of the stylus pen. */
+ uint16_t x; /**< Current x position of the mouse. */
+ uint16_t y; /**< Current y position of the mouse. */
+} hid_stylus_report_t;
+
+// Standard Stylus Pen Attributes Bitmap.
+typedef enum
+{
+ STYLUS_ATTR_TIP_SWITCH = TU_BIT(0), ///< Tip switch
+ STYLUS_ATTR_IN_RANGE = TU_BIT(1), ///< In-range bit.
+} hid_stylus_attr_bm_t;
+
+/// @}
+
+//--------------------------------------------------------------------+
// Keyboard
//--------------------------------------------------------------------+
/** \addtogroup ClassDriver_HID_Keyboard Keyboard
@@ -760,7 +783,9 @@ enum {
HID_USAGE_PAGE_PID = 0x0f,
HID_USAGE_PAGE_UNICODE = 0x10,
HID_USAGE_PAGE_ALPHA_DISPLAY = 0x14,
+ HID_USAGE_PAGE_IN_RANGE = 0x32,
HID_USAGE_PAGE_MEDICAL = 0x40,
+ HID_USAGE_PAGE_TIP_SWITCH = 0x42,
HID_USAGE_PAGE_LIGHTING_AND_ILLUMINATION = 0x59,
HID_USAGE_PAGE_MONITOR = 0x80, // 0x80 - 0x83
HID_USAGE_PAGE_POWER = 0x84, // 0x084 - 0x87
@@ -846,6 +871,15 @@ enum {
HID_USAGE_DESKTOP_SYSTEM_DISPLAY_LCD_AUTOSCALE = 0xB7
};
+/// HID Usage Table: Digitizer Page (0x0D)
+enum {
+ // Touch Screen.
+ HID_USAGE_DIGITIZER_TOUCH_SCREEN = 0x04,
+
+ // Stylus Pen.
+ HID_USAGE_DIGITIZER_STYLUS = 0x20,
+};
+
/// HID Usage Table: Consumer Page (0x0C)
/// Only contains controls that supported by Windows (whole list is too long)