File 0003-sg_inq-compability-links-for-ata_id.patch of Package sg3_utils
From 96300d5e6d62a9fd64183fe6c13a5227d07c6b1f Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Thu, 8 May 2014 15:59:33 +0200
Subject: sg_inq: compability links for ata_id
The original 'ata_id' program would return the data provided by
the 'IDENTIFY' ATA command.
As the 'product' information from the IDENTIFY command is 40
bytes long it doesn't fit into the 'product' field for the SCSI
inquiry, causing it to be truncated.
So we should be adding another field 'SCSI_IDENT_LUN_ATA'
to provide ata_id compatible information for creating symlinks.
References: bnc#876344
Signed-off-by: Hannes Reinecke <hare@suse.de>
---
scripts/55-scsi-sg3_id.rules | 3 ++-
src/sg_inq.c | 4 ++++
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/scripts/55-scsi-sg3_id.rules b/scripts/55-scsi-sg3_id.rules
index 2f99157..ab5a8e3 100644
--- a/scripts/55-scsi-sg3_id.rules
+++ b/scripts/55-scsi-sg3_id.rules
@@ -25,7 +25,8 @@ ENV{SCSI_IDENT_LUN_NAA}=="?*", ENV{ID_WWN}!="?*", ENV{ID_WWN}="0x$env{SCSI_IDENT
ENV{SCSI_IDENT_LUN_NAA}=="?*", ENV{ID_WWN_WITH_EXTENSION}!="?*", ENV{ID_WWN_WITH_EXTENSION}="0x$env{SCSI_IDENT_LUN_NAA}"
# ata_id compability
-ENV{ID_SERIAL}!="?*", ENV{SCSI_VENDOR}=="ATA", ENV{ID_BUS}="ata", ENV{ID_ATA}="1", ENV{ID_SERIAL}="$env{SCSI_MODEL}_$env{SCSI_IDENT_LUN_VENDOR}"
+ENV{ID_SERIAL}!="?*", ENV{SCSI_IDENT_LUN_ATA}=="?*", ENV{ID_BUS}="ata", ENV{ID_ATA}="1", ENV{ID_SERIAL}="$env{SCSI_IDENT_LUN_ATA}"
+ENV{ID_SERIAL_SHORT}!="?*", ENV{SCSI_VENDOR}=="ATA", ENV{SCSI_IDENT_LUN_VENDOR}=="?*", ENV{ID_SERIAL_SHORT}="$env{SCSI_IDENT_LUN_VENDOR}"
# Compat ID_SERIAL setting
ENV{ID_SERIAL}!="?*", ENV{SCSI_IDENT_LUN_NAA}=="?*", ENV{ID_BUS}="scsi", ENV{ID_SERIAL}="3$env{SCSI_IDENT_LUN_NAA}", ENV{ID_SERIAL_SHORT}="$env{SCSI_IDENT_LUN_NAA}"
ENV{ID_SERIAL}!="?*", ENV{SCSI_IDENT_LUN_EUI64}=="?*", ENV{ID_BUS}="scsi", ENV{ID_SERIAL}="2$env{SCSI_IDENT_LUN_EUI64}", ENV{ID_SERIAL_SHORT}="$env{SCSI_IDENT_LUN_EUI64}"
diff --git a/src/sg_inq.c b/src/sg_inq.c
index bfa4f58..7d8ada5 100644
--- a/src/sg_inq.c
+++ b/src/sg_inq.c
@@ -1839,6 +1839,10 @@ export_dev_ids(unsigned char * buff, int len)
if ((2 == c_set) || (3 == c_set)) {
k = encode_whitespaces(ip, i_len);
printf("%.*s\n", k, ip);
+ if (!memcmp(ip, "ATA_", 4)) {
+ printf("SCSI_IDENT_%s_ATA=%.*s\n", assoc_str,
+ k - 4, ip + 4);
+ }
} else {
for (m = 0; m < i_len; ++m)
printf("%02x", (unsigned int)ip[m]);
--
1.7.12.4