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

Fix #216: Correctly parse device-properties for Linux #217

Open
wants to merge 1 commit into
base: ctap2-2021
Choose a base branch
from

Conversation

msirringhaus
Copy link
Contributor

This needs to bump libudev, because the API had a bug that disallowed iterating the device tree.

Vendoring in Firefox is not a problem, since libudev is only used by auth-rs.
We need, however, to add 3 or 4 function definitions to dom/webauthn/libudev-sys/lib.rs.

If we don't want to do this yet, this PR can just stay pending, since the info is not really used currently (except for some output in the examples).

@jschanck
Copy link
Collaborator

jschanck commented Jun 2, 2023

Do you have a patch on dom/webauthn/libudev-sys/lib.rs ready to go? Alternatively, it looks like bindgen has libloading support now, so maybe we can get a patch upstream and remove our fork of libudev-sys.

@msirringhaus
Copy link
Contributor Author

I probably have it in some of my stashes. Even if I can't find it, it was a trivial patch.

@msirringhaus
Copy link
Contributor Author

Just for completeness, this is the patch:

diff --git a/dom/webauthn/libudev-sys/src/lib.rs b/dom/webauthn/libudev-sys/src/lib.rs
--- a/dom/webauthn/libudev-sys/src/lib.rs
+++ b/dom/webauthn/libudev-sys/src/lib.rs
@@ -124,6 +124,7 @@ macro_rules! define {
 
 // udev
 define!(udev_new, extern "C" fn () -> *mut udev);
+define!(udev_ref, extern "C" fn(*mut udev) -> *mut udev);
 define!(udev_unref, extern "C" fn (*mut udev) -> *mut udev);
 
 // udev_list
@@ -135,6 +136,7 @@ define!(udev_list_entry_get_value, exter
 define!(udev_device_ref, extern "C" fn (*mut udev_device) -> *mut udev_device);
 define!(udev_device_unref, extern "C" fn (*mut udev_device) -> *mut udev_device);
 define!(udev_device_new_from_syspath, extern "C" fn (*mut udev, *const c_char) -> *mut udev_device);
+define!(udev_device_get_udev, extern "C" fn (*mut udev_device) -> *mut udev);
 define!(udev_device_get_parent, extern "C" fn (*mut udev_device) -> *mut udev_device);
 define!(udev_device_get_devpath, extern "C" fn (*mut udev_device) -> *const c_char);
 define!(udev_device_get_subsystem, extern "C" fn (*mut udev_device) -> *const c_char);
@@ -160,6 +162,7 @@ define!(udev_monitor_unref, extern "C" f
 define!(udev_monitor_new_from_netlink, extern "C" fn (*mut udev, *const c_char) -> *mut udev_monitor);
 define!(udev_monitor_enable_receiving, extern "C" fn (*mut udev_monitor) -> c_int);
 define!(udev_monitor_get_fd, extern "C" fn (*mut udev_monitor) -> c_int);
+define!(udev_monitor_get_udev, extern "C" fn (*mut udev_monitor) -> *mut udev);
 define!(udev_monitor_receive_device, extern "C" fn (*mut udev_monitor) -> *mut udev_device);
 define!(udev_monitor_filter_add_match_subsystem_devtype, extern "C" fn (*mut udev_monitor, *const c_char, *const c_char) -> c_int);
 define!(udev_monitor_filter_add_match_tag, extern "C" fn (*mut udev_monitor, *const c_char) -> c_int);
@@ -180,3 +183,4 @@ define!(udev_enumerate_add_match_sysname
 define!(udev_enumerate_add_syspath, extern "C" fn (*mut udev_enumerate, *const c_char) -> c_int);
 define!(udev_enumerate_scan_devices, extern "C" fn (*mut udev_enumerate) -> c_int);
 define!(udev_enumerate_get_list_entry, extern "C" fn (*mut udev_enumerate) -> *mut udev_list_entry);
+define!(udev_enumerate_get_udev, extern "C" fn (*mut udev_enumerate) -> *mut udev);

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

Successfully merging this pull request may close these issues.

2 participants