summaryrefslogtreecommitdiff
path: root/extras/scsi_id
diff options
context:
space:
mode:
Diffstat (limited to 'extras/scsi_id')
-rw-r--r--extras/scsi_id/scsi_id.c8
-rw-r--r--extras/scsi_id/scsi_serial.c6
2 files changed, 12 insertions, 2 deletions
diff --git a/extras/scsi_id/scsi_id.c b/extras/scsi_id/scsi_id.c
index 4003ee6af5..cbefb445df 100644
--- a/extras/scsi_id/scsi_id.c
+++ b/extras/scsi_id/scsi_id.c
@@ -52,7 +52,7 @@
* options are not supported, but other code is still left in place for
* now.
*/
-static const char short_options[] = "bd:f:gip:s:uvVx";
+static const char short_options[] = "abd:f:gip:s:uvVx";
/*
* Just duplicate per dev options.
*/
@@ -61,6 +61,7 @@ static const char dev_short_options[] = "bgp:";
char sysfs_mnt_path[SYSFS_PATH_MAX];
static int all_good;
+static int always_info;
static char *default_callout;
static int dev_specified;
static int sys_specified;
@@ -485,6 +486,9 @@ static int set_options(int argc, char **argv, const char *short_opts,
dprintf("option '%c'\n", option);
switch (option) {
+ case 'a':
+ always_info = 1;
+ break;
case 'b':
all_good = 0;
break;
@@ -810,7 +814,7 @@ static int scsi_id(const char *target_path, char *maj_min_dev)
retval = 1;
} else if (scsi_get_serial(scsi_dev, maj_min_dev, page_code,
serial, MAX_SERIAL_LEN)) {
- retval = 1;
+ retval = always_info?0:1;
} else {
retval = 0;
}
diff --git a/extras/scsi_id/scsi_serial.c b/extras/scsi_id/scsi_serial.c
index 20a7928553..7bfa9d1812 100644
--- a/extras/scsi_id/scsi_serial.c
+++ b/extras/scsi_id/scsi_serial.c
@@ -89,6 +89,7 @@ static const char hex_str[]="0123456789abcdef";
#define SG_ERR_CAT_RESET 2 /* interpreted from sense buffer */
#define SG_ERR_CAT_TIMEOUT 3
#define SG_ERR_CAT_RECOVERED 4 /* Successful command after recovered err */
+#define SG_ERR_CAT_NOTSUPPORTED 5 /* Illegal / unsupported command */
#define SG_ERR_CAT_SENSE 98 /* Something else in the sense buffer */
#define SG_ERR_CAT_OTHER 99 /* Some other error/warning */
@@ -130,6 +131,8 @@ static int sg_err_category_new(int scsi_status, int msg_status, int
return SG_ERR_CAT_MEDIA_CHANGED;
if (0x29 == asc)
return SG_ERR_CAT_RESET;
+ } else if (sense_key == ILLEGAL_REQUEST) {
+ return SG_ERR_CAT_NOTSUPPORTED;
}
}
return SG_ERR_CAT_SENSE;
@@ -331,6 +334,9 @@ resend:
retval = sg_err_category3(&io_hdr);
switch (retval) {
+ case SG_ERR_CAT_NOTSUPPORTED:
+ buf[1] = 0;
+ /* Fallthrough */
case SG_ERR_CAT_CLEAN:
case SG_ERR_CAT_RECOVERED:
retval = 0;