[PATCH] lsusb: Show USB 3.0 U1, U2, and LTM status.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The Get Status value for USB 3.0 devices adds three new status bits.
Bits 2 and 3 indicate if U1 and U2 are enabled, and bit 4 indicates if
Latency Tolerance Messaging (LTM) is enabled.

Upcoming patches for the Linux kernel will enable LTM, so lsusb should
be changed to show whether LTM is enabled for a device.

Signed-off-by: Sarah Sharp <sarah.a.sharp@xxxxxxxxxxxxxxx>
---
 lsusb.c |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/lsusb.c b/lsusb.c
index 1e2957e..738d65a 100644
--- a/lsusb.c
+++ b/lsusb.c
@@ -3435,7 +3435,7 @@ static int do_otg(struct libusb_config_descriptor *config)
 }
 
 static void
-dump_device_status(libusb_device_handle *fd, int otg, int wireless)
+dump_device_status(libusb_device_handle *fd, int otg, int wireless, int super_speed)
 {
 	unsigned char status[8];
 	int ret;
@@ -3461,7 +3461,7 @@ dump_device_status(libusb_device_handle *fd, int otg, int wireless)
 		printf("  (Bus Powered)\n");
 	if (status[0] & (1 << 1))
 		printf("  Remote Wakeup Enabled\n");
-	if (status[0] & (1 << 2)) {
+	if (status[0] & (1 << 2) && !super_speed) {
 		/* for high speed devices */
 		if (!wireless)
 			printf("  Test Mode\n");
@@ -3469,6 +3469,14 @@ dump_device_status(libusb_device_handle *fd, int otg, int wireless)
 		else
 			printf("  Battery Powered\n");
 	}
+	if (super_speed) {
+		if (status[0] & (1 << 2))
+			printf("  U1 Enabled\n");
+		if (status[0] & (1 << 3))
+			printf("  U2 Enabled\n");
+		if (status[0] & (1 << 4))
+			printf("  Latency Tolerance Messaging (LTM) Enabled\n");
+	}
 	/* if both HOST and DEVICE support OTG */
 	if (otg) {
 		if (status[0] & (1 << 3))
@@ -3796,7 +3804,7 @@ static void dumpdev(libusb_device *dev)
 		do_dualspeed(udev);
 	}
 	do_debug(udev);
-	dump_device_status(udev, otg, wireless);
+	dump_device_status(udev, otg, wireless, desc.bcdUSB >= 0x0300);
 	libusb_close(udev);
 }
 
-- 
1.7.9

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux