Closed xJonathanLEI closed 2 years ago
Made some progress on my side. Am able to make rusb
work on Termux:
$ uname -a
Linux localhost 5.4.86-qgki-********-*************** #1 SMP PREEMPT Mon Feb 28 16:19:22 KST 2022 aarch64 Android
$ termux-usb -e "cargo run" "/dev/bus/usb/001/007"
Finished dev [unoptimized + debuginfo] target(s) in 0.09s
Running `target/debug/rusb-test 7`
Vendor ID: 2c97
Product ID: 4015
Manufacturer: Ledger
Product: Nano X
Serial No.: 0001
we intend to switch to an hidapi crate based on rusb as soon as one is reasonably mature and well maintained. I'm not convinced that that exists yet. any suggestions?
Wait I thought this library is already using rusb
:
Made it to work by patching coins-ledger
as well as the upstream lib hidapi-rusb
:
Other functions like getting addresses have also been tested. Works flawlessly. (They're the all the same from coins-ledger
's perspective anyways)
I guess I'll have to submit an upstream PR first, and hopefully get it to merged before proceeding with this issue :)
Made a PR to the upstream lib, hopefully getting merged soon:
I haven't had time to look into this yet, thanks for doing legwork on it :)
Upstream PR merged and new version published with the patch. It's a patch version bump so no need for downstream crates like coins-ledger
to do anything to incorporate.
Now we just need to build the Termux support into coins-ledger
for good :)
any action from me required besides bump dep version, test, and re-publish?
I think that's all it will be needed from you side :)
I will submit a PR for anything else before you do.
Is your feature request related to a problem? Please describe. I'm using a downstream lib ethers-rs and want to run scripts on the go on Android Termux with my Ledger. Currently their Ledger signer (which uses
coins-ledger
) fails with a runtime error on Termux.Describe the solution you'd like Make the signer work on Termux. If we manage to pull this off, we can even wrap it inside a Node module and use it for existing ethers.js scripts.
Describe alternatives you've considered Currently pretty much the only alternative that I'm aware of (tho outside the scope of this lib) would be to build the script as a WalletConnect-enabled webpage, open the said page in a browser, and connect to it from Ledger Live. This is far from ideal and limited by the feature set that WalletConnect supports (e.g. you can't sign transactions without broadcasting to RPC).
Additional context
My device:
Using
master
for ethers-rs withledger
feature enabled:Running this code:
Yields this error: