Fix coding style 47/293247/6
authorJihoon Kim <jihoon48.kim@samsung.com>
Tue, 23 May 2023 04:39:40 +0000 (13:39 +0900)
committerJihoon Kim <jihoon48.kim@samsung.com>
Fri, 12 Jan 2024 06:01:10 +0000 (15:01 +0900)
Change-Id: I5bfd5e9070a5d4bff5efd662ef8480856008fad0
Signed-off-by: Jihoon Kim <jihoon48.kim@samsung.com>
haltests/test_hal_libinput_info.cpp

index 94fa76f16af5a6df84b5f0262c041fd7446b3272..04f24afde7eae05df818f8236f45236446a96a48 100644 (file)
@@ -73,7 +73,7 @@ int handle_device_notify(struct libinput_event *ev)
        }
 
        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;
@@ -81,11 +81,11 @@ int handle_device_notify(struct libinput_event *ev)
 
        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;
@@ -102,7 +102,7 @@ int handle_device_notify(struct libinput_event *ev)
                                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;
@@ -115,11 +115,11 @@ int handle_device_notify(struct libinput_event *ev)
        }
        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;
@@ -128,11 +128,11 @@ int handle_device_notify(struct libinput_event *ev)
        }
        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;
@@ -151,12 +151,12 @@ int handle_device_notify(struct libinput_event *ev)
                                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);
                                }
@@ -213,9 +213,9 @@ handle_motion_event(struct libinput_event *ev)
        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);
@@ -275,9 +275,9 @@ handle_pointer_button_event(struct libinput_event *ev)
                        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);
@@ -496,7 +496,7 @@ int handle_libinput_event(struct libinput *li)
                }
                libinput_event_destroy(ev);
                libinput_dispatch(li);
-               if(rc < 0) return -1;
+               if (rc < 0) return -1;
        }
        return 0;
 }
@@ -517,7 +517,7 @@ int create_mouse_event(struct libinput *li, int idx)
        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) {
@@ -533,7 +533,7 @@ int create_mouse_event(struct libinput *li, int idx)
                        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;
                        }
@@ -562,7 +562,7 @@ int create_keyboard_event(struct libinput *li, int idx)
        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) {
@@ -578,7 +578,7 @@ int create_keyboard_event(struct libinput *li, int idx)
                        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;
                        }
@@ -598,7 +598,7 @@ int multi_touch_support(struct libinput *li, int idx)
        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) {
@@ -639,7 +639,7 @@ int create_touch_event(struct libinput *li, int idx)
        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) {
@@ -660,7 +660,7 @@ int create_touch_event(struct libinput *li, int idx)
                        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;
                        }
@@ -682,20 +682,20 @@ bool validate_mouse_event(struct libinput *li)
        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;
        }
@@ -709,20 +709,20 @@ bool validate_keyboard_event(struct libinput *li)
        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;
        }
@@ -736,25 +736,25 @@ bool validate_touch_event(struct libinput *li)
        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;
        }