Commit 2f327976 authored by Daniel Ritz's avatar Daniel Ritz Committed by Greg Kroah-Hartman

[PATCH] USB touchkitusb: module_param to swap axes

add a module parameter to swap the axes. many displays need this...
Signed-off-by: default avatarDaniel Ritz <daniel.ritz@gmx.ch>
Signed-off-by: default avatarGreg Kroah-Hartman <greg@kroah.com>
parent abd3447f
...@@ -59,6 +59,10 @@ ...@@ -59,6 +59,10 @@
#define DRIVER_AUTHOR "Daniel Ritz <daniel.ritz@gmx.ch>" #define DRIVER_AUTHOR "Daniel Ritz <daniel.ritz@gmx.ch>"
#define DRIVER_DESC "eGalax TouchKit USB HID Touchscreen Driver" #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 { struct touchkit_usb {
unsigned char *data; unsigned char *data;
dma_addr_t data_dma; dma_addr_t data_dma;
...@@ -80,6 +84,7 @@ static void touchkit_irq(struct urb *urb, struct pt_regs *regs) ...@@ -80,6 +84,7 @@ static void touchkit_irq(struct urb *urb, struct pt_regs *regs)
{ {
struct touchkit_usb *touchkit = urb->context; struct touchkit_usb *touchkit = urb->context;
int retval; int retval;
int x, y;
switch (urb->status) { switch (urb->status) {
case 0: case 0:
...@@ -103,13 +108,19 @@ static void touchkit_irq(struct urb *urb, struct pt_regs *regs) ...@@ -103,13 +108,19 @@ static void touchkit_irq(struct urb *urb, struct pt_regs *regs)
goto exit; 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_regs(&touchkit->input, regs);
input_report_key(&touchkit->input, BTN_TOUCH, input_report_key(&touchkit->input, BTN_TOUCH,
TOUCHKIT_GET_TOUCHED(touchkit->data)); TOUCHKIT_GET_TOUCHED(touchkit->data));
input_report_abs(&touchkit->input, ABS_X, input_report_abs(&touchkit->input, ABS_X, x);
TOUCHKIT_GET_X(touchkit->data)); input_report_abs(&touchkit->input, ABS_Y, y);
input_report_abs(&touchkit->input, ABS_Y,
TOUCHKIT_GET_Y(touchkit->data));
input_sync(&touchkit->input); input_sync(&touchkit->input);
exit: exit:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment