Difference between revisions of "Gasync"
(→GNU/Linux) |
(→Windows) |
||
Line 43: | Line 43: | ||
|- | |- | ||
|gpoll | |gpoll | ||
− | |colspan=" | + | |colspan="3"|ginput |
|gserial | |gserial | ||
|gtimer | |gtimer | ||
Line 52: | Line 52: | ||
|[https://msdn.microsoft.com/en-us/library/windows/desktop/ms645536%28v=vs.85%29.aspx Raw Input] | |[https://msdn.microsoft.com/en-us/library/windows/desktop/ms645536%28v=vs.85%29.aspx Raw Input] | ||
|[https://www.libsdl.org/ libSDL] | |[https://www.libsdl.org/ libSDL] | ||
+ | |ghid | ||
|[https://msdn.microsoft.com/en-us/library/windows/desktop/aa363140%28v=vs.85%29.aspx COM ports] | |[https://msdn.microsoft.com/en-us/library/windows/desktop/aa363140%28v=vs.85%29.aspx COM ports] | ||
|[https://msdn.microsoft.com/en-us/library/windows/desktop/ms687012%28v=vs.85%29.aspx Waitable Timers] | |[https://msdn.microsoft.com/en-us/library/windows/desktop/ms687012%28v=vs.85%29.aspx Waitable Timers] | ||
Line 60: | Line 61: | ||
Notes: | Notes: | ||
* The libSDL events are processed synchronously. | * The libSDL events are processed synchronously. | ||
+ | |||
==Porting to Darwin / MAC OS X== | ==Porting to Darwin / MAC OS X== | ||
{| class="wikitable" style="text-align: center;" | {| class="wikitable" style="text-align: center;" |
Revision as of 11:29, 11 May 2016
Note: this is applicable to the refactoring branch only.
The gasync (GIMX asynchronous) library is the evolution of the GE (GIMX events) library.
In addition to input devices (mice, keyboards, joysticks), gasync also handles the following components:
- serial ports (DIY USB adapter)
- high-resolution timers (delayed or periodic tasks)
- USB devices (authentication sources)
- HID devices (Logitech Wheels, GPP/Cronus/Titan One)
It also provides a waiting interface based on poll on GNU/Linux and MsgWaitForMultipleObject on Windows.
How it works
Gimx asks the kernel to be notified about events on a set of resources (file descriptors on GNU/Linux and handles on Windows).
Each resource has callbacks that are called on events like data available, write completed, or IO error.
Resources can be of various types: USB device, timer, input device, HID device, serial device, network socket (server mode), bluetooth socket. Network and bluetooth sockets are not integrated into gasync yet.
When data is available a read is performed and the data is passed to the callback. The callback then processes the data and may submit some IOs depending on various conditions.
Implementation
GNU/Linux
gpoll | ginput | gserial | gtimer | gusb | ghid | |||
poll | evdev | jsdev | X.Org Xi2 | ghid | termios | timerfd | libusb |
Notes:
- ghid is not based on hidraw because write() does not support non-blocking mode.
- Being based on libusb, ghid claims the HID interface and detaches the kernel driver. guhid is a uhid wrapper to allow connecting the device back with the kernel.
Windows
gpoll | ginput | gserial | gtimer | gusb | ghid | ||
MsgWaitForMultipleObject | Raw Input | libSDL | ghid | COM ports | Waitable Timers | libusb | HID API |
Notes:
- The libSDL events are processed synchronously.
Porting to Darwin / MAC OS X
gpoll | ginput | gserial | gtimer | gusb | ghid |
poll | libSDL | termios | TODO | libusb |
Notes:
- gtimer has to provide a file descriptor to be given to gpoll.
- ginput has to provide a way to capture the inputs (like constraining the mouse cursor into a window).
- Native input events could be added alongside the libSDL events.