-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add joystick support for OS X #195
Comments
Hi Steven I was going to use SLD as it is supported in windows too. I just haven't had any time to devote to it yet. SDL uses a polled idea wheres the current linux stuff uses a callback mechanism that I didn't have time to work out. Eric On 22/05/2012, at 1:38 PM, scdwyer wrote:
|
Hi Eric I was thinking SDL would be convenient and easy as well (and thought about the windows compatibility). In looking at the code that uses joysticks (input2ivy and nps), it looks like it would be rather easy to use SDL (I suspect far less code than current implementations) because it appears that the programs looking for joystick input both essentially use a polled method anyways. In input2ivy, the ocaml program calls a joystick init function and then repeatedly calls a joystick update function (both external c functions) which could easily be rewritten to used SDL (I think). The same goes for nps, it copies in the new joystick values at a periodic rate. Currently values seem updated by events with some Gtk help, but there doesn't seem to be a reason not to be able to call an update function just prior to copying values. Thoughts? -Stephen |
I started experimenting with SDL, very easy to use. One thing, I haven't found a way to specify the joystick by device (i.e. js0) like you would normally do in the joystick programs on linux. Should everything be moved to SDL-based support? Basically right now you select a joystick by number of which each one is assigned an index by SDL (0, 1, 2,...). There is also the option of somehow specifying by joystick name. For one joystick attached I don't think it will matter much, should always be the only one, linux or OS X. Should there be some sort of central joystick handler/SDL framework? Or just initialize SDL and select joystick in the current init functions and then read joystick state in the update function (make one if currently not used, like in nps)? |
Steven On 27/05/2012, at 4:15 PM, scdwyer wrote:
Eric |
Another option for this would be to update input2ivy to use SDL for joystick support. Then input2ivy could be used in current applications, and a small ivy listener written in C could be added to NPS in place of nps_radio_control_joystick.[c][h] instead of reimplementing the joystick support twice. This also allows all of the configuration handling of input2ivy to be used for NPS (right now extremely minimal/hardcoded). Might need a bit of extra configuration for NPS, but the feature set would be considerably enhanced. In converting input2ivy to use SDL, either ocamlsdl could be used (libsdl-ocaml-dev on debian, ocamlsdl on macports) which would mean input2ivy doesn't need the c-ocaml bindings any more, or just modify the existing usb_stick.[c][h] to use SDL instead of linux/joystick.h. Thoughts on this? I don't know how up to date the ocamlsdl stuff is. |
I haven't looked at plib, but SDL sounds good :-) Updating input2ivy to use SDL sounds good, but I would rather make a new input option for this in nps (radio_control_ivy or so). |
merged into master... |
Joystick support is needed for the nps sim (and old booz simulator) as well as input2ivy for manual control over a datalink.
Currently, joysticks are implemented using the built-in linux interface (#include <linux/joystick.h>).
As far as I know, there is no equivalent in OS X.
What are some options for joystick support in OS X?
With SDL, could possibly port the linux stuff over to that as well, and make everything consistent/cross platform. There are also Ocaml SDL bindings. It appears that FlightGear uses plib.
I don't know what would be easier to port existing linux code to.
The text was updated successfully, but these errors were encountered: