All of lore.kernel.org
 help / color / mirror / Atom feed
* SG_IO
@ 2010-04-02 17:16 Julian Bangert
  0 siblings, 0 replies; only message in thread
From: Julian Bangert @ 2010-04-02 17:16 UTC (permalink / raw)
  To: linux-scsi

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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2010-04-02 17:39 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-04-02 17:16 SG_IO Julian Bangert

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.