NetBSD Problem Report #21043
Received: (qmail 12353 invoked by uid 605); 6 Apr 2003 18:44:58 -0000
Message-Id: <200304061844.h36IipG8000739@night-porter.duskware.de>
Date: Sun, 6 Apr 2003 20:44:51 +0200 (MEST)
From: Martin Husemann <martin@duskware.de>
Sender: gnats-bugs-owner@netbsd.org
Reply-To: martin@duskware.de
To: gnats-bugs@gnats.netbsd.org
Subject: uplcom output not working
X-Send-Pr-Version: 3.95
>Number: 21043
>Category: kern
>Synopsis: uplcom output not working
>Confidential: no
>Severity: serious
>Priority: high
>Responsible: augustss
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sun Apr 06 18:45:01 +0000 2003
>Closed-Date: Fri Apr 09 19:26:01 +0000 2004
>Last-Modified: Wed Jul 28 10:31:01 +0000 2004
>Originator: Martin Husemann
>Release: NetBSD 1.6Q
>Organization:
>Environment:
System: NetBSD night-porter.duskware.de 1.6Q NetBSD 1.6Q (PORTER) #0: Sun Apr 6 19:20:59 MEST 2003 martin@night-porter.duskware.de:/usr/src/sys/arch/i386/compile/PORTER i386
Architecture: i386
Machine: i386
>Description:
I bought a uplcom serial dongle since I've run out of serial console conectors.
It dose work fine for input and it is able to send a break. But it does not
output anything. Could out=0x2 be the wrong endpoint in my case?
I enabled uplcom and ucom debuging messages, and the result looks pretty much
fine to me. Here is the part of the dmesg relevant to the problem:
uhub1 at uhub0 port 1
uhub1: vendor 0x0451 product 0x1446, class 9/0, rev 1.00/1.00, addr 2
uhub1: 4 ports with 4 removable, bus powered
uplcom0 at uhub1 port 1
uplcom0: vendor 0x067b product 0x2303, rev 1.10/2.02, addr 3
uplcom attach: sc=0xc0917080
uplcom: in=0x83 out=0x2 intr=0x81
ucom0 at uplcom0
ucom_attach: tty_attach 0xd2fab738
uplcom1 at uhub1 port 2
uplcom1: vendor 0x067b product 0x2303, rev 1.10/2.02, addr 4
uplcom attach: sc=0xc0936e00
uplcom: in=0x83 out=0x2 intr=0x81
ucom1 at uplcom1
ucom_attach: tty_attach 0xd2fab840
[...]
ucomopen: unit=0, tp=0xd2fab738
uplcom_open: sc=0xc0917080
uplcom_get_status:
uplcom_param: sc=0xc0917080
uplcom_set_line_coding: rate=9600 fmt=0 parity=0 bits=8
ucomparam: l_modem
ucom_dtr: onoff=1
uplcom_dtr: onoff=1
ucom_hwiflow:
ucomopen: open pipes in=131 out=2
ucomstartread: start
ucomioctl: cmd=0x8004745c
ucomioctl: our cmd=0x8004745c
ucomclose: unit=0
ucomstop: flag=3
ucomstop: flag=3
ucom_cleanup: closing pipes
ucom_shutdown
ucom_dtr: onoff=0
uplcom_dtr: onoff=0
ucomreadcb: status=6
ucomreadcb: dying
ucomstart: 2 chars
ucomwritecb: status=6
uplcom_close: close
ucomopen: unit=1, tp=0xd2fab840
uplcom_open: sc=0xc0936e00
uplcom_get_status:
uplcom_param: sc=0xc0936e00
uplcom_set_line_coding: rate=9600 fmt=0 parity=0 bits=8
uplcom1: uplcom status = 03
uplcom_get_status:
ucomparam: l_modem
ucom_dtr: onoff=1
uplcom_dtr: onoff=1
ucom_hwiflow:
ucomopen: open pipes in=131 out=2
ucomstartread: start
ucomioctl: cmd=0x8004745c
ucomioctl: our cmd=0x8004745c
ucomclose: unit=1
ucomstop: flag=3
ucomstop: flag=3
ucom_cleanup: closing pipes
ucom_shutdown
ucom_dtr: onoff=0
uplcom_dtr: onoff=0
ucomreadcb: status=6
ucomreadcb: dying
ucomstart: 2 chars
ucomwritecb: status=6
uplcom_close: close
[...]
ucomopen: unit=1, tp=0xd2fab840
uplcom_open: sc=0xc0936e00
uplcom_get_status:
uplcom_param: sc=0xc0936e00
uplcom_set_line_coding: rate=9600 fmt=0 parity=0 bits=8
uplcom_set_line_coding: already set
ucomparam: l_modem
ucom_dtr: onoff=1
uplcom_dtr: onoff=1
ucom_hwiflow:
ucomopen: open pipes in=131 out=2
ucomstartread: start
ucomioctl: cmd=0x402c7413
ucomioctl: cmd=0x80047410
ucomioctl: cmd=0x802c7414
ucomioctl: cmd=0x20007461
ucomioctl: cmd=0x802c7414
uplcom_param: sc=0xc0936e00
uplcom_set_line_coding: rate=9600 fmt=0 parity=0 bits=8
uplcom_set_line_coding: already set
uplcom_set_crtscts: on
ucomreadcb: status=0
ucomreadcb: got 20 chars, tp=0xd2fab840
ucomreadcb: char=0x0d
ucomstart: 2 chars
ucomreadcb: char=0x0a
ucomstart: no go, state=0x4c
ucomreadcb: char=0x0d
ucomstart: no go, state=0x4c
ucomreadcb: char=0x0a
ucomstart: no go, state=0x4c
ucomreadcb: char=0x20
ucomstart: no go, state=0x4c
ucomreadcb: char=0x0d
ucomstart: no go, state=0x4c
ucomreadcb: char=0x3e
ucomstart: no go, state=0x4c
ucomreadcb: char=0x3e
ucomstart: no go, state=0x4c
ucomreadcb: char=0x3e
ucomstart: no go, state=0x4c
ucomreadcb: char=0x20
ucomstart: no go, state=0x4c
ucomreadcb: char=0x0d
ucomstart: no go, state=0x4c
ucomreadcb: char=0x0a
ucomstart: no go, state=0x4c
ucomreadcb: char=0x0d
ucomstart: no go, state=0x4c
ucomreadcb: char=0x0a
ucomstart: no go, state=0x4c
ucomreadcb: char=0x20
ucomstart: no go, state=0x4c
ucomreadcb: char=0x0d
ucomstart: no go, state=0x4c
ucomreadcb: char=0x3e
ucomstart: no go, state=0x4c
ucomreadcb: char=0x3e
ucomstart: no go, state=0x4c
ucomreadcb: char=0x3e
ucomstart: no go, state=0x4c
ucomreadcb: char=0x20
ucomstart: no go, state=0x4c
ucomstartread: start
ucomwritecb: status=0
ucomwritecb: cc=2
ucomparam: l_modem
ucomioctl: cmd=0x802c7415
ucomioctl: cmd=0x8004667e
ucomstart: 1 chars
ucomwritecb: status=0
ucomwritecb: cc=1
[...]
ucomstart: 1 chars
ucomwritecb: status=0
ucomwritecb: cc=1
ucomstart: 1 chars
ucomwritecb: status=0
ucomwritecb: cc=1
ucomioctl: cmd=0x802c7415
uplcom_param: sc=0xc0936e00
uplcom_set_line_coding: rate=9600 fmt=0 parity=0 bits=8
uplcom_set_line_coding: already set
ucomparam: l_modem
ucomioctl: cmd=0x20007471
ucomioctl: our cmd=0x20007471
ucomclose: unit=1
ucomstop: flag=3
ucom_cleanup: closing pipes
ucom_shutdown
ucom_dtr: onoff=0
uplcom_dtr: onoff=0
ucomreadcb: status=6
ucomreadcb: dying
ucomstart: 2 chars
ucomwritecb: status=6
uplcom_close: close
>How-To-Repeat:
Just try to use cu(1) with ttyU0.
>Fix:
no idea, any hint for further debuging apreciated.
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: kern-bug-people->augustss
Responsible-Changed-By: perry
Responsible-Changed-When: Mon Apr 7 18:14:31 PDT 2003
Responsible-Changed-Why:
Lennart is the USB maintainer.
From: Martin Husemann <martin@duskware.de>
To: gnats-bugs@NetBSD.ORG
Cc:
Subject: Re: kern/21043: uplcom output not working
Date: Fri, 11 Apr 2003 09:28:03 +0200
Turns out that with a real 3-wire-only cable that fakes CTS and CD it works.
Maybe some tty settings are not transfered properly to the chip? Looks like
the driver does send a "turn rts/cts on" command, but relies on it being off
by default.
Martin
From: Martin Husemann <martin@duskware.de>
To: gnats-bugs@NetBSD.ORG
Cc:
Subject: Re: kern/21043: uplcom output not working
Date: Sat, 12 Apr 2003 00:18:18 +0200
--8t9RHnE3ZwKMSgU+
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
So there seem to be several problems:
1) the sc_rts and sc_dtr members of softc are initialized to -1,
other USB serial drivers set it explicitly to 0 or rely on the
implicit clearing of struct softc. This means by default they are
enabled - which is wrong, isn't it?
2) When translating termios flags to ulpcom line state the CRTSCTS
flag is checked, but not CLOCAL. I think CLOCAL overrides CRTSCTS
in other drivers (only tested with com @ isa and com @ ast).
But this is one point I feel pretty uncertain about.
3) The uplcom driver seems to use the same bits the umodem driver uses
to encode flow controll in the line state register - while the Linux
driver provided by Prolific uses different bits. I did not test anything
besided the no-flow-control case I was after, but I could do that at
least for CTS/RTS flow control. Just let me know...
So, to make it work with "local" set in /etc/ttys for a simple "cu -l ttyU0"
when connected to a serial console, I had to use the attached patch.
Since it contains parts I'm not sure about, I did not commit it. Let me know
if I should run any tests to explore details...
Martin
--8t9RHnE3ZwKMSgU+
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=patch
Index: uplcom.c
===================================================================
RCS file: /cvsroot/src/sys/dev/usb/uplcom.c,v
retrieving revision 1.29
diff -c -u -r1.29 uplcom.c
--- uplcom.c 2002/09/23 05:51:23 1.29
+++ uplcom.c 2003/04/11 22:01:39
@@ -88,6 +88,15 @@
#define RSAQ_STATUS_DSR 0x02
#define RSAQ_STATUS_DCD 0x01
+#define UPLCOM_FLOW_OUT_CTS 0x0001
+#define UPLCOM_FLOW_OUT_DSR 0x0002
+#define UPLCOM_FLOW_IN_DSR 0x0004
+#define UPLCOM_FLOW_IN_DTR 0x0008
+#define UPLCOM_FLOW_IN_RTS 0x0010
+#define UPLCOM_FLOW_OUT_RTS 0x0020
+#define UPLCOM_FLOW_OUT_XON 0x0080
+#define UPLCOM_FLOW_IN_XON 0x0100
+
struct uplcom_softc {
USBBASEDEVICE sc_dev; /* base device */
usbd_device_handle sc_udev; /* USB device */
@@ -330,7 +339,7 @@
USB_ATTACH_ERROR_RETURN;
}
- sc->sc_dtr = sc->sc_rts = -1;
+ sc->sc_dtr = sc->sc_rts = 0;
uca.portno = UCOM_UNK_PORTNO;
/* bulkin, bulkout set above */
uca.ibufsize = UPLCOMIBUFSIZE;
@@ -431,9 +440,12 @@
{
usb_device_request_t req;
int ls;
+
+ ls = (sc->sc_dtr ? UPLCOM_FLOW_OUT_DSR : 0) |
+ (sc->sc_rts ? UPLCOM_FLOW_OUT_CTS : 0);
+
+ DPRINTF(("uplcom_set_line_state: sc=%p state=0x%x\n", sc, ls));
- ls = (sc->sc_dtr ? UCDC_LINE_DTR : 0) |
- (sc->sc_rts ? UCDC_LINE_RTS : 0);
req.bmRequestType = UT_WRITE_CLASS_INTERFACE;
req.bRequest = UCDC_SET_CONTROL_LINE_STATE;
USETW(req.wValue, ls);
@@ -604,7 +616,7 @@
return (EIO);
}
- if (ISSET(t->c_cflag, CRTSCTS))
+ if (ISSET(t->c_cflag, CRTSCTS) && !ISSET(t->c_cflag, CLOCAL))
uplcom_set_crtscts(sc);
if (err) {
--8t9RHnE3ZwKMSgU+--
From: Martin Husemann <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: pr/21043 CVS commit: src/sys/dev/usb
Date: Fri, 9 Apr 2004 19:06:52 +0000 (UTC)
Module Name: src
Committed By: martin
Date: Fri Apr 9 19:06:52 UTC 2004
Modified Files:
src/sys/dev/usb: uplcom.c
Log Message:
Initialize sc_rts and sc_dts to 0, instead of -1, as suggested in
PR kern/21043.
To generate a diff of this commit:
cvs rdiff -r1.34 -r1.35 src/sys/dev/usb/uplcom.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
State-Changed-From-To: open->closed
State-Changed-By: martin
State-Changed-When: Fri Apr 9 19:25:00 UTC 2004
State-Changed-Why:
This PR talked about various things, some of which have been resolved.
After talking to others, I think it can be closed now.
The initial CRTSCTS is explicitly requested by cu(1), unless given the -f
flag. Why the com driver behaves differently (apparently ignores CRTSCTS
if CLOCAL is set) is a different question - this could be considered a
bug in that driver.
The differences in constants and USB controll packets to the Linux driver
might be a mis-reading of the Linux driver - the current state of our
driver seems to work.
From: Matthias Scheler <tron@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: pr/21043 CVS commit: [netbsd-2-0] src/sys/dev/usb
Date: Wed, 28 Jul 2004 10:30:51 +0000 (UTC)
Module Name: src
Committed By: tron
Date: Wed Jul 28 10:30:51 UTC 2004
Modified Files:
src/sys/dev/usb [netbsd-2-0]: uplcom.c
Log Message:
Pull up revision 1.35 (requested by dbj in ticket #717):
Initialize sc_rts and sc_dts to 0, instead of -1, as suggested in
PR kern/21043.
To generate a diff of this commit:
cvs rdiff -r1.34 -r1.34.2.1 src/sys/dev/usb/uplcom.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.