Input: tizen_bezel: Change event value of the bezel device accepted/tizen_5.5_unified accepted/tizen_5.5_unified_wearable_hotfix tizen_5.5_wearable_hotfix accepted/tizen/5.5/unified/20200324.134452 accepted/tizen/5.5/unified/wearable/hotfix/20201027.091924 submit/tizen_5.5/20200323.012542 submit/tizen_5.5_wearable_hotfix/20201026.1843010 submit/tizen_5.5_wearable_hotfix/20201027.114701
authorlsmin.lee <lsmin.lee@samsung.com>
Fri, 3 Jan 2020 09:31:42 +0000 (18:31 +0900)
committerSeung-Woo Kim <sw0312.kim@samsung.com>
Mon, 23 Mar 2020 01:10:59 +0000 (10:10 +0900)
Until Tizen 5.0, for bezel input device, its event value was in
between -2 and 2, but value 1. meant starting movement to
counter clockwiseare or clockwise, and value -1, meant moving back
to original position, never used. Change event value of the bezel
device for Tizen 5.5 and later version.

It changes bezel input driver event interface, so user input
framework for bezel input should be also changed.

Ref: https://review.tizen.org/gerrit/#/c/platform/upstream/enlightenment/+/220346/

Signed-off-by: lsmin.lee <lsmin.lee@samsung.com>
[sw0312.kim: adjust commit-msg to public style]
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Change-Id: I1293db138c71d2a5c4f52b827f3a441b47710449

drivers/input/misc/input_assistant.c
drivers/input/misc/tizen_bezel.c

index 2630a45..5a93e69 100644 (file)
@@ -157,17 +157,16 @@ static void input_assistant_key_logger(struct input_handle *handle,
        }
 }
 
+#define MAX_dir_str 3
 static void input_assistant_bezel_logger(struct input_handle *handle,
                               const struct input_value *vals, unsigned int count)
 {
        struct input_handler *handler = handle->handler;
        struct input_assistant_data *data = handler->private;
-       int i, wheel = 0, x = 0;
-       const char*  direction_str[] = {
+       int i, wheel = 0, x = 0, update = 0;
+       const char*  dir_str[MAX_dir_str] = {
                "ccw",
-               "return",
                "none",
-               "leave",
                "cw",
        };
 
@@ -179,7 +178,8 @@ static void input_assistant_bezel_logger(struct input_handle *handle,
 
                switch (vals[i].code) {
                case REL_WHEEL:
-                       wheel = vals[i].value;
+                       wheel = vals[i].value+1;
+                       update = true;
                        break;
                case REL_X:
                        x = ~vals[i].value & 0x07;
@@ -187,7 +187,12 @@ static void input_assistant_bezel_logger(struct input_handle *handle,
                }
        }
 
-       pr_info("%s: state:[%d][%s]\n", __func__, x, direction_str[wheel+2]);
+       if (update) {
+               if (((wheel) >= MAX_dir_str) || ((wheel) < 0))
+                       pr_err("%s: invalid state:[%d][%d]\n", __func__, x, wheel-1);
+               else
+                       pr_info("%s: state:[%d][%s]\n", __func__, x, dir_str[wheel]);
+       }
 }
 
 static void input_assistant_events(struct input_handle *handle,
index 3d87901..3dc15e2 100644 (file)
 extern struct class *sec_class;
 #endif
 
-enum direction_patten {
-       BZ_CC   = -2,
-       BZ_RT   = -1,
+enum bezel_event {
+       BZ_CC   = -1,
        BZ_NA   = 0,
-       BZ_LV   = 1,
-       BZ_CW   = 2,
+       BZ_CW   = 1,
        BZ_MAX,
 };
 
@@ -66,21 +64,21 @@ static void bezel_close(struct input_dev *input);
 
 static int bezel_get_direction(struct bezel_ddata *ddata, int value)
 {
-       const int magic_pattern[Status_MAX][Status_MAX] = {
-               {BZ_RT, BZ_LV, BZ_LV, BZ_NA, BZ_LV,},
-               {BZ_LV, BZ_RT, BZ_CC, BZ_NA, BZ_CW,},
-               {BZ_LV, BZ_CW, BZ_RT, BZ_NA, BZ_CC,},
+       const int dir_ptrn[Status_MAX][Status_MAX] = {
                {BZ_NA, BZ_NA, BZ_NA, BZ_NA, BZ_NA,},
-               {BZ_LV, BZ_CC, BZ_CW, BZ_NA, BZ_RT,} };
+               {BZ_NA, BZ_NA, BZ_CC, BZ_NA, BZ_CW,},
+               {BZ_NA, BZ_CW, BZ_NA, BZ_NA, BZ_CC,},
+               {BZ_NA, BZ_NA, BZ_NA, BZ_NA, BZ_NA,},
+               {BZ_NA, BZ_CC, BZ_CW, BZ_NA, BZ_NA,} };
 
        if ((ddata->last_status >= Status_MAX) ||
             (ddata->last_status <= Status_S))
-               return BZ_RT;
+               return BZ_NA;
 
        if ((value >= Status_MAX) || (value < Status_S))
-               return BZ_RT;
+               return BZ_NA;
 
-       return magic_pattern[value][ddata->last_status];
+       return dir_ptrn[value][ddata->last_status];
 }
 
 static int bezel_get_status(struct bezel_ddata *ddata)