From: Johan Hovold <johan@kernel.org> Date: 2014-07-14 18:26:15
[ +CC: Jiri and linux-input ]
On Wed, Jul 09, 2014 at 03:07:33PM +0200, Johan Hovold wrote:
On Mon, Jul 07, 2014 at 10:34:30PM -0700, Greg Kroah-Hartman wrote:
quoted
On Mon, Jul 07, 2014 at 11:24:42AM +0200, Johan Hovold wrote:
quoted
quoted
I ended up getting the same laptop so now I'm facing the same problem
with repeated disconnects (especially during resume, which is really
annoying as it adds about a minute to resume time), even with a
hard-coded check-high speed "quirk" and the multitouch driver loaded.
Did you manage to fix the disconnect issue? Are you seeing something
similar at resume?
No, it all seems to work for me. Here's my horrible "hack" I'm running
with on 3.16-rc.
I have seen some issues at times when the touchscreen stops working on
resume, but it just seems "dead". An unload/load of the xhci-hcd module
always fixes that :)
Ok. I'm effectively using the same hack as you, but I'm seeing these
repeated disconnects during resume for about a minute still. Everything
compiled in, so no modules (or fancy hibernate scripts) though.
quoted
I'll work on making this a "real" patch this week, when I dig out from
my pending patch queue...
Ok, I'll wait for that, and will try to find time to debug this later.
The timeout I experienced during resume was due to the wifi firmware not
being compiled in, but during that minute the touchscreen device kept
disconnecting every other second.
I get one such disconnect before X is started during normal boot as
well. It appears that something has to open the input device at least
once or the device will keep disconnecting itself (e.g. not booting into
X also triggers the repeated disconnects).
A simple
cat /dev/input/by-path/pci-0000:00:14.0-usb-0:7:1.0-event
is enough to stop the device from disconnecting. But unless the device
is kept open (and the interrupt-in urb submitted) any input event (i.e.
touching the screen) causes the device to start disconnecting
repeatedly again.
Adding something like the below (on top of the check-highspeed quirk)
fixes the repeated disconnect when the device is not open. (It cannot
prevent the disconnects during a lengthy resume though as reset_resume
will not have run yet.)
Is there any better way to fix this?
Thanks,
Johan
From 8101c0dfd42a232f1d2872de4f412d8d61d5646f Mon Sep 17 00:00:00 2001
From: Johan Hovold <johan@kernel.org>
Date: Mon, 14 Jul 2014 18:43:31 +0200
Subject: [PATCH] HID: usbhid: add HID_QUIRK_IN
Add quirk to submit the interrupt-in urb already at start() rather than
at open().
This is needed for devices that disconnects from the bus unless the
interrupt endpoint has been polled at least once or when not responding
to input events.
---
drivers/hid/usbhid/hid-core.c | 26 +++++++++++++++++++++++---
include/linux/hid.h | 1 +
2 files changed, 24 insertions(+), 3 deletions(-)
@@ -1133,6 +1137,20 @@ static int usbhid_start(struct hid_device *hid)set_bit(HID_STARTED,&usbhid->iofl);+hid->quirks|=HID_QUIRK_IN;/* FIXME */+if(hid->quirks&HID_QUIRK_IN){+ret=usb_autopm_get_interface(usbhid->intf);+if(ret)+gotofail;+usbhid->intf->needs_remote_wakeup=1;+ret=hid_start_in(hid);+if(ret){+dev_err(&hid->dev,+"failed to start in urb: %d\n",ret);+}+usb_autopm_put_interface(usbhid->intf);+}+/* Some keyboards don't work until their LEDs have been set.*SinceBIOSesdosettheLEDs,itmustbesafeforanydevice*thatsupportsthekeyboardbootprotocol.
@@ -1165,6 +1183,8 @@ static void usbhid_stop(struct hid_device *hid)if(WARN_ON(!usbhid))return;+usbhid->intf->needs_remote_wakeup=0;+clear_bit(HID_STARTED,&usbhid->iofl);spin_lock_irq(&usbhid->lock);/* Sync with error and led handlers */set_bit(HID_DISCONNECTED,&usbhid->iofl);
From 8101c0dfd42a232f1d2872de4f412d8d61d5646f Mon Sep 17 00:00:00 2001
From: Johan Hovold <johan@kernel.org>
Date: Mon, 14 Jul 2014 18:43:31 +0200
Subject: [PATCH] HID: usbhid: add HID_QUIRK_IN
Add quirk to submit the interrupt-in urb already at start() rather than
at open().
This is needed for devices that disconnects from the bus unless the
interrupt endpoint has been polled at least once or when not responding
to input events.
It's not really super-nice, but if no other way around it has been found
to be possible in USB core, I am willing to take this.
This of course needs to be set on per-device basis :)
quoted hunk
+ if (hid->quirks & HID_QUIRK_IN) {
+ ret = usb_autopm_get_interface(usbhid->intf);
+ if (ret)
+ goto fail;
+ usbhid->intf->needs_remote_wakeup = 1;
+ ret = hid_start_in(hid);
+ if (ret) {
+ dev_err(&hid->dev,
+ "failed to start in urb: %d\n", ret);
+ }
+ usb_autopm_put_interface(usbhid->intf);
+ }
+
/* Some keyboards don't work until their LEDs have been set.
* Since BIOSes do set the LEDs, it must be safe for any device
* that supports the keyboard boot protocol.
@@ -1165,6 +1183,8 @@ static void usbhid_stop(struct hid_device *hid) if (WARN_ON(!usbhid)) return;+ usbhid->intf->needs_remote_wakeup = 0;+ clear_bit(HID_STARTED, &usbhid->iofl); spin_lock_irq(&usbhid->lock); /* Sync with error and led handlers */ set_bit(HID_DISCONNECTED, &usbhid->iofl);
0x00000400 has been removed before dynamic quirks started to be possible,
so there is no potential clash, that's fine.
I'd just propose some more descriptive name for the quirk ... how about
something like HID_QUIRK_EARLY_INTERRUPT?
Thanks,
--
Jiri Kosina
SUSE Labs
From: Johan Hovold <johan@kernel.org> Date: 2014-08-21 10:55:29
On Wed, Aug 20, 2014 at 08:20:43AM -0500, Jiri Kosina wrote:
On Mon, 14 Jul 2014, Johan Hovold wrote:
quoted
From 8101c0dfd42a232f1d2872de4f412d8d61d5646f Mon Sep 17 00:00:00 2001
From: Johan Hovold <johan@kernel.org>
Date: Mon, 14 Jul 2014 18:43:31 +0200
Subject: [PATCH] HID: usbhid: add HID_QUIRK_IN
Add quirk to submit the interrupt-in urb already at start() rather than
at open().
This is needed for devices that disconnects from the bus unless the
interrupt endpoint has been polled at least once or when not responding
to input events.
It's not really super-nice, but if no other way around it has been found
to be possible in USB core, I am willing to take this.
Agreed, it's not that nice, but I'm not aware of any other way to
prevent the device firmware from disconnecting.
Autosuspend still seems to work, so it would not cause much overhead
for people not actually using the touchscreen (as long as autosuspend
is enabled) either.
This of course needs to be set on per-device basis :)
Of course.
quoted
+ if (hid->quirks & HID_QUIRK_IN) {
+ ret = usb_autopm_get_interface(usbhid->intf);
+ if (ret)
+ goto fail;
+ usbhid->intf->needs_remote_wakeup = 1;
+ ret = hid_start_in(hid);
+ if (ret) {
+ dev_err(&hid->dev,
+ "failed to start in urb: %d\n", ret);
+ }
+ usb_autopm_put_interface(usbhid->intf);
+ }
+
/* Some keyboards don't work until their LEDs have been set.
* Since BIOSes do set the LEDs, it must be safe for any device
* that supports the keyboard boot protocol.
@@ -1165,6 +1183,8 @@ static void usbhid_stop(struct hid_device *hid) if (WARN_ON(!usbhid)) return;+ usbhid->intf->needs_remote_wakeup = 0;+ clear_bit(HID_STARTED, &usbhid->iofl); spin_lock_irq(&usbhid->lock); /* Sync with error and led handlers */ set_bit(HID_DISCONNECTED, &usbhid->iofl);
0x00000400 has been removed before dynamic quirks started to be possible,
so there is no potential clash, that's fine.
I'd just propose some more descriptive name for the quirk ... how about
something like HID_QUIRK_EARLY_INTERRUPT?
Yeah, IN was just a working name. How about HID_QUIRK_ALWAYS_POLL or
similar as it is not just about disconnect before the device is opened,
but also if there's an event after the device has been closed (e.g.
stopping X)?
Thanks,
Johan
It's not really super-nice, but if no other way around it has been found
to be possible in USB core, I am willing to take this.
Agreed, it's not that nice, but I'm not aware of any other way to
prevent the device firmware from disconnecting.
Autosuspend still seems to work, so it would not cause much overhead
for people not actually using the touchscreen (as long as autosuspend
is enabled) either.
Okay, good. Will be waiting for your polished patch for this.
[ ... snip ... ]
0x00000400 has been removed before dynamic quirks started to be possible,
so there is no potential clash, that's fine.
I'd just propose some more descriptive name for the quirk ... how about
something like HID_QUIRK_EARLY_INTERRUPT?
Yeah, IN was just a working name. How about HID_QUIRK_ALWAYS_POLL or
similar as it is not just about disconnect before the device is opened,
but also if there's an event after the device has been closed (e.g.
stopping X)?