Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 26 Jan 2006 11:33:38 -0500
From:      John Baldwin <jhb@freebsd.org>
To:        freebsd-hackers@freebsd.org
Cc:        Vitaliy Skakun <vit.ska@gmail.com>
Subject:   Re: Comtrol Rocketport UNIVERSAL PCI 32-port
Message-ID:  <200601261133.39848.jhb@freebsd.org>
In-Reply-To: <806128ad0601260254u42dfd927k@mail.gmail.com>
References:  <806128ad0601250608u67aae744u@mail.gmail.com> <200601250956.35818.jhb@freebsd.org> <806128ad0601260254u42dfd927k@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
--Boundary-00=_jnP2DIjaYjxVBkg
Content-Type: text/plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

On Thursday 26 January 2006 05:54, Vitaliy Skakun wrote:
> Hi everybody!
>
> One problem arised:
>
> when doing in the shell
> echo "~WS" > /dev/cuaR00
>
> for several times as quick as I can, I get panic with the following
> message: panic: device_unbusy: called for non-busy device rp0
>
> same thing when trying to send data to /dev/cuaR00 via JDK File streams ...
>
> :(((
>
> (Some kind of barcode printers are attached to this multiport card)
>
> Any help will be kindly accepted.
>
> Cheers
> Vit

Try the attached patch.  tty's don't use D_TRACKCLOSE but rp(4) was expecting 
that rpclose() was called on every close, not just the last close.

-- 
John Baldwin <jhb@FreeBSD.org>  <><  http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve"  =  http://www.FreeBSD.org

--Boundary-00=_jnP2DIjaYjxVBkg
Content-Type: text/x-diff;
  charset="iso-8859-1";
  name="rp_busy.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename="rp_busy.patch"

Index: rp.c
===================================================================
RCS file: /usr/cvs/src/sys/dev/rp/rp.c,v
retrieving revision 1.71
diff -u -r1.71 rp.c
--- rp.c	4 Dec 2005 10:06:04 -0000	1.71
+++ rp.c	26 Jan 2006 16:32:48 -0000
@@ -929,7 +929,9 @@
 		rp_callout_handle = timeout(rp_do_poll, 
 					    (void *)NULL, POLL_INTERVAL);
 
-	device_busy(rp->rp_ctlp->dev);
+	if (rp->rp_open_count == 0)
+		device_busy(rp->rp_ctlp->dev);
+	rp->rp_open_count++;
 	return(0);
 }
 
@@ -960,6 +962,7 @@
 	tp->t_actout = FALSE;
 	wakeup(&tp->t_actout);
 	wakeup(TSA_CARR_ON(tp));
+	rp->rp_open_count = 0;
 	device_unbusy(rp->rp_ctlp->dev);
 }
 
Index: rpvar.h
===================================================================
RCS file: /usr/cvs/src/sys/dev/rp/rpvar.h,v
retrieving revision 1.9
diff -u -r1.9 rpvar.h
--- rpvar.h	4 Dec 2005 10:06:04 -0000	1.9
+++ rpvar.h	26 Jan 2006 16:31:59 -0000
@@ -47,6 +47,7 @@
 	unsigned char		state;	/* state of dtr */
 
 	int			rp_port;
+	int			rp_open_count;
 	int			rp_flags;
 	int			rp_unit:2;
 	int			rp_aiop:2;

--Boundary-00=_jnP2DIjaYjxVBkg--



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