{ 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); \
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);