NetBSD Problem Report #30685

From he@smistad.uninett.no  Thu Jul  7 11:50:51 2005
Return-Path: <he@smistad.uninett.no>
Received: from smistad.uninett.no (smistad.uninett.no [158.38.62.77])
	by narn.netbsd.org (Postfix) with ESMTP id 5DC0F63B104
	for <gnats-bugs@gnats.NetBSD.org>; Thu,  7 Jul 2005 11:50:50 +0000 (UTC)
Message-Id: <20050707115048.62DD321DC85@smistad.uninett.no>
Date: Thu,  7 Jul 2005 13:50:48 +0200 (CEST)
From: he@uninett.no
Reply-To: he@uninett.no
To: gnats-bugs@netbsd.org
Subject: uplcom / ucom driver toggles DTR when instructed to toggle RTS
X-Send-Pr-Version: 3.95

>Number:         30685
>Category:       kern
>Synopsis:       uplcom / ucom driver toggles DTR when instructed to toggle RTS
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Jul 07 11:51:00 +0000 2005
>Closed-Date:    Sat Jan 19 20:55:10 +0000 2008
>Last-Modified:  Sat Jan 19 20:55:10 +0000 2008
>Originator:     Havard Eidnes <he@uninett.no>
>Release:        NetBSD 3.99.7 of Jul 7 2005
>Organization:
	UNINETT AS
>Environment:
System: NetBSD ravnkloa.urc.uninett.no 3.99.7 NetBSD 3.99.7 (GENERIC) #20: Thu Jul  7 01:13:31 CEST 2005  he@ravnkloa.urc.uninett.no:/usr/obj/sys/arch/amd64/compile/GENERIC amd64
Architecture: amd64
Machine: amdd64
>Description:
	The uplcom / ucom driver in combination, probed as

