forked from enlightenment/efl
patch from christophe.dumez@intel.com for joystick support
ticket #1100 SVN revision: 73027
This commit is contained in:
parent
cbfb6d03a8
commit
cda0901ae0
|
@ -1,3 +1,4 @@
|
|||
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>
|
||||
|
|
|
@ -96,3 +96,7 @@
|
|||
2012-06-29 Mike Blumenkrantz
|
||||
|
||||
* Fix crash in eeze_net_free()
|
||||
|
||||
2012-06-29 Christophe Dumez (christophe.dumez@intel.com)
|
||||
|
||||
* Added joystick detection
|
||||
|
|
|
@ -1,4 +1,11 @@
|
|||
Eeze 1.2.0
|
||||
Eeze 1.3.0
|
||||
|
||||
Changes since Eeze 1.1.0:
|
||||
-------------------------
|
||||
|
||||
Additions:
|
||||
|
||||
* Joystick support
|
||||
|
||||
Changes since Eeze 1.1.0:
|
||||
-------------------------
|
||||
|
|
|
@ -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);
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue