All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] USB: serial: pl2303: Modify the detection method of PL2303HXN (TYPE_HXN)
@ 2022-06-17 13:35 Charles Yeh
  2022-06-20  9:39 ` Johan Hovold
  0 siblings, 1 reply; 7+ messages in thread
From: Charles Yeh @ 2022-06-17 13:35 UTC (permalink / raw)
  To: gregkh, johan, linux-usb; +Cc: charles-yeh, Charles Yeh

The setting value of bcdUSB & bcdDevice of PL2303TA is the same as the
setting value of bcdUSB & bcdDevice of a certain chip of PL2303HXN

The setting value of bcdUSB & bcdDevice of PL2303TB is the same as the
setting value of bcdUSB & bcdDevice of a certain chip of PL2303HXN

The PL2303HXN series currently has several chips on sale, and several chips
are about to be sold.
The PL2303HXN cannot use bcdDevice to determine the type one by one.

Signed-off-by: Charles Yeh <charlesyeh522@gmail.com>
---
 drivers/usb/serial/pl2303.c | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c
index 3506c47e1eef..95e5fdf3b80a 100644
--- a/drivers/usb/serial/pl2303.c
+++ b/drivers/usb/serial/pl2303.c
@@ -436,22 +436,23 @@ static int pl2303_detect_type(struct usb_serial *serial)
 		break;
 	case 0x200:
 		switch (bcdDevice) {
-		case 0x100:
-		case 0x105:
-		case 0x305:
-		case 0x405:
-		case 0x605:
+		case 0x300:
+			if (!pl2303_supports_hx_status(serial))
+				return TYPE_HXN;
+			else
+				return TYPE_TA;
+		case 0x500:
+			if (!pl2303_supports_hx_status(serial))
+				return TYPE_HXN;
+			else
+				return TYPE_TB;
+		default:
 			/*
 			 * 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;
-		case 0x500:
-			return TYPE_TB;
 		}
 		break;
 	}
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-06-21  8:17 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-17 13:35 [PATCH] USB: serial: pl2303: Modify the detection method of PL2303HXN (TYPE_HXN) Charles Yeh
2022-06-20  9:39 ` Johan Hovold
2022-06-20 10:51   ` Charles Yeh
2022-06-20 12:41     ` Johan Hovold
2022-06-21  4:41       ` Charles Yeh
2022-06-21  8:06         ` Johan Hovold
2022-06-21  8:17           ` Charles Yeh

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.