summaryrefslogtreecommitdiff
path: root/legacy/eeze/src/bin
diff options
context:
space:
mode:
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>2010-05-21 04:11:58 +0000
committerMike Blumenkrantz <michael.blumenkrantz@gmail.com>2010-05-21 04:11:58 +0000
commite13e6ce071d27f4068b8e4f1926db0e6fb735c5b (patch)
tree717d8f8b149c346f901a600e51c5f8f6f35129b0 /legacy/eeze/src/bin
parent0cae05c2a88a709eddfe467a7b7ab53af2aef80f (diff)
pretty huge overhaul:
test app should be a bit more robust now udev compat code is done (I think?) added udev walk functions for easier device checking fixed some potential segv in cases where errors checking was not complete enough SVN revision: 49081
Diffstat (limited to 'legacy/eeze/src/bin')
-rw-r--r--legacy/eeze/src/bin/eeze_udev_test.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/legacy/eeze/src/bin/eeze_udev_test.c b/legacy/eeze/src/bin/eeze_udev_test.c
index 4545140978..19da721d54 100644
--- a/legacy/eeze/src/bin/eeze_udev_test.c
+++ b/legacy/eeze/src/bin/eeze_udev_test.c
@@ -16,23 +16,19 @@ catch_events(const char *device, const char *event, void *data, Eeze_Udev_Watch
16 kbdmouse *akbdmouse = data; 16 kbdmouse *akbdmouse = data;
17 Eina_List *l; 17 Eina_List *l;
18 const char *name, *dev, *type; 18 const char *name, *dev, *type;
19 int new = 0;
20 19
21 /* the device that comes through will be prefixed by "/sys" 20 /* the device that comes through will be prefixed by "/sys"
22 * but the saved name will not, so we check for the saved name 21 * but the saved name will not, so we check for the saved name
23 * inside the device name 22 * inside the device name
24 */ 23 */
25 EINA_LIST_FOREACH(akbdmouse->kbds, l, name) 24 EINA_LIST_FOREACH(akbdmouse->kbds, l, name)
26 if (strstr(device, name)) goto end; 25 if (strncmp(device + 5, name, strlen(device + 5) - 8)) goto end;
27 EINA_LIST_FOREACH(akbdmouse->mice, l, name) 26 EINA_LIST_FOREACH(akbdmouse->mice, l, name)
28 if (strstr(device, name)) goto end; 27 if (strncmp(device + 5, name, strlen(device + 5) - 8)) goto end;
29 28
30 /* check to see if the device was just plugged in */ 29 /* check to see if the device was just plugged in */
31 if (eeze_udev_syspath_is_kbd(device) || eeze_udev_syspath_is_mouse(device)) 30 if (eeze_udev_syspath_is_kbd(device) || eeze_udev_syspath_is_mouse(device))
32 { 31 goto end;
33 new = 1;
34 goto end;
35 }
36 /* if we reach here, the device is neither a keyboard nor a mouse that we saw 32 /* if we reach here, the device is neither a keyboard nor a mouse that we saw
37 * previously, so we print a moderately amusing message and bail 33 * previously, so we print a moderately amusing message and bail
38 */ 34 */
@@ -44,7 +40,7 @@ end:
44 * we can retrieve them now even though the device has been removed and 40 * we can retrieve them now even though the device has been removed and
45 * is inaccessible to udev 41 * is inaccessible to udev
46 */ 42 */
47 if (new) 43 if (!strcmp(event, "add"))
48 { 44 {
49 dev = eeze_udev_syspath_get_devpath(device); 45 dev = eeze_udev_syspath_get_devpath(device);
50 type = "plugged in"; 46 type = "plugged in";
@@ -119,8 +115,7 @@ int main()
119 { /* add the devpath to the hash for use in the cb later */ 115 { /* add the devpath to the hash for use in the cb later */
120 if ((check = eeze_udev_syspath_get_devpath(name))) 116 if ((check = eeze_udev_syspath_get_devpath(name)))
121 eina_hash_direct_add(hash, name, check); /* get a property using the device's syspath */ 117 eina_hash_direct_add(hash, name, check); /* get a property using the device's syspath */
122 if ((check = eeze_udev_syspath_get_property(name, "ID_VENDOR"))) 118 printf("Found mouse %s with vendor: %s\n", name, eeze_udev_walk_get_sysattr(name, "manufacturer"));
123 printf("Found mouse %s with vendor: %s\n", name, check);
124 } 119 }
125 /* we save this list for later, because once a device is unplugged it can 120 /* we save this list for later, because once a device is unplugged it can
126 * no longer be detected by udev, and any related properties are unusable unless 121 * no longer be detected by udev, and any related properties are unusable unless