Contents of /trunk/xorg-server/patches/xorg-server-1.8.0-kdrive-evdev-with-valid-mouse-devices.patch
Parent Directory | Revision Log
Revision 1046 -
(show annotations)
(download)
Tue May 25 22:47:59 2010 UTC (14 years, 4 months ago) by niro
File size: 1700 byte(s)
Tue May 25 22:47:59 2010 UTC (14 years, 4 months ago) by niro
File size: 1700 byte(s)
-added some fixes for kdrive
1 | diff -Naur xorg-server-1.8.0/hw/kdrive/linux/evdev.c xorg-server-1.8.0-magellan/hw/kdrive/linux/evdev.c |
2 | --- xorg-server-1.8.0/hw/kdrive/linux/evdev.c 2010-03-24 14:03:51.000000000 +0100 |
3 | +++ xorg-server-1.8.0-magellan/hw/kdrive/linux/evdev.c 2010-05-26 00:45:59.000000000 +0200 |
4 | @@ -195,6 +195,8 @@ |
5 | "/dev/input/event1", |
6 | "/dev/input/event2", |
7 | "/dev/input/event3", |
8 | + "/dev/input/event4", |
9 | + "/dev/input/event5", |
10 | }; |
11 | |
12 | #define NUM_DEFAULT_EVDEV (sizeof (kdefaultEvdev) / sizeof (kdefaultEvdev[0])) |
13 | @@ -204,15 +206,29 @@ |
14 | { |
15 | int i; |
16 | int fd; |
17 | + int ret; |
18 | + unsigned long ev[NBITS(EV_MAX)]; |
19 | |
20 | if (!pi->path) { |
21 | for (i = 0; i < NUM_DEFAULT_EVDEV; i++) { |
22 | - fd = open (kdefaultEvdev[i], 2); |
23 | - if (fd >= 0) { |
24 | + if ((fd = open (kdefaultEvdev[i], 2)) < 0) { |
25 | + continue; |
26 | + } |
27 | + ret = ioctl (fd, EVIOCGBIT (0, sizeof (ev)), ev); |
28 | + close (fd); |
29 | + if (ret < 0) { |
30 | + ErrorF("EVIOCGBIT 0\n"); |
31 | + continue; |
32 | + } |
33 | + if (ISBITSET (ev, EV_KEY) && ISBITSET (ev, EV_REL)) { |
34 | pi->path = strdup (kdefaultEvdev[i]); |
35 | break; |
36 | } |
37 | } |
38 | + if (!pi->path) { |
39 | + ErrorF("Failed to find a valid mouse device\n"); |
40 | + return BadMatch; |
41 | + } |
42 | } |
43 | else { |
44 | fd = open (pi->path, O_RDWR); |
45 | @@ -220,10 +236,8 @@ |
46 | ErrorF("Failed to open evdev device %s\n", pi->path); |
47 | return BadMatch; |
48 | } |
49 | + close(fd); |
50 | } |
51 | - |
52 | - close(fd); |
53 | - |
54 | pi->name = strdup("Evdev mouse"); |
55 | |
56 | return Success; |