aboutsummaryrefslogtreecommitdiff
path: root/examples/sg_sat_smart_rd_data.c
diff options
context:
space:
mode:
Diffstat (limited to 'examples/sg_sat_smart_rd_data.c')
-rw-r--r--examples/sg_sat_smart_rd_data.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/examples/sg_sat_smart_rd_data.c b/examples/sg_sat_smart_rd_data.c
index deaf1454..36b824ca 100644
--- a/examples/sg_sat_smart_rd_data.c
+++ b/examples/sg_sat_smart_rd_data.c
@@ -57,12 +57,12 @@
#define EBUFF_SZ 256
-static char * version_str = "1.03 20160423";
+static char * version_str = "1.03 20160528";
int main(int argc, char * argv[])
{
int sg_fd, k, ok;
- unsigned char aptCmdBlk[SAT_ATA_PASS_THROUGH16_LEN] =
+ unsigned char apt_cdb[SAT_ATA_PASS_THROUGH16_LEN] =
{SAT_ATA_PASS_THROUGH16, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0};
sg_io_hdr_t io_hdr;
@@ -115,30 +115,30 @@ int main(int argc, char * argv[])
}
/* Prepare ATA PASS-THROUGH COMMAND (16) command */
- aptCmdBlk[4] = ATA_SMART_READ_DATA; /* feature (7:0) */
- aptCmdBlk[6] = 1; /* number of block (sector count) */
- aptCmdBlk[10] = 0x4f; /* lba_mid (7:0) */
- aptCmdBlk[12] = 0xc2; /* lba_high (7:0) */
- aptCmdBlk[14] = ATA_SMART;
- aptCmdBlk[1] = (protocol << 1) | extend;
- aptCmdBlk[2] = (chk_cond << 5) | (t_dir << 3) |
- (byte_block << 2) | t_length;
+ apt_cdb[4] = ATA_SMART_READ_DATA; /* feature (7:0) */
+ apt_cdb[6] = 1; /* number of block (sector count) */
+ apt_cdb[10] = 0x4f; /* lba_mid (7:0) */
+ apt_cdb[12] = 0xc2; /* lba_high (7:0) */
+ apt_cdb[14] = ATA_SMART;
+ apt_cdb[1] = (protocol << 1) | extend;
+ apt_cdb[2] = (chk_cond << 5) | (t_dir << 3) | (byte_block << 2) |
+ t_length;
if (verbose) {
fprintf(stderr, " ata pass through(16) cdb: ");
for (k = 0; k < SAT_ATA_PASS_THROUGH16_LEN; ++k)
- fprintf(stderr, "%02x ", aptCmdBlk[k]);
+ fprintf(stderr, "%02x ", apt_cdb[k]);
fprintf(stderr, "\n");
}
memset(&io_hdr, 0, sizeof(sg_io_hdr_t));
io_hdr.interface_id = 'S';
- io_hdr.cmd_len = sizeof(aptCmdBlk);
+ io_hdr.cmd_len = sizeof(apt_cdb);
/* io_hdr.iovec_count = 0; */ /* memset takes care of this */
io_hdr.mx_sb_len = sizeof(sense_buffer);
io_hdr.dxfer_direction = SG_DXFER_FROM_DEV;
io_hdr.dxfer_len = SMART_READ_DATA_RESPONSE_LEN;
io_hdr.dxferp = inBuff;
- io_hdr.cmdp = aptCmdBlk;
+ io_hdr.cmdp = apt_cdb;
io_hdr.sbp = sense_buffer;
io_hdr.timeout = 20000; /* 20000 millisecs == 20 seconds */
/* io_hdr.flags = 0; */ /* take defaults: indirect IO, etc */