diff options
| author | Julian Elischer <julian@FreeBSD.org> | 1995-11-28 09:42:06 +0000 |
|---|---|---|
| committer | Julian Elischer <julian@FreeBSD.org> | 1995-11-28 09:42:06 +0000 |
| commit | 7146c13e4371ca3a01d2c829771c3e6edb171adb (patch) | |
| tree | e174e9f0c9e876a67737e66592206a42258e33ef /sys/dev/joy | |
| parent | 43cbfcb3576ceb560a3d33061b51cafa0b604ad7 (diff) | |
Notes
Diffstat (limited to 'sys/dev/joy')
| -rw-r--r-- | sys/dev/joy/joy.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/sys/dev/joy/joy.c b/sys/dev/joy/joy.c index 8d0dc25b08439..5870e62f2930b 100644 --- a/sys/dev/joy/joy.c +++ b/sys/dev/joy/joy.c @@ -41,6 +41,12 @@ #include <i386/isa/isa_device.h> #include <i386/isa/timerreg.h> +#ifdef JREMOD +#include <sys/conf.h> +#define CDEV_MAJOR 51 +static void joy_devsw_install(); +#endif /*JREMOD*/ + /* The game port can manage 4 buttons and 4 variable resistors (usually 2 * joysticks, each with 2 buttons and 2 pots.) via the port at address 0x201. * Getting the state of the buttons is done by reading the game port: @@ -99,6 +105,10 @@ joyattach (struct isa_device *dev) joy[dev->id_unit].timeout[0] = joy[dev->id_unit].timeout[1] = 0; printf("joy%d: joystick\n", dev->id_unit); +#ifdef JREMOD + joy_devsw_install(); +#endif /*JREMOD*/ + return 1; } @@ -205,4 +215,27 @@ get_tick () return (high << 8) | low; } + +#ifdef JREMOD +struct cdevsw joy_cdevsw = + { joyopen, joyclose, joyread, nowrite, /*51*/ + joyioctl, nostop, nullreset, nodevtotty,/*joystick */ + seltrue, nommap, NULL}; + +static joy_devsw_installed = 0; + +static void joy_devsw_install() +{ + dev_t descript; + if( ! joy_devsw_installed ) { + descript = makedev(CDEV_MAJOR,0); + cdevsw_add(&descript,&joy_cdevsw,NULL); +#if defined(BDEV_MAJOR) + descript = makedev(BDEV_MAJOR,0); + bdevsw_add(&descript,&joy_bdevsw,NULL); +#endif /*BDEV_MAJOR*/ + joy_devsw_installed = 1; + } +} +#endif /* JREMOD */ #endif /* NJOY > 0 */ |
