HID: input: Add support for USI style events
Subsystems (2)
PATCH 1/1 HID: input: Add support for USI style events
Add support for Universal Stylus Interface (USI) style events to the HID input layers. The events are mapped as follows:
type id event
---- -- -----
MSC(4) 6 Pen ID
MSC(4) 7 Pen Color
MSC(4) 8 Pen Line Style Ink
MSC(4) 9 Pen Line Style Pencil
MSC(4) 0xa Pen Line Style Highlighter
MSC(4) 0xb Pen Line Style Chisel Marker
MSC(4) 0xc Pen Line Style Brush
MSC(4) 0xd Pen No Preferred Line Style
ABS(3) 0x1c Pen Line Width
All the listed MSC events are new, the ABS one is mapped to an existing event.
--- drivers/hid/hid-debug.c | 9 ++++++- drivers/hid/hid-input.c | 36 ++++++++++++++++++++++++++ include/linux/mod_devicetable.h | 2 +- include/uapi/linux/input-event-codes.h | 10 ++++++- 4 files changed, 54 insertions(+), 3 deletions(-)
drivers/hid/hid-debug.c +8 -1
@@ -1028,7 +1028,14 @@ static const char *absolutes[ABS_CNT] = {static const char *misc[MSC_MAX +1 ] = { [MSC_SERIAL ] ="Serial" , [MSC_PULSELED ] ="Pulseled" , - [MSC_GESTURE ] ="Gesture" , [MSC_RAW ] ="RawData" + [MSC_GESTURE ] ="Gesture" , [MSC_RAW ] ="RawData" , + [MSC_PEN_ID ] ="PenID" , [MSC_PEN_COLOR ] ="PenColor" , + [MSC_PEN_LINE_STYLE_INK ] ="PenLineStyleInk" , + [MSC_PEN_LINE_STYLE_PENCIL ] ="PenLineStylePencil" , + [MSC_PEN_LINE_STYLE_HIGHLIGHTER ] ="PenLineStyleHighLighter" , + [MSC_PEN_LINE_STYLE_CHISEL_MARKER ] ="PenLineStyleChiselMarker" , + [MSC_PEN_LINE_STYLE_BRUSH ] ="PenLineStyleBrush" , + [MSC_PEN_LINE_STYLE_NO_PREFERENCE ] ="PenLineStyleNoPreference" , };static const char *leds[LED_MAX +1 ] = {
drivers/hid/hid-input.c +36 -0
@@ -925,6 +925,10 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel }break ; +case 0x38 :/* Transducer Index */ +map_msc (MSC_PEN_ID ); +break ; +case 0x3b :/* Battery Strength */ hidinput_setup_battery (device,HID_INPUT_REPORT , field, false); usage->type =EV_PWR ;
@@ -972,6 +976,38 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fielmap_msc (MSC_SERIAL );break ; +case 0x5c :/* USI Pen Color */ +map_msc (MSC_PEN_COLOR ); +break ; + +case 0x5e :/* USI Pen Line Width */ +map_abs (ABS_TOOL_WIDTH ); +break ; + +case 0x72 :/* USI Pen preferred line style: Ink */ +map_msc (MSC_PEN_LINE_STYLE_INK ); +break ; + +case 0x73 :/* USI Pen preferred line style: Pencil */ +map_msc (MSC_PEN_LINE_STYLE_PENCIL ); +break ; + +case 0x74 :/* USI Pen preferred line style: Highlighter */ +map_msc (MSC_PEN_LINE_STYLE_HIGHLIGHTER ); +break ; + +case 0x75 :/* USI Pen preferred line style: Chisel Marker */ +map_msc (MSC_PEN_LINE_STYLE_CHISEL_MARKER ); +break ; + +case 0x76 :/* USI Pen preferred line style: Brush */ +map_msc (MSC_PEN_LINE_STYLE_BRUSH ); +break ; + +case 0x77 :/* USI Pen no preferred line style */ +map_msc (MSC_PEN_LINE_STYLE_NO_PREFERENCE ); +break ; +default : goto unknown; }break ;
include/linux/mod_devicetable.h +1 -1
@@ -322,7 +322,7 @@ struct pcmcia_device_id {#define INPUT_DEVICE_ID_KEY_MAX 0x2ff#define INPUT_DEVICE_ID_REL_MAX 0x0f#define INPUT_DEVICE_ID_ABS_MAX 0x3f -#define INPUT_DEVICE_ID_MSC_MAX 0x07 +#define INPUT_DEVICE_ID_MSC_MAX 0x0d#define INPUT_DEVICE_ID_LED_MAX 0x0f#define INPUT_DEVICE_ID_SND_MAX 0x07#define INPUT_DEVICE_ID_FF_MAX 0x7f
include/uapi/linux/input-event-codes.h +9 -1
@@ -930,7 +930,15 @@#define MSC_RAW 0x03#define MSC_SCAN 0x04#define MSC_TIMESTAMP 0x05 -#define MSC_MAX 0x07 +#define MSC_PEN_ID 0x06 +#define MSC_PEN_COLOR 0x07 +#define MSC_PEN_LINE_STYLE_INK 0x08 +#define MSC_PEN_LINE_STYLE_PENCIL 0x09 +#define MSC_PEN_LINE_STYLE_HIGHLIGHTER 0x0a +#define MSC_PEN_LINE_STYLE_CHISEL_MARKER 0x0b +#define MSC_PEN_LINE_STYLE_BRUSH 0x0c +#define MSC_PEN_LINE_STYLE_NO_PREFERENCE 0x0d +#define MSC_MAX 0x0d#define MSC_CNT (MSC_MAX+1)/*
Signature · 1 line
2.25.1
Jiri Kosina
maintainerQuoted 15 lines · Tero Kristo
Add support for Universal Stylus Interface (USI) style events to the HID input layers. The events are mapped as follows:
type id event
---- -- -----
MSC(4) 6 Pen ID
MSC(4) 7 Pen Color
MSC(4) 8 Pen Line Style Ink
MSC(4) 9 Pen Line Style Pencil
MSC(4)0xaPen Line Style Highlighter
MSC(4)0xbPen Line Style Chisel Marker
MSC(4)0xcPen Line Style Brush
MSC(4)0xdPen No Preferred Line Style
ABS(3)0x1cPen Line Width
Quoted 2 lines
All the listed MSC events are new, the ABS one is mapped to an existing event.
Dmitry, could you please Ack the MSC_PEN_* additions?
Thanks,
Signature · 2 lines
Jiri Kosina SUSE Labs
Jiri Kosina
maintainerQuoted 15 lines · Jiri Kosina
Quoted 15 lines
Add support for Universal Stylus Interface (USI) style events to the HID input layers. The events are mapped as follows:
type id event
---- -- -----
MSC(4) 6 Pen ID
MSC(4) 7 Pen Color
MSC(4) 8 Pen Line Style Ink
MSC(4) 9 Pen Line Style Pencil
MSC(4)0xaPen Line Style Highlighter
MSC(4)0xbPen Line Style Chisel Marker
MSC(4)0xcPen Line Style Brush
MSC(4)0xdPen No Preferred Line Style
ABS(3)0x1cPen Line Width
Quoted 4 lines
Quoted 2 lines
All the listed MSC events are new, the ABS one is mapped to an existing event.
Dmitry, could you please Ack the MSC_PEN_* additions?
Dmitry, friendly ping on this one.
Thanks,
Signature · 2 lines
Jiri Kosina SUSE Labs
Dmitry Torokhov
maintainerQuoted 17 lines · Jiri Kosina
Quoted 15 lines · Jiri Kosina
Quoted 15 lines
Add support for Universal Stylus Interface (USI) style events to the HID input layers. The events are mapped as follows:
type id event
---- -- -----
MSC(4) 6 Pen ID
MSC(4) 7 Pen Color
MSC(4) 8 Pen Line Style Ink
MSC(4) 9 Pen Line Style Pencil
MSC(4)0xaPen Line Style Highlighter
MSC(4)0xbPen Line Style Chisel Marker
MSC(4)0xcPen Line Style Brush
MSC(4)0xdPen No Preferred Line Style
ABS(3)0x1cPen Line Width
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
All the listed MSC events are new, the ABS one is mapped to an existing event.
Dmitry, could you please Ack the MSC_PEN_* additions?
Dmitry, friendly ping on this one.
Very sorry, I meant to answer and forgot...
We need good descriptions of what exactly these events are, and when and how userspace should expect/use them.
In general, I am wary of MISC_* namespace as it needs to be sent in every packet as we do not retain state and do not give userspace way of querying it, unlike ABS_* or KEY_* or number of other events.
Also, what do we do with multiple pens used at once? Maybe we do not have such devices now, but multitouch devices did not exist in the beginning either, and now are ubiquitous.
Thanks.
Signature · 1 line
Dmitry
Quoted 22 lines · Dmitry Torokhov
Quoted 17 lines · Jiri Kosina
Quoted 15 lines · Jiri Kosina
Quoted 15 lines
Add support for Universal Stylus Interface (USI) style events to the HID input layers. The events are mapped as follows:
type id event
---- -- -----
MSC(4) 6 Pen ID
MSC(4) 7 Pen Color
MSC(4) 8 Pen Line Style Ink
MSC(4) 9 Pen Line Style Pencil
MSC(4)0xaPen Line Style Highlighter
MSC(4)0xbPen Line Style Chisel Marker
MSC(4)0xcPen Line Style Brush
MSC(4)0xdPen No Preferred Line Style
ABS(3)0x1cPen Line WidthQuoted 4 lines
Quoted 3 lines
Quoted 2 lines
All the listed MSC events are new, the ABS one is mapped to an existing event.
Dmitry, could you please Ack the MSC_PEN_* additions?
Dmitry, friendly ping on this one.
Quoted 8 lines
Very sorry, I meant to answer and forgot...
We need good descriptions of what exactly these events are, and when and how userspace should expect/use them.
In general, I am wary of MISC_* namespace as it needs to be sent in every packet as we do not retain state and do not give userspace way of querying it, unlike ABS_* or KEY_* or number of other events.
Hmm ok, do you have a counter proposal for this? Should all of them move to some other namespace? I have been using Benjamin's HID-BPF support to handle the quirks of the USI support so far, and the events are passed via that interface also, allowing for writing of the parameters too.
However, it would seem like it would be good to pass the details via the input event route also, if the user does not want to tap to the HID-BPF for whatever reason, and the pens do work as is, except for the new parameters.
Quoted 4 lines
Also, what do we do with multiple pens used at once? Maybe we do not have such devices now, but multitouch devices did not exist in the beginning either, and now are ubiquitous.
Multiple pen support is expected to happen somewhere in future, the spec sort of supports it already but the controllers really don't (and I am not quite sure how flexible the controller interface is for multiple pen support either.) Should we use ABS_MT_* for the new params?
-Tero
Quoted 3 lines
Thanks.