From 02bc43b094e212c52075c69c9aa71003121596ce Mon Sep 17 00:00:00 2001 From: Sebastien Mondet Date: Wed, 10 Oct 2018 19:19:02 -0400 Subject: [PATCH] Target only USB ledger with interface number 0 --- src/lib_signer_backends/ledger.ml | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/lib_signer_backends/ledger.ml b/src/lib_signer_backends/ledger.ml index b817a2291..732b1eac0 100644 --- a/src/lib_signer_backends/ledger.ml +++ b/src/lib_signer_backends/ledger.ml @@ -304,12 +304,18 @@ let find_ledgers ?id () = log_info "Found %d Ledger(s)" (List.length ledgers) ; filter_map_s begin fun device_info -> log_info "Processing Ledger at path [%s]" device_info.Hidapi.path ; - match Hidapi.(open_path device_info.path) with - | None -> return_none - | Some h -> - Lwt.finalize - (fun () -> Ledger.of_hidapi ?id device_info h) - (fun () -> Hidapi.close h ; Lwt.return_unit) + if device_info.Hidapi.interface_number <> 0 + then + (* HID interfaces get number 0: + https://github.com/LedgerHQ/ledger-nano-s/issues/48 *) + return_none + else + match Hidapi.(open_path device_info.path) with + | None -> return_none + | Some h -> + Lwt.finalize + (fun () -> Ledger.of_hidapi ?id device_info h) + (fun () -> Hidapi.close h ; Lwt.return_unit) end ledgers let with_ledger id f =