}
test = udev_device_get_property_value(udev_device, "DEVPATH");
- if(test && strstr(test, "virtual")){
+ if (test && strstr(test, "virtual")) {
devnode = udev_device_get_devnode(libinput_device_get_udev_device(dev));
LOG("It contains virtual. No Check. (devnode = %s)\n", devnode);
return 0;
if (libinput_device_has_capability(dev, LIBINPUT_DEVICE_CAP_KEYBOARD)) {
devnode = udev_device_get_devnode(libinput_device_get_udev_device(dev));
- if(type == LIBINPUT_EVENT_DEVICE_ADDED) { // TODO. save using linked list
+ if (type == LIBINPUT_EVENT_DEVICE_ADDED) { // TODO. save using linked list
test = udev_device_get_property_value(udev_device, "ID_INPUT_KEYBOARD");
test1 = udev_device_get_property_value(udev_device, "ID_INPUT_KEY");
LOG("devnode = %s\n", devnode);
- if((test && (test[0] == '1')) ||
+ if ((test && (test[0] == '1')) ||
(test1 && (test1[0] == '1'))) {
LOG("ID_INPUT_KEYBOARD(_KEY) test = 1\n");
devices[devices_cnt].cap = LIBINPUT_DEVICE_CAP_KEYBOARD;
unsigned long keybits[NLONGS(KEY_CNT)] = { 0 };
ioctl(fd, EVIOCGBIT(EV_KEY, sizeof(keybits)), keybits);
for(int i = KEY_RESERVED; i< KEY_MAX; ++i)
- if(evdev_bit_is_set(keybits, i)){
+ if (evdev_bit_is_set(keybits, i)) {
LOG("Event Code %d\n", i);
devices[devices_cnt].available_keycode = i;
break;
}
if (libinput_device_has_capability(dev, LIBINPUT_DEVICE_CAP_POINTER)) {
devnode = udev_device_get_devnode(libinput_device_get_udev_device(dev));
- if(type == LIBINPUT_EVENT_DEVICE_ADDED) { // TODO. save using linked list
+ if (type == LIBINPUT_EVENT_DEVICE_ADDED) { // TODO. save using linked list
const char *test = NULL;
test = udev_device_get_property_value(udev_device, "ID_INPUT_MOUSE");
LOG("devnode = %s\n", devnode);
- if(test && (test[0] == '1')){
+ if (test && (test[0] == '1')) {
LOG("ID_INPUT_MOUSE test = %s\n", test);
devices[devices_cnt].cap = LIBINPUT_DEVICE_CAP_POINTER;
devices[devices_cnt++].path = devnode;
}
if (libinput_device_has_capability(dev, LIBINPUT_DEVICE_CAP_TOUCH)) {
devnode = udev_device_get_devnode(libinput_device_get_udev_device(dev));
- if(type == LIBINPUT_EVENT_DEVICE_ADDED) { // TODO. save using linked list
+ if (type == LIBINPUT_EVENT_DEVICE_ADDED) { // TODO. save using linked list
const char *test = NULL;
test = udev_device_get_property_value(udev_device, "ID_INPUT_TOUCHSCREEN");
LOG("devnode = %s\n", devnode);
- if(test && (test[0] == '1')){
+ if (test && (test[0] == '1')) {
LOG("ID_INPUT_TOUCHSCREEN test = %s\n", test);
devices[devices_cnt].cap = LIBINPUT_DEVICE_CAP_TOUCH;
devices[devices_cnt].path = devnode;
unsigned long keybits[NLONGS(KEY_CNT)] = { 0 };
ioctl(fd, EVIOCGBIT(EV_ABS, sizeof(keybits)), keybits);
code = ABS_MT_POSITION_X;
- if(evdev_bit_is_set(keybits, code)){
+ if (evdev_bit_is_set(keybits, code)) {
LOG("Event Code %d\n", code);
print_absdata(&(devices[devices_cnt]), fd, code);
}
code = ABS_MT_POSITION_Y;
- if(evdev_bit_is_set(keybits, code)){
+ if (evdev_bit_is_set(keybits, code)) {
LOG("Event Code %d\n", code);
print_absdata(&(devices[devices_cnt]), fd, code);
}
LOG("type = %d, button = %d, x = %d, y = %d, state = %d\n", queue_record_event[pop_idx].p.event_type, queue_record_event[pop_idx].p.button,
queue_record_event[pop_idx].p.x, queue_record_event[pop_idx].p.y, queue_record_event[pop_idx].p.state);
- if(queue_record_event[pop_idx].p.event_type != type) return -1;
- if(queue_record_event[pop_idx].p.x != (int)ux) return -1;
- if(queue_record_event[pop_idx].p.y != (int)uy) return -1;
+ if (queue_record_event[pop_idx].p.event_type != type) return -1;
+ if (queue_record_event[pop_idx].p.x != (int)ux) return -1;
+ if (queue_record_event[pop_idx].p.y != (int)uy) return -1;
EXPECT_EQ(queue_record_event[pop_idx].p.event_type, type);
EXPECT_EQ(queue_record_event[pop_idx].p.x, (int)ux);
state == LIBINPUT_BUTTON_STATE_PRESSED ? "pressed" : "released",
libinput_event_pointer_get_seat_button_count(p));
- if(queue_record_event[pop_idx].p.event_type != type) return -1;
- if(queue_record_event[pop_idx].p.button != button) return -1;
- if(queue_record_event[pop_idx].p.state != state) return -1;
+ if (queue_record_event[pop_idx].p.event_type != type) return -1;
+ if (queue_record_event[pop_idx].p.button != button) return -1;
+ if (queue_record_event[pop_idx].p.state != state) return -1;
LOG("type = %d, button = %d, x = %d, y = %d, state = %d\n", queue_record_event[pop_idx].p.event_type, queue_record_event[pop_idx].p.button,
queue_record_event[pop_idx].p.x, queue_record_event[pop_idx].p.y, queue_record_event[pop_idx].p.state);
}
libinput_event_destroy(ev);
libinput_dispatch(li);
- if(rc < 0) return -1;
+ if (rc < 0) return -1;
}
return 0;
}
struct record_libinput_event_keyboard k = {LIBINPUT_EVENT_NONE, 0, 0};
struct record_libinput_event_touch t = {LIBINPUT_EVENT_NONE, 0, 0, 0, 0, 0, 0, 0, 0};
- if(devices[idx].cap == LIBINPUT_DEVICE_CAP_POINTER){
+ if (devices[idx].cap == LIBINPUT_DEVICE_CAP_POINTER) {
LOG("create_mouse_event (path: %s)\n", devices[idx].path);
fd = open(devices[idx].path, O_RDWR);
if (fd < 0) {
rc_e.k = k;
rc_e.t = t;
- if(input_mouse_event_gen(fd, p[i].button, p[i].x, p[i].y, p[i].state) < 0) {
+ if (input_mouse_event_gen(fd, p[i].button, p[i].x, p[i].y, p[i].state) < 0) {
LOG("No device\n");
continue;
}
struct record_libinput_event_pointer p = {LIBINPUT_EVENT_NONE, 0, 0, 0, 0};
struct record_libinput_event_touch t = {LIBINPUT_EVENT_NONE, 0, 0, 0, 0, 0, 0, 0, 0};
- if(devices[idx].cap == LIBINPUT_DEVICE_CAP_KEYBOARD){
+ if (devices[idx].cap == LIBINPUT_DEVICE_CAP_KEYBOARD) {
LOG("create_keyboard_event (path: %s)\n", devices[idx].path);
fd = open(devices[idx].path, O_RDWR);
if (fd < 0) {
rc_e.p = p;
rc_e.t = t;
- if(input_keyboard_event_gen(fd, k[i].key, k[i].state) < 0) {
+ if (input_keyboard_event_gen(fd, k[i].key, k[i].state) < 0) {
LOG("No device\n");
continue;
}
int fd = -1;
errno = 0;
- if(devices[idx].cap == LIBINPUT_DEVICE_CAP_TOUCH){
+ if (devices[idx].cap == LIBINPUT_DEVICE_CAP_TOUCH) {
LOG("multi_touch_support\n");
fd = open(devices[idx].path, O_RDONLY | O_NONBLOCK);
if (fd < 0) {
struct record_libinput_event_pointer p = {LIBINPUT_EVENT_NONE, 0, 0, 0, 0};
struct record_libinput_event_keyboard k = {LIBINPUT_EVENT_NONE, 0, 0};
- if(devices[idx].cap == LIBINPUT_DEVICE_CAP_TOUCH){
+ if (devices[idx].cap == LIBINPUT_DEVICE_CAP_TOUCH) {
LOG("create_touch_event (path: %s)\n", devices[idx].path);
fd = open(devices[idx].path, O_RDWR);
if (fd < 0) {
rc_e.p = p;
rc_e.k = k;
- if(input_touch_event_gen(fd, t[i].idx, t[i].x, t[i].y, t[i].state) < 0) {
+ if (input_touch_event_gen(fd, t[i].idx, t[i].x, t[i].y, t[i].state) < 0) {
LOG("No device\n");
continue;
}
int ret = 0;
for(int i=0; i< devices_cnt; ++i) {
- if(devices[i].cap == LIBINPUT_DEVICE_CAP_POINTER) {
+ if (devices[i].cap == LIBINPUT_DEVICE_CAP_POINTER) {
checked = true;
LOG("LIBINPUT_DEVICE_CAP_POINTER, path = %s\n", devices[i].path);
queue_idx = 0;
pop_idx = -1;
create_mouse_event(li, i);
ret = handle_libinput_event(li);
- if(queue_idx == (pop_idx+1) && !ret) {
+ if (queue_idx == (pop_idx+1) && !ret) {
val = true;
}
}
- if(val) return true;
+ if (val) return true;
}
- if(!val && !checked){
+ if (!val && !checked) {
LOG("No Devices\n");
return true;
}
int ret = 0;
for(int i=0; i< devices_cnt; ++i) {
- if(devices[i].cap == LIBINPUT_DEVICE_CAP_KEYBOARD) {
+ if (devices[i].cap == LIBINPUT_DEVICE_CAP_KEYBOARD) {
LOG("LIBINPUT_DEVICE_CAP_KEYBOARD, path = %s\n", devices[i].path);
checked = true;
queue_idx = 0;
pop_idx = -1;
create_keyboard_event(li, i);
ret = handle_libinput_event(li);
- if(queue_idx == (pop_idx+1) && !ret) {
+ if (queue_idx == (pop_idx+1) && !ret) {
val = true;
}
}
- if(val) return true;
+ if (val) return true;
}
- if(!val && !checked){
+ if (!val && !checked) {
LOG("No Devices\n");
return true;
}
int ret = 0;
for(int i=0; i< devices_cnt; ++i) {
- if(devices[i].cap == LIBINPUT_DEVICE_CAP_TOUCH) {
+ if (devices[i].cap == LIBINPUT_DEVICE_CAP_TOUCH) {
LOG("LIBINPUT_DEVICE_CAP_TOUCH, path = %s\n", devices[i].path);
checked = true;
queue_idx = 0;
pop_idx = -1;
- if(multi_touch_support(li, i) < 0) {
+ if (multi_touch_support(li, i) < 0) {
LOG("NO MULTI TOUCH SUPPORT. don't have to test touch\n");
}
else{
create_touch_event(li, i);
ret = handle_libinput_event(li);
- if(queue_idx == (pop_idx+1) && !ret) {
+ if (queue_idx == (pop_idx+1) && !ret) {
val = true;
}
}
}
- if(val) return true;
+ if (val) return true;
}
- if(!val && !checked){
+ if (!val && !checked) {
LOG("No Devices\n");
return true;
}