Skip to contentSkip to conversation

full power management for usb touchscreens

PATCH In review Oliver Neukum 6 participants 17 messages Jun 7, 2010 – Jun 29, 2010 8 messages not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover full power management for usb touchscreens

Hi,

this patch series implements:

- full support for suspend/resume/reset_resume
- runtime power management

It does so by adding normal methods for suspend/resume, splitting device intialization into a part that needs to be repeated after reset_resume() and a part that does not.
Runtime power management is possible while the device is active if the device supports remote wakeup, otherwise a fallback to a method based on open/close is implemented.

I lack the hardware. Therefore I need testers.

Regards
Oliver
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw
Quoted 7 lines · Oliver Neukum

Hi,

this patch series implements:

- full support for suspend/resume/reset_resume
- runtime power management

Quoted 9 lines

It does so by adding normal methods for suspend/resume, splitting device intialization into a part that needs to be repeated after reset_resume() and a part that does not.
Runtime power management is possible while the device is active if the device supports remote wakeup, otherwise a fallback to a method based on open/close is implemented.

I lack the hardware. Therefore I need testers.

Ondrej,

You are the latest person I know who users usbtouchscreen driver, any chance you could lend a hand to Oliver here, please?

Thanks!

Signature · 5 lines
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 20100607161920.GA7706-WlK9ik9hQGAhIp7JRqBPierSzoNAToWh@public.gmane.org

#4 lore raw
Quoted 15 lines · Dmitry Torokhov
Quoted 14 lines · Oliver Neukum

Hi,

this patch series implements:

- full support for suspend/resume/reset_resume
- runtime power management

It does so by adding normal methods for suspend/resume, splitting device intialization into a part that needs to be repeated after reset_resume() and a part that does not.
Runtime power management is possible while the device is active if the device supports remote wakeup, otherwise a fallback to a method based on open/close is implemented.

Quoted 6 lines
Quoted 1 line

I lack the hardware. Therefore I need testers.

Ondrej,

You are the latest person I know who users usbtouchscreen driver, any chance you could lend a hand to Oliver here, please?

I can test Nexio and IRTOUCHSYSTEMS. After I fix the fscking broken Intel KMS driver...

Signature · 5 lines
Ondrej Zary
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#5 lore raw
In reply to Dmitry Torokhov
Quoted 15 lines · Dmitry Torokhov
Quoted 14 lines · Oliver Neukum

Hi,

this patch series implements:

- full support for suspend/resume/reset_resume
- runtime power management

It does so by adding normal methods for suspend/resume, splitting device intialization into a part that needs to be repeated after reset_resume() and a part that does not.
Runtime power management is possible while the device is active if the device supports remote wakeup, otherwise a fallback to a method based on open/close is implemented.

Quoted 6 lines
Quoted 1 line

I lack the hardware. Therefore I need testers.

Ondrej,

You are the latest person I know who users usbtouchscreen driver, any chance you could lend a hand to Oliver here, please?

Looking at the patches from archive:

If I understand it correctly, usbtouch_resume submits the irq URB only if the input device is open. That will fail with Nexio as it has an internal watchdog which needs URBs or the device will reconnect - see irq_always (Zytronic seems to need it too).

