diff mbox series

Revert "media: dvb-usb: Fix unexpected infinite loop in dvb_usb_read_remote_control()"

Message ID 20240808084757.18084-1-sean@mess.org (mailing list archive)
State New
Headers show
Series Revert "media: dvb-usb: Fix unexpected infinite loop in dvb_usb_read_remote_control()" | expand

Commit Message

Sean Young Aug. 8, 2024, 8:47 a.m. UTC
This reverts commit 2052138b7da52ad5ccaf74f736d00f39a1c9198c.

This breaks the TeVii s480 dual DVB-S2 S660. The device has a bulk in
endpoint but no corresponding out endpoint, so the device does not pass
the "has both receive and send bulk endpoint" test.

Seemingly this device does not use dvb_usb_generic_rw() so I have tried
removing the generic_bulk_ctrl_endpoint entry, but this resulted in
different problems.

As we have no explanation yet, revert.

$ dmesg | grep -i -e dvb -e dw21 -e usb\ 4
[    0.999122] usb 1-1: new high-speed USB device number 2 using ehci-pci
[    1.023123] usb 4-1: new high-speed USB device number 2 using ehci-pci
[    1.130247] usb 1-1: New USB device found, idVendor=9022, idProduct=d482,
+bcdDevice= 0.01
[    1.130257] usb 1-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[    1.152323] usb 4-1: New USB device found, idVendor=9022, idProduct=d481,
+bcdDevice= 0.01
[    1.152329] usb 4-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[    6.701033] dvb-usb: found a 'TeVii S480.2 USB' in cold state, will try to
+load a firmware
[    6.701178] dvb-usb: downloading firmware from file 'dvb-usb-s660.fw'
[    6.701179] dw2102: start downloading DW210X firmware
[    6.703715] dvb-usb: found a 'Microsoft Xbox One Digital TV Tuner' in cold
+state, will try to load a firmware
[    6.703974] dvb-usb: downloading firmware from file 'dvb-usb-dib0700-1.20.fw'
[    6.756432] usb 1-1: USB disconnect, device number 2
[    6.862119] dvb-usb: found a 'TeVii S480.2 USB' in warm state.
[    6.862194] dvb-usb: TeVii S480.2 USB error while loading driver (-22)
[    6.862209] dvb-usb: found a 'TeVii S480.1 USB' in cold state, will try to
+load a firmware
[    6.862244] dvb-usb: downloading firmware from file 'dvb-usb-s660.fw'
[    6.862245] dw2102: start downloading DW210X firmware
[    6.914811] usb 4-1: USB disconnect, device number 2
[    7.014131] dvb-usb: found a 'TeVii S480.1 USB' in warm state.
[    7.014487] dvb-usb: TeVii S480.1 USB error while loading driver (-22)
[    7.014538] usbcore: registered new interface driver dw2102

Closes: https://lore.kernel.org/stable/20240801165146.38991f60@mir/
Reported-by: Stefan Lippers-Hollmann <s.l-h@gmx.de>
Signed-off-by: Sean Young <sean@mess.org>
---
 drivers/media/usb/dvb-usb/dvb-usb-init.c | 35 +++---------------------
 1 file changed, 4 insertions(+), 31 deletions(-)

Comments

Stefan Lippers-Hollmann Aug. 8, 2024, 7:20 p.m. UTC | #1
Hi

On 2024-08-08, Sean Young wrote:
> This reverts commit 2052138b7da52ad5ccaf74f736d00f39a1c9198c.
>
> This breaks the TeVii s480 dual DVB-S2 S660. The device has a bulk in
> endpoint but no corresponding out endpoint, so the device does not pass
> the "has both receive and send bulk endpoint" test.
>
> Seemingly this device does not use dvb_usb_generic_rw() so I have tried
> removing the generic_bulk_ctrl_endpoint entry, but this resulted in
> different problems.
>
> As we have no explanation yet, revert.

Tested-by: Stefan Lippers-Hollmann <s.l-h@gmx.de>

I can confirm that this revert is working on my TeVii s480, both
frontends are working and no error messages from ds3000_writereg
anymore.

