diff options
author | jylefort <jylefort@FreeBSD.org> | 2005-11-09 20:26:00 +0000 |
---|---|---|
committer | jylefort <jylefort@FreeBSD.org> | 2005-11-09 20:26:00 +0000 |
commit | 07c0605ab8ee1d858a12347a7df2bf7417c35120 (patch) | |
tree | cee81be3fe21b6fcad64180ab43927d208acddad /sys | |
parent | 53b73d2a3139ee5ada71e8c7099ada19311ae53a (diff) | |
download | FreeBSD-src-07c0605ab8ee1d858a12347a7df2bf7417c35120.zip FreeBSD-src-07c0605ab8ee1d858a12347a7df2bf7417c35120.tar.gz |
Unbreak second joystick (joy1) support.
PR: kern/46734
Submitted by: Richard Airlie <richard@darq.net>
Approved by: netchild
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/joy/joy.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/sys/dev/joy/joy.c b/sys/dev/joy/joy.c index 0568feb..472985b 100644 --- a/sys/dev/joy/joy.c +++ b/sys/dev/joy/joy.c @@ -104,13 +104,13 @@ joy_attach(device_t dev) joy->rid = 0; joy->res = bus_alloc_resource_any(dev, SYS_RES_IOPORT, &joy->rid, - RF_ACTIVE); + RF_ACTIVE|RF_SHAREABLE); if (joy->res == NULL) return ENXIO; joy->bt = rman_get_bustag(joy->res); joy->port = rman_get_bushandle(joy->res); joy->timeout[0] = joy->timeout[1] = 0; - joy->d = make_dev(&joy_cdevsw, 0, 0, 0, 0600, "joy%d", unit); + joy->d = make_dev(&joy_cdevsw, unit, 0, 0, 0600, "joy%d", unit); return (0); } @@ -167,6 +167,12 @@ joyread(struct cdev *dev, struct uio *uio, int flag) #else disable_intr (); #endif + nanotime(&t); + end.tv_sec = 0; + end.tv_nsec = joy->timeout[joypart(dev)] * 1000; + timespecadd(&end, &t); + for (; timespeccmp(&t, &end, <) && (bus_space_read_1(bt, port, 0) & 0x0f); nanotime(&t)) + ; /* nothing */ bus_space_write_1 (bt, port, 0, 0xff); nanotime(&start); end.tv_sec = 0; |