diff --git a/ledger.go b/ledger.go index 359b647..2c57b06 100644 --- a/ledger.go +++ b/ledger.go @@ -25,8 +25,8 @@ import ( ) const ( - VendorLedger = 0x2c97 - UsagePageLedger = 0xffa0 + VendorLedger = 0x2c97 + UsagePageLedgerNanoS = 0xffa0 //ProductNano = 1 Channel = 0x0101 PacketSize = 64 @@ -71,8 +71,11 @@ func FindLedger() (*Ledger, error) { devices := hid.Enumerate(VendorLedger, 0) for _, d := range devices { - deviceFound := d.UsagePage == UsagePageLedger - deviceFound = deviceFound || (d.Product == "Nano S" && d.Interface == 0) + deviceFound := d.UsagePage == UsagePageLedgerNanoS + // Workarounds for possible empty usage pages + deviceFound = deviceFound || + (d.Product == "Nano S" && d.Interface == 0) || + (d.Product == "Nano X" && d.Interface == 0) if deviceFound { device, err := d.Open() diff --git a/ledger_test.go b/ledger_test.go index 01b83ba..0fb6136 100644 --- a/ledger_test.go +++ b/ledger_test.go @@ -66,7 +66,7 @@ func Test_BasicExchange(t *testing.T) { t.Fatalf("Error: %s", err.Error()) } - assert.Equal(t, 4, len(response)) + assert.Equal(t, 5, len(response)) } }