Skip to content
This repository has been archived by the owner on Dec 15, 2021. It is now read-only.

Commit

Permalink
Fixing issue with interfaces
Browse files Browse the repository at this point in the history
  • Loading branch information
karelbilek committed Oct 4, 2016
1 parent f3b5407 commit be1272d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/lowlevel/node-hid.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const REPORT_ID = 63;
const TREZOR_DESC = {
vendorId: 0x534c,
productId: 0x0001,
interface: 0,

This comment has been minimized.

Copy link
@Quentin-M

Quentin-M Jun 24, 2017

This breaks on macOS, at least - where the interface is always -1.

This comment has been minimized.

Copy link
@karelbilek

karelbilek via email Jun 24, 2017

Author Contributor

This comment has been minimized.

Copy link
@Quentin-M

Quentin-M Jun 24, 2017

Unfortunately, it seems it would not be the only weirdness because while the driver appears to somewhat recognize the device, it never appears in either trezor.js's unacquiredDevices or devices list, nor does it ever send any event (using the demo code). To be fair, my NodeJS foo is non-existent.

A Features message is sent by .call and the content looks fine (label, pin, passphrase booleans).

bundle.js Failed to load resource: net::ERR_CONNECTION_REFUSED
./node_modules/trezor-link-node/lib/debug-decorator.js:21 [trezor-link] Calling FallbackTransport.init( true )
./node_modules/trezor-link-node/lib/debug-decorator.js:21 [trezor-link] Calling BridgeTransport.init( true )
./node_modules/trezor-link-node/lib/bridge/http.js:342 GET https://localback.net:21324/ net::ERR_CONNECTION_REFUSED
(anonymous) @ ./node_modules/trezor-link-node/lib/bridge/http.js:342
boundThen @ ./node_modules/trezor-link-node/lib/lowlevel/node-hid.js:309
request @ ./node_modules/trezor-link-node/lib/bridge/http.js:340
(anonymous) @ ./node_modules/trezor-link-node/lib/bridge/index.js:400
boundThen @ ./node_modules/trezor-link-node/lib/lowlevel/node-hid.js:309
_silentInit @ ./node_modules/trezor-link-node/lib/bridge/index.js:398
(anonymous) @ ./node_modules/trezor-link-node/lib/bridge/index.js:390
boundThen @ ./node_modules/trezor-link-node/lib/lowlevel/node-hid.js:309
init @ ./node_modules/trezor-link-node/lib/bridge/index.js:388
descriptor.value @ ./node_modules/trezor-link-node/lib/debug-decorator.js:31
$Loop_9 @ ./node_modules/trezor-link-node/lib/fallback.js:411
b @ ./node_modules/trezor-link-node/lib/lowlevel/node-hid.js:47
(anonymous) @ ./node_modules/trezor-link-node/lib/fallback.js:399
boundThen @ ./node_modules/trezor-link-node/lib/lowlevel/node-hid.js:309
_tryInitTransports @ ./node_modules/trezor-link-node/lib/fallback.js:359
(anonymous) @ ./node_modules/trezor-link-node/lib/fallback.js:517
boundThen @ ./node_modules/trezor-link-node/lib/lowlevel/node-hid.js:309
init @ ./node_modules/trezor-link-node/lib/fallback.js:511
descriptor.value @ ./node_modules/trezor-link-node/lib/debug-decorator.js:31
_initTransport @ ./node_modules/trezor.js-node/lib/device-list.js:202
(anonymous) @ ./node_modules/trezor.js-node/lib/device-list.js:106
./node_modules/trezor-link-node/lib/debug-decorator.js:43 [trezor-link] Error in BridgeTransport.init TypeError: Failed to fetch
(anonymous) @ ./node_modules/trezor-link-node/lib/debug-decorator.js:43
./node_modules/trezor-link-node/lib/debug-decorator.js:21 [trezor-link] Calling LowlevelTransport.init( true )
./node_modules/trezor-link-node/lib/debug-decorator.js:21 [trezor-link] Calling NodeHidPlugin.init( true )
./node_modules/trezor-link-node/lib/debug-decorator.js:35 [trezor-link] Done NodeHidPlugin.init
./node_modules/trezor-link-node/lib/debug-decorator.js:35 [trezor-link] Done LowlevelTransport.init
./node_modules/trezor-link-node/lib/debug-decorator.js:35 [trezor-link] Done FallbackTransport.init
./node_modules/trezor-link-node/lib/debug-decorator.js:21 [trezor-link] Calling LowlevelTransport.configure( cd86b5eca11dd489b0e81579c17a60d8386c95a2b760fcbb3ca5da494743552ba147b3db85661f18b37d09c967a1354a67348119d0997357e4f9da216522a7890a1f68747470733f3a2f2f6c6f63616c686f7374283a5c642b293f282f2e2a293f0a2e68747470733f3a2f2f6c6f63616c686f73745c2e6d797472657a6f725c2e636f6d283a5c642b293f282f2e2a293f0a1b68747470733a2f2f6d797472657a6f725c2e636f6d282f2e2a293f0a2568747470733a2f2f5b5c775c2e2d5d2b5c2e6d797472657a6f725c2e636f6d282f2e2a293f0a1868747470733a2f2f7472657a6f725c2e696f282f2e2a293f0a2268747470733a2f2f5b5c775c2e2d5d2b5c2e7472657a6f725c2e696f282f2e2a293f0a2068747470733a2f2f7472657a6f725c2e6769746875625c2e696f282f2e2a293f0a1e68747470733a2f2f677265656e616464726573735c2e6974282f2e2a293f0a2868747470733a2f2f5b5c775c2e2d5d2b5c2e677265656e616464726573735c2e6974282f2e2a293f0a1c68747470733a2f2f636f696e707269736d5c2e636f6d282f2e2a293f0a2668747470733a2f2f5b5c775c2e2d5d2b5c2e636f696e707269736d5c2e636f6d282f2e2a293f0a1768747470733a2f2f62697465785c2e6c61282f2e2a293f0a2168747470733a2f2f5b5c775c2e2d5d2b5c2e6269... )
./node_modules/trezor-link-node/lib/debug-decorator.js:35 [trezor-link] Done LowlevelTransport.configure
./node_modules/trezor-link-node/lib/debug-decorator.js:21 [trezor-link] Calling LowlevelTransport.enumerate( )
./node_modules/trezor-link-node/lib/debug-decorator.js:37 [trezor-link] Done LowlevelTransport.enumerate, result  (2) [Object, Object]
./node_modules/trezor-link-node/lib/debug-decorator.js:21 [trezor-link] Calling LowlevelTransport.enumerate( )
./node_modules/trezor-link-node/lib/debug-decorator.js:37 [trezor-link] Done LowlevelTransport.enumerate, result  (2) [Object, Object]
./node_modules/trezor-link-node/lib/debug-decorator.js:21 [trezor-link] Calling LowlevelTransport.acquire( Object {path: "IOService:/AppleACPIPlatformExpert/PCI0@0/AppleACP…/TREZOR Interface@0/IOUSBHostHIDDevice@14100000,0", previous: null, checkPrevious: true} )
./node_modules/trezor-link-node/lib/debug-decorator.js:21 [trezor-link] Calling LowlevelTransport.listen( (2) [Object, Object] )
./node_modules/trezor-link-node/lib/debug-decorator.js:37 [trezor-link] Done LowlevelTransport.acquire, result  0
./node_modules/trezor-link-node/lib/debug-decorator.js:37 [trezor-link] Done LowlevelTransport.listen, result  (2) [Object, Object]
./node_modules/trezor-link-node/lib/debug-decorator.js:21 [trezor-link] Calling LowlevelTransport.acquire( Object {path: "IOService:/AppleACPIPlatformExpert/PCI0@0/AppleACP…000/U2F Interface@1/IOUSBHostHIDDevice@14100000,1", previous: null, checkPrevious: true} )
./node_modules/trezor-link-node/lib/debug-decorator.js:21 [trezor-link] Calling LowlevelTransport.call( 0 Initialize Object {} )
./node_modules/trezor-link-node/lib/debug-decorator.js:21 [trezor-link] Calling LowlevelTransport.listen( (2) [Object, Object] )
./node_modules/trezor-link-node/lib/debug-decorator.js:37 [trezor-link] Done LowlevelTransport.acquire, result  1
./node_modules/trezor-link-node/lib/debug-decorator.js:21 [trezor-link] Calling LowlevelTransport.call( 1 Initialize Object {} )
./node_modules/trezor-link-node/lib/debug-decorator.js:37 [trezor-link] Done LowlevelTransport.call, result  Object {message: Object, type: "Features"}
./node_modules/trezor-link-node/lib/debug-decorator.js:37 [trezor-link] Done LowlevelTransport.listen, result  (2) [Object, Object]
./node_modules/trezor-link-node/lib/debug-decorator.js:21 [trezor-link] Calling LowlevelTransport.listen( (2) [Object, Object] )
./node_modules/trezor-link-node/lib/debug-decorator.js:21 [trezor-link] Calling LowlevelTransport.release( 0 )

This comment has been minimized.

Copy link
@karelbilek

karelbilek Jun 25, 2017

Author Contributor

thanks. I cannot do more until I got a mac to debug, that will be on monday

This comment has been minimized.

Copy link
@LightningK0ala

LightningK0ala Nov 24, 2017

Any updates on this? I was trying to connect to the trezor through node-hid on my Mac (electron app) and it's dead...

};

type TrezorDeviceInfo = {path:string};
Expand Down Expand Up @@ -41,7 +42,11 @@ export default class NodeHidPlugin {

async enumerate(): Promise<Array<TrezorDeviceInfo>> {
const devices = HID.devices()
.filter(d => d.vendorId === TREZOR_DESC.vendorId && d.productId === TREZOR_DESC.productId)
.filter(d =>
d.vendorId === TREZOR_DESC.vendorId &&
d.productId === TREZOR_DESC.productId &&
d.interface === TREZOR_DESC.interface
)
.map((device: HIDDeviceDescription): TrezorDeviceInfo => {
const path = device.path;
return {
Expand Down

0 comments on commit be1272d

Please sign in to comment.