Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/usb Support for SIGIO.
details: https://anonhg.NetBSD.org/src/rev/f912e3bd4322
branches: trunk
changeset: 484893:f912e3bd4322
user: augustss <augustss%NetBSD.org@localhost>
date: Fri Apr 14 14:12:47 2000 +0000
description:
Support for SIGIO.
diffstat:
sys/dev/usb/uhid.c | 30 +++++++++++++++++++++++++++++-
1 files changed, 29 insertions(+), 1 deletions(-)
diffs (79 lines):
diff -r 36903b3437a4 -r f912e3bd4322 sys/dev/usb/uhid.c
--- a/sys/dev/usb/uhid.c Fri Apr 14 14:12:11 2000 +0000
+++ b/sys/dev/usb/uhid.c Fri Apr 14 14:12:47 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: uhid.c,v 1.36 2000/03/27 12:33:56 augustss Exp $ */
+/* $NetBSD: uhid.c,v 1.37 2000/04/14 14:12:47 augustss Exp $ */
/* $FreeBSD: src/sys/dev/usb/uhid.c,v 1.22 1999/11/17 22:33:43 n_hibma Exp $ */
/*
@@ -46,6 +46,7 @@
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/malloc.h>
+#include <sys/signalvar.h>
#if defined(__NetBSD__) || defined(__OpenBSD__)
#include <sys/device.h>
#include <sys/ioctl.h>
@@ -103,6 +104,7 @@
struct clist sc_q;
struct selinfo sc_rsel;
+ struct proc *sc_async; /* process that wants SIGIO */
u_char sc_state; /* driver state */
#define UHID_OPEN 0x01 /* device is open */
#define UHID_ASLP 0x02 /* waiting for device data */
@@ -356,6 +358,10 @@
wakeup(&sc->sc_q);
}
selwakeup(&sc->sc_rsel);
+ if (sc->sc_async != NULL) {
+ DPRINTFN(3, ("uhid_intr: sending SIGIO %p\n", sc->sc_async));
+ psignal(sc->sc_async, SIGIO);
+ }
}
int
@@ -402,6 +408,8 @@
sc->sc_state &= ~UHID_IMMED;
+ sc->sc_async = 0;
+
return (0);
}
@@ -430,6 +438,8 @@
sc->sc_state &= ~UHID_OPEN;
+ sc->sc_async = 0;
+
return (0);
}
@@ -591,6 +601,24 @@
/* All handled in the upper FS layer. */
break;
+ case FIOASYNC:
+ if (*(int *)addr) {
+ if (sc->sc_async != NULL)
+ return (EBUSY);
+ sc->sc_async = p;
+ DPRINTF(("uhid_do_ioctl: FIOASYNC %p\n", p));
+ } else
+ sc->sc_async = NULL;
+ break;
+
+ /* XXX this is not the most general solution. */
+ case TIOCSPGRP:
+ if (sc->sc_async == NULL)
+ return (EINVAL);
+ if (*(int *)addr != sc->sc_async->p_pgid)
+ return (EPERM);
+ break;
+
case USB_GET_REPORT_DESC:
rd = (struct usb_ctl_report_desc *)addr;
size = min(sc->sc_repdesc_size, sizeof rd->data);
Home |
Main Index |
Thread Index |
Old Index