Annotation of /trunk/xorg-server/patches/xorg-server-1.12.3-kdrive-evdev-with-valid-mouse-devices.patch
Parent Directory | Revision Log
Revision 1880 -
(hide annotations)
(download)
Tue Aug 21 12:51:10 2012 UTC (12 years, 1 month ago) by niro
File size: 1671 byte(s)
Tue Aug 21 12:51:10 2012 UTC (12 years, 1 month ago) by niro
File size: 1671 byte(s)
-rediffed for xorg-server-1.12.3
1 | niro | 1880 | diff -Naur xorg-server-1.12.3/hw/kdrive/linux/evdev.c xorg-server-1.12.3-magellan/hw/kdrive/linux/evdev.c |
2 | --- xorg-server-1.12.3/hw/kdrive/linux/evdev.c 2012-06-26 06:12:50.000000000 +0200 | ||
3 | +++ xorg-server-1.12.3-magellan/hw/kdrive/linux/evdev.c 2012-08-21 16:49:17.955981151 +0200 | ||
4 | @@ -191,6 +191,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 | @@ -200,15 +202,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 | @@ -216,10 +232,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; |