Closed spoelstraethan closed 1 year ago
Is it possible to see both lsusb
outputs (PC and Android) just to compare?
Yeah, I'll upload those, I think I just figured out part of the problem though.
The import/export tool I'm using is written in Rust and it's using a hidapi crate that requires the system packages libhidapi-hidraw0 and libhidapi-dev and therefore it is trying to access the device directly via /dev/hidrawN instead of through libusb.
This just occurred to me when without doing an lsusb
beforehand the
Python full device backup script prompted me to allow access to the device
but I don't get that prompt from the Rust version and even if I use lsusb
to attach the device beforehand it can't see it.
I'm not sure if the device's creator (who also hacked together the Python and Rust tooling) would be interested in using a libusb crate abstraction layer if one exists or if there's a way to patch the libhidapi bits for PRooted Linux on Android.
On Sun, Aug 13, 2023, 1:52 PM green-green-avk @.***> wrote:
Is it possible to see both lsusb outputs (PC and Android) just to compare?
— Reply to this email directly, view it on GitHub https://github.com/green-green-avk/AnotherTerm/issues/45#issuecomment-1676435889, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANPSNA2D2A5ZOQSOAESYEPTXVEPAPANCNFSM6AAAAAA3NLISIE . You are receiving this because you authored the thread.Message ID: @.***>
https://github.com/libusb/hidapi
On Linux, either the hidraw or the libusb back-end can be used. There are tradeoffs, and the functionality supported is slightly different. Both are built by default. It is up to the application linking to hidapi to choose the backend at link time by linking to either
libhidapi-libusb
orlibhidapi-hidraw
.
Possibly, no code changes should be required in order to use libusb
here at least...
Android has no hidraw specific API available for apps.
Maybe, it's possible to make a wrapper for full libhidapi-hidraw
functionality via libhidapi-libusb
... Some research is required.
So I attempted to override the default hidapi implemented used by Rust to linux-shared-libusb instead of linux-shared-hidraw but without success on my first few attempts.
Then I attempted to implement the barest minimum Rust "app" using the example code from https://docs.rs/hidapi/ but it was printing nothing in its device list. That made me think that my override wasn't working and it was still trying to use hidraw, so I played around with a couple different override methods and finally got it to apply, and then it complained that libusb-1.0 wasn't available even though I'd performed the libusb "fix". I installed libusb-1.0-0-dev and that appeared to sort the issue and I was able to list the device.
Then I attempted to get that MVP pulled into the Cargo.toml of the software I'm attempting to get working to see if it enabled the missing functionality. It appears that while the hidapi-shared-libusb worked in my simple app, with the wider set of crates pulled in I ended up having to switch to hidapi-static-libusb, and then it worked wonderfully, so I think this can be considered resolved, as long as a person can use libusb.
It also seems that the main reason a lot of folks have been using hidraw is that libusb hasn't always been able to resolve some of the self describing attributes like DeviceInfo while hidraw has been pretty effective at that.
On the plus side, I was able to dump a full device backup in the regular backup mode, unfortunately I haven't been able to perform an export or import which is more useful than full backup for adding new entries while away from a PC.
It is possible that there is a special U2F or security key permission that needs requested to interact with that aspect of the device. The Yubikey Authenticator app might have an example of that permission even though it's a different device.
This first section is the output from the PRoot, I'll add the lsusb from a working Linux install shortly.