summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordiscomfitor <discomfitor>2012-06-29 08:18:12 +0000
committerdiscomfitor <discomfitor@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>2012-06-29 08:18:12 +0000
commit09a379bc2cc6c1c7aab0478991a104b0c6af1844 (patch)
tree2d44684e7d7c4cabafc22067d4cd3a2285655946 /src
parent4c9cb0f26ae9b8780610111f2532112276ffd1d3 (diff)
downloadeeze-09a379bc2cc6c1c7aab0478991a104b0c6af1844.tar.gz
eeze-09a379bc2cc6c1c7aab0478991a104b0c6af1844.tar.bz2
eeze-09a379bc2cc6c1c7aab0478991a104b0c6af1844.zip
patch from christophe.dumez@intel.com for joystick support
ticket #1100 git-svn-id: http://svn.enlightenment.org/svn/e/trunk/eeze@73027 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33
Diffstat (limited to 'src')
-rw-r--r--src/lib/Eeze.h15
-rw-r--r--src/lib/eeze_udev_find.c7
-rw-r--r--src/lib/eeze_udev_syspath.c28
-rw-r--r--src/lib/eeze_udev_watch.c25
4 files changed, 68 insertions, 7 deletions
diff --git a/src/lib/Eeze.h b/src/lib/Eeze.h
index dd9b8ba..e816655 100644
--- a/src/lib/Eeze.h
+++ b/src/lib/Eeze.h
@@ -216,7 +216,11 @@ typedef enum
/** - WebCam */
EEZE_UDEV_TYPE_V4L,
/** - Bluetooth */
- EEZE_UDEV_TYPE_BLUETOOTH
+ EEZE_UDEV_TYPE_BLUETOOTH,
+ /** - Joystick
+ * @since 1.3
+ */
+ EEZE_UDEV_TYPE_JOYSTICK
} Eeze_Udev_Type;
/**@}*/
@@ -456,6 +460,15 @@ EAPI Eina_Bool eeze_udev_syspath_is_kbd(const char *syspath);
* @return If true, the device is a touchpad
*/
EAPI Eina_Bool eeze_udev_syspath_is_touchpad(const char *syspath);
+
+/**
+ * Checks whether the device is a joystick.
+ *
+ * @param syspath The /sys/ path with or without the /sys/
+ * @return If true, the device is a joystick
+ * @since 1.3
+ */
+EAPI Eina_Bool eeze_udev_syspath_is_joystick(const char *syspath);
/**
* @}
*/
diff --git a/src/lib/eeze_udev_find.c b/src/lib/eeze_udev_find.c
index bdd1037..3bd06ab 100644
--- a/src/lib/eeze_udev_find.c
+++ b/src/lib/eeze_udev_find.c
@@ -188,6 +188,13 @@ eeze_udev_find_by_type(Eeze_Udev_Type etype,
#endif
break;
+ case EEZE_UDEV_TYPE_JOYSTICK:
+ udev_enumerate_add_match_subsystem(en, "input");
+#ifndef OLD_UDEV_RRRRRRRRRRRRRR
+ udev_enumerate_add_match_property(en, "ID_INPUT_JOYSTICK", "1");
+#endif
+ break;
+
case EEZE_UDEV_TYPE_DRIVE_MOUNTABLE:
udev_enumerate_add_match_subsystem(en, "block");
udev_enumerate_add_match_property(en, "ID_FS_USAGE", "filesystem");
diff --git a/src/lib/eeze_udev_syspath.c b/src/lib/eeze_udev_syspath.c
index 55ba843..df858e6 100644
--- a/src/lib/eeze_udev_syspath.c
+++ b/src/lib/eeze_udev_syspath.c
@@ -236,6 +236,34 @@ eeze_udev_syspath_is_touchpad(const char *syspath)
return touchpad;
}
+EAPI Eina_Bool
+eeze_udev_syspath_is_joystick(const char *syspath)
+{
+ _udev_device *device = NULL;
+ Eina_Bool joystick = EINA_FALSE;
+ const char *test;
+
+ if (!syspath)
+ return EINA_FALSE;
+
+ if (!(device = _new_device(syspath)))
+ return EINA_FALSE;
+#ifdef OLD_UDEV_RRRRRRRRRRRRRR
+ test = udev_device_get_property_value(device, "ID_CLASS");
+
+ if ((test) && (!strcmp(test, "joystick")))
+ joystick = EINA_TRUE;
+#else
+ test = udev_device_get_property_value(device, "ID_INPUT_JOYSTICK");
+
+ if (test && (test[0] == '1'))
+ joystick = EINA_TRUE;
+
+#endif
+ udev_device_unref(device);
+ return joystick;
+}
+
EAPI const char *
eeze_udev_devpath_get_syspath(const char *devpath)
{
diff --git a/src/lib/eeze_udev_watch.c b/src/lib/eeze_udev_watch.c
index 5c23421..b89e2d6 100644
--- a/src/lib/eeze_udev_watch.c
+++ b/src/lib/eeze_udev_watch.c
@@ -166,6 +166,24 @@ _get_syspath_from_watch(void *data,
break;
+ case EEZE_UDEV_TYPE_JOYSTICK:
+#ifdef OLD_UDEV_RRRRRRRRRRRRRR
+ if ((!(test = udev_device_get_subsystem(device)))
+ || (strcmp(test, "input")))
+ goto error;
+
+ test = udev_device_get_property_value(device, "ID_CLASS");
+
+ if ((test) && (!strcmp(test, "joystick")))
+ break;
+
+ goto error;
+#endif
+ if (!udev_device_get_property_value(device, "ID_INPUT_JOYSTICK"))
+ goto error;
+
+ break;
+
case EEZE_UDEV_TYPE_DRIVE_MOUNTABLE:
#ifdef OLD_UDEV_RRRRRRRRRRRRRR
if ((!(test = udev_device_get_subsystem(device)))
@@ -319,14 +337,9 @@ eeze_udev_watch_add(Eeze_Udev_Type type,
switch (type)
{
+ case EEZE_UDEV_TYPE_JOYSTICK:
case EEZE_UDEV_TYPE_KEYBOARD:
- udev_monitor_filter_add_match_subsystem_devtype(mon, "input", NULL);
- break;
-
case EEZE_UDEV_TYPE_MOUSE:
- udev_monitor_filter_add_match_subsystem_devtype(mon, "input", NULL);
- break;
-
case EEZE_UDEV_TYPE_TOUCHPAD:
udev_monitor_filter_add_match_subsystem_devtype(mon, "input", NULL);
break;