Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Key repeat request to kernel #36

Closed
mikethebos opened this issue Jul 21, 2023 · 2 comments
Closed

Key repeat request to kernel #36

mikethebos opened this issue Jul 21, 2023 · 2 comments
Labels
question Further information is requested

Comments

@mikethebos
Copy link

mikethebos commented Jul 21, 2023

I would like to know how the repeat=enable feature is implemented (gvalkov/python-evdev#192).

I see a reference to EVIOCGREP in your libevdev binding, but that is a read syscall.

(I hope to implement this feature in my own application soon using python-evdev. Thanks! If you want my code to be licensed in a specific manner due to this inspiration, let me know.)

@KarsMulder
Copy link
Owner

KarsMulder commented Jul 22, 2023

The kernel will automatically generate repeat event when the the capabilities for the EV_REP-type events are enabled on the virtual output device. In C terms, it would require the following libevdev calls:

libevdev_enable_event_type(dev, EV_REP);
libevdev_enable_event_code(dev, EV_REP, REP_DELAY, &250);
libevdev_enable_event_code(dev, EV_REP, REP_PERIOD, &33);

Based on my personal tests:

  • The kernel just ignores whatever value for delay/period you pass to it; the kernel will always use a delay of 250 and a period of 33 regardless of what value you pass to it;
  • The repeat events you write to the output device will show up no matter whether you enable EV_REP or not. This means that you can write repeat events to a device that is not capable of EV_REP, and conversely, if you do write repeat events to an EV_REP capable device, the device will have double the usual amount of repeat events (the ones you wrote + the autogenerated ones.)

(I hope to implement this feature in my own application soon using python-evdev. Thanks! If you want my code to be licensed in a specific manner due to this inspiration, let me know.)

I do not think that the above info passes the threshold for being copyrightable; you're free to use it however you want to.

@KarsMulder KarsMulder added the question Further information is requested label Jul 22, 2023
@mikethebos
Copy link
Author

Thanks for your help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants