Use a rotary encoder as an arrow control

Hi

I want to use two rotary encoders to move the arrow around (right, left, up, down) The encoders works as expected with this patch:

root@colibri-t30:/# evtest /dev/input/by-path/platform-rotary-encoder.0-event 
Input driver version is 1.0.1
Input device ID: bus 0x19 vendor 0x0 product 0x0 version 0x0
Input device name: "rotary-encoder"
Supported events:
  Event type 0 (EV_SYN)
  Event type 3 (EV_ABS)
    Event code 0 (ABS_X)
      Value     16
      Min        0
      Max       24
      Flat       1
Properties:
Testing ... (interrupt to exit)
Event: time 2216.942477, type 3 (EV_ABS), code 0 (ABS_X), value 15
Event: time 2216.942601, -------------- SYN_REPORT ------------
Event: time 2218.170250, type 3 (EV_ABS), code 0 (ABS_X), value 16
Event: time 2218.170380, -------------- SYN_REPORT ------------

root@colibri-t30:/# evtest /dev/input/by-path/platform-rotary-encoder.1-event 
Input driver version is 1.0.1
Input device ID: bus 0x19 vendor 0x0 product 0x0 version 0x0
Input device name: "rotary-encoder"
Supported events:
  Event type 0 (EV_SYN)
  Event type 3 (EV_ABS)
    Event code 1 (ABS_Y)
      Value      3
      Min        0
      Max       24
      Flat       1
Properties:
Testing ... (interrupt to exit)
Event: time 2247.351572, type 3 (EV_ABS), code 1 (ABS_Y), value 4
Event: time 2247.351579, -------------- SYN_REPORT ------------
Event: time 2247.827057, type 3 (EV_ABS), code 1 (ABS_Y), value 3
Event: time 2247.827063, -------------- SYN_REPORT ------------
Event: time 2248.192462, type 3 (EV_ABS), code 1 (ABS_Y), value 2
Event: time 2248.192468, -------------- SYN_REPORT ------------

My Kernel module should handle both rotary encoders, but it connects only to one (right, left) of them:

root@colibri-t30:/# insmod ./lib/modules/3.1.10-2.8.7+g5e3cb65b1b4b/extra/arrowkey.ko
root@colibri-t30:/# dmesg 
[ 2762.139351] input: Rotary Encoder Arrow Key as /devices/virtual/input/input17
[ 2762.158831] arrowkey: **** matched
[ 2762.162272] arrowkey: **** matched
[ 2762.176074] arrowkey: Connected device: input1 (rotary-encoder at unknown)
[ 2762.176174] arrowkey: loaded.

I’m a little lost. Any ideas what is missing ?

Thanks, Andreas

Found the problem myself, see the solution here.

Never copy & paste code without
understanding it 100% !

Perfect that you found the solution. Thanks for the feedback.

Best regards,
Jaski