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 <[EMAIL PROTECTED]>  <><  http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve"  =  http://www.FreeBSD.org
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;
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to