Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 04 Jul 2003 00:39:14 +0900
From:      Shunsuke Akiyama <akiyama@jp.FreeBSD.org>
To:        Danny Braniss <danny@cs.huji.ac.il>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: USB, select/poll for ucom 
Message-ID:  <20030704003916X.akiyama@jp.FreeBSD.org>
In-Reply-To: <E19Xc3r-000GIU-00@cs.huji.ac.il>

next in thread | previous in thread | raw e-mail | index | archive | help
At Wed, 02 Jul 2003 10:29:51 +0300,
Danny Braniss wrote:
> 
> for the record:
> 	I can now confirm that select/poll/FIONREAD do work with the
> usb/ucom/uplcom!
> 
> what seems to be broken is the call to 'tcflush(fd, TCIFLUSH)'
> this works fine with /dev/cuaa0 but not with /dev/ucom0

Humm...
I'd reviewed sys/dev/usb/ucom.c, and found missing things.
Please try attached patch.
-- 
Shunsuke Akiyama
akiyama@jp.FreeBSD.org
akiyama@FreeBSD.org

Index: sys/dev/usb/ucom.c
===================================================================
RCS file: /home/ncvs/src/sys/dev/usb/ucom.c,v
retrieving revision 1.29
diff -u -r1.29 ucom.c
--- sys/dev/usb/ucom.c	9 Mar 2003 11:33:26 -0000	1.29
+++ sys/dev/usb/ucom.c	2 Jul 2003 10:39:28 -0000
@@ -544,6 +544,10 @@
 	int error;
 	int s;
 	int d;
+#if defined(COMPAT_43) || defined(COMPAT_SUNOS)
+	u_long oldcmd;
+	struct termios term;
+#endif
 
 	USB_GET_SC(ucom, UCOMUNIT(dev), sc);
 	tp = sc->sc_tty;
@@ -553,15 +557,28 @@
 
 	DPRINTF(("ucomioctl: cmd = 0x%08lx\n", cmd));
 
+#if defined(COMPAT_43) || defined(COMPAT_SUNOS)
+	term = tp->t_termios;
+	oldcmd = cmd;
+	error = ttsetcompat(tp, &cmd, data, &term);
+	if (error != 0)
+		return (error);
+	if (cmd != oldcmd)
+		data = (caddr_t)&term;
+#endif
+
 	error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag, p);
-	if (error >= 0) {
+	if (error != ENOIOCTL) {
 		DPRINTF(("ucomioctl: l_ioctl: error = %d\n", error));
 		return (error);
 	}
 
+	s = spltty();
+
 	error = ttioctl(tp, cmd, data, flag);
 	disc_optim(tp, &tp->t_termios, sc);
-	if (error >= 0) {
+	if (error != ENOIOCTL) {
+		splx(s);
 		DPRINTF(("ucomioctl: ttioctl: error = %d\n", error));
 		return (error);
 	}
@@ -577,8 +594,6 @@
 	error = 0;
 
 	DPRINTF(("ucomioctl: our cmd = 0x%08lx\n", cmd));
-
-	s = spltty();
 
 	switch (cmd) {
 	case TIOCSBRK:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030704003916X.akiyama>