aboutsummaryrefslogtreecommitdiff
path: root/src/sg_raw.c
diff options
context:
space:
mode:
authorDouglas Gilbert <dgilbert@interlog.com>2016-04-24 02:11:26 +0000
committerDouglas Gilbert <dgilbert@interlog.com>2016-04-24 02:11:26 +0000
commit58a90357e1c16deb0d18c7e517c3f471840069ad (patch)
treee19f714d30dedc61e67c084e9956ed0db4ee00e1 /src/sg_raw.c
parentee7c9e04ee035140fd8204edaf5bad1262383f08 (diff)
downloadsg3_utils-58a90357e1c16deb0d18c7e517c3f471840069ad.tar.gz
sg_decode sense: add --cdb option; add stdint.h to some headers
git-svn-id: https://svn.bingwo.ca/repos/sg3_utils/trunk@692 6180dd3e-e324-4e3e-922d-17de1ae2f315
Diffstat (limited to 'src/sg_raw.c')
-rw-r--r--src/sg_raw.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/sg_raw.c b/src/sg_raw.c
index 715d12a7..b260a93a 100644
--- a/src/sg_raw.c
+++ b/src/sg_raw.c
@@ -29,8 +29,9 @@
#include "sg_lib.h"
#include "sg_pt.h"
#include "sg_pr2serr.h"
+#include "sg_unaligned.h"
-#define SG_RAW_VERSION "0.4.15 (2016-03-31)"
+#define SG_RAW_VERSION "0.4.16 (2016-04-15)"
#ifdef SG_LIB_WIN32
#ifndef HAVE_SYSCONF
@@ -261,10 +262,10 @@ process_cl(struct opts_t * op, int argc, char *argv[])
char b[80];
if (op->cdb_length > 16) {
- sa = (op->cdb[8] << 8) + op->cdb[9];
- if (0x7f != op->cdb[0])
+ sa = sg_get_unaligned_be16(op->cdb + 8);
+ if ((0x7f != op->cdb[0]) && (0x7e != op->cdb[0]))
printf(">>> Unlikely to be SCSI CDB since all over 16 "
- "bytes long should\n>>> start with 0x7f\n");
+ "bytes long should\n>>> start with 0x7f or 0x7e\n");
} else
sa = op->cdb[1] & 0x1f;
sg_get_opcode_sa_name(op->cdb[0], sa, 0, sizeof(b), b);