From fixit  Fri Dec 27 06:28:48 1996
Received: from stills.pubnix.net (Stills.pubnix.net [192.172.250.8])
          by freefall.freebsd.org (8.8.4/8.8.4) with ESMTP id GAA20355
          for <FreeBSD-gnats-submit@freebsd.org>; Fri, 27 Dec 1996 06:28:47 -0800 (PST)
Received: (from root@localhost) by stills.pubnix.net (8.7.6/8.7.3) id JAA25479; Fri, 27 Dec 1996 09:28:45 -0500 (EST)
Message-Id: <199612271428.JAA25479@stills.pubnix.net>
Date: Fri, 27 Dec 1996 09:28:45 -0500 (EST)
From: root
Reply-To: andrew@fortress.org
To: FreeBSD-gnats-submit@freebsd.org
Cc: andrew@fortress.org
Subject: DCD/DSR swap support for sio.c
X-Send-Pr-Version: 3.2

>Number:         2298
>Category:       kern
>Synopsis:       [sio] [patch] [request] support for DSR/DCD swapping on serial ports (sio)
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          suspended
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Fri Dec 27 06:30:01 PST 1996
>Closed-Date:    
>Last-Modified:  Sat Jan 26 04:50:08 UTC 2008
>Originator:     root@pubnix.net
>Release:        FreeBSD 2.1.6-RELEASE
>Organization:
PubNIX Montreal
>Environment:

	ISP with multi port serial cards using 10 pin RJ45s

>Description:

	This change can benefit anyone using multiport serial cards that
	employ 10 pin RJ45 connectors (also known as RJ68) to distribute the
	data signals.  These include but are not limited to the Boca 16 port
	serial board and and Digi PC/x cards with RJ68 fanout plugs.

	The pinout of the RJ68 connections has DCD on pin 1 and RI on pin 10.
	As the RI signal is not generally required in an ISP environment,
	and DCD is, I've added a flag bit in sio.c to support swapping DCD
	and DSR.

	This is also a common feature found on most Digi drivers, the company
	being aware that RJ68 connectors and all the related stuff are hard to
	find and/or expensive.

>How-To-Repeat:

	N/R

>Fix:

*** sio.c.orig	Fri Nov 15 18:36:37 1996
--- sio.c	Fri Dec 20 11:24:46 1996
***************
*** 90,95 ****
--- 90,99 ----
  #define	COM_LOSESOUTINTS(dev)	((dev)->id_flags & 0x08)
  #define	COM_NOFIFO(dev)		((dev)->id_flags & 0x02)
  #define	COM_VERBOSE(dev)	((dev)->id_flags & 0x80)
+ #define COM_SWAPDCDDSR(dev)	((dev)->id_flags & 0x10)
+ #define SWAPMASKDCD		(MSR_DCD | MSR_DDCD)
+ #define SWAPMASKDSR		(MSR_DSR | MSR_DDSR)
+ #define SWAPMASKDCDDSR		(SWAPMASKDCD | SWAPMASKDSR)
  
  #define	com_scr		7	/* scratch register for 16450-16550 (R/W) */
  
***************
*** 168,173 ****
--- 172,178 ----
  #ifdef COM_MULTIPORT
  	bool_t	multiport;	/* is this unit part of a multiport device? */
  #endif /* COM_MULTIPORT */
+ 	bool_t	swapdcddsr;	/* We want to swap DCD and DSR */
  	bool_t	no_irq;		/* nonzero if irq is not attached */
  	bool_t	poll;		/* nonzero if polling is required */
  	bool_t	poll_output;	/* nonzero if polling for output is required */
***************
*** 410,415 ****
--- 415,421 ----
  		}
  	}
  #endif /* COM_MULTIPORT */
+ 		
  	if (idev->id_irq == 0)
  		mcr_image = 0;
  
***************
*** 683,688 ****
--- 689,698 ----
  	outb(iobase + com_fifo, 0);
  determined_type: ;
  
