Linux USB
 help / color / mirror / Atom feed
From: Charles Yeh <charlesyeh522@gmail.com>
To: gregkh@linuxfoundation.org, johan@kernel.org, linux-usb@vger.kernel.org
Cc: charles-yeh@prolific.com.tw, Charles Yeh <charlesyeh522@gmail.com>
Subject: [PATCH] USB: serial: pl2303: Modify the detection method of PL2303HXN (TYPE_HXN)
Date: Fri, 17 Jun 2022 21:35:14 +0800	[thread overview]
Message-ID: <20220617133514.357-1-charlesyeh522@gmail.com> (raw)

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


             reply	other threads:[~2022-06-17 13:35 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-17 13:35 Charles Yeh [this message]
2022-06-20  9:39 ` [PATCH] USB: serial: pl2303: Modify the detection method of PL2303HXN (TYPE_HXN) 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220617133514.357-1-charlesyeh522@gmail.com \
    --to=charlesyeh522@gmail.com \
    --cc=charles-yeh@prolific.com.tw \
    --cc=gregkh@linuxfoundation.org \
    --cc=johan@kernel.org \
    --cc=linux-usb@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox