|
|
716120 |
Index: hdparm-9.43/sgio.c
|
|
|
716120 |
===================================================================
|
|
|
716120 |
--- hdparm-9.43.orig/sgio.c
|
|
|
716120 |
+++ hdparm-9.43/sgio.c
|
|
|
716120 |
@@ -17,6 +17,10 @@
|
|
|
716120 |
|
|
|
716120 |
#include <linux/hdreg.h>
|
|
|
716120 |
|
|
|
716120 |
+#ifndef DEMAND_SENSE_DATA
|
|
|
716120 |
+ #define DEMAND_SENSE_DATA 0
|
|
|
716120 |
+#endif
|
|
|
716120 |
+
|
|
|
716120 |
extern int verbose;
|
|
|
716120 |
extern int prefer_ata12;
|
|
|
716120 |
|
|
|
716120 |
@@ -193,7 +197,7 @@ int sg16 (int fd, int rw, int dma, struc
|
|
|
716120 |
unsigned char cdb[SG_ATA_16_LEN];
|
|
|
716120 |
unsigned char sb[32], *desc;
|
|
|
716120 |
struct scsi_sg_io_hdr io_hdr;
|
|
|
716120 |
- int prefer12 = prefer_ata12, demanded_sense = 0;
|
|
|
716120 |
+ int prefer12 = prefer_ata12;
|
|
|
716120 |
|
|
|
716120 |
if (tf->command == ATA_OP_PIDENTIFY)
|
|
|
716120 |
prefer12 = 0;
|
|
|
716120 |
@@ -302,14 +306,16 @@ int sg16 (int fd, int rw, int dma, struc
|
|
|
716120 |
|
|
|
716120 |
desc = sb + 8;
|
|
|
716120 |
if (io_hdr.driver_status != SG_DRIVER_SENSE) {
|
|
|
716120 |
- if (sb[0] | sb[1] | sb[2] | sb[3] | sb[4] | sb[5] | sb[6] | sb[7] | sb[8] | sb[9]) {
|
|
|
716120 |
- static int second_try = 0;
|
|
|
716120 |
- if (!second_try++)
|
|
|
716120 |
+ static int second_try = 0;
|
|
|
716120 |
+ if (!second_try++) {
|
|
|
716120 |
+ if (sb[0] | sb[1] | sb[2] | sb[3] | sb[4] | sb[5] | sb[6] | sb[7] | sb[8] | sb[9]) {
|
|
|
716120 |
fprintf(stderr, "SG_IO: questionable sense data, results may be incorrect\n");
|
|
|
716120 |
- } else if (demanded_sense) {
|
|
|
716120 |
- static int second_try = 0;
|
|
|
716120 |
- if (!second_try++)
|
|
|
716120 |
+ }
|
|
|
716120 |
+#if DEMAND_SENSE_DATA
|
|
|
716120 |
+ else {
|
|
|
716120 |
fprintf(stderr, "SG_IO: missing sense data, results may be incorrect\n");
|
|
|
716120 |
+ }
|
|
|
716120 |
+#endif
|
|
|
716120 |
}
|
|
|
716120 |
} else if (sb[0] != 0x72 || sb[7] < 14 || desc[0] != 0x09 || desc[1] < 0x0c) {
|
|
|
716120 |
dump_bytes("SG_IO: bad/missing sense data, sb[]", sb, sizeof(sb));
|