linux/drivers/media/rc
A Sun 19d41a2899 media: mceusb: USB reset device following USB clear halt error
This patch schedules a USB reset device call following a USB clear
halt error. The issues solved, and patch implementation,
are similar to those found in
  drivers/hid/usbhid/hid-core.c.

As seen on very rare occasions approximately one time per month
(mceusb device 2304:0225 in this sample)
  Jul 27 2018 15:09:39
  [59388.696941] mceusb 1-1.1.2:1.0: Error: urb status = -32 (RX HALT)
  [59388.698838] mceusb 1-1.1.2:1.0: rx clear halt error -32
the device can get into RX or TX HALT state where usb_clear_halt()
also fails and also returns -EPIPE (HALT/STALL). After which, all
further mceusb device control and data I/O always fail with HALT/STALL.
Subsequently, the entire mceusb device no longer functions.
Cause and problem replication conditions remain unknown.

Further troubleshooting reveals usb_reset_device()
restores mceusb device operation.

Patch test 1:

Hot unplugging the mceusb device triggers USB RX HALT and
USB clear halt errors. A mceusb_dev_disconnect() call follows unplug.
This patch's reset device call invokes an extra
  mceusb_dev_probe()
  mceusb_dev_disconnect()
cycle, before the mceusb driver detaches.
The additional probe/disconnect verifies the patch's device reset
code executed.

But note this patch is for USB clear halt error cases not caused by
unplugging the mceusb device.

Patch test 2:

Simulate a RX HALT and a clear halt error with instrumented code in
the driver.
  Jul 12 2019 19:41:18
  [522745.263104] mceusb 1-1.3:1.0: set rx halt retval, 0
  [522745.263943] mceusb 1-1.3:1.0: Error: rx urb status = -32 (RX HALT)
  [522745.263970] mceusb 1-1.3:1.0: kevent 1 scheduled
  [522745.264016] mceusb 1-1.3:1.0: kevent handler called (flags 0x2)
  [522745.272883] mceusb 1-1.3:1.0: rx clear halt status = 0
  [522745.272917] mceusb 1-1.3:1.0: stuck RX HALT state requires USB Reset Device to clear
  [522745.273005] mceusb 1-1.3:1.0: mceusb_dev_disconnect called
  [522745.702815] usb 1-1.3: reset full-speed USB device number 14 using dwc_otg
  [522745.836812] mceusb 1-1.3:1.0: mceusb_dev_probe called
  [522745.836823] mceusb 1-1.3:1.0: acceptable bulk inbound endpoint found
  [522745.836832] mceusb 1-1.3:1.0: acceptable bulk outbound endpoint found
  ...
The result matches what is expected when the device gets into
a real rx clear halt error case by itself.
This is the same sequence of messages when manually invoking
the ./usbreset command line utility with an unpatched mceusb driver.

Signed-off-by: A Sun <as1033x@comcast.net>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2019-07-22 15:29:53 -04:00
..
img-ir treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
keymaps media updates for v5.3-rc1 2019-07-09 09:47:22 -07:00
ati_remote.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157 2019-05-30 11:26:37 -07:00
bpf-lirc.c bpf: media: properly use bpf_prog_array api 2019-05-29 15:17:35 +02:00
ene_ir.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157 2019-05-30 11:26:37 -07:00
ene_ir.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157 2019-05-30 11:26:37 -07:00
fintek-cir.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157 2019-05-30 11:26:37 -07:00
fintek-cir.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157 2019-05-30 11:26:37 -07:00
gpio-ir-recv.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 284 2019-06-05 17:36:37 +02:00
gpio-ir-tx.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 122 2019-05-24 17:39:03 +02:00
igorplugusb.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157 2019-05-30 11:26:37 -07:00
iguanair.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157 2019-05-30 11:26:37 -07:00
imon_raw.c media: rc: imon_raw: use fls rather than loop per bit 2018-11-22 13:29:27 -05:00
imon.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 158 2019-05-30 11:26:37 -07:00
ir-hix5hd2.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 422 2019-06-05 17:37:15 +02:00
ir-imon-decoder.c media: rc: imon: report mouse events using rc-core's input device 2018-10-05 06:55:08 -04:00
ir-jvc-decoder.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 285 2019-06-05 17:36:37 +02:00
ir-mce_kbd-decoder.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 285 2019-06-05 17:36:37 +02:00
ir-nec-decoder.c media: rc: set timeout to smallest value required by enabled protocols 2018-04-20 09:14:31 -04:00
ir-rc5-decoder.c media: rc: decoders do not need to check for transitions 2018-05-14 07:16:24 -04:00
ir-rc6-decoder.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 285 2019-06-05 17:36:37 +02:00
ir-rcmm-decoder.c media: rc: remove unused including <linux/version.h> 2019-03-19 16:45:25 -04:00
ir-rx51.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157 2019-05-30 11:26:37 -07:00
ir-sanyo-decoder.c media: rc: set timeout to smallest value required by enabled protocols 2018-04-20 09:14:31 -04:00
ir-sharp-decoder.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 285 2019-06-05 17:36:37 +02:00
ir-sony-decoder.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 285 2019-06-05 17:36:37 +02:00
ir-spi.c media: spi: IR LED: add missing of table registration 2019-05-22 15:27:37 -04:00
ir-xmp-decoder.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 285 2019-06-05 17:36:37 +02:00
ite-cir.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157 2019-05-30 11:26:37 -07:00
ite-cir.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157 2019-05-30 11:26:37 -07:00
Kconfig treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
lirc_dev.c media: rc: IR signal for Panasonic air conditioner too long 2019-06-21 15:33:48 -04:00
Makefile media: rc: rcmm decoder and encoder 2019-02-18 15:39:49 -05:00
mceusb.c media: mceusb: USB reset device following USB clear halt error 2019-07-22 15:29:53 -04:00
meson-ir.c media: rc: remove redundant dev_err message 2019-06-27 07:21:06 -04:00
mtk-cir.c media: mtk-cir: lower de-glitch counter for rc-mm protocol 2019-07-22 15:24:16 -04:00
nuvoton-cir.c media: rc: Remove init_ir_raw_event and DEFINE_IR_RAW_EVENT macros 2018-10-04 14:22:27 -04:00
nuvoton-cir.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157 2019-05-30 11:26:37 -07:00
pwm-ir-tx.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 122 2019-05-24 17:39:03 +02:00
rc-core-priv.h media: rc: rcmm decoder and encoder 2019-02-18 15:39:49 -05:00
rc-ir-raw.c media: rc: fix several typos 2019-03-01 09:39:39 -05:00
rc-loopback.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157 2019-05-30 11:26:37 -07:00
rc-main.c media: rc-main: clean-up two warnings 2019-05-23 13:39:21 -04:00
redrat3.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157 2019-05-30 11:26:37 -07:00
serial_ir.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157 2019-05-30 11:26:37 -07:00
sir_ir.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
st_rc.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
streamzap.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157 2019-05-30 11:26:37 -07:00
sunxi-cir.c media: rc: remove redundant dev_err message 2019-06-27 07:21:06 -04:00
tango-ir.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
ttusbir.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157 2019-05-30 11:26:37 -07:00
winbond-cir.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157 2019-05-30 11:26:37 -07:00
xbox_remote.c media: rc: xbox_remote: add protocol and set timeout 2019-04-22 13:02:53 -04:00
zx-irdec.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00