From 88ce6ab03e6e51b33d09e8293a65bb86c9a00f70 Mon Sep 17 00:00:00 2001 From: Andrew Chow Date: Fri, 8 Feb 2019 21:14:52 -0500 Subject: [PATCH] Fixes for Windows --- hwilib/devices/ckcc/client.py | 4 +++- hwilib/devices/trezorlib/transport/webusb.py | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/hwilib/devices/ckcc/client.py b/hwilib/devices/ckcc/client.py index f550e5179..3159cdbda 100644 --- a/hwilib/devices/ckcc/client.py +++ b/hwilib/devices/ckcc/client.py @@ -8,7 +8,7 @@ # # - ec_mult, ec_setup, aes_setup, mitm_verify # -import hid, sys, os +import hid, sys, os, platform from binascii import b2a_hex, a2b_hex from hashlib import sha256 from .protocol import CCProtocolPacker, CCProtocolUnpacker, CCProtoError, MAX_MSG_LEN, MAX_BLK_LEN @@ -27,6 +27,8 @@ def __init__(self, sn=None, dev=None, encrypt=True): self.is_simulator = False if not dev and sn and '/' in sn: + if platform.system() == 'Windows': + raise RuntimeError("Cannot connect to simulator. Is it running?") dev = UnixSimulatorPipe(sn) found = 'simulator' self.is_simulator = True diff --git a/hwilib/devices/trezorlib/transport/webusb.py b/hwilib/devices/trezorlib/transport/webusb.py index a4c2840ee..61d14e4a2 100644 --- a/hwilib/devices/trezorlib/transport/webusb.py +++ b/hwilib/devices/trezorlib/transport/webusb.py @@ -126,7 +126,7 @@ def enumerate(cls) -> Iterable["WebUsbTransport"]: # non-functional. dev.getProduct() devices.append(WebUsbTransport(dev)) - except usb1.USBErrorNotSupported: + except: pass return devices