Subject: kern/30685: uplcom / ucom driver toggles DTR when instructed to toggle RTS
To: None <kern-bug-people@netbsd.org, gnats-admin@netbsd.org,>
From: None <he@uninett.no>
List: netbsd-bugs
Date: 07/07/2005 11:51:00
>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:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Jul 07 11:51:00 +0000 2005
>Originator:     Havard Eidnes
>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.