Line 0
Link Here
|
|
|
1 |
--- src/wcmISDV4.c.orig 2013-08-07 16:41:16.844274271 -0700 |
2 |
+++ src/wcmISDV4.c 2013-08-07 19:38:52.321272814 -0700 |
3 |
@@ -24,11 +24,10 @@ |
4 |
#include "xf86Wacom.h" |
5 |
#include <xf86_OSproc.h> |
6 |
#include "wcmFilter.h" |
7 |
-#include <linux/serial.h> |
8 |
#include "isdv4.h" |
9 |
+#include <termios.h> |
10 |
#include <unistd.h> |
11 |
#include <fcntl.h> |
12 |
-#include <libudev.h> |
13 |
|
14 |
#define RESET_RELATIVE(ds) do { (ds).relwheel = 0; } while (0) |
15 |
|
16 |
@@ -192,11 +191,11 @@ |
17 |
|
18 |
static Bool isdv4Detect(InputInfoPtr pInfo) |
19 |
{ |
20 |
- struct serial_struct ser; |
21 |
+ struct termios termAttr; |
22 |
int rc; |
23 |
|
24 |
- rc = ioctl(pInfo->fd, TIOCGSERIAL, &ser); |
25 |
- if (rc == -1) |
26 |
+ rc = tcgetattr( pInfo->fd, &termAttr ); |
27 |
+ if( rc != 0 ) |
28 |
return FALSE; |
29 |
|
30 |
return TRUE; |
31 |
@@ -935,67 +934,6 @@ |
32 |
}; |
33 |
|
34 |
/** |
35 |
- * Query the model number from the sysfs /sys/.../device/id file and return |
36 |
- * the matching model and the ID for the model we found. |
37 |
- * |
38 |
- * @param pInfo Used for debugging purposes only. |
39 |
- * @param fd File descriptor to the serial device. |
40 |
- * @param[out] id On success, returns the numeric ID for this device |
41 |
- * according to the model-specific matching pattern. |
42 |
- * |
43 |
- * @return The model description for the matching device or NULL if no |
44 |
- * matching one could be found. |
45 |
- */ |
46 |
-static ISDV4ModelDesc* |
47 |
-model_from_sysfs(const InputInfoPtr pInfo, int fd, int *id) |
48 |
-{ |
49 |
- WacomDevicePtr priv = pInfo->private; |
50 |
- ISDV4ModelDesc* model = NULL; |
51 |
- struct udev *udev = NULL; |
52 |
- struct udev_device *device = NULL; |
53 |
- struct stat st; |
54 |
- char *sysfs_path = NULL; |
55 |
- FILE *file = NULL; |
56 |
- |
57 |
- fstat(fd, &st); |
58 |
- |
59 |
- udev = udev_new(); |
60 |
- device = udev_device_new_from_devnum(udev, 'c', st.st_rdev); |
61 |
- |
62 |
- if (!device) |
63 |
- goto out; |
64 |
- |
65 |
- if (asprintf(&sysfs_path, "%s/device/id", |
66 |
- udev_device_get_syspath(device)) == -1) |
67 |
- goto out; |
68 |
- |
69 |
- DBG(8, priv, "sysfs path: %s\n", sysfs_path); |
70 |
- |
71 |
- file = fopen(sysfs_path, "r"); |
72 |
- if (!file) |
73 |
- goto out; |
74 |
- |
75 |
- model = isdv4_models; |
76 |
- |
77 |
- while(model->pattern && fscanf(file, model->pattern, id) <= 0) |
78 |
- model++; |
79 |
- |
80 |
- if (!model->pattern) |
81 |
- model = NULL; |
82 |
- |
83 |
- DBG(8, priv, "sysfs check found %s:%d\n", |
84 |
- (model) ? model->pattern : "<unknown>", *id); |
85 |
- |
86 |
-out: |
87 |
- udev_device_unref(device); |
88 |
- udev_unref(udev); |
89 |
- if (file) |
90 |
- fclose(file); |
91 |
- free(sysfs_path); |
92 |
- return model; |
93 |
-} |
94 |
- |
95 |
-/** |
96 |
* Query the device's fd for the key bits and the tablet ID. Returns the ID |
97 |
* on success. If the model vendor is unknown, we assume a penabled device |
98 |
* (0x90). If the model vendor is known but the model itself is unknown, the |
99 |
@@ -1010,22 +948,18 @@ |
100 |
{ |
101 |
int id = 0; |
102 |
int tablet_id = 0x90; |
103 |
- struct serial_struct tmp; |
104 |
+ struct termios tmp; |
105 |
WacomDevicePtr priv = (WacomDevicePtr)pInfo->private; |
106 |
WacomCommonPtr common = priv->common; |
107 |
ISDV4ModelDesc *model = isdv4_models; |
108 |
|
109 |
- if (ioctl(pInfo->fd, TIOCGSERIAL, &tmp) < 0) |
110 |
+ if( tcgetattr( pInfo->fd, &tmp ) != 0 ) |
111 |
return 0; |
112 |
|
113 |
/* check device name for ID first */ |
114 |
while (model->pattern && sscanf(pInfo->name, model->pattern, &id) < 1) |
115 |
model++; |
116 |
|
117 |
- /* grab id from sysfs/.../device/id */ |
118 |
- if (!model->pattern) |
119 |
- model = model_from_sysfs(pInfo, pInfo->fd, &id); |
120 |
- |
121 |
memset(common->wcmKeys, 0, sizeof(common->wcmKeys)); |
122 |
|
123 |
/* default to penabled */ |