All of lore.kernel.org
 help / color / mirror / Atom feed
From: Julian Bangert <jbangert@acm.org>
To: linux-scsi@vger.kernel.org
Subject: SG_IO
Date: Fri, 02 Apr 2010 19:16:20 +0200	[thread overview]
Message-ID: <1270228580.12985.45.camel@fermat> (raw)

Hello, 
I want to write a tape utility using the SG_IO interface (because I
don't have the expensive IBM one ;) ) but I have got a problem with the
SCSI interface. 
My program looks as follows:

    ioctl(g_fd,SG_IO,&io_hdr);
    memset(&io_hdr, 0, sizeof(struct sg_io_hdr));
        struct read_attr_cmd cmd;
        cmd.opcode = 0x8C;
        cmd.s_action = 0;
        cmd.pad1 = cmd.pad2 = cmd.pad3 = cmd.pad4 = 0;
        cmd.volid = cmd.partition = 0;
        cmd.attrib_id = htons(attribs[idx].id);
        cmd.size = htonl(buffer_size);
        cmd.control = 0;
        
        assert(sizeof(struct read_attr_cmd) == 16);
    
        io_hdr.interface_id='S';
        io_hdr.cmd_len = 16;//sizeof cmd;
        io_hdr.mx_sb_len= sizeof(sense_b);
        io_hdr.dxfer_direction = SG_DXFER_FROM_DEV;
        io_hdr.dxferp = buffer;
        io_hdr.dxfer_len = buffer_size;
        io_hdr.cmdp = (unsigned char *) &cmd;
        io_hdr.sbp = sense_b;
        io_hdr.timeout = 10000;
        
        if(ioctl(g_fd,SG_IO,&io_hdr) == -1)

The IOCTL succeeds, but io_hdr.host_status contains SG_ERR_DID_ABORT.
All other fields are not touched. I am using an Adaptec 29160N(AIC7892)
with the adaptec aix7xxx driver  on Linux  2.6.31 (ubuntu). As far as I
know this driver supports 16 Byte commands.

Thank you very much for your assistance,

-- Julian Bangert


                 reply	other threads:[~2010-04-02 17:39 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1270228580.12985.45.camel@fermat \
    --to=jbangert@acm.org \
    --cc=linux-scsi@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.