JamesGKent / rotary_volume

kernel module to use rotary encoder as a volume control
GNU General Public License v2.0
13 stars 6 forks source link

Multiple KEY_VOLUMEUP KEY_VOLUMEDOWN #5

Open BenSeventy9 opened 5 years ago

BenSeventy9 commented 5 years ago

Because steps-per-period=2 or 4 did not work for me so I added:

Use steps-per-period=1

and

on line 22: static int multiple_key = 3; // minimum is 1 on line 41: int ii;

And added a for loop: for (ii=0; ii<multiple_key; ii++) { send_key( (inc > 0) ? KEY_VOLUMEUP : KEY_VOLUMEDOWN); }

JamesGKent commented 5 years ago

can you explain what didn't work for you and what you are trying to achieve? the purpose of the steps-per-period is to make it take multiple events before a button press is generated, but your loop seems to be trying to reverse that and generate multiple button presses for a single event, is that correct?

BenSeventy9 commented 5 years ago

If you have a standard cheap rotary encoder with 24 steps you need to turn 4 times 360° for volume 0-100%. This is annoying. As you say: Multiple button presses for a single event.

JamesGKent commented 4 years ago

understood, i hadn't considered that scenario, i shall look at adding it in unless you wish to open a pull request.