ChangeSet 1.1018.1.19, 2003/04/07 10:20:21-07:00, mdharm-usb@one-eyed-alien.net

[PATCH] usb-storage: add info to /proc interface

This patch adds some information about the quirks of the device to the
/proc interface.


 drivers/usb/storage/scsiglue.c |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+)


diff -Nru a/drivers/usb/storage/scsiglue.c b/drivers/usb/storage/scsiglue.c
--- a/drivers/usb/storage/scsiglue.c	Mon Apr  7 15:12:08 2003
+++ b/drivers/usb/storage/scsiglue.c	Mon Apr  7 15:12:08 2003
@@ -270,6 +270,7 @@
 	struct us_data *us;
 	char *pos = buffer;
 	struct Scsi_Host *hostptr;
+	unsigned long f;
 
 	/* if someone is sending us data, just throw it away */
 	if (inout)
@@ -284,6 +285,7 @@
 
 	/* if we couldn't find it, we return an error */
 	if (!us) {
+		scsi_host_put(hostptr);
 		return -ESRCH;
 	}
 
@@ -298,6 +300,24 @@
 	/* show the protocol and transport */
 	SPRINTF("     Protocol: %s\n", us->protocol_name);
 	SPRINTF("    Transport: %s\n", us->transport_name);
+
+	/* show the device flags */
+	if (pos < buffer + length) {
+		pos += sprintf(pos, "       Quirks:");
+		f = us->flags;
+
+#define DO_FLAG(a)  	if (f & US_FL_##a)  pos += sprintf(pos, " " #a)
+		DO_FLAG(SINGLE_LUN);
+		DO_FLAG(MODE_XLATE);
+		DO_FLAG(START_STOP);
+		DO_FLAG(IGNORE_SER);
+		DO_FLAG(SCM_MULT_TARG);
+		DO_FLAG(FIX_INQUIRY);
+		DO_FLAG(FIX_CAPACITY);
+#undef DO_FLAG
+
+		*(pos++) = '\n';
+		}
 
 	/* release the reference count on this host */
 	scsi_host_put(hostptr);
