Re: ch341

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Dec 08, 2016 at 07:26:26PM -0800, Russell Senior wrote:
> On Thu, Dec 8, 2016 at 10:02 AM, Johan Hovold <johan@xxxxxxxxxx> wrote:
> > On Thu, Dec 08, 2016 at 04:41:44AM -0800, Russell Senior wrote:
> >> >>>>> "Johan" == Johan Hovold <johan@xxxxxxxxxx> writes:
> >>
> >> [...]
> >>
> >> Johan> Ok, and you were using a terminal program such as minicom that
> >> Johan> properly configures the port for say 8-bit words?
> >>
> >> I was using GNU screen, which I don't specifically configure to be
> >> 8-bits, but I retried with minicom and specifically set a different byte
> >> size (non-8) and then set it back to 8, and saw the same 5-bit like
> >> behavior.
> >
> > Ok, try sticking to minicom for any further tests just to be sure.
> >
> >> Johan> [...] But if I configure the port for 5-bit words, I get the
> >> Johan> exact sequence you describe (i.e. the three most-significant bits
> >> Johan> are masked out).
> >>
> >> Johan> So my guess is that either you are not configuring the port
> >> Johan> correctly (and are using the default settings), or the driver
> >> Johan> fails to configure the port (and you are also stuck with the
> >> Johan> default settings).
> >>
> >> Johan> This may be a bit of long shot (or maybe not) but could you try
> >> Johan> the below patch on top of usb-next as well? [...]
> >>
> >> Your patch seems to have fixed it!  Yay!
> >
> > Interesting. I dug through the archives and found a report from Eddi De
> > Pieri which seems to have hit the same issue:
> >
> >         https://lkml.kernel.org/r/CAKdnbx7GTH3K7eGtQ==wh=Kb74EA_eGpii0h8HXxOkLjnhhfPw@xxxxxxxxxxxxxx
> >
> > The weird part is I appear to have the same device, and it works fine
> > without that change.
> >
> > Could you try and just commenting out that register write in a mainline
> > kernel (or my usb-linus branch) to make sure the changes in -next did
> > not cause the issues you still see when connected to a pl2303.
> 
> Okay, I built your usb-linus
> 
> 46490c347df406b3368680dd911620e52dc7bfa4
> 
> with the line:
> 
>    r = ch341_control_out(dev, 0x9a, 0x2518, 0x0050);
> 
> commented out.  More precisely:

> Loopback works, and also interoperates with pl2303 (through a null
> modem adapter).

Interesting indeed. The changes in usb-next enabled support for some
other devices which previously did not work, but hopefully we can find a
combination that works for all (unless we can reliably determine the
device-type during probe).

Can you try the below patch on top of my usb-next branch?

I fear that your device does not support the new way of the setting the
divisor, but let's see if this works first.

Also, when the above change makes usb-linus works, does changing the
word size appear to work after probe?

Thanks,
Johan


>From 611dd2ded0b914442d5256dfb401522e477b9d0c Mon Sep 17 00:00:00 2001
From: Johan Hovold <johan@xxxxxxxxxx>
Date: Fri, 9 Dec 2016 13:45:59 +0100
Subject: [PATCH v2] USB: serial: ch341: change initial LCR settings

Change the initial LCR setting to 8N1 and enable rx and tx.

This should have not effect as the LCR is again later updated at open,
but let's try anyway since we have gotten reports about ch341-devices
that appear to be stuck with 5-bit words.

Not-Yet-Signed-off-by: Johan Hovold <johan@xxxxxxxxxx>
---
 drivers/usb/serial/ch341.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/usb/serial/ch341.c b/drivers/usb/serial/ch341.c
index 2597b83a8ae2..75bb039a7f61 100644
--- a/drivers/usb/serial/ch341.c
+++ b/drivers/usb/serial/ch341.c
@@ -223,16 +223,12 @@ static int ch341_configure(struct usb_device *dev, struct ch341_private *priv)
 	if (r < 0)
 		goto out;
 
-	r = ch341_control_out(dev, CH341_REQ_WRITE_REG, 0x2518, 0x0050);
-	if (r < 0)
-		goto out;
-
 	/* expect 0xff 0xee */
 	r = ch341_get_status(dev, priv);
 	if (r < 0)
 		goto out;
 
-	r = ch341_init_set_baudrate(dev, priv, 0);
+	r = ch341_init_set_baudrate(dev, priv, 0xc3);
 	if (r < 0)
 		goto out;
 
-- 
2.7.3

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux