Mike Blumenkrantz (zmike/discomfitor) <michael.blumenkrantz@gmail.com>
Cedric Bail <cedric@efl.so>
Mikael Sans <sans.mikael@gmail.com>
+Christophe Dumez <christophe.dumez@intel.com>
2012-06-29 Mike Blumenkrantz
* Fix crash in eeze_net_free()
+
+2012-06-29 Christophe Dumez (christophe.dumez@intel.com)
+
+ * Added joystick detection
-Eeze 1.2.0
+Eeze 1.3.0
+
+Changes since Eeze 1.1.0:
+-------------------------
+
+Additions:
+
+ * Joystick support
Changes since Eeze 1.1.0:
-------------------------
/** - 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;
/**@}*/
* @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);
/**
* @}
*/
#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");
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)
{
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)))
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;