forked from Minki/linux
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: 8a7bf7510d
("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>
This commit is contained in:
parent
3c18e9baee
commit
1e9faef4d2
@ -418,24 +418,33 @@ static int pl2303_detect_type(struct usb_serial *serial)
|
|||||||
bcdDevice = le16_to_cpu(desc->bcdDevice);
|
bcdDevice = le16_to_cpu(desc->bcdDevice);
|
||||||
bcdUSB = le16_to_cpu(desc->bcdUSB);
|
bcdUSB = le16_to_cpu(desc->bcdUSB);
|
||||||
|
|
||||||
switch (bcdDevice) {
|
switch (bcdUSB) {
|
||||||
case 0x100:
|
case 0x110:
|
||||||
/*
|
switch (bcdDevice) {
|
||||||
* Assume it's an HXN-type if the device doesn't support the old read
|
case 0x300:
|
||||||
* request value.
|
return TYPE_HX;
|
||||||
*/
|
case 0x400:
|
||||||
if (bcdUSB == 0x200 && !pl2303_supports_hx_status(serial))
|
return TYPE_HXD;
|
||||||
return TYPE_HXN;
|
default:
|
||||||
|
return TYPE_HX;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 0x300:
|
case 0x200:
|
||||||
if (bcdUSB == 0x200)
|
switch (bcdDevice) {
|
||||||
|
case 0x100:
|
||||||
|
/*
|
||||||
|
* Assume it's an HXN-type if the device doesn't
|
||||||
|
* support the old read request value.
|
||||||
|
*/
|
||||||
|
if (!pl2303_supports_hx_status(serial))
|
||||||
|
return TYPE_HXN;
|
||||||
|
break;
|
||||||
|
case 0x300:
|
||||||
return TYPE_TA;
|
return TYPE_TA;
|
||||||
|
case 0x500:
|
||||||
return TYPE_HX;
|
return TYPE_TB;
|
||||||
case 0x400:
|
}
|
||||||
return TYPE_HXD;
|
break;
|
||||||
case 0x500:
|
|
||||||
return TYPE_TB;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dev_err(&serial->interface->dev,
|
dev_err(&serial->interface->dev,
|
||||||
|
Loading…
Reference in New Issue
Block a user