Added get_path() to transports

This commit is contained in:
slush 2018-02-06 21:10:30 +01:00
parent f00a689087
commit e141a6f5d1
4 changed files with 12 additions and 0 deletions

View File

@ -52,6 +52,9 @@ class BridgeTransport(Transport):
self.response = None
def __str__(self):
return self.get_path()
def get_path(self):
return '%s:%s' % (self.PATH_PREFIX, self.device['path'])
@staticmethod

View File

@ -79,6 +79,9 @@ class HidTransport(Transport):
self.hid_version = None
def __str__(self):
return self.get_path()
def get_path(self):
return "%s:%s" % (self.PATH_PREFIX, self.device['path'].decode())
@staticmethod

View File

@ -56,6 +56,9 @@ class UdpTransport(Transport):
self.socket = None
def __str__(self):
return self.get_path()
def get_path(self):
return "%s:%s:%s" % ((self.PATH_PREFIX,) + self.device)
@staticmethod

View File

@ -88,6 +88,9 @@ class WebUsbTransport(Transport):
self.debug = debug
def __str__(self):
return self.get_path()
def get_path(self):
return "%s:%s" % (self.PATH_PREFIX, dev_to_str(self.device))
@classmethod