Polling is another method of determining SCSI request completion. This method is not recommended. After the command is sent and ASPI for Win32 returns control back to the calling application, you can then poll the status byte waiting for the command to complete. For example, the following code segment will execute a SCSI Inquiry command to target #2 using polling.
SRB_ExecSCSICmd6 MySRB; DWORD ASPIStatus; char InquiryBuffer[32]; . . /**************************************************/ /* Code is entered with 'MySRB' zeroed. /**************************************************/ MySRB.SRB_Cmd = SC_EXEC_SCSI_CMD; MySRB.SRB_Flags = SRB_DIR_SCSI; MySRB.SRB_Target = 2; MySRB.SRB_BufLen = 32; MySRB.SRB_SenseLen = SENSE_LEN; MySRB.SRB_BufPointer = InquiryBuffer; MySRB.SRB_CDBLen = 6; MySRB.CDBByte[0] = SCSI_INQUIRY; MySRB.CDBByte[4] = 32; . . ASPIStatus = SendASPI32Command ( (LPSRB) &MySRB ); // Send Inquiry command while ( MySRB.SRB_Status == SS_PENDING ); // Wait till it's finished