diff options
author | Ruslan Kabatsayev <b7.10110111@gmail.com> | 2020-11-10 10:22:13 +0300 |
---|---|---|
committer | Ruslan Kabatsayev <b7.10110111@gmail.com> | 2021-02-22 22:31:39 +0300 |
commit | fa02764527f3f8275ac89a6a38922b653d4c5097 (patch) | |
tree | e02814ac6db3a90274a1b63f5392134ae5b5e8b4 | |
parent | 1a19bf5d8e5fcd2519d1423ef44ba39a407fe4d4 (diff) | |
download | usbutils-fa02764527f3f8275ac89a6a38922b653d4c5097.tar.gz |
Fix formatting of endpoint direction to match /sys/kernel/debug/usb/devices
Direction of an endpoint is formatted as "I", "O" or "B" in
/sys/kernel/debug/usb/devices, while in
/sys/bus/usb/devices/..../direction it's instead "in", "out" or "both". This
patch adds the conversion to make the relevant output of usb-devices
look like /sys/kernel/debug/usb/devices.
Signed-off-by: Ruslan Kabatsayev <b7.10110111@gmail.com>
-rwxr-xr-x | usb-devices | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/usb-devices b/usb-devices index 7daa139..296d432 100755 --- a/usb-devices +++ b/usb-devices @@ -49,6 +49,13 @@ print_endpoint() { addr=`cat $eppath/bEndpointAddress` attr=`cat $eppath/bmAttributes` dir=`cat $eppath/direction` + if [ "$dir" = in ]; then + dir=I + elif [ "$dir" = out ]; then + dir=O + elif [ "$dir" = both ]; then + dir=B + fi eptype=`cat $eppath/type` maxps_hex="0x`cat $eppath/wMaxPacketSize`" # Extract MaxPS size (bits 0-10) and multiplicity values (bits 11-12) |