1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-15 10:17:20 +00:00

Unbreak second joystick (joy1) support.

PR:		kern/46734
Submitted by:	Richard Airlie <richard@darq.net>
Approved by:	netchild
This commit is contained in:
Jean-Yves Lefort 2005-11-09 20:26:00 +00:00
parent 5d56add2ba
commit 73c0fce2e1
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=152249

View File

@ -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;