~ubuntu-branches/ubuntu/intrepid/sg3-utils/intrepid

« back to all changes in this revision

Viewing changes to examples/sg_sense_test.c

  • Committer: Bazaar Package Importer
  • Author(s): Luk Claes
  • Date: 2006-11-05 17:23:29 UTC
  • mfrom: (1.1.4 upstream) (3.1.2 edgy)
  • Revision ID: james.westby@ubuntu.com-20061105172329-l4loha00sk36qz6k
* Non-maintainer upload.
* Fix FTBFS due to old syscall usage (Closes: #395512).

Show diffs side-by-side

added added

removed removed

Lines of Context:
7
7
#include <sys/ioctl.h>
8
8
#include <sys/types.h>
9
9
#include <sys/stat.h>
10
 
#include "sg_include.h"
11
 
#include "sg_err.h"
 
10
#include "sg_lib.h"
12
11
 
13
12
/* This is a simple program that tests the sense data descriptor format
14
 
   printout function in sg_err.c
 
13
   printout function in sg_lib.c
15
14
 
16
 
*  Copyright (C) 2004 D. Gilbert
 
15
*  Copyright (C) 2004-2006 D. Gilbert
17
16
*  This program is free software; you can redistribute it and/or modify
18
17
*  it under the terms of the GNU General Public License as published by
19
18
*  the Free Software Foundation; either version 2, or (at your option)
25
24
 
26
25
#define ME "sg_sense_test: "
27
26
 
28
 
int main(int argc, char * argv[])
 
27
int main(/* int argc, char * argv[] */)
29
28
{
30
29
    unsigned char err1[] = {0x72, 0x5, 0x4, 0x1, 0, 0, 0, 32,
31
30
                            0x2, 0x6, 0, 0, 0xc8, 0x0, 0x3, 0,
33
32
                            0xaa, 0xbb, 0xcc, 0xdd,
34
33
                            1, 0xa, 0, 0, 1, 2, 3, 4,
35
34
                            0xaa, 0xbb, 0xcc, 0xdd};
36
 
    unsigned char err2[] = {0x72, MEDIUM_ERROR, 0x4, 0x1, 0, 0, 0, 32,
 
35
    unsigned char err2[] = {0x72, SPC_SK_MEDIUM_ERROR, 0x4, 0x1, 0, 0, 0, 32,
37
36
                            0x2, 0x6, 0, 0, 0xc8, 0x0, 0x3, 0,
38
37
                            0, 0xa, 0x80, 0, 1, 2, 3, 4,
39
38
                            0xaa, 0xbb, 0xcc, 0xdd,
40
39
                            1, 0xa, 0, 0, 1, 2, 3, 4,
41
40
                            0xaa, 0xbb, 0xcc, 0xdd};
42
 
    unsigned char err3[] = {0x72, NO_SENSE, 0x4, 0x1, 0, 0, 0, 8,
 
41
    unsigned char err3[] = {0x72, SPC_SK_NO_SENSE, 0x4, 0x1, 0, 0, 0, 8,
43
42
                            0x2, 0x6, 0, 0, 0xc8, 0x0, 0x3, 0};
44
 
    unsigned char err4[] = {0x73, COPY_ABORTED, 0x4, 0x1, 0, 0, 0, 22,
 
43
    unsigned char err4[] = {0x73, SPC_SK_COPY_ABORTED, 0x4, 0x1, 0, 0, 0, 22,
45
44
                            0x2, 0x6, 0, 0, 0xc8, 0x0, 0x3, 0,
46
45
                            0x3, 0x2, 0, 0x55,
47
46
                            0x5, 0x2, 0, 0x20,
48
47
                            0x85, 0x4, 0, 0x20, 0x33, 0x44};
49
 
    unsigned char err5[] = {0xf1, 0, (0xf0 | ILLEGAL_REQUEST), 0x11, 0x22,
 
48
    unsigned char err5[] = {0xf1, 0, (0xf0 | SPC_SK_ILLEGAL_REQUEST), 0x11, 0x22,
50
49
                            0x33, 0x44, 0xa,
51
50
                            0x0, 0x0, 0, 0, 0x4, 0x1, 0, 0xcf, 0, 5,};
 
51
    unsigned char err6[] = {0x72, SPC_SK_NO_SENSE, 0x4, 0x1, 0, 0, 0, 14,
 
52
                            0x9, 0xc, 1, 0, 0x11, 0x22, 0x66, 0x33,
 
53
                            0x77, 0x44, 0x88, 0x55, 0x1, 0x2};
 
54
    unsigned char err7[] = {0xf1, 0, 0xe5, 0x11, 0x22, 0x33, 0x44, 0xa,
 
55
                            0x0, 0x0, 0x0, 0x0, 0x24, 0x1, 0xbb,
 
56
                            0xc9, 0x0, 0x2};
52
57
 
53
 
    sg_print_sense("err1 test", err1, sizeof(err1));
54
 
    sg_print_sense("\nerr2 test", err2, sizeof(err2));
55
 
    sg_print_sense("\nerr3 test", err3, sizeof(err3));
56
 
    sg_print_sense("\nerr4 test", err4, sizeof(err4));
57
 
    sg_print_sense("\nerr5 test", err5, sizeof(err5));
 
58
    sg_print_sense("err1 test", err1, sizeof(err1), 1);
 
59
    sg_print_sense("\nerr2 test", err2, sizeof(err2), 1);
 
60
    sg_print_sense("\nerr3 test", err3, sizeof(err3), 1);
 
61
    sg_print_sense("\nerr4 test", err4, sizeof(err4), 1);
 
62
    sg_print_sense("\nerr5 test", err5, sizeof(err5), 1);
 
63
    sg_print_sense("\nerr6 test", err6, sizeof(err6), 1);
 
64
    sg_print_sense("\nerr7 test", err7, sizeof(err7), 1);
58
65
    return 0;
59
66
}