E_API E_Input *e_input = NULL;
+EINTERN const char *
+e_input_base_dir_get(void)
+{
+ return e_input->input_base_dir;
+}
+
EINTERN int
e_input_init(Ecore_Evas *ee)
{
goto log_err;
}
+ // TODO : make this variable configurable e.g. e.cfg
+ e_input->input_base_dir = eina_stringshare_add("/dev/input");
+
dev = e_input_device_open();
if (!dev)
e_input_device_close(dev);
log_err:
+ if (e_input->input_base_dir)
+ {
+ eina_stringshare_del(e_input->input_base_dir);
+ e_input->input_base_dir = NULL;
+ }
ecore_event_evas_shutdown();
ecore_event_evas_err:
E_EVENT_INPUT_ENABLED = -1;
E_EVENT_INPUT_DISABLED = -1;
+ if (e_input->input_base_dir)
+ eina_stringshare_del(e_input->input_base_dir);
e_input_device_close(e_input->dev);
free(e_input);
static void
_e_input_device_cb_close_restricted(int fd, void *data)
{
- E_Input_Backend *input;
- E_Input_Seat *seat;
- E_Input_Evdev *edev;
- Eina_List *l, *ll;
-
- if (!(input = data)) return;
-
- EINA_LIST_FOREACH(input->dev->seats, l, seat)
- {
- EINA_LIST_FOREACH(seat->devices, ll, edev)
- {
- if (edev->fd == fd)
- {
- _device_close(edev->path, fd);
-
- /* re-initialize fd after closing */
- edev->fd = -1;
- return;
- }
- }
- }
-
if (fd >= 0) close(fd);
}
}
}
+//LCOV_EXCL_START
+#ifdef _F_E_INPUT_ENABLE_DEVICE_CALIBRATION_
if ((!libinput_device_config_calibration_has_matrix(edev->device)) ||
(libinput_device_config_calibration_get_default_matrix(edev->device, cal) != 0))
return;
devices = eeze_udev_find_by_subsystem_sysname("input", sysname);
if (eina_list_count(devices) < 1) return;
+#ifdef _F_E_INPUT_USE_WL_CALIBRATION_
EINA_LIST_FREE(devices, device)
{
vals = eeze_udev_syspath_get_property(device, "WL_CALIBRATION");
- if ((!vals) ||
+ if ((!vals) ||
(sscanf(vals, "%f %f %f %f %f %f",
&cal[0], &cal[1], &cal[2], &cal[3], &cal[4], &cal[5]) != 6))
goto cont;
eina_stringshare_del(device);
continue;
}
+#endif//_F_E_INPUT_USE_WL_CALIBRATION_
+#endif//_F_E_INPUT_ENABLE_DEVICE_CALIBRATION_
+//LCOV_EXCL_STOP
}
static void
edev->seat = seat;
edev->device = device;
- edev->path = eina_stringshare_add(libinput_device_get_sysname(device));
+ edev->path = eina_stringshare_printf("%s/%s", e_input_base_dir_get(), libinput_device_get_sysname(device));
edev->fd = -1;
- if (edev->path)
- {
- devices = eeze_udev_find_by_filter("input", NULL, edev->path);
- if (eina_list_count(devices) >= 1)
- {
- Eina_List *l;
- const char *dev, *name;
-
- EINA_LIST_FOREACH(devices, l, dev)
- {
- name = eeze_udev_syspath_get_devname(dev);
- if (name && strstr(name, edev->path))
- {
- eina_stringshare_replace(&edev->path, eeze_udev_syspath_get_devpath(dev));
- break;
- }
- }
-
- EINA_LIST_FREE(devices, dev)
- eina_stringshare_del(dev);
- }
- }
-
if (libinput_device_has_capability(device, LIBINPUT_DEVICE_CAP_KEYBOARD))
{
edev->caps |= E_INPUT_SEAT_KEYBOARD;