$ dmesg | grep -i -e dvb -e dw2102 -e ds3000 -e ts2020
[    1.701918] usb 4-1: Product: DVBS2BOX
[    1.719977] usb 6-1: Product: DVBS2BOX
[    4.443254] dvb-usb: found a 'TeVii S660 USB' in cold state, will try to load a firmware
[    4.445002] dvb-usb: downloading firmware from file 'dvb-usb-s660.fw'
[    4.445006] dw2102: start downloading DW210X firmware
[    4.616595] dvb-usb: found a 'TeVii S660 USB' in warm state.
[    4.616654] dvb-usb: will pass the complete MPEG2 transport stream to the software demuxer.
[    4.617080] dvbdev: DVB: registering new adapter (TeVii S660 USB)
[    4.850800] dvb-usb: MAC address: 00:18:bd:XX:XX:XX
[    4.850931] dvbdev: dvb_create_media_entity: media entity 'dvb-demux' registered.
[    4.859527] DS3000 chip version: 0.192 attached.
[    4.920936] ts2020 9-0060: Montage Technology TS2020 successfully identified
[    4.921577] dw2102: Attached ds3000+ts2020!
[    4.921599] usb 4-1: DVB: registering adapter 0 frontend 0 (Montage Technology DS3000)...
[    4.921608] dvbdev: dvb_create_media_entity: media entity 'Montage Technology DS3000' registered.
[    4.948752] rc rc1: lirc_dev: driver dw2102 registered at minor = 1, scancode receiver, no transmitter
[    4.948875] dvb-usb: schedule remote query interval to 150 msecs.
[    4.948879] dvb-usb: TeVii S660 USB successfully initialized and connected.
[    4.948937] dvb-usb: found a 'TeVii S660 USB' in cold state, will try to load a firmware
[    4.948979] dvb-usb: downloading firmware from file 'dvb-usb-s660.fw'
[    4.948981] dw2102: start downloading DW210X firmware
[    5.104581] dvb-usb: found a 'TeVii S660 USB' in warm state.
[    5.104663] dvb-usb: will pass the complete MPEG2 transport stream to the software demuxer.
[    5.105030] dvbdev: DVB: registering new adapter (TeVii S660 USB)
[    5.351019] dvb-usb: MAC address: 00:18:bd:XX:XX:XX
[    5.351265] dvbdev: dvb_create_media_entity: media entity 'dvb-demux' registered.
[    5.354757] DS3000 chip version: 0.192 attached.
[    5.392646] ts2020 10-0060: Montage Technology TS2020 successfully identified
[    5.393030] dw2102: Attached ds3000+ts2020!
[    5.393038] usb 6-1: DVB: registering adapter 1 frontend 0 (Montage Technology DS3000)...
[    5.393048] dvbdev: dvb_create_media_entity: media entity 'Montage Technology DS3000' registered.
[    5.394468] rc rc2: lirc_dev: driver dw2102 registered at minor = 2, scancode receiver, no transmitter
[    5.394697] dvb-usb: schedule remote query interval to 150 msecs.
[    5.394704] dvb-usb: TeVii S660 USB successfully initialized and connected.
[    5.394764] usbcore: registered new interface driver dw2102
[    8.741397] ds3000_firmware_ondemand: Waiting for firmware upload (dvb-fe-ds3000.fw)...
[    8.741712] ds3000_firmware_ondemand: Waiting for firmware upload(2)...
[    9.304511] ds3000_firmware_ondemand: Waiting for firmware upload (dvb-fe-ds3000.fw)...
[    9.304551] ds3000_firmware_ondemand: Waiting for firmware upload(2)...
[    9.913428] ds3000_firmware_ondemand: Waiting for firmware upload (dvb-fe-ds3000.fw)...
[    9.913454] ds3000_firmware_ondemand: Waiting for firmware upload(2)...

Thanks a lot, if there's any other testing to be done, I'll always be
available. Hoping that these two cards remain working for quite a while
to come, as there doesn't seem to be any replacements on the market (let
alone for reasonable prices).

Regards
	Stefan Lippers-Hollmann
diff mbox series

Patch

diff --git a/drivers/media/usb/dvb-usb/dvb-usb-init.c b/drivers/media/usb/dvb-usb/dvb-usb-init.c
index 22d83ac18eb7..fbf58012becd 100644
--- a/drivers/media/usb/dvb-usb/dvb-usb-init.c
+++ b/drivers/media/usb/dvb-usb/dvb-usb-init.c
@@ -23,40 +23,11 @@  static int dvb_usb_force_pid_filter_usage;
 module_param_named(force_pid_filter_usage, dvb_usb_force_pid_filter_usage, int, 0444);
 MODULE_PARM_DESC(force_pid_filter_usage, "force all dvb-usb-devices to use a PID filter, if any (default: 0).");
 
-static int dvb_usb_check_bulk_endpoint(struct dvb_usb_device *d, u8 endpoint)
-{
-	if (endpoint) {
-		int ret;
-
-		ret = usb_pipe_type_check(d->udev, usb_sndbulkpipe(d->udev, endpoint));
-		if (ret)
-			return ret;
-		ret = usb_pipe_type_check(d->udev, usb_rcvbulkpipe(d->udev, endpoint));
-		if (ret)
-			return ret;
-	}
-	return 0;
-}
-
-static void dvb_usb_clear_halt(struct dvb_usb_device *d, u8 endpoint)
-{
-	if (endpoint) {
-		usb_clear_halt(d->udev, usb_sndbulkpipe(d->udev, endpoint));
-		usb_clear_halt(d->udev, usb_rcvbulkpipe(d->udev, endpoint));
-	}
-}
-
 static int dvb_usb_adapter_init(struct dvb_usb_device *d, short *adapter_nrs)
 {
 	struct dvb_usb_adapter *adap;
 	int ret, n, o;
 
-	ret = dvb_usb_check_bulk_endpoint(d, d->props.generic_bulk_ctrl_endpoint);
-	if (ret)
-		return ret;
-	ret = dvb_usb_check_bulk_endpoint(d, d->props.generic_bulk_ctrl_endpoint_response);
-	if (ret)
-		return ret;
 	for (n = 0; n < d->props.num_adapters; n++) {
 		adap = &d->adapter[n];
 		adap->dev = d;
@@ -132,8 +103,10 @@  static int dvb_usb_adapter_init(struct dvb_usb_device *d, short *adapter_nrs)
 	 * when reloading the driver w/o replugging the device
 	 * sometimes a timeout occurs, this helps
 	 */
-	dvb_usb_clear_halt(d, d->props.generic_bulk_ctrl_endpoint);
-	dvb_usb_clear_halt(d, d->props.generic_bulk_ctrl_endpoint_response);
+	if (d->props.generic_bulk_ctrl_endpoint != 0) {
+		usb_clear_halt(d->udev, usb_sndbulkpipe(d->udev, d->props.generic_bulk_ctrl_endpoint));
+		usb_clear_halt(d->udev, usb_rcvbulkpipe(d->udev, d->props.generic_bulk_ctrl_endpoint));
+	}
 
 	return 0;