Review static int usbtouch_probe(struct usb_interface · line 1487

Quoted 8 lines

From patch 3/3:

(quoted diff) +1 -1
@@ -1449,14 +1483,23 @@ static int usbtouch_probe(struct usb_interface
 *intf, usbtouch->irq->transfer_dma = usbtouch->data_dma;
        usbtouch->irq->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
 
-       /* device specific init */
+       /* device specific allocations */
        if (type->init) {

Looks like a copy&paste bug, should be "if (type->alloc) {".

Quoted 20 lines
(quoted diff) +9 -2
-               err = type->init(usbtouch);
+               err = type->alloc(usbtouch);
                if (err) {
-                       dbg("%s - type->init() failed, err: %d", __func__,
 err); +                       dbg("%s - type->alloc() failed, err: %d",
 __func__, err); goto out_free_urb;
                }
        }
+
+       /* device specific init*/
+       if (type->init) {
+               err = type->alloc(usbtouch);
+               if (err) {
+                       dbg("%s - type->init() failed, err: %d", __func__,
 err); +                       goto out_do_exit;
+               }
+       }
 
        err = input_register_device(usbtouch->input);
        if (err) {
Signature · 1 line
Ondrej Zary
#6 lore raw

Am Mittwoch, 9. Juni 2010 15:40:04 schrieb Ondrej Zary:

Quoted 6 lines

Looking at the patches from archive:

If I understand it correctly, usbtouch_resume submits the irq URB only if the input device is open. That will fail with Nexio as it has an internal watchdog which needs URBs or the device will reconnect - see irq_always (Zytronic seems to need it too).

Thank you for the review. Does this patch fix the issues?

Regards
Oliver

Quoted 1 line

From 3fe66013333931b4b0cb7361fbe60d502d306eb4 Mon Sep 17 00:00:00 2001

From: Oliver Neukum <[email protected]>
Date: Wed, 9 Jun 2010 18:32:58 +0200
Subject: [PATCH] usbtouchscreen: fix typo and touchpads which require constant polling

1. fix typo
2. start polling on closed devices if they require it

---
 drivers/input/touchscreen/usbtouchscreen.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/input/touchscreen/usbtouchscreen.c +2 -2
index 421f168..d13517a 100644
@@ -1333,7 +1333,7 @@ static int usbtouch_resume(struct usb_interface *intf)
 	int result = 0;
 	
 	mutex_lock(&input->mutex);
-	if (input->users)
+	if (input->users || usbtouch->type->irq_always)
 		result = usb_submit_urb(usbtouch->irq, GFP_NOIO);
 	mutex_unlock(&input->mutex);
 	return result;
@@ -1484,7 +1484,7 @@ static int usbtouch_probe(struct usb_interface *intf,
 	usbtouch->irq->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
 
 	/* device specific allocations */
-	if (type->init) {
+	if (type->alloc) {
 		err = type->alloc(usbtouch);
 		if (err) {
 			dbg("%s - type->alloc() failed, err: %d", __func__, err);
Signature · 1 line
1.6.4.2

A message that is not in the archive (sent off-list or not yet received): 201006091836.14136.oliver-GvhC2dPhHPQdnm+yROfE0A@public.gmane.org

#8 lore raw
Quoted 9 lines · Oliver Neukum

Am Mittwoch, 9. Juni 2010 15:40:04 schrieb Ondrej Zary:

Quoted 6 lines

Looking at the patches from archive:

If I understand it correctly, usbtouch_resume submits the irq URB only if the input device is open. That will fail with Nexio as it has an internal watchdog which needs URBs or the device will reconnect - see irq_always (Zytronic seems to need it too).

Thank you for the review. Does this patch fix the issues?

I haven't tested the patches before. Now I tested them and the Nexio touchscreen does not play well with suspend. It always reconnects after resume from STR or hibernation. Autosuspend is probably never activated at the URBs are submitted continuously.

Quoted 39 lines

Regards
Oliver

From 3fe66013333931b4b0cb7361fbe60d502d306eb4 Mon Sep 17 00:00:00 2001
From: Oliver Neukum <[email protected]>
Date: Wed, 9 Jun 2010 18:32:58 +0200
Subject: [PATCH] usbtouchscreen: fix typo and touchpads which require constant polling

1. fix typo
2. start polling on closed devices if they require it

---
 drivers/input/touchscreen/usbtouchscreen.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
(quoted diff) +0 -0

b/drivers/input/touchscreen/usbtouchscreen.c index 421f168..d13517a 100644

drivers/input/touchscreen/usbtouchscreen.c +2 -2
@@ -1333,7 +1333,7 @@ static int usbtouch_resume(struct usb_interface
 *intf) int result = 0;
 
 	mutex_lock(&input->mutex);
-	if (input->users)
+	if (input->users || usbtouch->type->irq_always)
 		result = usb_submit_urb(usbtouch->irq, GFP_NOIO);
 	mutex_unlock(&input->mutex);
 	return result;
@@ -1484,7 +1484,7 @@ static int usbtouch_probe(struct usb_interface *intf,
 	usbtouch->irq->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
 
 	/* device specific allocations */
-	if (type->init) {
+	if (type->alloc) {
 		err = type->alloc(usbtouch);
 		if (err) {
 			dbg("%s - type->alloc() failed, err: %d", __func__, err);
Signature · 5 lines
Ondrej Zary
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#9 lore raw

Am Donnerstag, 10. Juni 2010 13:33:57 schrieb Ondrej Zary:

Quoted 9 lines · Oliver Neukum
Quoted 8 lines

Am Mittwoch, 9. Juni 2010 15:40:04 schrieb Ondrej Zary:

Quoted 6 lines

Looking at the patches from archive:

If I understand it correctly, usbtouch_resume submits the irq URB only if the input device is open. That will fail with Nexio as it has an internal watchdog which needs URBs or the device will reconnect - see irq_always (Zytronic seems to need it too).

Quoted 6 lines
Quoted 1 line

Thank you for the review. Does this patch fix the issues?

I haven't tested the patches before. Now I tested them and the Nexio touchscreen does not play well with suspend. It always reconnects after resume from STR or hibernation. Autosuspend is probably never activated at the URBs are submitted continuously.

I see. Can you compile with CONFIG_USB_DEBUG and send me the log?

Thank you
Oliver

A message that is not in the archive (sent off-list or not yet received): 201006101546.55460.oliver-GvhC2dPhHPQdnm+yROfE0A@public.gmane.org

#11 lore raw
Quoted 10 lines · Oliver Neukum

Am Donnerstag, 10. Juni 2010 13:33:57 schrieb Ondrej Zary:

Quoted 9 lines · Oliver Neukum
Quoted 8 lines

Am Mittwoch, 9. Juni 2010 15:40:04 schrieb Ondrej Zary:

Quoted 6 lines

Looking at the patches from archive:

If I understand it correctly, usbtouch_resume submits the irq URB only if the input device is open. That will fail with Nexio as it has an internal watchdog which needs URBs or the device will reconnect - see irq_always (Zytronic seems to need it too).

Quoted 8 lines
Quoted 6 lines
Quoted 1 line

Thank you for the review. Does this patch fix the issues?

I haven't tested the patches before. Now I tested them and the Nexio touchscreen does not play well with suspend. It always reconnects after resume from STR or hibernation. Autosuspend is probably never activated at the URBs are submitted continuously.

I see. Can you compile with CONFIG_USB_DEBUG and send me the log?

This can't be fixed - no matter what you do, the device reconnects if you stop talking to it.

Signature · 5 lines
Ondrej Zary
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 201006101613.52736.linux-ZCIryABCsrmttCpgsWEBFmD2FQJk+8+b@public.gmane.org

#13 lore raw

Am Donnerstag, 10. Juni 2010 16:13:51 schrieb Ondrej Zary:

Quoted 9 lines
Quoted 6 lines
Quoted 4 lines

I haven't tested the patches before. Now I tested them and the Nexio touchscreen does not play well with suspend. It always reconnects after resume from STR or hibernation. Autosuspend is probably never activated at the URBs are submitted continuously.

I see. Can you compile with CONFIG_USB_DEBUG and send me the log?

This can't be fixed - no matter what you do, the device reconnects if you stop talking to it.

Even if you immediately go into suspend?

Regards
Oliver
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#14 lore raw
In reply to Ondrej Zary

Am Donnerstag, 10. Juni 2010 16:13:51 schrieb Ondrej Zary:

Quoted 9 lines
Quoted 6 lines
Quoted 4 lines

I haven't tested the patches before. Now I tested them and the Nexio touchscreen does not play well with suspend. It always reconnects after resume from STR or hibernation. Autosuspend is probably never activated at the URBs are submitted continuously.

I see. Can you compile with CONFIG_USB_DEBUG and send me the log?

This can't be fixed - no matter what you do, the device reconnects if you stop talking to it.

Have you tried setting it back to config 0?

Regards
Oliver

#15 lore raw
Quoted 6 lines · On Friday 18 June 2010 20:22:07 Oliver Neukum wrote:

Am Donnerstag, 10. Juni 2010 16:13:51 schrieb Ondrej Zary:

Quoted 5 lines
Quoted 5 lines
Quoted 4 lines

I haven't tested the patches before. Now I tested them and the Nexio touchscreen does not play well with suspend. It always reconnects after resume from STR or hibernation. Autosuspend is probably never activated at the URBs are submitted continuously.

Quoted 6 lines
Quoted 4 lines
Quoted 1 line

I see. Can you compile with CONFIG_USB_DEBUG and send me the log?

This can't be fixed - no matter what you do, the device reconnects if you stop talking to it.

Have you tried setting it back to config 0?

No, I haven't. It reconnects even if there's no driver loaded (e.g. older kernel). I don't know if kernel sets configuration on all USB devices upon connect (even if there's no driver).

Signature · 1 line
Ondrej Zary

A message that is not in the archive (sent off-list or not yet received): 201006182034.05793.linux-ZCIryABCsrmttCpgsWEBFmD2FQJk+8+b@public.gmane.org

#17 lore raw

Am Freitag, 18. Juni 2010 20:34:03 schrieb Ondrej Zary:

Quoted 9 lines · On Friday 18 June 2010 20:22:07 Oliver Neukum wrote:
Quoted 8 lines

Am Donnerstag, 10. Juni 2010 16:13:51 schrieb Ondrej Zary:

Quoted 7 lines
Quoted 6 lines
Quoted 4 lines

I haven't tested the patches before. Now I tested them and the Nexio touchscreen does not play well with suspend. It always reconnects after resume from STR or hibernation. Autosuspend is probably never activated at the URBs are submitted continuously.

I see. Can you compile with CONFIG_USB_DEBUG and send me the log?

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

This can't be fixed - no matter what you do, the device reconnects if you stop talking to it.

Have you tried setting it back to config 0?

No, I haven't. It reconnects even if there's no driver loaded (e.g. older kernel). I don't know if kernel sets configuration on all USB devices upon connect (even if there's no driver).

Yes, the kernel sets a configuration if the power budget allows it. You can set it back to 0 through sysfs and see what happens.

Regards
Oliver
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#18 lore raw
Quoted 13 lines · Oliver Neukum

Am Freitag, 18. Juni 2010 20:34:03 schrieb Ondrej Zary:

Quoted 12 lines · On Friday 18 June 2010 20:22:07 Oliver Neukum wrote:
Quoted 11 lines

Am Donnerstag, 10. Juni 2010 16:13:51 schrieb Ondrej Zary:

Quoted 9 lines
Quoted 6 lines
Quoted 4 lines

I haven't tested the patches before. Now I tested them and the Nexio touchscreen does not play well with suspend. It always reconnects after resume from STR or hibernation. Autosuspend is probably never activated at the URBs are submitted continuously.

I see. Can you compile with CONFIG_USB_DEBUG and send me the log?

This can't be fixed - no matter what you do, the device reconnects if you stop talking to it.

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

Have you tried setting it back to config 0?

No, I haven't. It reconnects even if there's no driver loaded (e.g. older kernel). I don't know if kernel sets configuration on all USB devices upon connect (even if there's no driver).

Yes, the kernel sets a configuration if the power budget allows it. You can set it back to 0 through sysfs and see what happens.

It disconnects and reconnects after bConfigurationValue is set to 0.

Signature · 1 line
Ondrej Zary
#19 lore raw

Am Dienstag, 22. Juni 2010, 13:06:12 schrieb Ondrej Zary:

Quoted 16 lines · Oliver Neukum
Quoted 15 lines

Am Freitag, 18. Juni 2010 20:34:03 schrieb Ondrej Zary:

Quoted 14 lines · On Friday 18 June 2010 20:22:07 Oliver Neukum wrote:
Quoted 12 lines

Am Donnerstag, 10. Juni 2010 16:13:51 schrieb Ondrej Zary:

Quoted 9 lines
Quoted 6 lines
Quoted 4 lines

I haven't tested the patches before. Now I tested them and the Nexio touchscreen does not play well with suspend. It always reconnects after resume from STR or hibernation. Autosuspend is probably never activated at the URBs are submitted continuously.

I see. Can you compile with CONFIG_USB_DEBUG and send me the log?

This can't be fixed - no matter what you do, the device reconnects if you stop talking to it.

Have you tried setting it back to config 0?

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

No, I haven't. It reconnects even if there's no driver loaded (e.g. older kernel). I don't know if kernel sets configuration on all USB devices upon connect (even if there's no driver).

Yes, the kernel sets a configuration if the power budget allows it. You can set it back to 0 through sysfs and see what happens.

It disconnects and reconnects after bConfigurationValue is set to 0.

This is a violation of the spec. Can you give me the IDs so that I can put the devices into the quirks file? Or can I take this from the driver? Do all devices that marked as always needing an irq transfer behave this way?

Regards
Oliver

A message that is not in the archive (sent off-list or not yet received): 201006221524.25084.oliver-GvhC2dPhHPQdnm+yROfE0A@public.gmane.org

#21 lore raw
Quoted 26 lines · Oliver Neukum

Am Dienstag, 22. Juni 2010, 13:06:12 schrieb Ondrej Zary:

Quoted 25 lines · Oliver Neukum
Quoted 23 lines

Am Freitag, 18. Juni 2010 20:34:03 schrieb Ondrej Zary:

Quoted 11 lines · On Friday 18 June 2010 20:22:07 Oliver Neukum wrote:
Quoted 10 lines

Am Donnerstag, 10. Juni 2010 16:13:51 schrieb Ondrej Zary:

Quoted 9 lines
Quoted 8 lines
Quoted 5 lines

I haven't tested the patches before. Now I tested them and the Nexio touchscreen does not play well with suspend. It always reconnects after resume from STR or hibernation. Autosuspend is probably never activated at the URBs are submitted continuously.

I see. Can you compile with CONFIG_USB_DEBUG and send me the log?

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

This can't be fixed - no matter what you do, the device reconnects if you stop talking to it.

Have you tried setting it back to config 0?

No, I haven't. It reconnects even if there's no driver loaded (e.g. older kernel). I don't know if kernel sets configuration on all USB devices upon connect (even if there's no driver).

Yes, the kernel sets a configuration if the power budget allows it. You can set it back to 0 through sysfs and see what happens.

Quoted 6 lines
Quoted 1 line

It disconnects and reconnects after bConfigurationValue is set to 0.

This is a violation of the spec. Can you give me the IDs so that I can put the devices into the quirks file? Or can I take this from the driver? Do all devices that marked as always needing an irq transfer behave this way?

This is not a bug surprise as this device is broken in many ways. It takes ages to detect and identify and looks like cdc_acm. The pseudo-multitouch capable protocol is pretty bad too. Also there are some reports about devices using the same ID but different protocol.

I have only one - 1870:0001, don't know anything about the other.

Signature · 5 lines
Ondrej Zary
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 201006221543.27169.linux-ZCIryABCsrmttCpgsWEBFmD2FQJk+8+b@public.gmane.org

#23 lore raw

Am Dienstag, 22. Juni 2010, 15:43:24 schrieb Ondrej Zary:

Quoted 7 lines · Oliver Neukum
Quoted 5 lines

This is a violation of the spec. Can you give me the IDs so that I can put the devices into the quirks file? Or can I take this from the driver? Do all devices that marked as always needing an irq transfer behave this way?

Quoted 6 lines

This is not a bug surprise as this device is broken in many ways. It takes ages to detect and identify and looks like cdc_acm. The pseudo-multitouch capable protocol is pretty bad too. Also there are some reports about devices using the same ID but different protocol.

I have only one - 1870:0001, don't know anything about the other.

OK, it seems like those devices are hopeless. Could you test this series form harmlessness on a broken device and functionality on a non-broken device?

Regards
Oliver

From 0f28efab0c7c48dc02f728f57d4a89a203bac986 Mon Sep 17 00:00:00 2001
From: Oliver Neukum <[email protected]>
Date: Thu, 24 Jun 2010 08:20:34 +0200
Subject: [PATCH 1/3] usbtouchscreen: Implement basic suspend/resume

This implements basic support for suspend & resume

---
 drivers/input/touchscreen/usbtouchscreen.c |   23 +++++++++++++++++++++++
 1 files changed, 23 insertions(+), 0 deletions(-)
drivers/input/touchscreen/usbtouchscreen.c +23 -0
index 567d572..f51d2fd 100644
@@ -1291,6 +1291,27 @@ static void usbtouch_close(struct input_dev *input)
 		usb_kill_urb(usbtouch->irq);
 }
 
+static int usbtouch_suspend
+(struct usb_interface *intf, pm_message_t message)
+{
+	struct usbtouch_usb *usbtouch = usb_get_intfdata(intf);
+	
+	usb_kill_urb(usbtouch->irq);
+	return 0;
+}
+
+static int usbtouch_resume(struct usb_interface *intf)
+{
+	struct usbtouch_usb *usbtouch = usb_get_intfdata(intf);
+	struct input_dev *input = usbtouch->input;
+	int result = 0;
+	
+	mutex_lock(&input->mutex);
+	if (input->users || usbtouch->type->irq_always)
+		result = usb_submit_urb(usbtouch->irq, GFP_NOIO);
+	mutex_unlock(&input->mutex);
+	return result;
+}
 
 static void usbtouch_free_buffers(struct usb_device *udev,
 				  struct usbtouch_usb *usbtouch)
@@ -1481,6 +1502,8 @@ static struct usb_driver usbtouch_driver = {
 	.name		= "usbtouchscreen",
 	.probe		= usbtouch_probe,
 	.disconnect	= usbtouch_disconnect,
+	.suspend	= usbtouch_suspend,
+	.resume		= usbtouch_resume,
 	.id_table	= usbtouch_devices,
 };
 
Signature · 1 line
1.7.1

From 71b07110871d7b9e754a3b56f3e914745c329be6 Mon Sep 17 00:00:00 2001
From: Oliver Neukum <[email protected]>
Date: Thu, 24 Jun 2010 08:38:57 +0200
Subject: [PATCH 2/3] usbtouchscreen: Implement runtime power management

This implement USB autosuspend while the device is opened for devices that do remote wakeup with a fallback to open/close for those devices that don't. Devices that require the host to constantly poll them are never autosuspended.

---
 drivers/input/touchscreen/usbtouchscreen.c |   27 ++++++++++++++++++++++++---
 1 files changed, 24 insertions(+), 3 deletions(-)
drivers/input/touchscreen/usbtouchscreen.c +24 -3
index f51d2fd..3c57df8 100644
@@ -1263,6 +1263,7 @@ static void usbtouch_irq(struct urb *urb)
 	usbtouch->type->process_pkt(usbtouch, usbtouch->data, urb->actual_length);
 
 exit:
+	usb_mark_last_busy(interface_to_usbdev(usbtouch->interface));
 	retval = usb_submit_urb(urb, GFP_ATOMIC);
 	if (retval)
 		err("%s - usb_submit_urb failed with result: %d",
@@ -1272,23 +1273,39 @@ exit:
 static int usbtouch_open(struct input_dev *input)
 {
 	struct usbtouch_usb *usbtouch = input_get_drvdata(input);
+	int r;
 
 	usbtouch->irq->dev = interface_to_usbdev(usbtouch->interface);
 
+	r = usb_autopm_get_interface(usbtouch->interface) ? -EIO : 0;
+	if (r < 0)
+		goto out;
+	
 	if (!usbtouch->type->irq_always) {
-		if (usb_submit_urb(usbtouch->irq, GFP_KERNEL))
-		  return -EIO;
+		if (usb_submit_urb(usbtouch->irq, GFP_KERNEL)) {
+			r = -EIO;
+			goto out_put;
+		}
 	}
 
-	return 0;
+	usbtouch->interface->needs_remote_wakeup = 1;
+out_put:
+	usb_autopm_put_interface(usbtouch->interface);
+out:
+	return r;
 }
 
 static void usbtouch_close(struct input_dev *input)
 {
 	struct usbtouch_usb *usbtouch = input_get_drvdata(input);
+	int r;
 
 	if (!usbtouch->type->irq_always)
 		usb_kill_urb(usbtouch->irq);
+	r = usb_autopm_get_interface(usbtouch->interface);
+	usbtouch->interface->needs_remote_wakeup = 0;
+	if (!r)
+		usb_autopm_put_interface(usbtouch->interface);
 }
 
 static int usbtouch_suspend
@@ -1450,8 +1467,11 @@ static int usbtouch_probe(struct usb_interface *intf,
 	usb_set_intfdata(intf, usbtouch);
 
 	if (usbtouch->type->irq_always) {
+		/* this can't fail */
+		usb_autopm_get_interface(intf);
 		err = usb_submit_urb(usbtouch->irq, GFP_KERNEL);
 		if (err) {
+			usb_autopm_put_interface(intf);
 			err("%s - usb_submit_urb failed with result: %d",
 			    __func__, err);
 			goto out_unregister_input;
@@ -1505,6 +1525,7 @@ static struct usb_driver usbtouch_driver = {
 	.suspend	= usbtouch_suspend,
 	.resume		= usbtouch_resume,
 	.id_table	= usbtouch_devices,
+	.supports_autosuspend = 1,
 };
 
 static int __init usbtouch_init(void)
Signature · 1 line
1.7.1

From c12539f30d0585056be37227a8d65976db49241f Mon Sep 17 00:00:00 2001
From: Oliver Neukum <[email protected]>
Date: Thu, 24 Jun 2010 08:50:25 +0200
Subject: [PATCH 3/3] usbtouchscreen: Implement reset_resume()

This implements reset_resume() by splitting init into allocations of private data structures and device initializations. Device initializations are repeated upon reset_resume.

---
 drivers/input/touchscreen/usbtouchscreen.c |  108 +++++++++++++++++++--------
 1 files changed, 76 insertions(+), 32 deletions(-)
drivers/input/touchscreen/usbtouchscreen.c +76 -32

184 lines not on this page · raw message

Signature · 1 line
1.7.1
#24 lore raw
Quoted 12 lines · Oliver Neukum

Am Dienstag, 22. Juni 2010, 15:43:24 schrieb Ondrej Zary:

Quoted 11 lines · Oliver Neukum
Quoted 4 lines

This is a violation of the spec. Can you give me the IDs so that I can put the devices into the quirks file? Or can I take this from the driver? Do all devices that marked as always needing an irq transfer behave this way?

This is not a bug surprise as this device is broken in many ways. It takes ages to detect and identify and looks like cdc_acm. The pseudo-multitouch capable protocol is pretty bad too. Also there are some reports about devices using the same ID but different protocol.

Quoted 5 lines
Quoted 1 line

I have only one - 1870:0001, don't know anything about the other.

OK, it seems like those devices are hopeless. Could you test this series form harmlessness on a broken device and functionality on a non-broken device?

Tested with:
0eef:0001 D-WAV Scientific Co., Ltd eGalax TouchScreen 595a:0001 IRTOUCHSYSTEMS Co. Ltd. Touchscreen 1870:0001 Nexio Co., Ltd iNexio Touchscreen controller

The patches have no visible effect on these devices so they're probably OK.

Signature · 1 line
Ondrej Zary