NetBSD Problem Report #39044
From leo@marco.de Thu Jun 26 16:40:08 2008
Return-Path: <leo@marco.de>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
by narn.NetBSD.org (Postfix) with ESMTP id 2641D63B880
for <gnats-bugs@gnats.netbsd.org>; Thu, 26 Jun 2008 16:40:08 +0000 (UTC)
Message-Id: <20080626153838.B0864748494@hera.dachau.marco.de>
Date: Thu, 26 Jun 2008 17:38:38 +0200 (CEST)
From: leo@marco.de
Reply-To: leo@marco.de
To: gnats-bugs@gnats.NetBSD.org
Subject: spurious '\n' received from USB-Modems
X-Send-Pr-Version: 3.95
>Number: 39044
>Category: kern
>Synopsis: spurious '\n' received from USB-Modems
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: kern-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu Jun 26 16:45:00 +0000 2008
>Last-Modified: Sat Dec 31 05:25:01 +0000 2022
>Originator: Matthias Pfaller
>Release: NetBSD 4.99.62
>Organization:
Matthias Pfaller Software Entwicklung
marco Systemanalyse und Entwicklung GmbH Tel +49 8131 5161-41
Hans-Böckler-Str. 2, D 85221 Dachau Fax +49 8131 5161-66
http://www.marco.de/ Email leo@dachau.marco.de
>Environment:
System: NetBSD joghurt 4.99.62 NetBSD 4.99.62 (JOGHURT) #1: Sat May 3 14:51:54 CEST 2008 leo@joghurt:/usr/src/sys/arch/i386/compile/JOGHURT i386
Architecture: i386
Machine: i386
>Description:
When using an USB communications class device, I will sometimes
read a spurious '\n' directly after the open. It happens only if
the device was used (open/close) before.
>How-To-Repeat:
Get an USB communications class device. connect and disconnect several
times and get a '\n'.
>Fix:
Don't really know, but there is the following in sys/dev/usb/ucom.c:
ucomreadcb(usbd_xfer_handle xfer, usbd_private_handle p, usbd_status status)
{
struct ucom_softc *sc = (struct ucom_softc *)p;
struct tty *tp = sc->sc_tty;
int (*rint)(int, struct tty *) = tp->t_linesw->l_rint;
usbd_status err;
u_int32_t cc;
u_char *cp;
int s;
DPRINTFN(5,("ucomreadcb: status=%d\n", status));
if (status == USBD_CANCELLED || status == USBD_IOERROR ||
sc->sc_dying) {
DPRINTF(("ucomreadcb: dying\n"));
/* Send something to wake upper layer */
s = spltty();
(*rint)('\n', tp);
I think this where my '\n' gets injected. Is it safe to remove this
code?
Regards, Matthias
>Audit-Trail:
From: Matthias Pfaller <leo@marco.de>
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: kern/39044: spurious '\n' received from USB-Modems
Date: Mon, 30 Jun 2008 10:58:39 +0200
Removing the
(*rint)('\n', tp);
line from ucom.c doesn't seem to harm and I'm no longer getting the
spurious 0x0a characters. Somebody knowing the usb code needs to approve
and commit this.
Matthias
--
Matthias Pfaller Software-Entwicklung
marco Systemanalyse und Entwicklung GmbH Tel +49 8131 5161 41
Hans-Böckler-Str. 2, D 85221 Dachau Fax +49 8131 5161 66
http://www.marco.de/ Email leo@marco.de
Geschäftsführer Martin Reuter HRB 171775 Amtsgericht München
From: Matthias Drochner <M.Drochner@fz-juelich.de>
To: gnats-bugs@NetBSD.org
Cc: kern-bug-people@NetBSD.org, gnats-admin@NetBSD.org,
netbsd-bugs@NetBSD.org, leo@marco.de
Subject: Re: kern/39044: spurious '\n' received from USB-Modems
Date: Tue, 01 Jul 2008 13:51:41 +0200
leo@marco.de said:
> Removing the
> (*rint)('\n', tp);
> line from ucom.c doesn't seem to harm
Maybe, but to understand what's going on it would help
to know which of the 3 possible conditions trigger this.
(status == USBD_CANCELLED || status == USBD_IOERROR ||
sc->sc_dying)
best regards
Matthias
-------------------------------------------------------------------
-------------------------------------------------------------------
Forschungszentrum Juelich GmbH
52425 Juelich
Sitz der Gesellschaft: Juelich
Eingetragen im Handelsregister des Amtsgerichts Dueren Nr. HR B 3498
Vorsitzende des Aufsichtsrats: MinDir'in Baerbel Brumme-Bothe
Geschaeftsfuehrung: Prof. Dr. Achim Bachem (Vorsitzender),
Dr. Ulrich Krafft (stellv. Vorsitzender), Prof. Dr. Harald Bolt,
Dr. Sebastian M. Schmidt
-------------------------------------------------------------------
-------------------------------------------------------------------
From: Matthias Pfaller <leo@marco.de>
To: M.Drochner@fz-juelich.de
Cc: gnats-bugs@NetBSD.org, kern-bug-people@NetBSD.org,
gnats-admin@NetBSD.org, netbsd-bugs@NetBSD.org
Subject: Re: kern/39044: spurious '\n' received from USB-Modems
Date: Fri, 04 Jul 2008 15:18:04 +0200
Matthias Drochner wrote:
> leo@marco.de said:
>> Removing the
>> (*rint)('\n', tp);
>> line from ucom.c doesn't seem to harm
>
> Maybe, but to understand what's going on it would help
> to know which of the 3 possible conditions trigger this.
> (status == USBD_CANCELLED || status == USBD_IOERROR ||
> sc->sc_dying)
I inserted:
logprintf("status = %d, sc->sc_dying = %d\n", status,
sc->sc_dying);
The result is:
Jul 1 14:05:49 joghurt /netbsd: status = 6, sc->sc_dying = 0
status = 6 is USBD_CANCELLED.
Some more investigation showed (and a mail from Matthias Drochner)
showed, that it is ucomclose calling ucom_cleanup that triggers the
spurious \n. The \n is inserted into the tty queue at device close time
and delivered, when I open the device. Is there any reason to to insert
the \n into the queue when doing a device close?
Regards, Matthias
--
Matthias Pfaller Software-Entwicklung
marco Systemanalyse und Entwicklung GmbH Tel +49 8131 5161 41
Hans-Böckler-Str. 2, D 85221 Dachau Fax +49 8131 5161 66
http://www.marco.de/ Email leo@marco.de
Geschäftsführer Martin Reuter HRB 171775 Amtsgericht München
From: David Holland <dholland-bugs@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: kern/39044: spurious '\n' received from USB-Modems
Date: Sat, 31 Dec 2022 05:20:21 +0000
On Thu, Jun 26, 2008 at 04:45:00PM +0000, leo@marco.de wrote:
> /* Send something to wake upper layer */
> s = spltty();
> (*rint)('\n', tp);
This code is still there, and it seems highly bogus. If there's
actually any need to wake the upper layer, it should be done some
other way...
--
David A. Holland
dholland@netbsd.org
(Contact us)
$NetBSD: query-full-pr,v 1.47 2022/09/11 19:34:41 kim Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2022
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.