首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >SCSI查询数据

SCSI查询数据
EN

Stack Overflow用户
提问于 2013-08-22 18:41:57
回答 1查看 2.6K关注 0票数 0

我是SCSI编程的新手,因此很抱歉问了一个基本的问题。我通过6字节CDB向磁带设备发送SCSI查询命令

ccb = (Exec_IO_CCB *)( buffer + header_size );

ccb->ccb_length = sizeof(Exec_IO_CCB);

ccb->cam_opcode = 0x1;

ccb->connect_id = 0;

ccb->sense_buf_ptr = (long)(header_size + ccb->ccb_length);

ccb->sense_buf_length = MAX_SENSE_LEN;

ccb->time_out = CAM_TIMEOUT;

ccb->cdb_length = 6;

查询集cam_flags和cdb的/* */

ccb->cam_flags = NO_DATA;

ccb->cdb =查询;查询命令/* 0x12 SCSI操作码*/

ccb->cdb1 = 0;

ccb->cdb2 = 0;

ccb->cdb3 = 0;

ccb->cdb4 = 3200;

ccb->cdb5 = 0;

SCSI命令成功。如何捕获查询命令的输出,以便获取Vendor ID / Product ID?

我声明了执行I/O SCSI缓冲区,如下所示

类型定义结构{

代码语言:javascript
复制
long        ccb_address;            /* Address of this CCB               */
short       ccb_length;             /* CAM Control Block Length          */
char        cam_opcode;             /* CAM Operation Code                */
char        status;                 /* CAM Status                        */
long        connect_id;             /* Connect ID - no fields supported  */
long        cam_flags;              /* CAM Flags                         */
long        pd_pointer;             /* Peripheral driver pointer         */
long        next_ccb_ptr;           /* Next CCB Pointer                  */
long        req_map_info;           /* Request mapping information       */
long        call_on_comp;           /* Callback on completion            */
long        data_buf_ptr;           /* Data Buffer Pointer               */
long        data_xfer_length;       /* Data transfer length              */
long        sense_buf_ptr;          /* Sense information buffer pointer  */
char        sense_buf_length;       /* Sense information buffer length   */
char        cdb_length;             /* Command Descriptor Block (CDB)    **
                                    **  length                           */
short       num_sg_entries;         /* Number of scatter/gather entries  */
long        vendor_unique;          /* Vendor Unique field               */
char        scsi_status;            /* SCSI status                       */
char        auto_resid;             /* Auto sense residual length        */
short       reserved;               /* Reserved                          */
long        resid_length;           /* Residual length                   */
char        cdb[12];                /* Command Descriptor Block (CDB)    */
long        time_out;               /* Time-out value                    */
long        msg_buf_ptr;            /* Message buffer pointer            */
short       msg_buf_length;         /* Message buffer length             */
short       vu_flags;               /* Vendor-unique flags               */
char        tag_queue_act;          /* Tagged Queue action               */
char        tag_id;                 /* Tag ID (target only)              */
char        init_id;                /* Initiator ID (target only)        */
char        reserved2;              /* Reserved                          */

} Exec_IO_CCB;

此结构永远不会捕获SCSI输出?

我声明了如下的查询结构。但我不确定查询命令将如何填充Inquiry_Data结构数据??

类型定义结构{

代码语言:javascript
复制
short data_valid;           /* Flag that indicates whether or not the */
                            /*   structure has been filled in with    */
                            /*   inquiry data from the device.        */
byte  periph_qual;
byte  periph_dev_type;
byte  rmb;
byte  iso_version;
byte  ecma_version;
byte  ansi_version;
byte  resp_data_format;
byte  rel_adr;
byte  sync;
byte  linked;
byte  cmd_que;
byte  sft_rst;
char  vendor_id[9];
char  prod_id[17];
char  prod_rev[5];
char  reserved;

} Inquiry_Data;

EN

回答 1

Stack Overflow用户

发布于 2013-08-26 22:24:53

你给cdb4赋值的第一件事是,cdb4是一个字节。赋值可能会在那里放一个0,因为编译器会截断。由于字节3和4是您告诉目标不要发送任何内容的分配长度。也许您需要将32赋给cdb4;但是由于您的Inquiry_Data结构是44字节,您可能希望将44赋给cdb4。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/18378224

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档