static void _device_calibration_set(Ecore_Drm_Evdev *edev) { const char *sysname; float cal[6]; const char *device; Eina_List *devices; const char *vals; enum libinput_config_status status; if ((!libinput_device_config_calibration_has_matrix(edev->device)) || (libinput_device_config_calibration_get_default_matrix(edev->device, cal) != 0)) return; sysname = libinput_device_get_sysname(edev->device); devices = eeze_udev_find_by_subsystem_sysname("input", sysname); if (eina_list_count(devices) < 1) return; EINA_LIST_FREE(devices, device) { vals = eeze_udev_syspath_get_property(device, "WL_CALIBRATION"); 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; cal[2] /= edev->output->current_mode->width; cal[5] /= edev->output->current_mode->height; status = libinput_device_config_calibration_set_matrix(edev->device, cal); if (status != LIBINPUT_CONFIG_STATUS_SUCCESS) ERR("Failed to apply calibration"); cont: eina_stringshare_del(device); continue; }
static Emotion_Webcam * _emotion_webcam_new(const char *syspath) { Emotion_Webcam *test; const char *device; char *local; test = malloc(sizeof (Emotion_Webcam)); if (!test) return NULL; test->custom = NULL; test->syspath = eina_stringshare_ref(syspath); test->name = eeze_udev_syspath_get_sysattr(syspath, "name"); device = eeze_udev_syspath_get_property(syspath, "DEVNAME"); local = alloca(eina_stringshare_strlen(device) + 8); snprintf(local, eina_stringshare_strlen(device) + 8, "v4l2://%s", device); test->device = eina_stringshare_add(local); eina_stringshare_del(device); test->filename = test->device + 7; return test; }