[Python-modules-commits] [python-trezor] 01/07: Import python-trezor_0.6.11.orig.tar.gz

Tristan Seligmann mithrandi at moszumanska.debian.org
Sun May 29 13:30:12 UTC 2016


This is an automated email from the git hooks/post-receive script.

mithrandi pushed a commit to branch master
in repository python-trezor.

commit 06906129d91becef56591b23150d740ac00d493a
Author: Tristan Seligmann <mithrandi at mithrandi.net>
Date:   Sun May 29 15:20:36 2016 +0200

    Import python-trezor_0.6.11.orig.tar.gz
---
 PKG-INFO                             |  2 +-
 setup.py                             |  2 +-
 PKG-INFO => trezor.egg-info/PKG-INFO |  2 +-
 trezor.egg-info/SOURCES.txt          | 28 +++++++++++++++++++++++
 trezor.egg-info/dependency_links.txt |  1 +
 trezor.egg-info/not-zip-safe         |  1 +
 trezor.egg-info/requires.txt         |  4 ++++
 trezor.egg-info/top_level.txt        |  1 +
 trezorlib/ckd_public.py              |  4 ++--
 trezorlib/client.py                  |  8 +++----
 trezorlib/debuglink.py               |  4 ++--
 trezorlib/mapping.py                 |  2 +-
 trezorlib/qt/pinmatrix.py            |  2 +-
 trezorlib/transport_hid.py           | 43 ++++++++++--------------------------
 14 files changed, 60 insertions(+), 44 deletions(-)

diff --git a/PKG-INFO b/PKG-INFO
index 2ee5f14..0e63933 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: trezor
-Version: 0.6.10
+Version: 0.6.11
 Summary: Python library for communicating with TREZOR Bitcoin Hardware Wallet
 Home-page: https://github.com/trezor/python-trezor
 Author: Bitcoin TREZOR
