maru: rotary: Change event value 76/227876/1 accepted/tizen/unified/20200324.101627 submit/tizen/20200323.012640
authorDongwoo Lee <dwoo08.lee@samsung.com>
Tue, 17 Mar 2020 02:39:31 +0000 (11:39 +0900)
committerDongwoo Lee <dwoo08.lee@samsung.com>
Tue, 17 Mar 2020 02:59:52 +0000 (11:59 +0900)
Until Tizen 5.0, for detent/bezel input device, its event value
was in between -2 and 2, but value 1, meant starting movement to
counter clockwise or clockwise, and value -1, meant moving back
to original position, never used. Change event value of the
detent/bezel device for Tizen 5.5 and later version.

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

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

Change-Id: Iaa8e76de94eb4254820d93865dab9d4f7006f4e4
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
drivers/maru/maru_virtio_rotary.c

index 6e193e1..ff47408 100644 (file)
@@ -69,6 +69,14 @@ static struct virtio_device_id id_table[] = {
        { 0 },
 };
 
+enum rotary_event_type {
+       ROTARY_EVENT_CCW = -1,          /* Counter-ClockWise movement */
+       ROTARY_EVENT_RETURN = 0,        /* ignore event for returning */
+       ROTARY_EVENT_NA = 0,            /* not to send event */
+       ROTARY_EVENT_LEAVE = 0,         /* ignore event for leaving */
+       ROTARY_EVENT_CW = 1,            /* ClockWise movement */
+};
+
 #define DETENT_UNIT (15)
 #define REMAINDER(n, div) ({ \
 typeof(n) _n = (n) % (div); \
@@ -128,20 +136,20 @@ static void vq_rotary_callback(struct virtqueue *vq)
                for (i = 1; i <= abs(event->delta); i++) {
                        value = (event->delta > 0) ? last_pos + i : last_pos - i;
                        if ((value % DETENT_UNIT) == 0) {
-                               input_report_rel(vrtr->idev, REL_WHEEL, 1);
+                               input_report_rel(vrtr->idev, REL_WHEEL, ROTARY_EVENT_LEAVE);
                                input_sync(vrtr->idev);
                                if (get_rotary_pos(value) != last_detent) {
                                        last_detent = get_rotary_pos(value);
                                        if (event->delta > 0) { /* CW */
                                                input_report_rel(vrtr->idev,
-                                                               REL_WHEEL, 2);
+                                                               REL_WHEEL, ROTARY_EVENT_CW);
                                        } else { /* CCW */
                                                input_report_rel(vrtr->idev,
-                                                               REL_WHEEL, -2);
+                                                               REL_WHEEL, ROTARY_EVENT_CCW);
                                        }
                                } else {
                                        input_report_rel(vrtr->idev,
-                                                               REL_WHEEL, -1);
+                                                               REL_WHEEL, ROTARY_EVENT_RETURN);
                                }
                                input_sync(vrtr->idev);