uplcom0 at uhub0 port 1
uplcom0: Prolific Technology Inc. USB-Serial Controller, rev 1.10/3.00, addr 2
ucom0 at uplcom0

	appears to toggle the DTR line when instructed to toggle RTS.

	This was found while trying to get the "Trimble Palisade" GPS
	reference clock driver in ntpd to work in "hardware event
	capture" mode, i.e. without "fudge flag2 1" set, and was
	detected and worked around for now by wiring the DTR signal
	from the host to the RTS line towards the level converter in
	the Trimble Palisade kit using a serial line LED
	tester/patcher.

	The relevant code from ntpd showing that it tries to toggle
	RTS is:

        x |= TIOCM_RTS;        /* turn on RTS  */

        /* Edge trigger */
        if (ioctl(pp->io.fd, TIOCMSET, &x) < 0) { 
...
        x &= ~TIOCM_RTS;        /* turn off RTS  */

        /* poll timestamp */
        get_systime(&pp->lastrec);

        if (ioctl(pp->io.fd, TIOCMSET, &x) == -1) {

	in src/dist/ntp/ntpd/refclock_palisade.c.

>How-To-Repeat:
	Try to toggle RTS on an uplcom serial, watch it toggle DTR
	instead.

>Fix:
	Sorry, I don't know how to find the bug right now.

>Release-Note:

>Audit-Trail:
From: Martin Husemann <martin@duskware.de>
To: he@uninett.no
Cc: gnats-bugs@NetBSD.org
Subject: Re: kern/30685: uplcom / ucom driver toggles DTR when instructed to toggle RTS
Date: Thu, 7 Jul 2005 15:45:49 +0200

 On Thu, Jul 07, 2005 at 11:51:00AM +0000, he@uninett.no wrote:
 > 	appears to toggle the DTR line when instructed to toggle RTS.

 Could you please try a kernel with options UPLCOM_DEBUG and then set
 uplcomdebug to 1 at boot?

 This should output the rts and dtr changes that the driver thinks it is making,
 so we can see if the bug is in uplcom or some higher level.

 Martin

From: Havard Eidnes <he@uninett.no>
To: martin@duskware.de
Cc: gnats-bugs@NetBSD.org
Subject: Re: kern/30685: uplcom / ucom driver toggles DTR when instructed
 to toggle RTS
Date: Mon, 25 Jul 2005 10:13:39 +0200 (CEST)

 > > 	appears to toggle the DTR line when instructed to toggle RTS.
 >
 > Could you please try a kernel with options UPLCOM_DEBUG and then set
 > uplcomdebug to 1 at boot?
 >
 > This should output the rts and dtr changes that the driver
 > thinks it is making, so we can see if the bug is in uplcom or
 > some higher level.

 A cylcle triggered by ntpd prints out:

 uplcom_dtr: onoff=3D0
 uplcom_rts: onoff=3D1
 uplcom_dtr: onoff=3D0
 uplcom_rts: onoff=3D0

 So uplcom thinks it is toggling RTS, while in reality it's
 toggling DTR.

 Regards,

 - H=E5vard

From: Martin Husemann <martin@duskware.de>
To: Havard Eidnes <he@uninett.no>
Cc: gnats-bugs@NetBSD.org
Subject: Re: kern/30685: uplcom / ucom driver toggles DTR when instructed to toggle RTS
Date: Fri, 5 Aug 2005 01:38:56 +0200

 --VS++wcV0S1rZb1Fb
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline

 Could you try this patch, please?

 Thanks,

 Martin

 --VS++wcV0S1rZb1Fb
 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.44
 diff -u -r1.44 uplcom.c
 --- uplcom.c	7 Jul 2005 09:59:37 -0000	1.44
 +++ uplcom.c	4 Aug 2005 23:38:11 -0000
 @@ -85,15 +85,6 @@
  #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
 -
  enum  pl2303_type {
  	UPLCOM_TYPE_0,
  	UPLCOM_TYPE_HX,
 @@ -492,8 +483,8 @@
  	if (sc->sc_rts == -1)
  		sc->sc_rts = 0;

 -	ls = (sc->sc_dtr ? UPLCOM_FLOW_OUT_DSR : 0) |
 -		(sc->sc_rts ? UPLCOM_FLOW_OUT_CTS : 0);
 +	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;

 --VS++wcV0S1rZb1Fb--

From: Havard Eidnes <he@uninett.no>
To: martin@duskware.de
Cc: gnats-bugs@NetBSD.org
Subject: Re: kern/30685: uplcom / ucom driver toggles DTR when instructed
 to toggle RTS
Date: Fri, 05 Aug 2005 11:34:30 +0200 (CEST)

 > Could you try this patch, please?

 Thanks, that solved it.

 - H=E5vard

From: Martin Husemann <martin@netbsd.org>
To: gnats-bugs@netbsd.org
Cc: 
Subject: PR/30685 CVS commit: src/sys/dev/usb
Date: Sat, 13 Aug 2005 21:50:45 +0000 (UTC)

 Module Name:	src
 Committed By:	martin
 Date:		Sat Aug 13 21:50:45 UTC 2005

 Modified Files:
 	src/sys/dev/usb: uplcom.c

 Log Message:
 Back out the "it is not completely clear" part of revision 1.37 - it
 effectively swapped RTS and DTR, apparently on all versions of the chip.
 This fixes PR kern/30685.


 To generate a diff of this commit:
 cvs rdiff -r1.44 -r1.45 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.

From: Matthias Scheler <tron@netbsd.org>
To: gnats-bugs@netbsd.org
Cc: 
Subject: PR/30685 CVS commit: [netbsd-3] src/sys/dev/usb
Date: Mon, 15 Aug 2005 19:10:55 +0000 (UTC)

 Module Name:	src
 Committed By:	tron
 Date:		Mon Aug 15 19:10:55 UTC 2005

 Modified Files:
 	src/sys/dev/usb [netbsd-3]: uplcom.c

 Log Message:
 Pull up revision 1.45 (requested by martin in ticket #663):
 Back out the "it is not completely clear" part of revision 1.37 - it
 effectively swapped RTS and DTR, apparently on all versions of the chip.
 This fixes PR kern/30685.


 To generate a diff of this commit:
 cvs rdiff -r1.41.10.1 -r1.41.10.2 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.

From: Jeff Rizzo <riz@netbsd.org>
To: gnats-bugs@netbsd.org
Cc: 
Subject: PR/30685 CVS commit: [netbsd-2] src/sys/dev/usb
Date: Wed, 17 Aug 2005 16:51:21 +0000 (UTC)

 Module Name:	src
 Committed By:	riz
 Date:		Wed Aug 17 16:51:21 UTC 2005

 Modified Files:
 	src/sys/dev/usb [netbsd-2]: uplcom.c

 Log Message:
 Pull up revision 1.45 (requested by martin in ticket #5576):
 Back out the "it is not completely clear" part of revision 1.37 - it
 effectively swapped RTS and DTR, apparently on all versions of the chip.
 This fixes PR kern/30685.


 To generate a diff of this commit:
 cvs rdiff -r1.34.2.3.2.1 -r1.34.2.3.2.2 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: dholland@narn.netbsd.org
State-Changed-When: Sat, 19 Jan 2008 20:55:10 +0000
State-Changed-Why:
fixed, confirmed, and pulled up more than a year ago.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.