Enhancement: Event based architecture
The current method for detecting YubiKeys is extremely inelegant and causes high CPU load, as described under: #13
Currently the slot occupation is polled periodically. A better approach would be to listen to events thrown by the system.
A fellow developer suggested to have a look into udev rules and dbus events as a potential starting point for implementing such event based approach.
Potentially this might also solve: #2
However, implementing such appproahc is currently beyond my understanding of OSes. Hence, such improvement would require help of other contributors more versed in that matters than I am are.
~Would udev or dbus be preferred? It seems to me that dbus is the choice for desktop applications.~
It seems that there is an somewhat well-documented way to attach yubiguard to the dbus event loop, so it can list devices and get notified of new devices being added/removed.
The blog post at https://linuxmeerkat.wordpress.com/2014/11/12/python-detection-of-usb-storage-device/ summarizes benefits of the various abstraction layers, then comes to the conclusion that dbus is the right layer and then has example code (do an in-page search for the term "DBusGMainLoop" to find the relevant snippet).
@mozfreddyb Thanks for link. I am going to study it. However I do not know when I will have the time to make such big refactoring.
Thank you for responding so quickly. To be clear, I did not expect you to do this a) soon or b) all by yourself. Just wanted to get some clarity about a potential way forward. Maybe I'll be able to find time for some minor patches in that direction