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

Enhancement: Event based architecture #14

Open
pykong opened this issue Oct 16, 2019 · 3 comments
Open

Enhancement: Event based architecture #14

pykong opened this issue Oct 16, 2019 · 3 comments

Comments

@pykong
Copy link
Owner

pykong commented Oct 16, 2019

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.

@mozfreddyb
Copy link
Contributor

mozfreddyb commented Oct 23, 2019

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).

@pykong
Copy link
Owner Author

pykong commented Oct 23, 2019

@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.

@mozfreddyb
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants