i would rather integrate it to the kernel; actually, the code already
does exist in its most part, it's just the we lack the /dev/keyboard to
peep the scancodes passed from one part of the kernel to another.
> > all other things i've done are palette reconfiguration scripts, clumsy
> > patches to the joystick.o driver (to enable the two extra buttons when the
> > two extra pots don't exist), and a joystick-to-mouse converter that sucks.
> As a joystick driver maintainer, I'm interested in any joystick hacks for
> Linux that have been done ... including these. The 4-button one is probably
> obsoleted by the 1.0+ drivers, but the joystick-to-mouse thingy sounds
> interesting. Would it be possible for me to take a look at it? There already
> is a nice joy2key utility by Peter Amstutz, so a joy2mouse utility would
> fit nicely into the collection.
not exactly knowing what i was doing, i wrote this:
#include <linux/joystick.h>
#include <fcntl.h>
#include <unistd.h>
int main (int argc, char **argv) {
int v, fd, mouse, status, nx, ny; char buf[5];
struct JS_DATA_TYPE js;
fd = open ("/dev/js0", O_RDONLY);
if (fd < 0) { perror ("js"); exit (1); }
mouse = open("/dev/joymouse", O_RDWR|O_NONBLOCK);
if (mouse < 0) { perror ("joymouse"); exit (2); }
status = read (fd, &js, JS_RETURN); nx = js.x/2; ny = js.y/2;
while (1) {
status = read (fd, &js, JS_RETURN);
v = 1 + (js.buttons&0x04)/2;
buf[0]= (
((js.buttons&0x08)>>3)
| (js.buttons&0x02)
| ((js.buttons&0x01)<<2)
)^0x07 | 0x80;
buf[3]=buf[1]= ( (js.x > nx*3) ? +v : (js.x < nx) ? -v : 0 )&0xff;
buf[4]=buf[2]= ( (js.y > ny*3) ? -v : (js.y < ny) ? +v : 0 )&0xff;
write(mouse,buf,5);
usleep(5000);
}
return 0;
}
i'm not sure whether i'd recommend using this, though.
btw, here are the instructions:
using a gravis gamepad, red button is left button, blue button is middle
button, green button is right button, and yellow button makes the pad
move the pointer twice as fast.
matju
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu