All of lore.kernel.org
 help / color / mirror / Atom feed
From: Patrick Mansfield <patmans@us.ibm.com>
To: Douglas Gilbert <dougg@torque.net>, linux-scsi@vger.kernel.org
Subject: [PATCH] add scsi_level and revision support to lsscsci 0.03
Date: Tue, 7 Jan 2003 17:00:44 -0800	[thread overview]
Message-ID: <20030107170044.A17770@beaverton.ibm.com> (raw)

Doug -

This patch adds support for use of scsi_level and the output of revision
to lsscsi 0.03. It should work even without scsi_level in the scsi sysfs
attributes.

lsscsi -c now gives the exact same output as catting /proc/scsi/scsi.

--- lsscsi.c-orig	Tue Jan  7 15:55:25 2003
+++ lsscsi.c	Tue Jan  7 15:56:25 2003
@@ -221,7 +221,7 @@
 	int hcil_arr[4];
 	char buff[NAME_LEN_MAX];
 	char value[NAME_LEN_MAX];
-	int type, k;
+	int type, scsi_level, k;
 
 	strcpy(buff, dir_name);
 	strcat(buff, "/");
@@ -254,7 +254,13 @@
 		printf("  Type:   %-33s", "???");
 	} else
 		printf("  Type:   %-33s", scsi_device_types[type]);
-	printf("ANSI SCSI revision: ??\n");
+	if (! get_value(buff, "scsi_level", value, NAME_LEN_MAX)) {
+		printf("ANSI SCSI revision: ?\n");
+	} else if (1 != sscanf(value, "%d", &scsi_level)) {
+		printf("ANSI SCSI revision: ??\n");
+	} else
+		printf("ANSI SCSI revision: %02x\n", (scsi_level - 1) ?
+		                            scsi_level - 1 : 1);
 	if (out_mask & MASK_NAME) {
 		if (get_value(buff, "name", value, NAME_LEN_MAX))
 			printf("  name: %s\n", value);

-- Patrick Mansfield

                 reply	other threads:[~2003-01-08  1:00 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20030107170044.A17770@beaverton.ibm.com \
    --to=patmans@us.ibm.com \
    --cc=dougg@torque.net \
    --cc=linux-scsi@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.