linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Joakim Tjernlund <Joakim.Tjernlund@infinera.com>
To: "oneukum@suse.com" <oneukum@suse.com>,
	"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>
Subject: Re: ttyACM: disabled by hub (EMI?), re-enabling... Causes garbage chars & disconnect
Date: Tue, 26 May 2020 17:19:38 +0000	[thread overview]
Message-ID: <4c2bd25aa7f6672cb132487f7af6a787ffc1fab6.camel@infinera.com> (raw)
In-Reply-To: <42c92312c74e90e5507de4103bd15bbbe175f98d.camel@infinera.com>

On Tue, 2020-05-26 at 18:46 +0200, Joakim Tjernlund wrote:
> On Tue, 2020-05-26 at 12:14 +0200, Oliver Neukum wrote:
> > CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe.
> > 
> > 
> > Am Dienstag, den 26.05.2020, 08:59 +0000 schrieb Joakim Tjernlund:
> > > On Tue, 2020-05-26 at 10:47 +0200, Oliver Neukum wrote:
> > > > Am Montag, den 25.05.2020, 16:49 +0000 schrieb Joakim Tjernlund:
> > > > 
> > > > > To be clear, I can pull the cable and put it back and there are no garbage chars.
> > > > > There is also this error:
> > > > > [Wed May 20 14:03:25 2020] cdc_acm 1-6.3:1.1: acm_ctrl_irq - usb_submit_urb failed: -19
> > > > > [Wed May 20 14:03:25 2020] usb 1-6-port2: attempt power cycle
> > > > > [Wed May 20 14:03:26 2020] usb 1-6.3: USB disconnect, device number 86
> > > > > [Wed May 20 14:03:26 2020] cdc_acm 1-6.3:1.1: failed to set dtr/rts
> > > > > 
> > > > > Should not this auto reenable emulate reattaching the USB cable?
> > > > 
> > > > Hi,
> > > > 
> > > > yes it should. You find the garage characters after the EMI event. How
> > > > sure are you that they arrive after the event and not during the event?
> > > > 
> > > 
> > > Don't known how to determine that?
> > > I can say that
> > >    acm_ctrl_irq - usb_submit_urb failed: -19
> > 
> > -19 is -ENODEV
> > 
> > The driver thinks tries to resubmit the URB asking for control
> > messages.
> > Basically you are seeing error handling starting and failing due
> > to a subsequent disconnect.
> > 
> > > and
> > >    cdc_acm 1-6.3:1.1: failed to set dtr/rts
> > > are unique to this EMI event though. It does not feel like this
> > > reenabling follow the same procedure as a cable pull?
> > > As I can only see the above two errors I think we should get rid of
> > > these first.
> > 
> > The timing is different and if there is EMI transfer can end
> > in errors and cause error handling to kick in. You are seeing
> > symptoms. You can try enabling dynamic debugging to get
> > a better log.
> > 
> >         Regards
> >                 Oliver
> > 
> 
> Tried som dynamic debug for module cdc_acm got something I cannot parse:
> [Tue May 26 18:24:30 2020] cdc_acm 1-6.3:1.1: ttyACM0: USB ACM device
> [Tue May 26 18:24:30 2020] cdc_acm 1-6.3:1.1: acm_ctrl_msg - rq 0x20, val 0x0, len 0x7, result 7
> [Tue May 26 18:24:43 2020] usb 1-6.2: new high-speed USB device number 36 using xhci_hcd
> [Tue May 26 18:24:43 2020] cdc_ether 1-6.2:1.0 usb0: register 'cdc_ether' at usb-0000:00:14.0-6.2, CDC Ethernet Device, 92:d1:c9:b4:91:d5
> [Tue May 26 18:24:43 2020] IPv6: ADDRCONF(NETDEV_UP): usb0: link is not ready
> [Tue May 26 18:25:40 2020] cdc_acm 1-6.3:1.1: acm_ctrl_msg - rq 0x22, val 0x3, len 0x0, result 0
> [Tue May 26 18:25:40 2020] cdc_acm 1-6.3:1.1: acm_tty_set_termios - set line: 115200 0 0 8
> [Tue May 26 18:25:40 2020] cdc_acm 1-6.3:1.1: acm_ctrl_msg - rq 0x20, val 0x0, len 0x7, result 7
> [Tue May 26 18:25:42 2020] cdc_acm 1-6.3:1.1: acm_ctrl_irq - urb shutting down with status: -2
> [Tue May 26 18:25:42 2020] cdc_acm 1-6.3:1.2: acm_read_bulk_callback - urb shutting down with status: -2
> ....
> 
> I do note one thing in:
> 
> First connect after power on for the gadget I see some garbage chars when connecting with cu.
> However, if I just do a "cat /dev/ttyACM0", Ctrl-C and then cu I there are no garbage chars.
> 
> It feels like the gadget is spewing some garbage at power on and this gets saved in hosts cdc_acm, once
> I open /dev/ttyACM0 for write, these gets echoed back to the gadget.
> If so, cdc_acm fails to clear its buffers before the first open, does this make sense to you?
> 

Got some evidence now, I change the default baud rate form 9600 to 115200 in cdc_acm and now
I can see(instead of garbage chars):
cu usbacm0
Connected.
^@



U-Boot SPL


This "u-boot SPL" is the first thing u-boot writes and somehow this is remembered, I assume, by cdc_acm 
and gets echoed back when I open ttyACM0

 Jocke

  reply	other threads:[~2020-05-26 17:19 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-25 14:46 ttyACM: disabled by hub (EMI?), re-enabling... Causes garbage chars & disconnect Joakim Tjernlund
2020-05-25 15:02 ` Oliver Neukum
2020-05-25 15:15   ` Joakim Tjernlund
2020-05-25 16:49     ` Joakim Tjernlund
2020-05-26  8:47       ` Oliver Neukum
2020-05-26  8:59         ` Joakim Tjernlund
2020-05-26 10:14           ` Oliver Neukum
2020-05-26 16:46             ` Joakim Tjernlund
2020-05-26 17:19               ` Joakim Tjernlund [this message]
2020-05-27  8:38                 ` Oliver Neukum
2020-05-27  9:40                   ` Joakim Tjernlund
2020-05-27 10:12                     ` Greg KH
2020-05-27 10:41                     ` Oliver Neukum
2020-05-27 13:16                       ` Joakim Tjernlund
2020-05-27 15:41                         ` Joakim Tjernlund
2020-06-05 10:09                           ` Joakim Tjernlund
2020-06-08  9:13                             ` Oliver Neukum
2020-06-08 11:39                               ` Joakim Tjernlund
2020-06-08 15:40                                 ` Oliver Neukum
2020-06-08 16:00                                   ` Joakim Tjernlund
2020-06-08 19:21                                     ` Oliver Neukum
2020-06-15 11:01           ` Joakim Tjernlund

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=4c2bd25aa7f6672cb132487f7af6a787ffc1fab6.camel@infinera.com \
    --to=joakim.tjernlund@infinera.com \
    --cc=linux-usb@vger.kernel.org \
    --cc=oneukum@suse.com \
    /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).