[PATCH 1/2] dump_audio_bmcontrols(): tell users about faulty bmControl bits

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

 



Signed-off-by: Daniel Mack <daniel@xxxxxxxx>
---
 lsusb.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/lsusb.c b/lsusb.c
index 43ce219..b0b073d 100644
--- a/lsusb.c
+++ b/lsusb.c
@@ -939,12 +939,16 @@ static void dump_audio_bmcontrols(const char *prefix, int bmcontrols, const stru
 
 			break;
 
-		case USB_AUDIO_CLASS_2:
-			if (bmcontrols & (1 << (list->bit * 2)))
-				printf("%s%s Control (%s)\n", prefix, list->name,
-					bmcontrols & (2 << (list->bit * 2)) ? "read/write" : "read-only");
+		case USB_AUDIO_CLASS_2: {
+			const char *ctrl_type[] = { "read-only", "ILLEGAL (0b10)", "read/write" };
+			int ctrl = (bmcontrols >> (list->bit * 2)) & 0x3;
+
+			if (ctrl)
+				printf("%s%s Control (%s)\n", prefix, list->name, ctrl_type[ctrl-1]);
 
 			break;
+		}
+
 		} /* switch */
 
 		list++;
-- 
1.7.1

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