I am trying to replicate sg_inq through sg_raw
This is the command used:
inq_cmd := exec.Command("sg_raw", "-r", "512", "/dev/sg0", "12 00 00 00 60 00")
stdoutStderr, err := read_cmd.CombinedOutput()
if err != nil {
log.Fatal(err)
}
fmt.Printf("%s\n", stdoutStderr)
Output after execution is Inq COMMAND : exit status 1 Invalid command byte '12 00 00 00 60 00'
Inquire COMMAND : 2020/05/28 19:42:48 exit status 1
exit status 1 Invalid command byte '12 00 00 00 60 00' Usage: sg_raw [OPTION]* DEVICE CDB0 CDB1 ... Options: -b, --binary Dump data in binary form, even when writing to stdout -h, --help Show this message and exit -i, --infile=IFILE Read data to send from IFILE (default: stdin) -k, --skip=LEN Skip the first LEN bytes when reading data to send -n, --nosense Don't display sense information -o, --outfile=OFILE Write binary data to OFILE (def: hexdump to stdout) -r, --request=RLEN Request up to RLEN bytes of data (data-in) -R, --readonly Open DEVICE read-only (default: read-write) -s, --send=SLEN Send SLEN bytes of data (data-out) -t, --timeout=SEC Timeout in seconds (default: 20) -v, --verbose Increase verbosity -V, --version Show version information and exit
Between 6 and 256 command bytes (two hex digits each) can be specified and will be sent to DEVICE. Lengths RLEN and SLEN are decimal by default. Bidirectional commands accepted.
Simple example: Perform INQUIRY on /dev/sg0: sg_raw -r 1k /dev/sg0 12 00 00 00 60 00
What's wrong in the command? It would be a great help! Thanks in advance!