From c513b7646687b35543f3e5a16640807a84eb1a5b Mon Sep 17 00:00:00 2001 From: Mantas Mikulėnas Date: Mon, 6 May 2019 12:02:35 +0300 Subject: lsusb.py: add an actual __repr__() to classes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This simplifies debugging. Signed-off-by: Mantas Mikulėnas Signed-off-by: Greg Kroah-Hartman --- lsusb.py.in | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lsusb.py.in b/lsusb.py.in index d907711..e7a57fb 100644 --- a/lsusb.py.in +++ b/lsusb.py.in @@ -258,6 +258,9 @@ class UsbEndpoint: self.attr = int(readattr(self.path, "bmAttributes"), 16) self.max = int(readattr(self.path, "wMaxPacketSize"), 16) + def __repr__(self): + return "" % self.fname + def __str__(self): indent = self.level + len(self.parent.fname) return "%-17s %s(EP) %02x: %s %s attr %02x len %02x max %03x%s\n" % \ @@ -302,6 +305,9 @@ class UsbInterface: ep = UsbEndpoint(self, dirent, self.level+1) self.eps.append(ep) + def __repr__(self): + return "" % self.fname + def __str__(self): plural = (" " if self.noep == 1 else "s") strg = "%-17s (IF) %02x:%02x:%02x %iEP%s (%s) %s%s %s%s%s\n" % \ @@ -405,6 +411,9 @@ class UsbDevice: self.interfaces.sort(key=usbsortkey) self.children.sort(key=usbsortkey) + def __repr__(self): + return "" % self.fname + def __str__(self): if self.iclass == HUB_ICLASS: col = cols[2] -- cgit 1.2.3-korg