>From 4f5391a1c67e69d913163c9dcf168cdf39229ad9 Mon Sep 17 00:00:00 2001
From: Ronnie Sahlberg <[EMAIL PROTECTED]>
Date: Wed, 7 May 2008 06:18:55 +1000
Subject: [PATCH] Use same serial num in getconfig:unitserialnum as inquiry does

The feature GetConfiguration/Lun_Serial_Number is used to pull
the unit serial number from a device.
Use the same data that inq 0x80 uses to report the serial number
so that both methods (getconf and inq) report the same serial number
for the device.

Signed-off-by: Ronnie Sahlberg <[EMAIL PROTECTED]>
---
 usr/mmc.c |   19 ++++++++++---------
 1 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/usr/mmc.c b/usr/mmc.c
index 074b9be..aaf26e9 100644
--- a/usr/mmc.c
+++ b/usr/mmc.c
@@ -833,6 +833,9 @@ static char *feature_dvd_plus_r(struct scsi_cmd
*cmd, char *data,
 static char *feature_lun_serial_no(struct scsi_cmd *cmd, char *data,
                                   int only_current)
 {
+       struct lu_phy_attr *attrs;
+       struct vpd *vpd_pg;
+
        /* feature code */
        *data++ = 0x01;
        *data++ = 0x08;
@@ -843,15 +846,13 @@ static char *feature_lun_serial_no(struct
scsi_cmd *cmd, char *data,
        /* additional length */
        *data++ = 8;

-       /* XXX */
-       *data++ = 'D';
-       *data++ = 'V';
-       *data++ = 'D';
-       *data++ = '#';
-       *data++ = '1';
-       *data++ = '2';
-       *data++ = '3';
-       *data++ = '4';
+       /* serial number */
+       attrs = &cmd->dev->attrs;
+       vpd_pg = attrs->lu_vpd[PCODE_OFFSET(0x80)];
+       if (vpd_pg->size == 8) {
+               memcpy(data, vpd_pg->data, 8);
+       }
+       data += 8;

        return data;
 }
-- 
1.5.5
_______________________________________________
Stgt-devel mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/stgt-devel

Reply via email to