linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johan Hovold <johan@kernel.org>
To: "Alex Villacís Lasso" <a_villacis@palosanto.com>
Cc: linux-usb@vger.kernel.org
Subject: Re: cp210x module broken in 5.12.5 and 5.12.6, works in 5.11.21 (with bisection)
Date: Tue, 1 Jun 2021 17:40:50 +0200	[thread overview]
Message-ID: <YLZVAmYxFZ1Q/nrH@hovoldconsulting.com> (raw)
In-Reply-To: <2881bd97-f790-c4d6-aed6-de9ab8cd1a9e@palosanto.com>

On Tue, Jun 01, 2021 at 09:51:56AM -0500, Alex Villacís Lasso wrote:

> Here is the full result of the test I performed. First I installed the 
> distro kernel update, kernel-5.12.8-300.fc34.x86_64, then rebooted. 
> Anything with a date is the journalctl output. Everything else is 
> console input and output. I have pasted the relevant journalctl messages 
> immediately after the command or action that triggered them.

> $ miniterm.py /dev/ttyUSB0 115200
> Traceback (most recent call last):
>    File "/usr/bin/miniterm.py", line 976, in <module>
>      main()
>    File "/usr/bin/miniterm.py", line 932, in main
>      serial_instance.open()
>    File "/usr/lib/python3.9/site-packages/serial/serialposix.py", line 
> 288, in open
>      self._update_rts_state()
>    File "/usr/lib/python3.9/site-packages/serial/serialposix.py", line 
> 627, in _update_rts_state
>      fcntl.ioctl(self.fd, TIOCMBIS, TIOCM_RTS_str)
> BrokenPipeError: [Errno 32] Broken pipe
> 
> jun 01 09:23:43 karlalex-asus systemd[1665]: Started VTE child process 
> 3306 launched by gnome-terminal-server process 2856.
> jun 01 09:23:55 karlalex-asus kernel: cp210x ttyUSB0: 
> cp210x_change_speed - setting baud rate to 9600
> jun 01 09:23:55 karlalex-asus kernel: cp210x ttyUSB0: 
> cp210x_set_flow_control - ctrl = 0x00, flow = 0x01
> jun 01 09:23:55 karlalex-asus kernel: cp210x ttyUSB0: 
> cp210x_tiocmset_port - control = 0x0303
> jun 01 09:23:55 karlalex-asus kernel: cp210x ttyUSB0: failed set request 
> 0x7 status: -32
> jun 01 09:23:55 karlalex-asus kernel: cp210x ttyUSB0: 
> cp210x_change_speed - setting baud rate to 115384
> jun 01 09:23:55 karlalex-asus kernel: cp210x ttyUSB0: 
> cp210x_set_flow_control - ctrl = 0x01, flow = 0x40
> jun 01 09:23:55 karlalex-asus kernel: cp210x ttyUSB0: 
> cp210x_tiocmset_port - control = 0x0101
> jun 01 09:23:55 karlalex-asus kernel: cp210x ttyUSB0: 
> cp210x_tiocmset_port - control = 0x0202
> jun 01 09:23:55 karlalex-asus kernel: cp210x ttyUSB0: failed set request 
> 0x7 status: -32
> jun 01 09:23:55 karlalex-asus python3[3362]: detected unhandled Python 
> exception in '/usr/bin/miniterm.py'
> jun 01 09:23:55 karlalex-asus kernel: cp210x ttyUSB0: 
> cp210x_tiocmset_port - control = 0x0300
> jun 01 09:23:55 karlalex-asus kernel: cp210x ttyUSB0: failed set request 
> 0x7 status: -32

Thanks a lot for this.

Could you try applying the below patch, and with debugging enabled

	1. plug the device in
	2. start the terminal program 

and then send me the logs?

This should show the current device settings which appear to have flow
control enabled (which the driver fails to disable).

> I note that the mere act of running stty -a on the device also triggers 
> the error.

Yeah, you'll see this error on every open/close when the driver tries to
assert/deassert RTS.

Johan


From 736c4c099591317d55a20da627db3b148d8d71ca Mon Sep 17 00:00:00 2001
From: Johan Hovold <johan@kernel.org>
Date: Tue, 1 Jun 2021 17:29:01 +0200
Subject: [PATCH] USB: cp210x: add flow-control debugging

Signed-off-by: Johan Hovold <johan@kernel.org>
---
 drivers/usb/serial/cp210x.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c
index ee595d1bea0a..92382798b574 100644
--- a/drivers/usb/serial/cp210x.c
+++ b/drivers/usb/serial/cp210x.c
@@ -1159,6 +1159,12 @@ static void cp210x_set_flow_control(struct tty_struct *tty,
 	ctl_hs = le32_to_cpu(flow_ctl.ulControlHandshake);
 	flow_repl = le32_to_cpu(flow_ctl.ulFlowReplace);
 
+	dev_dbg(&port->dev, "%s - ctrl = 0x%02x, flow = 0x%02x\n", __func__,
+			ctl_hs, flow_repl);
+	dev_dbg(&port->dev, "%s - xon_limit = %u, xoff_limit = %u\n", __func__,
+			le32_to_cpu(flow_ctl.ulXonLimit),
+			le32_to_cpu(flow_ctl.ulXoffLimit));
+
 	ctl_hs &= ~CP210X_SERIAL_DSR_HANDSHAKE;
 	ctl_hs &= ~CP210X_SERIAL_DCD_HANDSHAKE;
 	ctl_hs &= ~CP210X_SERIAL_DSR_SENSITIVITY;
-- 
2.31.1


  reply	other threads:[~2021-06-01 15:40 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-31 17:38 cp210x module broken in 5.12.5 and 5.12.6, works in 5.11.21 (with bisection) Alex Villacís Lasso
2021-06-01  7:50 ` Johan Hovold
2021-06-01 14:51   ` Alex Villacís Lasso
2021-06-01 15:40     ` Johan Hovold [this message]
2021-06-01 17:18       ` Alex Villacís Lasso
2021-06-02 14:50         ` Johan Hovold
2021-06-02 15:54           ` Alex Villacís Lasso
2021-06-04 15:42             ` Johan Hovold
2021-06-04 18:25               ` Alex Villacís Lasso
2021-06-05 10:24                 ` Johan Hovold
2021-06-05 10:54                   ` Johan Hovold
2021-06-04 23:16               ` David Frey
2021-06-05 10:13                 ` Johan Hovold
2021-06-07 15:16                   ` Alex Villacís Lasso
2021-06-07 16:45                     ` Johan Hovold
2021-06-07 16:44                   ` David Frey
2021-06-07 16:52                     ` Johan Hovold
2021-06-07 18:02                       ` David Frey
2021-06-07 20:44                         ` David Frey
2021-06-07 23:50                           ` Alex Villacís Lasso
2021-06-08  9:10                             ` Tung Pham
2021-06-08  9:52                               ` Johan Hovold
2021-06-08  9:41                           ` Johan Hovold
2021-06-09 16:15                             ` [PATCH] USB: serial: cp210x: fix CP2102N-A01 modem control Johan Hovold
2021-06-09 17:00                               ` Alex Villacís Lasso
2021-06-10  7:23                                 ` Johan Hovold
2021-06-10 14:55                                   ` Alex Villacís Lasso

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=YLZVAmYxFZ1Q/nrH@hovoldconsulting.com \
    --to=johan@kernel.org \
    --cc=a_villacis@palosanto.com \
    --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;
as well as URLs for NNTP newsgroup(s).