[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[MiNT] Proposed joystick device standard
A while ago I experimented with joystick devices for FreeMiNT.
I found 3 APIs that could be used:
1. BSD joystick API (seems to be used by FreeBSD/OpenBSD/NetBSD)
Returns: X, Y, button 0, button 1 (4 ints)
Support: 1 axis, 2 buttons.
Comment: Extremely easy to implement, too limited.
2. "old" Linux joystick API (v1.xx)
Returns: Buttons, X, Y (3 ints)
Support: 1 axis, 32 buttons.
Comment: Extremely easy to implement, a bit limited.
3. "new" Linux joystick API (v2.xx)
This API is event-based, i.e. an event is generated each time button is pressed/released, an axis is moved etc.
Returns: Event data
Support: Any number of axis and buttons
Comment: Harder to implement, but *very* flexible.
I think "something" usually beats than "nothing". Even though the "new" Linux API is far superior in many aspects, I suggest using the "old" Linux API until the demand for a more advanced API emerges.
The "old" Linux API is extremely easy to implement both at the driver- and application level, and it imposes nearly zero overhead compared to reading the hardware directly. Again, if this protocol isn't sufficient in the future, there is always the possibility to expand it later on as done in the Linux implementation.
I have drivers for joypads atm, but I won't release anything before I know if this standard could be accepted. Please let me know what you think.