[PATCH evdev 2/3] Move axis labels up in the source file.
walter harms
wharms at bfs.de
Thu Mar 29 01:51:52 PDT 2012
Am 29.03.2012 02:09, schrieb Peter Hutterer:
> Simple move, no functional changes.
>
> Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
> ---
> src/evdev.c | 320 +++++++++++++++++++++++++++++-----------------------------
> 1 files changed, 160 insertions(+), 160 deletions(-)
>
> diff --git a/src/evdev.c b/src/evdev.c
> index dcb1aee..7848c9d 100644
> --- a/src/evdev.c
> +++ b/src/evdev.c
> @@ -136,6 +136,166 @@ static Atom prop_btn_label;
> static Atom prop_device;
> static Atom prop_virtual;
>
> +/* Aligned with linux/input.h.
> + Note that there are holes in the ABS_ range, these are simply replaced with
> + MISC here */
MISC is missleading and reason not to call it UNKNOWN ?
just my 2 cents,
re
wh
> +static char* abs_labels[] = {
> + AXIS_LABEL_PROP_ABS_X, /* 0x00 */
> + AXIS_LABEL_PROP_ABS_Y, /* 0x01 */
> + AXIS_LABEL_PROP_ABS_Z, /* 0x02 */
> + AXIS_LABEL_PROP_ABS_RX, /* 0x03 */
> + AXIS_LABEL_PROP_ABS_RY, /* 0x04 */
> + AXIS_LABEL_PROP_ABS_RZ, /* 0x05 */
> + AXIS_LABEL_PROP_ABS_THROTTLE, /* 0x06 */
> + AXIS_LABEL_PROP_ABS_RUDDER, /* 0x07 */
> + AXIS_LABEL_PROP_ABS_WHEEL, /* 0x08 */
> + AXIS_LABEL_PROP_ABS_GAS, /* 0x09 */
> + AXIS_LABEL_PROP_ABS_BRAKE, /* 0x0a */
> + AXIS_LABEL_PROP_ABS_MISC, /* undefined */
> + AXIS_LABEL_PROP_ABS_MISC, /* undefined */
> + AXIS_LABEL_PROP_ABS_MISC, /* undefined */
> + AXIS_LABEL_PROP_ABS_MISC, /* undefined */
> + AXIS_LABEL_PROP_ABS_MISC, /* undefined */
> + AXIS_LABEL_PROP_ABS_HAT0X, /* 0x10 */
> + AXIS_LABEL_PROP_ABS_HAT0Y, /* 0x11 */
> + AXIS_LABEL_PROP_ABS_HAT1X, /* 0x12 */
> + AXIS_LABEL_PROP_ABS_HAT1Y, /* 0x13 */
> + AXIS_LABEL_PROP_ABS_HAT2X, /* 0x14 */
> + AXIS_LABEL_PROP_ABS_HAT2Y, /* 0x15 */
> + AXIS_LABEL_PROP_ABS_HAT3X, /* 0x16 */
> + AXIS_LABEL_PROP_ABS_HAT3Y, /* 0x17 */
> + AXIS_LABEL_PROP_ABS_PRESSURE, /* 0x18 */
> + AXIS_LABEL_PROP_ABS_DISTANCE, /* 0x19 */
> + AXIS_LABEL_PROP_ABS_TILT_X, /* 0x1a */
> + AXIS_LABEL_PROP_ABS_TILT_Y, /* 0x1b */
> + AXIS_LABEL_PROP_ABS_TOOL_WIDTH, /* 0x1c */
> + AXIS_LABEL_PROP_ABS_MISC, /* undefined */
> + AXIS_LABEL_PROP_ABS_MISC, /* undefined */
> + AXIS_LABEL_PROP_ABS_MISC, /* undefined */
> + AXIS_LABEL_PROP_ABS_VOLUME /* 0x20 */
> + AXIS_LABEL_PROP_ABS_MISC, /* undefined */
> + AXIS_LABEL_PROP_ABS_MISC, /* undefined */
> + AXIS_LABEL_PROP_ABS_MISC, /* undefined */
> + AXIS_LABEL_PROP_ABS_MISC, /* undefined */
> + AXIS_LABEL_PROP_ABS_MISC, /* undefined */
> + AXIS_LABEL_PROP_ABS_MISC, /* undefined */
> + AXIS_LABEL_PROP_ABS_MISC, /* undefined */
> + AXIS_LABEL_PROP_ABS_MISC, /* undefined */
> + AXIS_LABEL_PROP_ABS_MISC, /* undefined */
> + AXIS_LABEL_PROP_ABS_MISC, /* undefined */
> + AXIS_LABEL_PROP_ABS_MISC, /* undefined */
> + AXIS_LABEL_PROP_ABS_MISC, /* undefined */
> + AXIS_LABEL_PROP_ABS_MISC, /* undefined */
> + AXIS_LABEL_PROP_ABS_MISC, /* undefined */
> + AXIS_LABEL_PROP_ABS_MISC, /* undefined */
> + AXIS_LABEL_PROP_ABS_MISC, /* undefined */
> + AXIS_LABEL_PROP_ABS_MT_TOUCH_MAJOR, /* 0x30 */
> + AXIS_LABEL_PROP_ABS_MT_TOUCH_MINOR, /* 0x31 */
> + AXIS_LABEL_PROP_ABS_MT_WIDTH_MAJOR, /* 0x32 */
> + AXIS_LABEL_PROP_ABS_MT_WIDTH_MINOR, /* 0x33 */
> + AXIS_LABEL_PROP_ABS_MT_ORIENTATION, /* 0x34 */
> + AXIS_LABEL_PROP_ABS_MT_POSITION_X, /* 0x35 */
> + AXIS_LABEL_PROP_ABS_MT_POSITION_Y, /* 0x36 */
> + AXIS_LABEL_PROP_ABS_MT_TOOL_TYPE, /* 0x37 */
> + AXIS_LABEL_PROP_ABS_MT_BLOB_ID, /* 0x38 */
> + AXIS_LABEL_PROP_ABS_MT_TRACKING_ID, /* 0x39 */
> + AXIS_LABEL_PROP_ABS_MT_PRESSURE, /* 0x3a */
> +};
> +
> +static char* rel_labels[] = {
> + AXIS_LABEL_PROP_REL_X,
> + AXIS_LABEL_PROP_REL_Y,
> + AXIS_LABEL_PROP_REL_Z,
> + AXIS_LABEL_PROP_REL_RX,
> + AXIS_LABEL_PROP_REL_RY,
> + AXIS_LABEL_PROP_REL_RZ,
> + AXIS_LABEL_PROP_REL_HWHEEL,
> + AXIS_LABEL_PROP_REL_DIAL,
> + AXIS_LABEL_PROP_REL_WHEEL,
> + AXIS_LABEL_PROP_REL_MISC
> +};
> +
> +static char* btn_labels[][16] = {
> + { /* BTN_MISC group offset 0x100*/
> + BTN_LABEL_PROP_BTN_0, /* 0x00 */
> + BTN_LABEL_PROP_BTN_1, /* 0x01 */
> + BTN_LABEL_PROP_BTN_2, /* 0x02 */
> + BTN_LABEL_PROP_BTN_3, /* 0x03 */
> + BTN_LABEL_PROP_BTN_4, /* 0x04 */
> + BTN_LABEL_PROP_BTN_5, /* 0x05 */
> + BTN_LABEL_PROP_BTN_6, /* 0x06 */
> + BTN_LABEL_PROP_BTN_7, /* 0x07 */
> + BTN_LABEL_PROP_BTN_8, /* 0x08 */
> + BTN_LABEL_PROP_BTN_9 /* 0x09 */
> + },
> + { /* BTN_MOUSE group offset 0x110 */
> + BTN_LABEL_PROP_BTN_LEFT, /* 0x00 */
> + BTN_LABEL_PROP_BTN_RIGHT, /* 0x01 */
> + BTN_LABEL_PROP_BTN_MIDDLE, /* 0x02 */
> + BTN_LABEL_PROP_BTN_SIDE, /* 0x03 */
> + BTN_LABEL_PROP_BTN_EXTRA, /* 0x04 */
> + BTN_LABEL_PROP_BTN_FORWARD, /* 0x05 */
> + BTN_LABEL_PROP_BTN_BACK, /* 0x06 */
> + BTN_LABEL_PROP_BTN_TASK /* 0x07 */
> + },
> + { /* BTN_JOYSTICK group offset 0x120 */
> + BTN_LABEL_PROP_BTN_TRIGGER, /* 0x00 */
> + BTN_LABEL_PROP_BTN_THUMB, /* 0x01 */
> + BTN_LABEL_PROP_BTN_THUMB2, /* 0x02 */
> + BTN_LABEL_PROP_BTN_TOP, /* 0x03 */
> + BTN_LABEL_PROP_BTN_TOP2, /* 0x04 */
> + BTN_LABEL_PROP_BTN_PINKIE, /* 0x05 */
> + BTN_LABEL_PROP_BTN_BASE, /* 0x06 */
> + BTN_LABEL_PROP_BTN_BASE2, /* 0x07 */
> + BTN_LABEL_PROP_BTN_BASE3, /* 0x08 */
> + BTN_LABEL_PROP_BTN_BASE4, /* 0x09 */
> + BTN_LABEL_PROP_BTN_BASE5, /* 0x0a */
> + BTN_LABEL_PROP_BTN_BASE6, /* 0x0b */
> + NULL,
> + NULL,
> + NULL,
> + BTN_LABEL_PROP_BTN_DEAD /* 0x0f */
> + },
> + { /* BTN_GAMEPAD group offset 0x130 */
> + BTN_LABEL_PROP_BTN_A, /* 0x00 */
> + BTN_LABEL_PROP_BTN_B, /* 0x01 */
> + BTN_LABEL_PROP_BTN_C, /* 0x02 */
> + BTN_LABEL_PROP_BTN_X, /* 0x03 */
> + BTN_LABEL_PROP_BTN_Y, /* 0x04 */
> + BTN_LABEL_PROP_BTN_Z, /* 0x05 */
> + BTN_LABEL_PROP_BTN_TL, /* 0x06 */
> + BTN_LABEL_PROP_BTN_TR, /* 0x07 */
> + BTN_LABEL_PROP_BTN_TL2, /* 0x08 */
> + BTN_LABEL_PROP_BTN_TR2, /* 0x09 */
> + BTN_LABEL_PROP_BTN_SELECT, /* 0x0a */
> + BTN_LABEL_PROP_BTN_START, /* 0x0b */
> + BTN_LABEL_PROP_BTN_MODE, /* 0x0c */
> + BTN_LABEL_PROP_BTN_THUMBL, /* 0x0d */
> + BTN_LABEL_PROP_BTN_THUMBR /* 0x0e */
> + },
> + { /* BTN_DIGI group offset 0x140 */
> + BTN_LABEL_PROP_BTN_TOOL_PEN, /* 0x00 */
> + BTN_LABEL_PROP_BTN_TOOL_RUBBER, /* 0x01 */
> + BTN_LABEL_PROP_BTN_TOOL_BRUSH, /* 0x02 */
> + BTN_LABEL_PROP_BTN_TOOL_PENCIL, /* 0x03 */
> + BTN_LABEL_PROP_BTN_TOOL_AIRBRUSH, /* 0x04 */
> + BTN_LABEL_PROP_BTN_TOOL_FINGER, /* 0x05 */
> + BTN_LABEL_PROP_BTN_TOOL_MOUSE, /* 0x06 */
> + BTN_LABEL_PROP_BTN_TOOL_LENS, /* 0x07 */
> + NULL,
> + NULL,
> + BTN_LABEL_PROP_BTN_TOUCH, /* 0x0a */
> + BTN_LABEL_PROP_BTN_STYLUS, /* 0x0b */
> + BTN_LABEL_PROP_BTN_STYLUS2, /* 0x0c */
> + BTN_LABEL_PROP_BTN_TOOL_DOUBLETAP, /* 0x0d */
> + BTN_LABEL_PROP_BTN_TOOL_TRIPLETAP /* 0x0e */
> + },
> + { /* BTN_WHEEL group offset 0x150 */
> + BTN_LABEL_PROP_BTN_GEAR_DOWN, /* 0x00 */
> + BTN_LABEL_PROP_BTN_GEAR_UP /* 0x01 */
> + }
> +};
> +
> /* All devices the evdev driver has allocated and knows about.
> * MAXDEVICES is safe as null-terminated array, as two devices (VCP and VCK)
> * cannot be used by evdev, leaving us with a space of 2 at the end. */
> @@ -2543,166 +2703,6 @@ EvdevUtilButtonEventToButtonNumber(EvdevPtr pEvdev, int code)
> }
> }
>
> -/* Aligned with linux/input.h.
> - Note that there are holes in the ABS_ range, these are simply replaced with
> - MISC here */
> -static char* abs_labels[] = {
> - AXIS_LABEL_PROP_ABS_X, /* 0x00 */
> - AXIS_LABEL_PROP_ABS_Y, /* 0x01 */
> - AXIS_LABEL_PROP_ABS_Z, /* 0x02 */
> - AXIS_LABEL_PROP_ABS_RX, /* 0x03 */
> - AXIS_LABEL_PROP_ABS_RY, /* 0x04 */
> - AXIS_LABEL_PROP_ABS_RZ, /* 0x05 */
> - AXIS_LABEL_PROP_ABS_THROTTLE, /* 0x06 */
> - AXIS_LABEL_PROP_ABS_RUDDER, /* 0x07 */
> - AXIS_LABEL_PROP_ABS_WHEEL, /* 0x08 */
> - AXIS_LABEL_PROP_ABS_GAS, /* 0x09 */
> - AXIS_LABEL_PROP_ABS_BRAKE, /* 0x0a */
> - AXIS_LABEL_PROP_ABS_MISC, /* undefined */
> - AXIS_LABEL_PROP_ABS_MISC, /* undefined */
> - AXIS_LABEL_PROP_ABS_MISC, /* undefined */
> - AXIS_LABEL_PROP_ABS_MISC, /* undefined */
> - AXIS_LABEL_PROP_ABS_MISC, /* undefined */
> - AXIS_LABEL_PROP_ABS_HAT0X, /* 0x10 */
> - AXIS_LABEL_PROP_ABS_HAT0Y, /* 0x11 */
> - AXIS_LABEL_PROP_ABS_HAT1X, /* 0x12 */
> - AXIS_LABEL_PROP_ABS_HAT1Y, /* 0x13 */
> - AXIS_LABEL_PROP_ABS_HAT2X, /* 0x14 */
> - AXIS_LABEL_PROP_ABS_HAT2Y, /* 0x15 */
> - AXIS_LABEL_PROP_ABS_HAT3X, /* 0x16 */
> - AXIS_LABEL_PROP_ABS_HAT3Y, /* 0x17 */
> - AXIS_LABEL_PROP_ABS_PRESSURE, /* 0x18 */
> - AXIS_LABEL_PROP_ABS_DISTANCE, /* 0x19 */
> - AXIS_LABEL_PROP_ABS_TILT_X, /* 0x1a */
> - AXIS_LABEL_PROP_ABS_TILT_Y, /* 0x1b */
> - AXIS_LABEL_PROP_ABS_TOOL_WIDTH, /* 0x1c */
> - AXIS_LABEL_PROP_ABS_MISC, /* undefined */
> - AXIS_LABEL_PROP_ABS_MISC, /* undefined */
> - AXIS_LABEL_PROP_ABS_MISC, /* undefined */
> - AXIS_LABEL_PROP_ABS_VOLUME /* 0x20 */
> - AXIS_LABEL_PROP_ABS_MISC, /* undefined */
> - AXIS_LABEL_PROP_ABS_MISC, /* undefined */
> - AXIS_LABEL_PROP_ABS_MISC, /* undefined */
> - AXIS_LABEL_PROP_ABS_MISC, /* undefined */
> - AXIS_LABEL_PROP_ABS_MISC, /* undefined */
> - AXIS_LABEL_PROP_ABS_MISC, /* undefined */
> - AXIS_LABEL_PROP_ABS_MISC, /* undefined */
> - AXIS_LABEL_PROP_ABS_MISC, /* undefined */
> - AXIS_LABEL_PROP_ABS_MISC, /* undefined */
> - AXIS_LABEL_PROP_ABS_MISC, /* undefined */
> - AXIS_LABEL_PROP_ABS_MISC, /* undefined */
> - AXIS_LABEL_PROP_ABS_MISC, /* undefined */
> - AXIS_LABEL_PROP_ABS_MISC, /* undefined */
> - AXIS_LABEL_PROP_ABS_MISC, /* undefined */
> - AXIS_LABEL_PROP_ABS_MISC, /* undefined */
> - AXIS_LABEL_PROP_ABS_MISC, /* undefined */
> - AXIS_LABEL_PROP_ABS_MT_TOUCH_MAJOR, /* 0x30 */
> - AXIS_LABEL_PROP_ABS_MT_TOUCH_MINOR, /* 0x31 */
> - AXIS_LABEL_PROP_ABS_MT_WIDTH_MAJOR, /* 0x32 */
> - AXIS_LABEL_PROP_ABS_MT_WIDTH_MINOR, /* 0x33 */
> - AXIS_LABEL_PROP_ABS_MT_ORIENTATION, /* 0x34 */
> - AXIS_LABEL_PROP_ABS_MT_POSITION_X, /* 0x35 */
> - AXIS_LABEL_PROP_ABS_MT_POSITION_Y, /* 0x36 */
> - AXIS_LABEL_PROP_ABS_MT_TOOL_TYPE, /* 0x37 */
> - AXIS_LABEL_PROP_ABS_MT_BLOB_ID, /* 0x38 */
> - AXIS_LABEL_PROP_ABS_MT_TRACKING_ID, /* 0x39 */
> - AXIS_LABEL_PROP_ABS_MT_PRESSURE, /* 0x3a */
> -};
> -
> -static char* rel_labels[] = {
> - AXIS_LABEL_PROP_REL_X,
> - AXIS_LABEL_PROP_REL_Y,
> - AXIS_LABEL_PROP_REL_Z,
> - AXIS_LABEL_PROP_REL_RX,
> - AXIS_LABEL_PROP_REL_RY,
> - AXIS_LABEL_PROP_REL_RZ,
> - AXIS_LABEL_PROP_REL_HWHEEL,
> - AXIS_LABEL_PROP_REL_DIAL,
> - AXIS_LABEL_PROP_REL_WHEEL,
> - AXIS_LABEL_PROP_REL_MISC
> -};
> -
> -static char* btn_labels[][16] = {
> - { /* BTN_MISC group offset 0x100*/
> - BTN_LABEL_PROP_BTN_0, /* 0x00 */
> - BTN_LABEL_PROP_BTN_1, /* 0x01 */
> - BTN_LABEL_PROP_BTN_2, /* 0x02 */
> - BTN_LABEL_PROP_BTN_3, /* 0x03 */
> - BTN_LABEL_PROP_BTN_4, /* 0x04 */
> - BTN_LABEL_PROP_BTN_5, /* 0x05 */
> - BTN_LABEL_PROP_BTN_6, /* 0x06 */
> - BTN_LABEL_PROP_BTN_7, /* 0x07 */
> - BTN_LABEL_PROP_BTN_8, /* 0x08 */
> - BTN_LABEL_PROP_BTN_9 /* 0x09 */
> - },
> - { /* BTN_MOUSE group offset 0x110 */
> - BTN_LABEL_PROP_BTN_LEFT, /* 0x00 */
> - BTN_LABEL_PROP_BTN_RIGHT, /* 0x01 */
> - BTN_LABEL_PROP_BTN_MIDDLE, /* 0x02 */
> - BTN_LABEL_PROP_BTN_SIDE, /* 0x03 */
> - BTN_LABEL_PROP_BTN_EXTRA, /* 0x04 */
> - BTN_LABEL_PROP_BTN_FORWARD, /* 0x05 */
> - BTN_LABEL_PROP_BTN_BACK, /* 0x06 */
> - BTN_LABEL_PROP_BTN_TASK /* 0x07 */
> - },
> - { /* BTN_JOYSTICK group offset 0x120 */
> - BTN_LABEL_PROP_BTN_TRIGGER, /* 0x00 */
> - BTN_LABEL_PROP_BTN_THUMB, /* 0x01 */
> - BTN_LABEL_PROP_BTN_THUMB2, /* 0x02 */
> - BTN_LABEL_PROP_BTN_TOP, /* 0x03 */
> - BTN_LABEL_PROP_BTN_TOP2, /* 0x04 */
> - BTN_LABEL_PROP_BTN_PINKIE, /* 0x05 */
> - BTN_LABEL_PROP_BTN_BASE, /* 0x06 */
> - BTN_LABEL_PROP_BTN_BASE2, /* 0x07 */
> - BTN_LABEL_PROP_BTN_BASE3, /* 0x08 */
> - BTN_LABEL_PROP_BTN_BASE4, /* 0x09 */
> - BTN_LABEL_PROP_BTN_BASE5, /* 0x0a */
> - BTN_LABEL_PROP_BTN_BASE6, /* 0x0b */
> - NULL,
> - NULL,
> - NULL,
> - BTN_LABEL_PROP_BTN_DEAD /* 0x0f */
> - },
> - { /* BTN_GAMEPAD group offset 0x130 */
> - BTN_LABEL_PROP_BTN_A, /* 0x00 */
> - BTN_LABEL_PROP_BTN_B, /* 0x01 */
> - BTN_LABEL_PROP_BTN_C, /* 0x02 */
> - BTN_LABEL_PROP_BTN_X, /* 0x03 */
> - BTN_LABEL_PROP_BTN_Y, /* 0x04 */
> - BTN_LABEL_PROP_BTN_Z, /* 0x05 */
> - BTN_LABEL_PROP_BTN_TL, /* 0x06 */
> - BTN_LABEL_PROP_BTN_TR, /* 0x07 */
> - BTN_LABEL_PROP_BTN_TL2, /* 0x08 */
> - BTN_LABEL_PROP_BTN_TR2, /* 0x09 */
> - BTN_LABEL_PROP_BTN_SELECT, /* 0x0a */
> - BTN_LABEL_PROP_BTN_START, /* 0x0b */
> - BTN_LABEL_PROP_BTN_MODE, /* 0x0c */
> - BTN_LABEL_PROP_BTN_THUMBL, /* 0x0d */
> - BTN_LABEL_PROP_BTN_THUMBR /* 0x0e */
> - },
> - { /* BTN_DIGI group offset 0x140 */
> - BTN_LABEL_PROP_BTN_TOOL_PEN, /* 0x00 */
> - BTN_LABEL_PROP_BTN_TOOL_RUBBER, /* 0x01 */
> - BTN_LABEL_PROP_BTN_TOOL_BRUSH, /* 0x02 */
> - BTN_LABEL_PROP_BTN_TOOL_PENCIL, /* 0x03 */
> - BTN_LABEL_PROP_BTN_TOOL_AIRBRUSH, /* 0x04 */
> - BTN_LABEL_PROP_BTN_TOOL_FINGER, /* 0x05 */
> - BTN_LABEL_PROP_BTN_TOOL_MOUSE, /* 0x06 */
> - BTN_LABEL_PROP_BTN_TOOL_LENS, /* 0x07 */
> - NULL,
> - NULL,
> - BTN_LABEL_PROP_BTN_TOUCH, /* 0x0a */
> - BTN_LABEL_PROP_BTN_STYLUS, /* 0x0b */
> - BTN_LABEL_PROP_BTN_STYLUS2, /* 0x0c */
> - BTN_LABEL_PROP_BTN_TOOL_DOUBLETAP, /* 0x0d */
> - BTN_LABEL_PROP_BTN_TOOL_TRIPLETAP /* 0x0e */
> - },
> - { /* BTN_WHEEL group offset 0x150 */
> - BTN_LABEL_PROP_BTN_GEAR_DOWN, /* 0x00 */
> - BTN_LABEL_PROP_BTN_GEAR_UP /* 0x01 */
> - }
> -};
> -
> static void EvdevInitOneAxisLabel(EvdevPtr pEvdev, int axis,
> char **labels, int label_idx, Atom *atoms)
> {
More information about the xorg-devel
mailing list