lsusb doesn't handle 32 bits Usage tags.

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

 



Hi.

lsusb doesn't handle 32 bits Usage tags.

I've tried to do a patch but i'm not confident in its implementation.

Could you review it please ?

Regards.

Paul.
From 8a0ad009c76de54cc871ad4eb5bf2dd2adb75ef6 Mon Sep 17 00:00:00 2001
From: Paul Chavent <paul.chavent@xxxxxxxx>
Date: Sun, 7 Jul 2013 19:09:32 +0200
Subject: [PATCH] Fix 32 bits usage tags.

---
 lsusb.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/lsusb.c b/lsusb.c
index 29af933..01f9eb2 100644
--- a/lsusb.c
+++ b/lsusb.c
@@ -2810,8 +2810,16 @@ static void dump_report_desc(unsigned char *b, int l)
 		case 0x08: /* Usage */
 		case 0x18: /* Usage Minimum */
 		case 0x28: /* Usage Maximum */
-			printf("%s%s\n", indent,
-			       names_hutus((hut << 16) + data));
+			if (bsize<=2) {
+				printf("%s%s\n", indent,
+				       names_hutus((hut << 16) + data));
+			}
+			else if (bsize<=4) {
+				data =  ((data >> 16) & 0x0000FFFF) | 
+					((data << 16) & 0xFFFF0000);
+				printf("%s%s\n", indent,
+				       names_hutus(data));
+			}
 			break;
 
 		case 0x54: /* Unit Exponent */
-- 
1.7.12.1


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

  Powered by Linux