+ 	if (COM_SWAPDCDDSR(isdp)) {
+ 		com->swapdcddsr = TRUE;
+ 		printf (" DSR<->DCD ");
+ 	}
  #ifdef COM_MULTIPORT
  	if (COM_ISMULTIPORT(isdp)) {
  		com->multiport = TRUE;
***************
*** 752,757 ****
--- 762,768 ----
  	int		s;
  	struct tty	*tp;
  	int		unit;
+ 	u_char		tmp1;
  
  	mynor = minor(dev);
  	unit = MINOR_TO_UNIT(mynor);
***************
*** 857,864 ****
  		disable_intr();
  		(void) inb(com->line_status_port);
  		(void) inb(com->data_port);
! 		com->prev_modem_status = com->last_modem_status
! 		    = inb(com->modem_status_port);
  		outb(iobase + com_ier, IER_ERXRDY | IER_ETXRDY | IER_ERLS
  				       | IER_EMSC);
  		enable_intr();
--- 868,884 ----
  		disable_intr();
  		(void) inb(com->line_status_port);
  		(void) inb(com->data_port);
! 		tmp1 = inb(com->modem_status_port);
! 		if (com->swapdcddsr) 
! 			com->prev_modem_status = com->last_modem_status = 
!   		             ((tmp1 & ~SWAPMASKDCDDSR)
! 				    | ((tmp1 & SWAPMASKDCD) >> 2)
! 				    | ((tmp1 & SWAPMASKDSR) << 2));
! 		else  
! 			com->prev_modem_status = com->last_modem_status = tmp1;	
! 		
! 		
! 			
  		outb(iobase + com_ier, IER_ERXRDY | IER_ETXRDY | IER_ERLS
  				       | IER_EMSC);
  		enable_intr();
***************
*** 1102,1107 ****
--- 1122,1128 ----
  	u_char	modem_status;
  	u_char	*ioptr;
  	u_char	recv_data;
+ 	u_char	tmp1;
  
  	if (com->do_timestamp)
  		/* XXX a little bloat here... */
***************
*** 1187,1193 ****
  		}
  
  		/* modem status change? (always check before doing output) */
! 		modem_status = inb(com->modem_status_port);
  		if (modem_status != com->last_modem_status) {
  			/*
  			 * Schedule high level to handle DCD changes.  Note
--- 1208,1220 ----
  		}
  
  		/* modem status change? (always check before doing output) */
! 		tmp1 = inb(com->modem_status_port);
! 		if (com->swapdcddsr) 
! 		modem_status = ((tmp1 & ~SWAPMASKDCDDSR)
! 				    | ((tmp1 & SWAPMASKDCD) >> 2)
! 				    | ((tmp1 & SWAPMASKDSR) << 2));
! 		else 
! 		modem_status = tmp1;
  		if (modem_status != com->last_modem_status) {
  			/*
  			 * Schedule high level to handle DCD changes.  Note
>Release-Note:
>Audit-Trail:

From: Julian Elischer <julian@whistle.com>
To: andrew@fortress.org
Cc: FreeBSD-gnats-submit@freebsd.org
Subject: Re: kern/2298: DCD/DSR swap support for sio.c
Date: Fri, 27 Dec 1996 10:45:25 -0800

 Your change is much more likely to be accepted if you also include
 about 2 paragraphs of description in a diff to the sio man page,
 so that this change is not lost in obscurity.
 
 julian.
State-Changed-From-To: open->suspended 
State-Changed-By: phk 
State-Changed-When: Tue Apr 14 11:58:50 PDT 1998 
State-Changed-Why:  
->suspend 

From: "Cox SMTP central" <harry685@cox.net>
To: <freebsd-gnats-submit@FreeBSD.org>, <andrew@fortress.org>
Cc:  
Subject: Re: kern/2298: Support for DSR/DCD swapping on serial ports (sio) [PATCH]
Date: Fri, 5 Jul 2002 14:11:27 -0500

 You have a syntax error in your patch.  Delete the first #endif to fix it.
 
>Unformatted:
Is this still relevant?
