* usbtouchscreen: Add support for Zytronic capacitive touchscreen
@ 2009-01-09 12:10 Ben Dooks
2009-01-12 7:53 ` Dmitry Torokhov
0 siblings, 1 reply; 14+ messages in thread
From: Ben Dooks @ 2009-01-09 12:10 UTC (permalink / raw)
To: linux-input; +Cc: vince, dsilvers
[-- Attachment #1: simtec/simtec-zytronic-usbtouch.patch --]
[-- Type: text/plain, Size: 4835 bytes --]
From: Vincent Sanders <vince@simtec.co.uk>
Zytronic USB-attached capacitive touchscreen support
within the generic USB touchscreen driver.
Signed-off-by: Daniel Silverstone <dsilvers@simtec.co.uk>
Signed-off-by: Vincent Sanders <vince@simtec.co.uk>
Index: linux.git/drivers/input/touchscreen/usbtouchscreen.c
===================================================================
--- linux.git.orig/drivers/input/touchscreen/usbtouchscreen.c 2009-01-08 15:26:04.000000000 +0000
+++ linux.git/drivers/input/touchscreen/usbtouchscreen.c 2009-01-09 12:03:39.000000000 +0000
@@ -13,6 +13,7 @@
* - IdealTEK URTC1000
* - General Touch
* - GoTop Super_Q2/GogoPen/PenPower tablets
+ * - Zytronic capacitive touchscreen
*
* Copyright (C) 2004-2007 by Daniel Ritz <daniel.ritz@gmx.ch>
* Copyright (C) by Todd E. Johnson (mtouchusb.c)
@@ -68,6 +69,11 @@ struct usbtouch_device_info {
int min_press, max_press;
int rept_size;
+ /* Always service the USB devices irq not just when the input device is
+ * open.
+ */
+ int irq_always;
+
void (*process_pkt) (struct usbtouch_usb *usbtouch, unsigned char *pkt, int len);
/*
@@ -114,6 +120,7 @@ enum {
DEVTYPE_IDEALTEK,
DEVTYPE_GENERAL_TOUCH,
DEVTYPE_GOTOP,
+ DEVTYPE_ZYTRONIC,
};
#define USB_DEVICE_HID_CLASS(vend, prod) \
@@ -186,6 +193,10 @@ static struct usb_device_id usbtouch_dev
{USB_DEVICE(0x08f2, 0x00f4), .driver_info = DEVTYPE_GOTOP},
#endif
+#ifdef CONFIG_TOUCHSCREEN_USB_ZYTRONIC
+ {USB_DEVICE(0x14c8, 0x0003), .driver_info = DEVTYPE_ZYTRONIC},
+#endif
+
{}
};
@@ -547,6 +558,41 @@ static int gotop_read_data(struct usbtou
}
#endif
+/*****************************************************************************
+ * Zytronic Part
+ */
+#ifdef CONFIG_TOUCHSCREEN_USB_ZYTRONIC
+static int zytronic_read_data(struct usbtouch_usb *dev, unsigned char *pkt)
+{
+ switch (pkt[0]) {
+ case 0x3A: /* command response */
+ dbg("%s: Command response %d", __func__, pkt[1]);
+ break;
+
+ case 0xC0: /* down */
+ dev->x = (pkt[1] & 0x7f) | ((pkt[2] & 0x07) << 7);
+ dev->y = (pkt[3] & 0x7f) | ((pkt[4] & 0x07) << 7);
+ dev->touch = 1;
+ dev->press = 1;
+ dbg("%s: down %d,%d", __func__, dev->x, dev->y);
+ return 1;
+
+ case 0x80: /* up */
+ dev->x = (pkt[1] & 0x7f) | ((pkt[2] & 0x07) << 7);
+ dev->y = (pkt[3] & 0x7f) | ((pkt[4] & 0x07) << 7);
+ dev->touch = 0;
+ dev->press = 0;
+ dbg("%s: up %d,%d", __func__, dev->x, dev->y);
+ return 1;
+
+ default:
+ dbg("%s: Unknown return %d", __func__, pkt[0]);
+ break;
+ }
+
+ return 0;
+}
+#endif
/*****************************************************************************
* the different device descriptors
@@ -686,8 +732,20 @@ static struct usbtouch_device_info usbto
.read_data = gotop_read_data,
},
#endif
-};
+#ifdef CONFIG_TOUCHSCREEN_USB_ZYTRONIC
+ [DEVTYPE_ZYTRONIC] = {
+ .min_xc = 0x0,
+ .max_xc = 0x03ff,
+ .min_yc = 0x0,
+ .max_yc = 0x03ff,
+ .max_press = 0x1,
+ .rept_size = 5,
+ .read_data = zytronic_read_data,
+ .irq_always = 1,
+ },
+#endif
+};
/*****************************************************************************
* Generic Part
@@ -836,8 +894,10 @@ static int usbtouch_open(struct input_de
usbtouch->irq->dev = usbtouch->udev;
- if (usb_submit_urb(usbtouch->irq, GFP_KERNEL))
- return -EIO;
+ if (!usbtouch->type->irq_always) {
+ if (usb_submit_urb(usbtouch->irq, GFP_KERNEL))
+ return -EIO;
+ }
return 0;
}
@@ -846,7 +906,8 @@ static void usbtouch_close(struct input_
{
struct usbtouch_usb *usbtouch = input_get_drvdata(input);
- usb_kill_urb(usbtouch->irq);
+ if (!usbtouch->type->irq_always)
+ usb_kill_urb(usbtouch->irq);
}
@@ -969,6 +1030,9 @@ static int usbtouch_probe(struct usb_int
usb_set_intfdata(intf, usbtouch);
+ if (usbtouch->type->irq_always)
+ usb_submit_urb(usbtouch->irq, GFP_KERNEL);
+
return 0;
out_free_buffers:
Index: linux.git/drivers/input/touchscreen/Kconfig
===================================================================
--- linux.git.orig/drivers/input/touchscreen/Kconfig 2009-01-09 11:37:07.000000000 +0000
+++ linux.git/drivers/input/touchscreen/Kconfig 2009-01-09 12:03:39.000000000 +0000
@@ -342,6 +342,7 @@ config TOUCHSCREEN_USB_COMPOSITE
- IRTOUCHSYSTEMS/UNITOP
- IdealTEK URTC1000
- GoTop Super_Q2/GogoPen/PenPower tablets
+ - Zytronic controllers
Have a look at <http://linux.chapter7.ch/touchkit/> for
a usage description and the required user-space stuff.
@@ -426,4 +427,9 @@ config TOUCHSCREEN_TSC2007
To compile this driver as a module, choose M here: the
module will be called tsc2007.
+config TOUCHSCREEN_USB_ZYTRONIC
+ default y
+ bool "Zytronic controller" if EMBEDDED
+ depends on TOUCHSCREEN_USB_COMPOSITE
+
endif
--
Ben (ben@fluff.org, http://www.fluff.org/)
'a smiley only costs 4 bytes'
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: usbtouchscreen: Add support for Zytronic capacitive touchscreen
2009-01-09 12:10 usbtouchscreen: Add support for Zytronic capacitive touchscreen Ben Dooks
@ 2009-01-12 7:53 ` Dmitry Torokhov
2009-01-12 9:07 ` Daniel Silverstone
0 siblings, 1 reply; 14+ messages in thread
From: Dmitry Torokhov @ 2009-01-12 7:53 UTC (permalink / raw)
To: Ben Dooks; +Cc: linux-input, vince, dsilvers
On Fri, Jan 09, 2009 at 12:10:26PM +0000, Ben Dooks wrote:
> From: Vincent Sanders <vince@simtec.co.uk>
>
> Zytronic USB-attached capacitive touchscreen support
> within the generic USB touchscreen driver.
>
> Signed-off-by: Daniel Silverstone <dsilvers@simtec.co.uk>
> Signed-off-by: Vincent Sanders <vince@simtec.co.uk>
>
Since you are passing the driver on your sign off is also needed.
> Index: linux.git/drivers/input/touchscreen/usbtouchscreen.c
> ===================================================================
> --- linux.git.orig/drivers/input/touchscreen/usbtouchscreen.c 2009-01-08 15:26:04.000000000 +0000
> +++ linux.git/drivers/input/touchscreen/usbtouchscreen.c 2009-01-09 12:03:39.000000000 +0000
> @@ -13,6 +13,7 @@
> * - IdealTEK URTC1000
> * - General Touch
> * - GoTop Super_Q2/GogoPen/PenPower tablets
> + * - Zytronic capacitive touchscreen
> *
> * Copyright (C) 2004-2007 by Daniel Ritz <daniel.ritz@gmx.ch>
> * Copyright (C) by Todd E. Johnson (mtouchusb.c)
> @@ -68,6 +69,11 @@ struct usbtouch_device_info {
> int min_press, max_press;
> int rept_size;
>
> + /* Always service the USB devices irq not just when the input device is
> + * open.
> + */
> + int irq_always;
> +
Why is this needed?
> + case 0xC0: /* down */
> + dev->x = (pkt[1] & 0x7f) | ((pkt[2] & 0x07) << 7);
> + dev->y = (pkt[3] & 0x7f) | ((pkt[4] & 0x07) << 7);
> + dev->touch = 1;
> + dev->press = 1;
Since the device does not report real pressure readings don't try to
fake it, reporting touch is enough.
--
Dmitry
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: usbtouchscreen: Add support for Zytronic capacitive touchscreen
2009-01-12 7:53 ` Dmitry Torokhov
@ 2009-01-12 9:07 ` Daniel Silverstone
2009-01-13 5:33 ` Dmitry Torokhov
0 siblings, 1 reply; 14+ messages in thread
From: Daniel Silverstone @ 2009-01-12 9:07 UTC (permalink / raw)
To: Dmitry Torokhov; +Cc: Ben Dooks, linux-input, vince
> > Index: linux.git/drivers/input/touchscreen/usbtouchscreen.c
> > + /* Always service the USB devices irq not just when the input device is
> > + * open.
> > + */
> > + int irq_always;
> > +
> Why is this needed?
Some devices (E.g. specifically this one) expect their interrupt
endpoints to always be serviced. In this case, the device has an
on-board watchdog and will reboot (disconnect and reconnecting to the
USB) if it is not serviced in a timely fashion.
> > + case 0xC0: /* down */
> > + dev->x = (pkt[1] & 0x7f) | ((pkt[2] & 0x07) << 7);
> > + dev->y = (pkt[3] & 0x7f) | ((pkt[4] & 0x07) << 7);
> > + dev->touch = 1;
> > + dev->press = 1;
> Since the device does not report real pressure readings don't try to
> fake it, reporting touch is enough.
I believe that this is because some userland libraries, particularly
tslib, require the pressure reading in order to believe the device is
functioning usefully. Specifically, consider plugins/input-raw of
tslib's source package which uses pressure rather than touch.
Regards,
Daniel.
--
Daniel Silverstone http://www.simtec.co.uk/
PGP mail accepted and encouraged. Key Id: 2BC8 4016 2068 7895
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: usbtouchscreen: Add support for Zytronic capacitive touchscreen
2009-01-12 9:07 ` Daniel Silverstone
@ 2009-01-13 5:33 ` Dmitry Torokhov
2009-01-13 9:29 ` Daniel Silverstone
0 siblings, 1 reply; 14+ messages in thread
From: Dmitry Torokhov @ 2009-01-13 5:33 UTC (permalink / raw)
To: Daniel Silverstone; +Cc: Ben Dooks, linux-input, vince
Hi Daniel,
On Mon, Jan 12, 2009 at 09:07:14AM +0000, Daniel Silverstone wrote:
> > > Index: linux.git/drivers/input/touchscreen/usbtouchscreen.c
> > > + /* Always service the USB devices irq not just when the input device is
> > > + * open.
> > > + */
> > > + int irq_always;
> > > +
> > Why is this needed?
>
> Some devices (E.g. specifically this one) expect their interrupt
> endpoints to always be serviced. In this case, the device has an
> on-board watchdog and will reboot (disconnect and reconnecting to the
> USB) if it is not serviced in a timely fashion.
>
So what happens if driver was unloaded or there was no driver loaded at
all? Is this device constantly connecting and reconnecting?
>
> > > + case 0xC0: /* down */
> > > + dev->x = (pkt[1] & 0x7f) | ((pkt[2] & 0x07) << 7);
> > > + dev->y = (pkt[3] & 0x7f) | ((pkt[4] & 0x07) << 7);
> > > + dev->touch = 1;
> > > + dev->press = 1;
> > Since the device does not report real pressure readings don't try to
> > fake it, reporting touch is enough.
>
> I believe that this is because some userland libraries, particularly
> tslib, require the pressure reading in order to believe the device is
> functioning usefully. Specifically, consider plugins/input-raw of
> tslib's source package which uses pressure rather than touch.
>
Yes, I am aware of TSLIB case and I am telling everyone who submits
touchscreen drivers that they need to fix it. The policy is that
kernel should not generate fake events but present as accurate state
of hardware as possible.
--
Dmitry
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: usbtouchscreen: Add support for Zytronic capacitive touchscreen
2009-01-13 5:33 ` Dmitry Torokhov
@ 2009-01-13 9:29 ` Daniel Silverstone
2009-01-14 5:35 ` Dmitry Torokhov
0 siblings, 1 reply; 14+ messages in thread
From: Daniel Silverstone @ 2009-01-13 9:29 UTC (permalink / raw)
To: Dmitry Torokhov; +Cc: Ben Dooks, linux-input, vince
On Mon, 2009-01-12 at 21:33 -0800, Dmitry Torokhov wrote:
> > > > + /* Always service the USB devices irq not just when the input device is
> > > > + * open.
> > > > + */
> > > > + int irq_always;
> > > Why is this needed?
> > Some devices (E.g. specifically this one) expect their interrupt
> > endpoints to always be serviced. In this case, the device has an
> > on-board watchdog and will reboot (disconnect and reconnecting to the
> > USB) if it is not serviced in a timely fashion.
> So what happens if driver was unloaded or there was no driver loaded at
> all? Is this device constantly connecting and reconnecting?
As I understand it; yes. (Some bits of hardware really are hideous
things) Indeed if the driver fails to load quickly enough, the device
might disconnect/reconnect before the driver can get hold of it.
> > > > + dev->touch = 1;
> > > > + dev->press = 1;
> > > Since the device does not report real pressure readings don't try to
> > > fake it, reporting touch is enough.
> > I believe that this is because some userland libraries, particularly
> > tslib, require the pressure reading in order to believe the device is
> > functioning usefully. Specifically, consider plugins/input-raw of
> > tslib's source package which uses pressure rather than touch.
> Yes, I am aware of TSLIB case and I am telling everyone who submits
> touchscreen drivers that they need to fix it. The policy is that
> kernel should not generate fake events but present as accurate state
> of hardware as possible.
Unfortunately it's often harder to get people to change their userland
than their kernel. It seems a pity to make the driver less useful during
any longer-term effort to fix TSLIB. If acceptance of this patch is
predicated on removing that then I guess we'll have to discuss it
amongst ourselves and try and work out what we'd rather do. Is removing
the fake pressure report a requirement or a would-like?
Regards,
Daniel.
--
Daniel Silverstone http://www.simtec.co.uk/
PGP mail accepted and encouraged. Key Id: 2BC8 4016 2068 7895
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: usbtouchscreen: Add support for Zytronic capacitive touchscreen
2009-01-13 9:29 ` Daniel Silverstone
@ 2009-01-14 5:35 ` Dmitry Torokhov
2009-01-14 17:36 ` Daniel Silverstone
0 siblings, 1 reply; 14+ messages in thread
From: Dmitry Torokhov @ 2009-01-14 5:35 UTC (permalink / raw)
To: Daniel Silverstone; +Cc: Ben Dooks, linux-input, vince
On Tue, Jan 13, 2009 at 09:29:18AM +0000, Daniel Silverstone wrote:
> On Mon, 2009-01-12 at 21:33 -0800, Dmitry Torokhov wrote:
> > > > > + /* Always service the USB devices irq not just when the input device is
> > > > > + * open.
> > > > > + */
> > > > > + int irq_always;
> > > > Why is this needed?
> > > Some devices (E.g. specifically this one) expect their interrupt
> > > endpoints to always be serviced. In this case, the device has an
> > > on-board watchdog and will reboot (disconnect and reconnecting to the
> > > USB) if it is not serviced in a timely fashion.
> > So what happens if driver was unloaded or there was no driver loaded at
> > all? Is this device constantly connecting and reconnecting?
>
> As I understand it; yes. (Some bits of hardware really are hideous
> things) Indeed if the driver fails to load quickly enough, the device
> might disconnect/reconnect before the driver can get hold of it.
>
Geez... you sure it wasn't just broken device/batch?
> > > > > + dev->touch = 1;
> > > > > + dev->press = 1;
> > > > Since the device does not report real pressure readings don't try to
> > > > fake it, reporting touch is enough.
> > > I believe that this is because some userland libraries, particularly
> > > tslib, require the pressure reading in order to believe the device is
> > > functioning usefully. Specifically, consider plugins/input-raw of
> > > tslib's source package which uses pressure rather than touch.
> > Yes, I am aware of TSLIB case and I am telling everyone who submits
> > touchscreen drivers that they need to fix it. The policy is that
> > kernel should not generate fake events but present as accurate state
> > of hardware as possible.
>
> Unfortunately it's often harder to get people to change their userland
> than their kernel. It seems a pity to make the driver less useful during
> any longer-term effort to fix TSLIB. If acceptance of this patch is
> predicated on removing that then I guess we'll have to discuss it
> amongst ourselves and try and work out what we'd rather do. Is removing
> the fake pressure report a requirement or a would-like?
>
I just checked TSLIB and the change to recognize devices that do not
report pressure was applied 2 months ago so everything should work fine
now. I do not think that we need to implement workarounds in newly
added drivers just because users are not willing to upgrade their
TSLIB installation.
--
Dmitry
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: usbtouchscreen: Add support for Zytronic capacitive touchscreen
2009-01-14 5:35 ` Dmitry Torokhov
@ 2009-01-14 17:36 ` Daniel Silverstone
2009-01-15 15:12 ` Ben Dooks
0 siblings, 1 reply; 14+ messages in thread
From: Daniel Silverstone @ 2009-01-14 17:36 UTC (permalink / raw)
To: Dmitry Torokhov; +Cc: Ben Dooks, linux-input, vince
On Tue, 2009-01-13 at 21:35 -0800, Dmitry Torokhov wrote:
> > As I understand it; yes. (Some bits of hardware really are hideous
> > things) Indeed if the driver fails to load quickly enough, the device
> > might disconnect/reconnect before the driver can get hold of it.
> Geez... you sure it wasn't just broken device/batch?
Nope, the datasheet proudly proclaims this watchdog functionality.
> > Unfortunately it's often harder to get people to change their userland
> > than their kernel. It seems a pity to make the driver less useful during
> > any longer-term effort to fix TSLIB. If acceptance of this patch is
> > predicated on removing that then I guess we'll have to discuss it
> > amongst ourselves and try and work out what we'd rather do. Is removing
> > the fake pressure report a requirement or a would-like?
> I just checked TSLIB and the change to recognize devices that do not
> report pressure was applied 2 months ago so everything should work fine
> now. I do not think that we need to implement workarounds in newly
> added drivers just because users are not willing to upgrade their
> TSLIB installation.
I see. I shall look into sorting out a fresh patch without fake
pressure.
Regards,
Daniel.
--
Daniel Silverstone http://www.simtec.co.uk/
PGP mail accepted and encouraged. Key Id: 2BC8 4016 2068 7895
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: usbtouchscreen: Add support for Zytronic capacitive touchscreen
2009-01-14 17:36 ` Daniel Silverstone
@ 2009-01-15 15:12 ` Ben Dooks
2009-01-29 10:55 ` Daniel Silverstone
0 siblings, 1 reply; 14+ messages in thread
From: Ben Dooks @ 2009-01-15 15:12 UTC (permalink / raw)
To: Daniel Silverstone; +Cc: Dmitry Torokhov, Ben Dooks, linux-input, vince
On Wed, Jan 14, 2009 at 05:36:53PM +0000, Daniel Silverstone wrote:
> On Tue, 2009-01-13 at 21:35 -0800, Dmitry Torokhov wrote:
> > > As I understand it; yes. (Some bits of hardware really are hideous
> > > things) Indeed if the driver fails to load quickly enough, the device
> > > might disconnect/reconnect before the driver can get hold of it.
> > Geez... you sure it wasn't just broken device/batch?
>
> Nope, the datasheet proudly proclaims this watchdog functionality.
Would be useful to add a comment about that being the primary function
for the irq_always flag, ie:
+ /* Always service the USB devices irq not just when the input device is
+ * open. This is often for devices that have a watchdog which watches
+ * the polling process.
+ */
> > > Unfortunately it's often harder to get people to change their userland
> > > than their kernel. It seems a pity to make the driver less useful during
> > > any longer-term effort to fix TSLIB. If acceptance of this patch is
> > > predicated on removing that then I guess we'll have to discuss it
> > > amongst ourselves and try and work out what we'd rather do. Is removing
> > > the fake pressure report a requirement or a would-like?
> > I just checked TSLIB and the change to recognize devices that do not
> > report pressure was applied 2 months ago so everything should work fine
> > now. I do not think that we need to implement workarounds in newly
> > added drivers just because users are not willing to upgrade their
> > TSLIB installation.
>
> I see. I shall look into sorting out a fresh patch without fake
> pressure.
--
Ben
Q: What's a light-year?
A: One-third less calories than a regular year.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: usbtouchscreen: Add support for Zytronic capacitive touchscreen
2009-01-15 15:12 ` Ben Dooks
@ 2009-01-29 10:55 ` Daniel Silverstone
2009-03-31 9:52 ` Daniel Silverstone
0 siblings, 1 reply; 14+ messages in thread
From: Daniel Silverstone @ 2009-01-29 10:55 UTC (permalink / raw)
To: Ben Dooks; +Cc: Dmitry Torokhov, linux-input, vince
On Thu, 2009-01-15 at 15:12 +0000, Ben Dooks wrote:
> > > > As I understand it; yes. (Some bits of hardware really are hideous
> > > > things) Indeed if the driver fails to load quickly enough, the device
> > > > might disconnect/reconnect before the driver can get hold of it.
> > > Geez... you sure it wasn't just broken device/batch?
> > Nope, the datasheet proudly proclaims this watchdog functionality.
> Would be useful to add a comment about that being the primary function
> for the irq_always flag
I've done this.
Here is a patch with the fake pressure support removed, as Dmitry tells
me there is now support in TSLib for that. It also updates the comment
as suggested by Ben Dooks.
Regards,
Daniel.
usbtouchscreen: Add support for Zytronic capacitive touchscreen
Zytronic USB-attached capacitive touchscreen support
within the generic USB touchscreen driver.
Signed-off-by: Simtec Linux Team <linux@simtec.co.uk>
Signed-off-by: Daniel Silverstone <dsilvers@simtec.co.uk>
Signed-off-by: Vincent Sanders <vince@simtec.co.uk>
Index: linux-2.6.29-rc2/drivers/input/touchscreen/usbtouchscreen.c
===================================================================
--- linux-2.6.29-rc2.orig/drivers/input/touchscreen/usbtouchscreen.c
2009-01-29 09:50:40.677710539 +0000
+++ linux-2.6.29-rc2/drivers/input/touchscreen/usbtouchscreen.c
2009-01-29 10:51:24.897709879 +0000
@@ -13,6 +13,7 @@
* - IdealTEK URTC1000
* - General Touch
* - GoTop Super_Q2/GogoPen/PenPower tablets
+ * - Zytronic capacitive touchscreen
*
* Copyright (C) 2004-2007 by Daniel Ritz <daniel.ritz@gmx.ch>
* Copyright (C) by Todd E. Johnson (mtouchusb.c)
@@ -68,6 +69,14 @@
int min_press, max_press;
int rept_size;
+ /* Always service the USB devices irq not just when the input device
is
+ * open. This is useful when devices have a watchdog which prevents us
+ * from periodically polling the device. Leave this unset
unless your
+ * touchscreen device requires it, as it does consume more of
the USB
+ * bandwidth.
+ */
+ int irq_always;
+
void (*process_pkt) (struct usbtouch_usb *usbtouch, unsigned char
*pkt, int len);
/*
@@ -114,6 +123,7 @@
DEVTYPE_IDEALTEK,
DEVTYPE_GENERAL_TOUCH,
DEVTYPE_GOTOP,
+ DEVTYPE_ZYTRONIC,
};
#define USB_DEVICE_HID_CLASS(vend, prod) \
@@ -186,6 +196,10 @@
{USB_DEVICE(0x08f2, 0x00f4), .driver_info = DEVTYPE_GOTOP},
#endif
+#ifdef CONFIG_TOUCHSCREEN_USB_ZYTRONIC
+ {USB_DEVICE(0x14c8, 0x0003), .driver_info = DEVTYPE_ZYTRONIC},
+#endif
+
{}
};
@@ -547,6 +561,39 @@
}
#endif
+/*****************************************************************************
+ * Zytronic Part
+ */
+#ifdef CONFIG_TOUCHSCREEN_USB_ZYTRONIC
+static int zytronic_read_data(struct usbtouch_usb *dev, unsigned char
*pkt)
+{
+ switch (pkt[0]) {
+ case 0x3A: /* command response */
+ dbg("%s: Command response %d", __func__, pkt[1]);
+ break;
+
+ case 0xC0: /* down */
+ dev->x = (pkt[1] & 0x7f) | ((pkt[2] & 0x07) << 7);
+ dev->y = (pkt[3] & 0x7f) | ((pkt[4] & 0x07) << 7);
+ dev->touch = 1;
+ dbg("%s: down %d,%d", __func__, dev->x, dev->y);
+ return 1;
+
+ case 0x80: /* up */
+ dev->x = (pkt[1] & 0x7f) | ((pkt[2] & 0x07) << 7);
+ dev->y = (pkt[3] & 0x7f) | ((pkt[4] & 0x07) << 7);
+ dev->touch = 0;
+ dbg("%s: up %d,%d", __func__, dev->x, dev->y);
+ return 1;
+
+ default:
+ dbg("%s: Unknown return %d", __func__, pkt[0]);
+ break;
+ }
+
+ return 0;
+}
+#endif
/*****************************************************************************
* the different device descriptors
@@ -686,8 +733,19 @@
.read_data = gotop_read_data,
},
#endif
-};
+#ifdef CONFIG_TOUCHSCREEN_USB_ZYTRONIC
+ [DEVTYPE_ZYTRONIC] = {
+ .min_xc = 0x0,
+ .max_xc = 0x03ff,
+ .min_yc = 0x0,
+ .max_yc = 0x03ff,
+ .rept_size = 5,
+ .read_data = zytronic_read_data,
+ .irq_always = 1,
+ },
+#endif
+};
/*****************************************************************************
* Generic Part
@@ -836,8 +894,10 @@
usbtouch->irq->dev = usbtouch->udev;
- if (usb_submit_urb(usbtouch->irq, GFP_KERNEL))
- return -EIO;
+ if (!usbtouch->type->irq_always) {
+ if (usb_submit_urb(usbtouch->irq, GFP_KERNEL))
+ return -EIO;
+ }
return 0;
}
@@ -846,7 +906,8 @@
{
struct usbtouch_usb *usbtouch = input_get_drvdata(input);
- usb_kill_urb(usbtouch->irq);
+ if (!usbtouch->type->irq_always)
+ usb_kill_urb(usbtouch->irq);
}
@@ -969,6 +1030,9 @@
usb_set_intfdata(intf, usbtouch);
+ if (usbtouch->type->irq_always)
+ usb_submit_urb(usbtouch->irq, GFP_KERNEL);
+
return 0;
out_free_buffers:
Index: linux-2.6.29-rc2/drivers/input/touchscreen/Kconfig
===================================================================
--- linux-2.6.29-rc2.orig/drivers/input/touchscreen/Kconfig 2009-01-29
10:16:41.433707585 +0000
+++ linux-2.6.29-rc2/drivers/input/touchscreen/Kconfig 2009-01-29
10:16:51.301709658 +0000
@@ -342,6 +342,7 @@
- IRTOUCHSYSTEMS/UNITOP
- IdealTEK URTC1000
- GoTop Super_Q2/GogoPen/PenPower tablets
+ - Zytronic controllers
Have a look at <http://linux.chapter7.ch/touchkit/> for
a usage description and the required user-space stuff.
@@ -426,4 +427,9 @@
To compile this driver as a module, choose M here: the
module will be called tsc2007.
+config TOUCHSCREEN_USB_ZYTRONIC
+ default y
+ bool "Zytronic controller" if EMBEDDED
+ depends on TOUCHSCREEN_USB_COMPOSITE
+
endif
--
Daniel Silverstone http://www.simtec.co.uk/
PGP mail accepted and encouraged. Key Id: 2BC8 4016 2068 7895
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: usbtouchscreen: Add support for Zytronic capacitive touchscreen
2009-01-29 10:55 ` Daniel Silverstone
@ 2009-03-31 9:52 ` Daniel Silverstone
2009-04-08 20:33 ` Dmitry Torokhov
0 siblings, 1 reply; 14+ messages in thread
From: Daniel Silverstone @ 2009-03-31 9:52 UTC (permalink / raw)
To: Ben Dooks; +Cc: Dmitry Torokhov, linux-input, vince
On Thu, 2009-01-29 at 10:55 +0000, Daniel Silverstone wrote:
> Here is a patch with the fake pressure support removed, as Dmitry tells
> me there is now support in TSLib for that. It also updates the comment
> as suggested by Ben Dooks.
Has anyone had chance to review and possibly merge this patch? I've not
heard anything since January.
Regards,
Daniel.
--
Daniel Silverstone http://www.simtec.co.uk/
PGP mail accepted and encouraged. Key Id: 2BC8 4016 2068 7895
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: usbtouchscreen: Add support for Zytronic capacitive touchscreen
2009-03-31 9:52 ` Daniel Silverstone
@ 2009-04-08 20:33 ` Dmitry Torokhov
2009-04-09 8:20 ` Daniel Silverstone
0 siblings, 1 reply; 14+ messages in thread
From: Dmitry Torokhov @ 2009-04-08 20:33 UTC (permalink / raw)
To: dsilvers; +Cc: Ben Dooks, linux-input, vince
Hi Daniel,
On Tuesday 31 March 2009 02:52:53 Daniel Silverstone wrote:
> On Thu, 2009-01-29 at 10:55 +0000, Daniel Silverstone wrote:
> > Here is a patch with the fake pressure support removed, as Dmitry tells
> > me there is now support in TSLib for that. It also updates the comment
> > as suggested by Ben Dooks.
>
> Has anyone had chance to review and possibly merge this patch? I've not
> heard anything since January.
>
It's been sitting in my tree and will be merged next time Linus pulls from me.
--
Dmitry
^ permalink raw reply [flat|nested] 14+ messages in thread
* usbtouchscreen: Add support for Zytronic capacitive touchscreen
@ 2009-11-23 14:39 Ben Dooks
2009-11-23 17:21 ` Dmitry Torokhov
0 siblings, 1 reply; 14+ messages in thread
From: Ben Dooks @ 2009-11-23 14:39 UTC (permalink / raw)
To: linux-input
Cc: dmitry.torokhov, daniel.ritz, ddstreet, floe, jim-linux,
Daniel Silverstone, Vincent Sanders, Simtec Linux Team
[-- Attachment #1: new-zytronic.patch --]
[-- Type: text/plain, Size: 5250 bytes --]
From: Daniel Silverstone <dsilvers@simtec.co.uk>
Zytronic USB-attached capacitive touchscreen support within
the generic USB touchscreen driver.
Signed-off-by: Daniel Silverstone <dsilvers@simtec.co.uk>
Signed-off-by: Vincent Sanders <vince@simtec.co.uk>
Signed-off-by: Simtec Linux Team <linux@simtec.co.uk>
---
drivers/input/touchscreen/Kconfig | 6 ++
drivers/input/touchscreen/usbtouchscreen.c | 72 +++++++++++++++++++++++++++--
2 files changed, 75 insertions(+), 3 deletions(-)
Index: b/drivers/input/touchscreen/Kconfig
===================================================================
--- a/drivers/input/touchscreen/Kconfig 2009-11-23 22:29:31.000000000 +0000
+++ b/drivers/input/touchscreen/Kconfig 2009-11-23 22:29:31.000000000 +0000
@@ -437,6 +437,7 @@ config TOUCHSCREEN_USB_COMPOSITE
- IdealTEK URTC1000
- GoTop Super_Q2/GogoPen/PenPower tablets
- JASTEC USB Touch Controller/DigiTech DTR-02U
+ - Zytronic controllers
Have a look at <http://linux.chapter7.ch/touchkit/> for
a usage description and the required user-space stuff.
@@ -509,6 +510,11 @@ config TOUCHSCREEN_USB_E2I
bool "e2i Touchscreen controller (e.g. from Mimo 740)"
depends on TOUCHSCREEN_USB_COMPOSITE
+config TOUCHSCREEN_USB_ZYTRONIC
+ default y
+ bool "Zytronic controller" if EMBEDDED
+ depends on TOUCHSCREEN_USB_COMPOSITE
+
config TOUCHSCREEN_TOUCHIT213
tristate "Sahara TouchIT-213 touchscreen"
select SERIO
Index: b/drivers/input/touchscreen/usbtouchscreen.c
===================================================================
--- a/drivers/input/touchscreen/usbtouchscreen.c 2009-11-23 22:25:02.000000000 +0000
+++ b/drivers/input/touchscreen/usbtouchscreen.c 2009-11-23 22:29:31.000000000 +0000
@@ -14,6 +14,7 @@
* - General Touch
* - GoTop Super_Q2/GogoPen/PenPower tablets
* - JASTEC USB touch controller/DigiTech DTR-02U
+ * - Zytronic capacitive touchscreen
*
* Copyright (C) 2004-2007 by Daniel Ritz <daniel.ritz@gmx.ch>
* Copyright (C) by Todd E. Johnson (mtouchusb.c)
@@ -73,6 +74,14 @@ struct usbtouch_device_info {
int min_press, max_press;
int rept_size;
+ /* Always service the USB devices irq not just when the input device is
+ * open. This is useful when devices have a watchdog which prevents us
+ * from periodically polling the device. Leave this unset unless your
+ * touchscreen device requires it, as it does consume more of the USB
+ * bandwidth.
+ */
+ int irq_always;
+
void (*process_pkt) (struct usbtouch_usb *usbtouch, unsigned char *pkt, int len);
/*
@@ -121,6 +130,7 @@ enum {
DEVTYPE_GOTOP,
DEVTYPE_JASTEC,
DEVTYPE_E2I,
+ DEVTYPE_ZYTRONIC,
};
#define USB_DEVICE_HID_CLASS(vend, prod) \
@@ -201,6 +211,11 @@ static struct usb_device_id usbtouch_dev
#ifdef CONFIG_TOUCHSCREEN_USB_E2I
{USB_DEVICE(0x1ac7, 0x0001), .driver_info = DEVTYPE_E2I},
#endif
+
+#ifdef CONFIG_TOUCHSCREEN_USB_ZYTRONIC
+ {USB_DEVICE(0x14c8, 0x0003), .driver_info = DEVTYPE_ZYTRONIC},
+#endif
+
{}
};
@@ -621,6 +636,39 @@ static int jastec_read_data(struct usbto
}
#endif
+/*****************************************************************************
+ * Zytronic Part
+ */
+#ifdef CONFIG_TOUCHSCREEN_USB_ZYTRONIC
+static int zytronic_read_data(struct usbtouch_usb *dev, unsigned char *pkt)
+{
+ switch (pkt[0]) {
+ case 0x3A: /* command response */
+ dbg("%s: Command response %d", __func__, pkt[1]);
+ break;
+
+ case 0xC0: /* down */
+ dev->x = (pkt[1] & 0x7f) | ((pkt[2] & 0x07) << 7);
+ dev->y = (pkt[3] & 0x7f) | ((pkt[4] & 0x07) << 7);
+ dev->touch = 1;
+ dbg("%s: down %d,%d", __func__, dev->x, dev->y);
+ return 1;
+
+ case 0x80: /* up */
+ dev->x = (pkt[1] & 0x7f) | ((pkt[2] & 0x07) << 7);
+ dev->y = (pkt[3] & 0x7f) | ((pkt[4] & 0x07) << 7);
+ dev->touch = 0;
+ dbg("%s: up %d,%d", __func__, dev->x, dev->y);
+ return 1;
+
+ default:
+ dbg("%s: Unknown return %d", __func__, pkt[0]);
+ break;
+ }
+
+ return 0;
+}
+#endif
/*****************************************************************************
* the different device descriptors
@@ -783,6 +831,18 @@ static struct usbtouch_device_info usbto
.read_data = e2i_read_data,
},
#endif
+
+#ifdef CONFIG_TOUCHSCREEN_USB_ZYTRONIC
+ [DEVTYPE_ZYTRONIC] = {
+ .min_xc = 0x0,
+ .max_xc = 0x03ff,
+ .min_yc = 0x0,
+ .max_yc = 0x03ff,
+ .rept_size = 5,
+ .read_data = zytronic_read_data,
+ .irq_always = 1,
+ },
+#endif
};
@@ -933,8 +993,10 @@ static int usbtouch_open(struct input_de
usbtouch->irq->dev = usbtouch->udev;
- if (usb_submit_urb(usbtouch->irq, GFP_KERNEL))
- return -EIO;
+ if (!usbtouch->type->irq_always) {
+ if (usb_submit_urb(usbtouch->irq, GFP_KERNEL))
+ return -EIO;
+ }
return 0;
}
@@ -943,7 +1005,8 @@ static void usbtouch_close(struct input_
{
struct usbtouch_usb *usbtouch = input_get_drvdata(input);
- usb_kill_urb(usbtouch->irq);
+ if (!usbtouch->type->irq_always)
+ usb_kill_urb(usbtouch->irq);
}
@@ -1066,6 +1129,9 @@ static int usbtouch_probe(struct usb_int
usb_set_intfdata(intf, usbtouch);
+ if (usbtouch->type->irq_always)
+ usb_submit_urb(usbtouch->irq, GFP_KERNEL);
+
return 0;
out_free_buffers:
--
Ben (ben@fluff.org, http://www.fluff.org/)
'a smiley only costs 4 bytes'
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: usbtouchscreen: Add support for Zytronic capacitive touchscreen
2009-11-23 14:39 Ben Dooks
@ 2009-11-23 17:21 ` Dmitry Torokhov
0 siblings, 0 replies; 14+ messages in thread
From: Dmitry Torokhov @ 2009-11-23 17:21 UTC (permalink / raw)
To: Ben Dooks
Cc: linux-input, daniel.ritz, ddstreet, floe, jim-linux,
Daniel Silverstone, Vincent Sanders, Simtec Linux Team
On Mon, Nov 23, 2009 at 02:39:52PM +0000, Ben Dooks wrote:
> From: Daniel Silverstone <dsilvers@simtec.co.uk>
>
> Zytronic USB-attached capacitive touchscreen support within
> the generic USB touchscreen driver.
>
HHm, I already promised Daniel to merge this one... I wonder how I
managed to lose it. Anyways, changed 'irq_always' to be a bool and
it should be in 'next' branch now.
--
Dmitry
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2009-11-23 17:21 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-09 12:10 usbtouchscreen: Add support for Zytronic capacitive touchscreen Ben Dooks
2009-01-12 7:53 ` Dmitry Torokhov
2009-01-12 9:07 ` Daniel Silverstone
2009-01-13 5:33 ` Dmitry Torokhov
2009-01-13 9:29 ` Daniel Silverstone
2009-01-14 5:35 ` Dmitry Torokhov
2009-01-14 17:36 ` Daniel Silverstone
2009-01-15 15:12 ` Ben Dooks
2009-01-29 10:55 ` Daniel Silverstone
2009-03-31 9:52 ` Daniel Silverstone
2009-04-08 20:33 ` Dmitry Torokhov
2009-04-09 8:20 ` Daniel Silverstone
-- strict thread matches above, loose matches on Subject: below --
2009-11-23 14:39 Ben Dooks
2009-11-23 17:21 ` Dmitry Torokhov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).