]> git.codecow.com Git - libnemo.git/commitdiff
Prioritize HID over USB.
authorChris Duncan <chris@zoso.dev>
Wed, 10 Sep 2025 22:22:02 +0000 (15:22 -0700)
committerChris Duncan <chris@zoso.dev>
Wed, 10 Sep 2025 22:22:02 +0000 (15:22 -0700)
Current Ledger firmware is having issues communicating over WebUSB. WebHID is a different tech stack, and Ledger recommends using it first and foremost, so reorder priority of transports.

src/lib/wallet/ledger.ts

index 9b64960d7a26b810913ac77df9f03f4b329fef57..af7b93f864907620fb3932161b90128aaca3400d 100644 (file)
@@ -54,7 +54,7 @@ export class Ledger {
                0x9000: 'OK'
        })
 
-       static DynamicTransport: typeof TransportBLE | typeof TransportUSB | typeof TransportHID
+       static DynamicTransport: typeof TransportHID | typeof TransportBLE | typeof TransportUSB
        static UsbVendorId = ledgerUSBVendorId
        static SYMBOL: Symbol = Symbol('Ledger')
 
@@ -64,16 +64,16 @@ export class Ledger {
        */
        static get isUnsupported (): boolean {
                console.log('Checking browser Ledger support...')
-               if (typeof globalThis.navigator?.usb?.getDevices === 'function') {
-                       this.DynamicTransport = TransportUSB
+               if (typeof globalThis.navigator?.hid?.getDevices === 'function') {
+                       this.DynamicTransport = TransportHID
                        return false
                }
                if (typeof globalThis.navigator?.bluetooth?.getDevices === 'function') {
                        this.DynamicTransport = TransportBLE
                        return false
                }
-               if (typeof globalThis.navigator?.hid?.getDevices === 'function') {
-                       this.DynamicTransport = TransportHID
+               if (typeof globalThis.navigator?.usb?.getDevices === 'function') {
+                       this.DynamicTransport = TransportUSB
                        return false
                }
                return true