* ttyACM and BREAK chars ? @ 2019-09-11 12:39 Joakim Tjernlund 2019-09-11 14:22 ` Oliver Neukum 0 siblings, 1 reply; 6+ messages in thread From: Joakim Tjernlund @ 2019-09-11 12:39 UTC (permalink / raw) To: linux-usb@vger.kernel.org Every now and then my ttyACM0 hangs up or sends a BREAK char to my device. I am trying to make ttyACM ignore incoming(over USB) and not emit any BREAK automatically using termios (IGN_BRK) but that does not make a difference. Is BREAK handling unimpl. in ttyACM ? if so, could it be added ? Jocke ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: ttyACM and BREAK chars ? 2019-09-11 12:39 ttyACM and BREAK chars ? Joakim Tjernlund @ 2019-09-11 14:22 ` Oliver Neukum 2019-09-11 14:34 ` Joakim Tjernlund 0 siblings, 1 reply; 6+ messages in thread From: Oliver Neukum @ 2019-09-11 14:22 UTC (permalink / raw) To: Joakim Tjernlund, linux-usb@vger.kernel.org Am Mittwoch, den 11.09.2019, 12:39 +0000 schrieb Joakim Tjernlund: > Every now and then my ttyACM0 hangs up or sends a BREAK char to my device. > I am trying to make ttyACM ignore incoming(over USB) and not emit > any BREAK automatically using termios (IGN_BRK) but that does not make a difference. > > Is BREAK handling unimpl. in ttyACM ? acm_send_break() implements it. But the support is optional in ACM devices. What is bmCapabilities in sysfs for your device? Regards Oliver ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: ttyACM and BREAK chars ? 2019-09-11 14:22 ` Oliver Neukum @ 2019-09-11 14:34 ` Joakim Tjernlund 2019-09-11 18:27 ` Oliver Neukum 0 siblings, 1 reply; 6+ messages in thread From: Joakim Tjernlund @ 2019-09-11 14:34 UTC (permalink / raw) To: oneukum@suse.com, linux-usb@vger.kernel.org On Wed, 2019-09-11 at 16:22 +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 Mittwoch, den 11.09.2019, 12:39 +0000 schrieb Joakim Tjernlund: > > Every now and then my ttyACM0 hangs up or sends a BREAK char to my device. > > I am trying to make ttyACM ignore incoming(over USB) and not emit > > any BREAK automatically using termios (IGN_BRK) but that does not make a difference. > > > > Is BREAK handling unimpl. in ttyACM ? > > acm_send_break() implements it. Yes, I se that funktion but I don't see how one can ignore received BREAKs If I set IGN_BRK on /dev/ttyACM0 I expect that every BREAK should just be ignored > But the support is optional in ACM devices. > > What is bmCapabilities in sysfs for your device? I found one bmCapabilities in sysfs: cat /sys/devices/pci0000:00/0000:00:14.0/usb1/1-6/1-6.3/1-6.3:1.1/bmCapabilities 2 Locks like my device Jocke ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: ttyACM and BREAK chars ? 2019-09-11 14:34 ` Joakim Tjernlund @ 2019-09-11 18:27 ` Oliver Neukum 2019-09-12 7:09 ` Joakim Tjernlund 0 siblings, 1 reply; 6+ messages in thread From: Oliver Neukum @ 2019-09-11 18:27 UTC (permalink / raw) To: Joakim Tjernlund, linux-usb@vger.kernel.org [-- Attachment #1: Type: text/plain, Size: 978 bytes --] Am Mittwoch, den 11.09.2019, 14:34 +0000 schrieb Joakim Tjernlund: > On Wed, 2019-09-11 at 16:22 +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 Mittwoch, den 11.09.2019, 12:39 +0000 schrieb Joakim Tjernlund: > > > Every now and then my ttyACM0 hangs up or sends a BREAK char to my device. > > > I am trying to make ttyACM ignore incoming(over USB) and not emit > > > any BREAK automatically using termios (IGN_BRK) but that does not make a difference. > > > > > > Is BREAK handling unimpl. in ttyACM ? > > > > acm_send_break() implements it. > > Yes, I se that funktion but I don't see how one can ignore received BREAKs > If I set IGN_BRK on /dev/ttyACM0 I expect that every BREAK should just be ignored Handling breaks looks a bit broken on CDC-ACM. Could you test the attached patch? Regards Oliver [-- Attachment #2: 0001-cdc-acm-fix-BREAK-rx-code-path-adding-necessary-call.patch --] [-- Type: text/x-patch, Size: 1095 bytes --] From 74a16a0fdc056659b0543ec377b51fa231a423c2 Mon Sep 17 00:00:00 2001 From: Oliver Neukum <oneukum@suse.com> Date: Wed, 11 Sep 2019 20:17:38 +0200 Subject: [PATCH] cdc-acm: fix BREAK rx code path adding necessary calls Counting break events is nice but we should actually report them to the tty layer. Fixes: 5a6a62bdb9257 ("cdc-acm: add TIOCMIWAIT") Signed-off-by: Oliver Neukum <oneukum@suse.com> --- drivers/usb/class/cdc-acm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c index 62f4fb9b362f..89d97d9763b0 100644 --- a/drivers/usb/class/cdc-acm.c +++ b/drivers/usb/class/cdc-acm.c @@ -312,8 +312,10 @@ static void acm_process_notification(struct acm *acm, unsigned char *buf) acm->iocount.dsr++; if (difference & ACM_CTRL_DCD) acm->iocount.dcd++; - if (newctrl & ACM_CTRL_BRK) + if (newctrl & ACM_CTRL_BRK) { acm->iocount.brk++; + tty_insert_flip_char(&acm->port, 0, TTY_BREAK); + } if (newctrl & ACM_CTRL_RI) acm->iocount.rng++; if (newctrl & ACM_CTRL_FRAMING) -- 2.16.4 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: ttyACM and BREAK chars ? 2019-09-11 18:27 ` Oliver Neukum @ 2019-09-12 7:09 ` Joakim Tjernlund 2019-09-12 8:30 ` Oliver Neukum 0 siblings, 1 reply; 6+ messages in thread From: Joakim Tjernlund @ 2019-09-12 7:09 UTC (permalink / raw) To: oneukum@suse.com, linux-usb@vger.kernel.org On Wed, 2019-09-11 at 20:27 +0200, Oliver Neukum wrote: > Am Mittwoch, den 11.09.2019, 14:34 +0000 schrieb Joakim Tjernlund: > > On Wed, 2019-09-11 at 16:22 +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 Mittwoch, den 11.09.2019, 12:39 +0000 schrieb Joakim Tjernlund: > > > > Every now and then my ttyACM0 hangs up or sends a BREAK char to my device. > > > > I am trying to make ttyACM ignore incoming(over USB) and not emit > > > > any BREAK automatically using termios (IGN_BRK) but that does not make a difference. > > > > > > > > Is BREAK handling unimpl. in ttyACM ? > > > > > > acm_send_break() implements it. > > > > Yes, I se that funktion but I don't see how one can ignore received BREAKs > > If I set IGN_BRK on /dev/ttyACM0 I expect that every BREAK should just be ignored > > Handling breaks looks a bit broken on CDC-ACM. > Could you test the attached patch? > Sure, I can test it but from looking at the patch it seems like ACM already ignores BREAKs(hardcoded) and with your patch you actually start reporting them. My problem is sudden disconnects I cannot explain but I think they are connect to BREAKs I have seen these errors in dmesg though, not sure if they help the diagnose: [181780.167987] usb usb1-port6: disabled by hub (EMI?), re-enabling... [181780.168208] cdc_acm 1-6.3:1.1: acm_ctrl_irq - usb_submit_urb failed: -19 [181780.167996] usb 1-6: USB disconnect, device number 30 [181780.176548] usb 1-6-port2: attempt power cycle [181781.772847] usb 1-6.3: USB disconnect, device number 32 [181781.773134] cdc_acm 1-6.3:1.1: failed to set dtr/rts ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: ttyACM and BREAK chars ? 2019-09-12 7:09 ` Joakim Tjernlund @ 2019-09-12 8:30 ` Oliver Neukum 0 siblings, 0 replies; 6+ messages in thread From: Oliver Neukum @ 2019-09-12 8:30 UTC (permalink / raw) To: Joakim Tjernlund, linux-usb@vger.kernel.org Am Donnerstag, den 12.09.2019, 07:09 +0000 schrieb Joakim Tjernlund: > On Wed, 2019-09-11 at 20:27 +0200, Oliver Neukum wrote: > > Am Mittwoch, den 11.09.2019, 14:34 +0000 schrieb Joakim Tjernlund: > > > On Wed, 2019-09-11 at 16:22 +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 Mittwoch, den 11.09.2019, 12:39 +0000 schrieb Joakim Tjernlund: > > > > > Every now and then my ttyACM0 hangs up or sends a BREAK char to my device. > > > > > I am trying to make ttyACM ignore incoming(over USB) and not emit > > > > > any BREAK automatically using termios (IGN_BRK) but that does not make a difference. > > > > > > > > > > Is BREAK handling unimpl. in ttyACM ? > > > > > > > > acm_send_break() implements it. > > > > > > Yes, I se that funktion but I don't see how one can ignore received BREAKs > > > If I set IGN_BRK on /dev/ttyACM0 I expect that every BREAK should just be ignored > > > > Handling breaks looks a bit broken on CDC-ACM. > > Could you test the attached patch? > > > > Sure, I can test it but from looking at the patch it seems like ACM already ignores > BREAKs(hardcoded) and with your patch you actually start reporting them. Well, what is not reported cannot really be ignored. AFAICT n_tty_receive_break() should solve the issue generically. > My problem is sudden disconnects I cannot explain but I think they are connect to BREAKs > I have seen these errors in dmesg though, not sure if they help the diagnose: > [181780.167987] usb usb1-port6: disabled by hub (EMI?), re-enabling... The relevant fault happens likely just before that. > [181780.168208] cdc_acm 1-6.3:1.1: acm_ctrl_irq - usb_submit_urb failed: -19 > [181780.167996] usb 1-6: USB disconnect, device number 30 > [181780.176548] usb 1-6-port2: attempt power cycle > [181781.772847] usb 1-6.3: USB disconnect, device number 32 > [181781.773134] cdc_acm 1-6.3:1.1: failed to set dtr/rts Either your cabling is indeed crap, or something crashes your device. Regards Oliver ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2019-09-12 8:45 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2019-09-11 12:39 ttyACM and BREAK chars ? Joakim Tjernlund 2019-09-11 14:22 ` Oliver Neukum 2019-09-11 14:34 ` Joakim Tjernlund 2019-09-11 18:27 ` Oliver Neukum 2019-09-12 7:09 ` Joakim Tjernlund 2019-09-12 8:30 ` Oliver Neukum
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).