Skip to content

Commit 1e9faef

Browse files
committed
USB: serial: pl2303: fix HX type detection
The device release number for HX-type devices is configurable in EEPROM/OTPROM and cannot be used reliably for type detection. Assume all (non-H) devices with bcdUSB 1.1 and unknown bcdDevice to be of HX type while adding a bcdDevice check for HXD and TB (1.1 and 2.0, respectively). Reported-by: Chris <chris@cyber-anlage.de> Fixes: 8a7bf75 ("USB: serial: pl2303: amend and tighten type detection") Cc: stable@vger.kernel.org # 5.13 Link: https://lore.kernel.org/r/20210730122156.718-1-johan@kernel.org Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Johan Hovold <johan@kernel.org>
1 parent 3c18e9b commit 1e9faef

File tree

1 file changed

+25
-16
lines changed

1 file changed

+25
-16
lines changed

drivers/usb/serial/pl2303.c

Lines changed: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -418,24 +418,33 @@ static int pl2303_detect_type(struct usb_serial *serial)
418418
bcdDevice = le16_to_cpu(desc->bcdDevice);
419419
bcdUSB = le16_to_cpu(desc->bcdUSB);
420420

421-
switch (bcdDevice) {
422-
case 0x100:
423-
/*
424-
* Assume it's an HXN-type if the device doesn't support the old read
425-
* request value.
426-
*/
427-
if (bcdUSB == 0x200 && !pl2303_supports_hx_status(serial))
428-
return TYPE_HXN;
421+
switch (bcdUSB) {
422+
case 0x110:
423+
switch (bcdDevice) {
424+
case 0x300:
425+
return TYPE_HX;
426+
case 0x400:
427+
return TYPE_HXD;
428+
default:
429+
return TYPE_HX;
430+
}
429431
break;
430-
case 0x300:
431-
if (bcdUSB == 0x200)
432+
case 0x200:
433+
switch (bcdDevice) {
434+
case 0x100:
435+
/*
436+
* Assume it's an HXN-type if the device doesn't
437+
* support the old read request value.
438+
*/
439+
if (!pl2303_supports_hx_status(serial))
440+
return TYPE_HXN;
441+
break;
442+
case 0x300:
432443
return TYPE_TA;
433-
434-
return TYPE_HX;
435-
case 0x400:
436-
return TYPE_HXD;
437-
case 0x500:
438-
return TYPE_TB;
444+
case 0x500:
445+
return TYPE_TB;
446+
}
447+
break;
439448
}
440449

441450
dev_err(&serial->interface->dev,

0 commit comments

Comments
 (0)