* [PATCH 2.6] touchkitusb: module_param to swap axes
@ 2004-11-24 21:28 Daniel Ritz
2004-11-25 5:10 ` Dmitry Torokhov
0 siblings, 1 reply; 4+ messages in thread
From: Daniel Ritz @ 2004-11-24 21:28 UTC (permalink / raw)
To: Greg KH; +Cc: linux-kernel
add a module parameter to swap the axes. many displays need this...
--- 1.2/drivers/usb/input/touchkitusb.c 2004-09-18 10:07:25 +02:00
+++ edited/drivers/usb/input/touchkitusb.c 2004-11-24 18:57:59 +01:00
@@ -59,6 +59,10 @@
#define DRIVER_AUTHOR "Daniel Ritz <daniel.ritz@gmx.ch>"
#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:
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 2.6] touchkitusb: module_param to swap axes
2004-11-24 21:28 [PATCH 2.6] touchkitusb: module_param to swap axes Daniel Ritz
@ 2004-11-25 5:10 ` Dmitry Torokhov
2004-11-25 20:18 ` Daniel Ritz
0 siblings, 1 reply; 4+ messages in thread
From: Dmitry Torokhov @ 2004-11-25 5:10 UTC (permalink / raw)
To: linux-kernel, daniel.ritz; +Cc: Greg KH
On Wednesday 24 November 2004 04:28 pm, Daniel Ritz wrote:
> add a module parameter to swap the axes. many displays need this...
>
> --- 1.2/drivers/usb/input/touchkitusb.c 2004-09-18 10:07:25 +02:00
> +++ edited/drivers/usb/input/touchkitusb.c 2004-11-24 18:57:59 +01:00
> @@ -59,6 +59,10 @@
> #define DRIVER_AUTHOR "Daniel Ritz <daniel.ritz@gmx.ch>"
> #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.
--
Dmitry
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 2.6] touchkitusb: module_param to swap axes
2004-11-25 5:10 ` Dmitry Torokhov
@ 2004-11-25 20:18 ` Daniel Ritz
2004-11-29 19:07 ` Greg KH
0 siblings, 1 reply; 4+ messages in thread
From: Daniel Ritz @ 2004-11-25 20:18 UTC (permalink / raw)
To: Dmitry Torokhov, linux-kernel; +Cc: Greg KH
On Thursday 25 November 2004 06:10, Dmitry Torokhov wrote:
> On Wednesday 24 November 2004 04:28 pm, Daniel Ritz wrote:
> > add a module parameter to swap the axes. many displays need this...
> >
> > --- 1.2/drivers/usb/input/touchkitusb.c 2004-09-18 10:07:25 +02:00
> > +++ edited/drivers/usb/input/touchkitusb.c 2004-11-24 18:57:59 +01:00
> > @@ -59,6 +59,10 @@
> > #define DRIVER_AUTHOR "Daniel Ritz <daniel.ritz@gmx.ch>"
> > #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.
>
agreed. and when 0600 is ok, i guess 0644 is ok too.
Signed-off-by: Daniel Ritz <daniel.ritz@gmx.ch>
--- 1.2/drivers/usb/input/touchkitusb.c 2004-09-18 10:07:25 +02:00
+++ edited/drivers/usb/input/touchkitusb.c 2004-11-24 18:57:59 +01:00
@@ -59,6 +59,10 @@
#define DRIVER_AUTHOR "Daniel Ritz <daniel.ritz@gmx.ch>"
#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:
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 2.6] touchkitusb: module_param to swap axes
2004-11-25 20:18 ` Daniel Ritz
@ 2004-11-29 19:07 ` Greg KH
0 siblings, 0 replies; 4+ messages in thread
From: Greg KH @ 2004-11-29 19:07 UTC (permalink / raw)
To: Daniel Ritz; +Cc: Dmitry Torokhov, linux-kernel
On Thu, Nov 25, 2004 at 09:18:17PM +0100, Daniel Ritz wrote:
> On Thursday 25 November 2004 06:10, Dmitry Torokhov wrote:
> > On Wednesday 24 November 2004 04:28 pm, Daniel Ritz wrote:
> > > add a module parameter to swap the axes. many displays need this...
> > >
> > > --- 1.2/drivers/usb/input/touchkitusb.c 2004-09-18 10:07:25 +02:00
> > > +++ edited/drivers/usb/input/touchkitusb.c 2004-11-24 18:57:59 +01:00
> > > @@ -59,6 +59,10 @@
> > > #define DRIVER_AUTHOR "Daniel Ritz <daniel.ritz@gmx.ch>"
> > > #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.
> >
>
> agreed. and when 0600 is ok, i guess 0644 is ok too.
Applied, thanks.
greg k-h
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2004-11-29 19:35 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-11-24 21:28 [PATCH 2.6] touchkitusb: module_param to swap axes Daniel Ritz
2004-11-25 5:10 ` Dmitry Torokhov
2004-11-25 20:18 ` Daniel Ritz
2004-11-29 19:07 ` Greg KH
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox