Re: [PATCH 02/13] xhci: add port speed ID to portsc tracing

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

 



On 05.10.2017 17:59, David Laight wrote:
From: Mathias Nyman
Sent: 05 October 2017 09:22
Shows the port speed protocol speed ID (PSID) in use.
speed ID may map to custom speeds, but in most cases it uses default

1 = Full-Speed        12 MB/s
2 = Low-Speed         1.5 Mb/s
3 = High-speed        480 Mb/s
4 = SuperSpeed        5 Gb/s
5 = SuperSpeedPlus    10 Gb/s

Signed-off-by: Mathias Nyman <mathias.nyman@xxxxxxxxxxxxxxx>
---
  drivers/usb/host/xhci.h | 5 +++--
  1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
index dc22392..ea176da 100644
--- a/drivers/usb/host/xhci.h
+++ b/drivers/usb/host/xhci.h
@@ -2441,11 +2441,12 @@ static inline const char *xhci_decode_portsc(u32 portsc)
  	static char str[256];
  	int ret;

-	ret = sprintf(str, "%s %s %s Link:%s ",
+	ret = sprintf(str, "%s %s %s Link:%s PortSpeed:%d ",

Shouldn't that be an snprintf() ?

No need as we are just picking among string literals that we defined ourself and know the length.


I'm not sure adding "1" to "5" here is entirely useful.
It would be better is a string could be returned containing the actual speed
ie "480Mb/s" etc.

I agree that actual speed would be more useful, but even if the mapping from 1-5
is mostly standard, the values from 6 and up are custom.

To get a really reliable speed we would need to match the speed ID with the PSI
Dword table provided by hardware and parse if from there.

For me this is already really useful to know if a device was enumerated correctly at
SuperSpeedPlus by just looking for PortSpeed:5

-Mathias

--
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