bool huamobile_touch_device_matcher(int fd, const char *name, void *data) { int ret; uint8_t abs_bitmask[ABS_BITMASK_SIZE]; uint8_t key_bitmask[KEY_BITMASK_SIZE]; pr_pos_info(); ret = huamobile_event_get_abs_bitmask(fd, abs_bitmask); if (ret < 0) { pr_error_info("huamobile_event_get_abs_bitmask"); return false; } if (huamobile_multi_touch_device_match(abs_bitmask)) { pr_green_info("Deivce %s mutil touch screen", name); return true; } ret = huamobile_event_get_key_bitmask(fd, key_bitmask); if (ret < 0) { pr_error_info("huamobile_event_get_key_bitmask"); return false; } return huamobile_single_touch_device_match(abs_bitmask, key_bitmask); }
static struct huamobile_input_device *huamobile_input_device_create(uint8_t *key_bitmask, uint8_t *abs_bitmask, uint8_t *rel_bitmask) { if (huamobile_gsensor_device_match(abs_bitmask)) { return huamobile_gsensor_create(); } if (huamobile_multi_touch_device_match(abs_bitmask)) { return huamobile_multi_touch_device_create(); } if (huamobile_single_touch_device_match(abs_bitmask, key_bitmask)) { return huamobile_single_touch_device_create(); } if (huamobile_mouse_device_match(key_bitmask, rel_bitmask)) { return huamobile_mouse_create(); } if (huamobile_keypad_device_match(key_bitmask)) { return huamobile_keypad_create(); } return NULL; }