mozilla/authenticator-rs

get_property() broken on Linux

msirringhaus opened this issue · 0 comments

        let vendor = self
            .get_property("Manufacturer")
            .unwrap_or_else(|_| String::from("Unknown Vendor"));
        let product = self
            .get_property("Product")
            .unwrap_or_else(|_| String::from("Unknown Device"));

always returns "Unkown Vendor/Device", because the function get_property_linux() looks at the wrong udev-device.

We operate on hidraw-devices, but the properties are set on usb_device-types (subsystem="usb", devtype="usb_device"). These are reachable via subsequent .parent()-calls on the hidraw-device, but libudev has a bug in the API that prevents it from being used this way.

From what I can tell, we would need to update libudev to 0.3, then find the correct hidraw-device as we do now in get_property_linux(), but then iterate over its parents until we find the first usb_device-type, and query it for those properties (which are actually attributes and not properties in udev-parlance).
Also, one has to check if the strings are case-sensitive.