diff --git a/setup.py b/setup.py
index d2590ea..d40560c 100755
--- a/setup.py
+++ b/setup.py
@@ -3,7 +3,7 @@ from setuptools import setup
 
 setup(
     name='trezor',
-    version='0.6.10',
+    version='0.6.11',
     author='Bitcoin TREZOR',
     author_email='info at bitcointrezor.com',
     description='Python library for communicating with TREZOR Bitcoin Hardware Wallet',
diff --git a/PKG-INFO b/trezor.egg-info/PKG-INFO
similarity index 96%
copy from PKG-INFO
copy to trezor.egg-info/PKG-INFO
index 2ee5f14..0e63933 100644
--- a/PKG-INFO
+++ b/trezor.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: trezor
-Version: 0.6.10
+Version: 0.6.11
 Summary: Python library for communicating with TREZOR Bitcoin Hardware Wallet
 Home-page: https://github.com/trezor/python-trezor
 Author: Bitcoin TREZOR
diff --git a/trezor.egg-info/SOURCES.txt b/trezor.egg-info/SOURCES.txt
new file mode 100644
index 0000000..8929a70
--- /dev/null
+++ b/trezor.egg-info/SOURCES.txt
@@ -0,0 +1,28 @@
+README.rst
+setup.py
+trezorctl
+trezor.egg-info/PKG-INFO
+trezor.egg-info/SOURCES.txt
+trezor.egg-info/dependency_links.txt
+trezor.egg-info/not-zip-safe
+trezor.egg-info/requires.txt
+trezor.egg-info/top_level.txt
+trezorlib/__init__.py
+trezorlib/ckd_public.py
+trezorlib/client.py
+trezorlib/debuglink.py
+trezorlib/mapping.py
+trezorlib/messages_pb2.py
+trezorlib/protobuf_json.py
+trezorlib/tools.py
+trezorlib/transport.py
+trezorlib/transport_bridge.py
+trezorlib/transport_fake.py
+trezorlib/transport_hid.py
+trezorlib/transport_pipe.py
+trezorlib/transport_serial.py
+trezorlib/transport_socket.py
+trezorlib/tx_api.py
+trezorlib/types_pb2.py
+trezorlib/qt/__init__.py
+trezorlib/qt/pinmatrix.py
\ No newline at end of file
diff --git a/trezor.egg-info/dependency_links.txt b/trezor.egg-info/dependency_links.txt
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/trezor.egg-info/dependency_links.txt
@@ -0,0 +1 @@
+
diff --git a/trezor.egg-info/not-zip-safe b/trezor.egg-info/not-zip-safe
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/trezor.egg-info/not-zip-safe
@@ -0,0 +1 @@
+
diff --git a/trezor.egg-info/requires.txt b/trezor.egg-info/requires.txt
new file mode 100644
index 0000000..b3887c3
--- /dev/null
+++ b/trezor.egg-info/requires.txt
@@ -0,0 +1,4 @@
+ecdsa>=0.9
+protobuf==2.6.1
+mnemonic>=0.8
+hidapi>=0.7.99
diff --git a/trezor.egg-info/top_level.txt b/trezor.egg-info/top_level.txt
new file mode 100644
index 0000000..a0f17dc
--- /dev/null
+++ b/trezor.egg-info/top_level.txt
@@ -0,0 +1 @@
+trezorlib
diff --git a/trezorlib/ckd_public.py b/trezorlib/ckd_public.py
index 64787b7..bdf1eaa 100644
--- a/trezorlib/ckd_public.py
+++ b/trezorlib/ckd_public.py
@@ -17,7 +17,7 @@ def point_to_pubkey(point):
     x_str = number_to_string(point.x(), order)
     y_str = number_to_string(point.y(), order)
     vk = x_str + y_str
-    return chr((ord(vk[63]) & 1) + 2) + vk[0:32]  # To compressed key 
+    return chr((ord(vk[63]) & 1) + 2) + vk[0:32]  # To compressed key
 
 def sec_to_public_pair(pubkey):
     """Convert a public key in sec binary format to a public pair."""
@@ -115,7 +115,7 @@ def deserialize(xpub):
     node.fingerprint = struct.unpack('>I', data[5:9])[0]
     node.child_num = struct.unpack('>I', data[9:13])[0]
     node.chain_code = data[13:45]
-    
+
     key = data[45:-4]
     if key[0] == '\x00':
         node.private_key = key[1:]
diff --git a/trezorlib/client.py b/trezorlib/client.py
index 173bb54..6e14ab3 100644
--- a/trezorlib/client.py
+++ b/trezorlib/client.py
@@ -78,7 +78,7 @@ class expect(object):
     # or raises an exception
     def __init__(self, *expected):
         self.expected = expected
-        
+
     def __call__(self, f):
         def wrapped_f(*args, **kwargs):
             ret = f(*args, **kwargs)
@@ -220,7 +220,7 @@ class DebugLinkMixin(object):
 
         # Always press Yes and provide correct pin
         self.setup_debuglink(True, True)
-        
+
         # Do not expect any specific response from device
         self.expected_responses = None
 
@@ -292,7 +292,7 @@ class DebugLinkMixin(object):
         resp = super(DebugLinkMixin, self).call_raw(msg)
         self._check_request(resp)
         return resp
-        
+
     def _check_request(self, msg):
         if self.expected_responses != None:
             try:
@@ -310,7 +310,7 @@ class DebugLinkMixin(object):
                 if not msg.HasField(field.name) or getattr(msg, field.name) != value:
                     raise CallException(types.Failure_Other,
                             "Expected %s, got %s" % (pprint(expected), pprint(msg)))
-            
+
     def callback_ButtonRequest(self, msg):
         log("ButtonRequest code: " + get_buttonrequest_value(msg.code))
 
diff --git a/trezorlib/debuglink.py b/trezorlib/debuglink.py
index 9bc1c17..374c19a 100644
--- a/trezorlib/debuglink.py
+++ b/trezorlib/debuglink.py
@@ -19,7 +19,7 @@ class DebugLink(object):
 
     def close(self):
         self.transport.close()
-        
+
     def _call(self, msg, nowait=False):
         print "DEBUGLINK SEND", pprint(msg)
         self.transport.write(msg)
@@ -53,7 +53,7 @@ class DebugLink(object):
 
         print "Encoded PIN:", pin_encoded
         return pin_encoded
-        
+
     def read_layout(self):
         obj = self._call(proto.DebugLinkGetState())
         return obj.layout
diff --git a/trezorlib/mapping.py b/trezorlib/mapping.py
index f631ed0..c20661d 100644
--- a/trezorlib/mapping.py
+++ b/trezorlib/mapping.py
@@ -10,7 +10,7 @@ def build_map():
 
         map_type_to_class[i] = msg_class
         map_class_to_type[msg_class] = i
-    
+
 def get_type(msg):
     return map_class_to_type[msg.__class__]
 
diff --git a/trezorlib/qt/pinmatrix.py b/trezorlib/qt/pinmatrix.py
index 070ff03..dc96a9d 100644
--- a/trezorlib/qt/pinmatrix.py
+++ b/trezorlib/qt/pinmatrix.py
@@ -27,7 +27,7 @@ class PinMatrixWidget(QWidget):
     '''
     def __init__(self, show_strength=True, parent=None):
         super(PinMatrixWidget, self).__init__(parent)
-        
+
         self.password = QLineEdit()
         self.password.setValidator(QRegExpValidator(QRegExp('[1-9]+'), None))
         self.password.setEchoMode(QLineEdit.Password)
diff --git a/trezorlib/transport_hid.py b/trezorlib/transport_hid.py
index 63a679c..440fe56 100644
--- a/trezorlib/transport_hid.py
+++ b/trezorlib/transport_hid.py
@@ -6,7 +6,7 @@ import platform
 from transport import Transport, ConnectionError, NotImplementedException
 
 DEVICE_IDS = [
-    (0x10c4, 0xea80),  # Shield
+#    (0x10c4, 0xea80),  # Shield
     (0x534c, 0x0001),  # Trezor
 ]
 
@@ -27,32 +27,6 @@ class HidTransport(Transport):
         super(HidTransport, self).__init__(device, *args, **kwargs)
 
     @classmethod
-    def _detect_debuglink(cls, path):
-        # Takes platform-specific path of USB and
-        # decide if the HID interface is normal transport
-        # or debuglink
-        
-        if platform.system() == 'Linux':
-            # Sample: 0003:0017:00
-            if path.endswith(':00'):
-                return False
-            return True
-        
-        elif platform.system() == 'Windows':
-            # Sample: \\\\?\\hid#vid_534c&pid_0001&mi_01#7&1d71791f&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}
-            # Note: 'mi' parameter is optional and might be unset
-            if '&mi_01#' in path:  # ,,,<o.O>,,,~
-                return True
-            return False
-
-        elif platform.system() == 'Darwin':
-            # DebugLink doesn't work on Mac
-            return False
-
-        else:
-            raise Exception("USB interface detection not implemented for %s" % platform.system())
-
-    @classmethod
     def enumerate(cls):
         """
         Return a list of available TREZOR devices.
@@ -62,6 +36,7 @@ class HidTransport(Transport):
             vendor_id = d['vendor_id']
             product_id = d['product_id']
             serial_number = d['serial_number']
+            interface_number = d['interface_number']
             path = d['path']
 
             # HIDAPI on Mac cannot detect correct HID interfaces, so device with
@@ -71,8 +46,13 @@ class HidTransport(Transport):
 
             if (vendor_id, product_id) in DEVICE_IDS:
                 devices.setdefault(serial_number, [None, None])
-                devices[serial_number][int(bool(cls._detect_debuglink(path)))] = path
-                
+                if interface_number == 0 or interface_number == -1: # normal link
+                    devices[serial_number][0] = path
+                elif interface_number == 1: # debug link
+                    devices[serial_number][1] = path
+                else:
+                    raise Exception("Unknown USB interface number: %d" % interface_number)
+
         # List of two-tuples (path_normal, path_debuglink)
         return devices.values()
 
@@ -90,8 +70,9 @@ class HidTransport(Transport):
         self.hid = hid.device()
         self.hid.open_path(self.device)
         self.hid.set_nonblocking(True)
-        self.hid.send_feature_report([0x41, 0x01]) # enable UART
-        self.hid.send_feature_report([0x43, 0x03]) # purge TX/RX FIFOs
+        # the following was needed just for Trezor Shield
+        # self.hid.send_feature_report([0x41, 0x01]) # enable UART
+        # self.hid.send_feature_report([0x43, 0x03]) # purge TX/RX FIFOs
     
     def _close(self):
         self.hid.close()

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-trezor.git



More information about the Python-modules-commits mailing list