#include "e_input_private.h"
#include "e_input_event.h"
#include "e_keyrouter.h"
+#include <libudev.h>
#include <glib.h>
}
static Eina_Bool
-_e_input_add_ecore_device(E_Input_Evdev *edev, Ecore_Device_Class clas)
+_e_input_add_ecore_device(E_Input_Evdev *edev, Ecore_Device_Class clas, Ecore_Device_Subclass subclas)
{
const Eina_List *dev_list = NULL;
const Eina_List *l;
ecore_device_name_set(dev, libinput_device_get_name(edev->device));
ecore_device_identifier_set(dev, edev->path);
ecore_device_class_set(dev, clas);
- ecore_device_subclass_set(dev, ECORE_DEVICE_SUBCLASS_NONE);
+ ecore_device_subclass_set(dev, subclas);
if (!edev->ecore_dev)
{
e_device_name_set(e_dev, libinput_device_get_name(edev->device));
e_device_identifier_set(e_dev, edev->path);
e_device_class_set(e_dev, clas);
- e_device_subclass_set(e_dev, ECORE_DEVICE_SUBCLASS_NONE);
+ e_device_subclass_set(e_dev, subclas);
if (!edev->e_dev)
{
return ret;
}
+static Ecore_Device_Subclass
+_e_input_device_get_ecore_device_subclass(E_Input_Evdev *edev, Ecore_Device_Class clas)
+{
+ Ecore_Device_Subclass subclas = ECORE_DEVICE_SUBCLASS_NONE;
+ struct udev_device *udev_device = NULL;
+ const char *devpath;
+
+ udev_device = libinput_device_get_udev_device(edev->device);
+ devpath = udev_device_get_property_value(udev_device, "DEVPATH");
+ if (devpath && strstr(devpath, "virtual"))
+ {
+ if (clas == ECORE_DEVICE_CLASS_MOUSE)
+ subclas = ECORE_DEVICE_SUBCLASS_VIRTUAL_MOUSE;
+ else if (clas == ECORE_DEVICE_CLASS_KEYBOARD)
+ subclas = ECORE_DEVICE_SUBCLASS_VIRTUAL_REMOCON;
+ }
+ return subclas;
+}
+
Eina_Bool
_e_input_device_add(E_Input_Evdev *edev)
{
Eina_Bool ret = EINA_FALSE;
Ecore_Device_Class clas = ECORE_DEVICE_CLASS_NONE;
+ Ecore_Device_Subclass subclas = ECORE_DEVICE_SUBCLASS_NONE;
if (edev->caps & E_INPUT_SEAT_POINTER)
{
if (!e_devicemgr_detent_is_detent(libinput_device_get_name(edev->device)))
- clas = _e_input_seat_cap_to_ecore_device_class(E_INPUT_SEAT_POINTER);
- ret = _e_input_add_ecore_device(edev, clas);
+ {
+ clas = _e_input_seat_cap_to_ecore_device_class(E_INPUT_SEAT_POINTER);
+ subclas = _e_input_device_get_ecore_device_subclass(edev, clas);
+ }
+ ret = _e_input_add_ecore_device(edev, clas, subclas);
}
if (edev->caps & E_INPUT_SEAT_KEYBOARD)
{
clas = _e_input_seat_cap_to_ecore_device_class(E_INPUT_SEAT_KEYBOARD);
- ret = _e_input_add_ecore_device(edev, clas);
+ subclas = _e_input_device_get_ecore_device_subclass(edev, clas);
+ ret = _e_input_add_ecore_device(edev, clas, subclas);
}
if (edev->caps & E_INPUT_SEAT_TOUCH)
{
clas = _e_input_seat_cap_to_ecore_device_class(E_INPUT_SEAT_TOUCH);
- ret = _e_input_add_ecore_device(edev, clas);
+ ret = _e_input_add_ecore_device(edev, clas, subclas);
}
return ret;