Re: [Plib-devel] Joystick problem
Brought to you by:
sjbaker
From: Stephen J B. <sj...@li...> - 2000-07-19 13:15:03
|
Risto S Varanka wrote: > My joystick (CH Combatstick) works fine in Linux itself, but not > with Plib's JS. The joy-analog module loads fine with the correct > parameters, and it works perfectly in jstest. However, the JS > example program says that no joysticks are found. (notWorking > returns true.) > > What could be the problem? How can I investigate it? I haven't yet > tried other programs or hacking the Plib code. (I didn't get > joystick working with one of my own Plib experiments, though.) That's certainly an unusual problem. I havn't heard of anyone with that kind of a problem before. Hence, I'm rather at a loss to know what to suggest - so here are a bunch of questions that might show up something useful: * When you ran './configure' on PLIB, did it say that it had detected 'linux/joystick.h' or did it say that 'joystick.h' had been found? It *should* be linux/joystick.h for Linux systems - if it isn't then there is something wrong with your installation of the joystick drivers. * That being the case, could you look in /usr/include/linux/joystick.h and tell me what 'JS_VERSION' is defined as. grep JS_VERSION /usr/include/linux/joystick.h ...should do the trick. * Also, could you tell me which version of PLIB you have and what Linux distribution and Kernel version you are running. * Is it possible that the joystick header file and your joystick driver are out of sync? Have you ever upgraded either of them? * Does the file /dev/js0 exist? Does it have '-rw-rw-rw' permissions? If you *really* want to investigate this some more by digging around in the code, I would add: if ( fd < 0 ) { perror("JS-open") ; exit(1) ; } ...just after: fd = ::open ( fname, O_RDONLY | O_NONBLOCK ) ; ...on about line 176 of src/js/js.h in PLIB. That will let us see whether the joystick device is being opened correctly (I suspect it is not - but I don't know why not). If it *is* being opened correctly then...I'm *really* puzzled...there are three possibilities: If you have the old joystick driver (unlikely) then I can't imagine what could be wrong. If the system *thinks* you have the old driver - but you actually have the new driver - or vice-versa then who knows what crap could be happening. (Hence my questions about headers and upgrades). If you have the new joystick driver (I think you must have since the old one wasn't called 'joy-analog' IIRC) then perhaps the 'ioctl' on lines 219 and 220 are somehow not returning. Hmmm - I should be checking for error there and I'm not...*BAD* programmer :-) Add: if ( errno != 0 ) perror("JS-ioctl"); ...after each ioctl and the fcntl, then print out: fprintf(stderr, "Axes=%d Buttons=%d\n", num_axes, num_buttons ) ; ...and let's see exactly what it detected. Good luck - and *please* let me know what you find. Steve Baker (817)619-2657 (Vox/Vox-Mail) L3Com/Link Simulation & Training (817)619-2466 (Fax) Work: sj...@li... http://www.link.com Home: sjb...@ai... http://web2.airmail.net/sjbaker1 |