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

Cannot detect device #69

Open
patnir opened this issue Aug 7, 2024 · 3 comments
Open

Cannot detect device #69

patnir opened this issue Aug 7, 2024 · 3 comments

Comments

@patnir
Copy link

patnir commented Aug 7, 2024

I am able to install the app on device and delete the app using the VS Code extension.

Running Quick initial device setup cases the following error (even though I did open the right application)

Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/Users/patni/dev/app-boilerplate/ledger/lib/python3.12/site-packages/ledgerblue/hostOnboard.py", line 88, in <module>
    dongle.exchange(apdu, timeout=3000)
  File "/Users/patni/dev/app-boilerplate/ledger/lib/python3.12/site-packages/ledgerblue/comm.py", line 163, in exchange
    raise CommException("Invalid status %04x (%s)" % (sw, possibleCause), sw, response)
ledgerblue.commException.CommException: Exception : Invalid status 6d00 (Unexpected state of device: verify that the right application is opened?)

Running Run tests with display - on device produces the following errors:

___________________________________________________ ERROR at setup of test_sign_tx_refused[nanosp] ____________________________________________________
/usr/lib/python3.9/site-packages/ragger/backend/ledgerwallet.py:57: in __enter__
    self._client = LedgerClient()
/usr/lib/python3.9/site-packages/ledgerwallet/client.py:115: in __init__
    raise NoLedgerDeviceException("No Ledger device has been found.")
E   ledgerwallet.client.NoLedgerDeviceException: No Ledger device has been found.

During handling of the above exception, another exception occurred:
/usr/lib/python3.9/site-packages/ragger/conftest/base_conftest.py:220: in backend
    with create_backend(root_pytest_dir, backend_name, firmware, display, log_apdu_file,
/usr/lib/python3.9/site-packages/ragger/backend/ledgerwallet.py:62: in __enter__
    self._client = LedgerClient()
/usr/lib/python3.9/site-packages/ledgerwallet/client.py:115: in __init__
    raise NoLedgerDeviceException("No Ledger device has been found.")
E   ledgerwallet.client.NoLedgerDeviceException: No Ledger device has been found.
---------------------------------------------------------------- Captured stderr setup ----------------------------------------------------------------
[2024-08-07 17:53:08,714][INFO] ragger.gui.RaggerGUI - Initiated
[2024-08-07 17:53:08,715][INFO] ragger.logger - Starting LedgerWalletBackend stream
----------------------------------------------------------------- Captured log setup ------------------------------------------------------------------
INFO     ragger.gui.RaggerGUI:process.py:90 Initiated
INFO     ragger.logger:ledgerwallet.py:55 Starting LedgerWalletBackend stream

I am using an M2 mac. I have a ledger nano S plus. I am using the Ledger VS Code extension.

@rdubois-crypto
Copy link

I have the same problem (device not found) lauching the command:
cargo ledger build nanosplus --load
, which seems to be the docker being unable to forward the usb. While in the docker, typing ledgerctl list, or lsusb, nano is not recognized.

I tried to add permission related to usb while launching the docker:
sudo docker run --rm -ti --privileged \
--device=/dev/bus/usb:/dev/bus/usb
-v "$(pwd -P):/app"
ghcr.io/ledgerhq/ledger-app-builder/ledger-app-dev-tools:latest

But still got an error.

@yogh333
Copy link
Contributor

yogh333 commented Dec 20, 2024

On Windows and MacOS, we have some issues accessing usb devices from the Docker instance. Ragger tests should be performed with speculos. To test on real devices, one way to proceed is to get the APDU sequence sent to the device (you can get it by running Ragger test with the -s option), put them in a file (test.apdu) then, after installing natively ledgercomm on your OS (pip install ledgercomm) and the app on your device:
ledgercomm-send --hid file test.apdu

@rdubois-crypto
Copy link

rdubois-crypto commented Dec 20, 2024

Thx a lot, i didn't get that i could load the app using ledgerctl. So maybe for macOS users, the section "loading" shall be replaced by the command:

ledgerctl install app_nanosplus.json

(As it is documented in the starknet application).

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

No branches or pull requests

3 participants