touchkitusb: module_param to swap axes
PATCH 1/1 touchkitusb: module_param to swap axes
add a module parameter to swap the axes. many displays need this...
drivers/usb/input/touchkitusb.c +15 -4
@@ -59,6 +59,10 @@#define DRIVER_AUTHOR "Daniel Ritz <[email protected]>"#define DRIVER_DESC "eGalax TouchKit USB HID Touchscreen Driver" +static int swap_xy; +module_param (swap_xy, bool,0 ); +MODULE_PARM_DESC (swap_xy,"If set X and Y axes are swapped." ); +struct touchkit_usb {unsigned char *data;dma_addr_t data_dma;
@@ -80,6 +84,7 @@ {struct touchkit_usb *touchkit = urb->context;int retval; +int x, y;switch (urb->status) {case 0 :
@@ -103,13 +108,19 @@ goto exit; } +if (swap_xy) { + y =TOUCHKIT_GET_X (touchkit->data); + x =TOUCHKIT_GET_Y (touchkit->data); + }else { + x =TOUCHKIT_GET_X (touchkit->data); + y =TOUCHKIT_GET_Y (touchkit->data); + } +input_regs (&touchkit->input, regs);input_report_key (&touchkit->input,BTN_TOUCH ,TOUCHKIT_GET_TOUCHED (touchkit->data)); -input_report_abs (&touchkit->input,ABS_X , -TOUCHKIT_GET_X (touchkit->data)); -input_report_abs (&touchkit->input,ABS_Y , -TOUCHKIT_GET_Y (touchkit->data)); +input_report_abs (&touchkit->input,ABS_X , x); +input_report_abs (&touchkit->input,ABS_Y , y);input_sync (&touchkit->input); exit:
drivers/usb/input/touchkitusb.c line 63
Quoted 10 lines · Daniel Ritz
add a module parameter to swap the axes. many displays need this...
drivers/usb/input/touchkitusb.c +2
-0@@ -59,6 +59,10 @@#define DRIVER_AUTHOR "Daniel Ritz <[email protected]>"#define DRIVER_DESC "eGalax TouchKit USB HID Touchscreen Driver" +static int swap_xy; +module_param (swap_xy, bool,0 );
It looks it can easily be exported to userspace to allow switching "on-fly" since it is checked for every packet. I think 0600 will do.
Signature · 1 line
Dmitry
Quoted 9 lines · Dmitry Torokhov
Quoted 8 lines · Daniel Ritz
add a module parameter to swap the axes. many displays need this...
drivers/usb/input/touchkitusb.c +0
-0@@ -59,6 +59,10 @@#define DRIVER_AUTHOR "Daniel Ritz <[email protected]>"#define DRIVER_DESC "eGalax TouchKit USB HID Touchscreen Driver"
Quoted 6 lines
drivers/usb/input/touchkitusb.c line 63
Quoted 2 lines
drivers/usb/input/touchkitusb.c +2
-0+static int swap_xy; +module_param (swap_xy, bool,0 );It looks it can easily be exported to userspace to allow switching "on-fly" since it is checked for every packet. I think 0600 will do.
agreed. and when 0600 is ok, i guess 0644 is ok too.
drivers/usb/input/touchkitusb.c +15 -4
@@ -59,6 +59,10 @@#define DRIVER_AUTHOR "Daniel Ritz <[email protected]>"#define DRIVER_DESC "eGalax TouchKit USB HID Touchscreen Driver" +static int swap_xy; +module_param (swap_xy, bool,0644 ); +MODULE_PARM_DESC (swap_xy,"If set X and Y axes are swapped." ); +struct touchkit_usb {unsigned char *data;dma_addr_t data_dma;
@@ -80,6 +84,7 @@ {struct touchkit_usb *touchkit = urb->context;int retval; +int x, y;switch (urb->status) {case 0 :
@@ -103,13 +108,19 @@ goto exit; } +if (swap_xy) { + y =TOUCHKIT_GET_X (touchkit->data); + x =TOUCHKIT_GET_Y (touchkit->data); + }else { + x =TOUCHKIT_GET_X (touchkit->data); + y =TOUCHKIT_GET_Y (touchkit->data); + } +input_regs (&touchkit->input, regs);input_report_key (&touchkit->input,BTN_TOUCH ,TOUCHKIT_GET_TOUCHED (touchkit->data)); -input_report_abs (&touchkit->input,ABS_X , -TOUCHKIT_GET_X (touchkit->data)); -input_report_abs (&touchkit->input,ABS_Y , -TOUCHKIT_GET_Y (touchkit->data)); +input_report_abs (&touchkit->input,ABS_X , x); +input_report_abs (&touchkit->input,ABS_Y , y);input_sync (&touchkit->input); exit:
Greg KH
AppliedQuoted 10 lines · Daniel Ritz
Quoted 9 lines · Dmitry Torokhov
Quoted 8 lines · Daniel Ritz
add a module parameter to swap the axes. many displays need this...
drivers/usb/input/touchkitusb.c +0
-0@@ -59,6 +59,10 @@#define DRIVER_AUTHOR "Daniel Ritz <[email protected]>"#define DRIVER_DESC "eGalax TouchKit USB HID Touchscreen Driver"
Quoted 8 lines
Quoted 6 lines
drivers/usb/input/touchkitusb.c line 63
Quoted 2 lines
drivers/usb/input/touchkitusb.c +2
-0+static int swap_xy; +module_param (swap_xy, bool,0 );It looks it can easily be exported to userspace to allow switching "on-fly" since it is checked for every packet. I think 0600 will do.
agreed. and when 0600 is ok, i guess 0644 is ok too.
Applied, thanks.
greg k-h