Fix configuration + Exception.

This commit is contained in:
Merlijn Wajer 2013-05-18 22:25:17 +02:00
parent d3b23386bf
commit a340b28289
5 changed files with 3 additions and 45 deletions

View File

@ -119,10 +119,10 @@ class InputDevice(object):
def open_uinput():
try:
f = os.open('/dev/uinput', os.O_WRONLY | os.O_NONBLOCK)
except IOError:
except OSError:
try:
f = os.open('/dev/input/uinput', os.O_WRONLY | os.O_NONBLOCK)
except IOError:
except OSError:
print 'FAIL MUCH?'
return None
return f

View File

@ -71,7 +71,7 @@ class KeyMapper(object):
"""
_type = ev.type
if _type in self._config:
if (fd, _type) in self._config:
typemaps = self._config[(fd, _type)]
if ev.code in typemaps:
info = typemaps[ev.code]

View File

@ -1,13 +0,0 @@
.PHONY: default clean
CFLAGS+=-ansi -pedantic -Wall -Wextra -Werror -Wno-unused-result
CFLAGS+=-pipe -O2
CFLAGS+=-D_BSD_SOURCE
default: read
map: read.c
$(CC) read.c $(CFLAGS) -o read
clean:
rm -f read

View File

@ -1,3 +0,0 @@
Use: evtest /dev/input/by-id/usb-Logitech_USB-PS_2_Optical_Mouse-event-mouse
Check: http://cgit.freedesktop.org/evtest/tree/evtest.c#n739

View File

@ -1,26 +0,0 @@
#include <stdio.h>
#include <stdlib.h>
#include <linux/input.h>
#include <unistd.h>
#include <fcntl.h>
#define INPUT_PATH "/dev/input/by-id/usb-Logitech_USB-PS_2_Optical_Mouse-event-mouse"
int main (int argc, char** argv) {
int f;
(void)argc;
(void)argv;
f = open(INPUT_PATH, O_RDONLY);
if (f < 0) {
perror("open");
return 1;
}
return 0;
}