Home > Mobile >  Mac systems send SCSI custom commands to USB devices
Mac systems send SCSI custom commands to USB devices

Time:11-16

, please, send SCSI commands to USB on the Mac, which structure is the use? SCSICmd_INQUIRY_StandardDataAll or SCSI_Sense_Data, how to realize send? Under Linux is a structure designed to handle this matter, the code is as follows:

Sg_io_hdr_t the p_io_hdr;
Memset (& amp; The p_io_hdr, 0 x00, sizeof (sg_io_hdr_t));

The p_io_hdr. Interface_id='S'.
The p_io_hdr. Flags=SG_FLAG_LUN_INHIBIT;

If (aDataIn==DATA_USB_TO_HOST)
The p_io_hdr. Dxfer_direction=SG_DXFER_FROM_DEV;
The else
The p_io_hdr. Dxfer_direction=SG_DXFER_TO_DEV;

The p_io_hdr. Cmd_len=aCBDLen;//points to the SCSI command CMDP bytes
The p_io_hdr. CMDP=aCBD (unsigned char *);//pointer to will execute the SCSI command
The p_io_hdr. Dxfer_len=aDataLen;//the length of the data transmission of user memory
The p_io_hdr. Dxferp=aData;//data transmitting length at least dxfer_len bytes of user memory pointer


Int ret=ioctl (aHandle, SG_IO, & amp; The p_io_hdr);
If (ret<0 | | the p_io_hdr driver_status!=0)
return -1;
How to use this code Mac system structure on the written?

CodePudding user response:

No bosses see

CodePudding user response:

Epsilon=(' &western ` *))) well, who estimates are too busy...

CodePudding user response:

  •  Tags:  
  • iOS
  • Related