refs #401 Implementation of IJoystick for Linux

Basically, the implementation uses the API described in the kernel
documentation. It listens for new events that come from the device.
It also supports joystick hotplugging.

* https://www.kernel.org/doc/Documentation/input/joystick-api.txt
This commit is contained in:
Michał Garapich
2015-04-03 21:35:39 +02:00
committed by Roland Winklmeier
parent c94e5c0fbd
commit 2b07dfb789
3 changed files with 143 additions and 10 deletions

View File

@@ -131,7 +131,7 @@ namespace BlackInput
quint8 events[EV_MAX/8 + 1];
memset(events, 0, sizeof(events));
if ((ioctl(fd, EVIOCGVERSION, &version) >= 0) && (ioctl(fd, EVIOCGNAME(sizeof(name)), name)>=0) && (ioctl(fd, EVIOCGBIT(0,sizeof(events)), &events) >= 0) && test_bit(EV_KEY, events) && (((version >> 16) & 0xFF) > 0)) {
if ((ioctl(fd, EVIOCGVERSION, &version) >= 0) && (ioctl(fd, EVIOCGNAME(sizeof(name)), name)>=0) && (ioctl(fd, EVIOCGBIT(0,sizeof(events)), &events) >= 0) && test_bit(EV_KEY, events) && !test_bit(EV_SYN, events) && (((version >> 16) & 0xFF) > 0)) {
name[255]=0;
qDebug() << "CKeyboardLinux: " << qPrintable(inputFile->fileName()) << " " << name;
// Is it grabbed by someone else?