1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-22 22:38:08 +00:00

Document transport_hid class

This commit is contained in:
Timothy 2014-08-26 14:06:19 +00:00
parent 78e9afae6e
commit e7cb1d474a
2 changed files with 7 additions and 2 deletions

View File

@ -10,6 +10,6 @@ To get a list of TREZORs that are currently plugged into our computer, we use th
We can now interact with our TREZORs by creating a :doc:`TrezorClient <client>` object. We can now interact with our TREZORs by creating a :doc:`TrezorClient <client>` object.
.. automodule:: trezorlib.transport_hid .. autoclass:: trezorlib.transport_hid.HidTransport
:members: :members:
:undoc-members: :undoc-members:

View File

@ -54,6 +54,9 @@ class HidTransport(Transport):
@classmethod @classmethod
def enumerate(cls): def enumerate(cls):
"""
Return a list of available TREZOR devices.
"""
devices = {} devices = {}
for d in hid.enumerate(0, 0): for d in hid.enumerate(0, 0):
vendor_id = d['vendor_id'] vendor_id = d['vendor_id']
@ -74,7 +77,9 @@ class HidTransport(Transport):
return devices.values() return devices.values()
def is_connected(self): def is_connected(self):
# Check if the device is still connected """
Check if the device is still connected.
"""
for d in hid.enumerate(0, 0): for d in hid.enumerate(0, 0):
if d['path'] == self.device: if d['path'] == self.device:
return True return True