Prototype: DWORD SendASPI32Command(LPSRB)
Declaration: LPSRB lpSRB;
The SendASPI32Command function with command code SC_GET_DEV_TYPE enables you to identify the devices available on the SCSI bus. A Win32 tape backup package, for example, can scan each target/LUN on each installed host adapter looking for a device type corresponding to sequential access devices. This eliminates the need for each Win32 application to duplicate the effort of scanning the SCSI bus for devices.
Parameter | Description |
---|---|
lpSRB | Points to the following SCSI request block |
typedef struct {
BYTE SRB_Cmd; // ASPI command code = SC_GET_DEV_TYPE
BYTE SRB_Status; // ASPI command status byte
BYTE SRB_HaId; // ASPI host adapter number
BYTE SRB_Flags; // Reserved
DWORD SRB_Hdr_Rsvd; // Reserved
BYTE SRB_Target; // Target's SCSI ID
BYTE SRB_Lun; // Target's LUN number
BYTE SRB_DeviceType; // Target's peripheral device type
BYTE SRB_Rsvd1; // Reserved for alignment
} SRB_GDEVBlock, *PSRB_GDEVBlock;
Table 4-4. Get Device Type Command
Member | Description |
---|---|
SRB_Cmd | [IN] This field must contain SC_GET_DEV_TYPE. |
SRB_Status | [OUT] On return, this field will be the same as the return status defined below. |
SRB_HaId | [IN] This field specifies which installed host adapter the request is intended for. Host adapter numbers are always assigned by the ASPI manager layer beginning with zero. |
SRB_Flags | [IN] Reserved = 0 |
SRB_Hdr_Rsvd | Reserved = 0 |
SRB_Target | [IN] SCSI ID of target device. |
SRB_Lun | [IN] Logical Unit Number (LUN) of device. |
SRB_DeviceType | [OUT] The ASPI manager fills this field with the peripheral device type. This is derived from the Peripheral Device Type returned by the SCSI Inquiry command. Refer to the SCSI specification to learn more about the SCSI Inquiry command. |
Table 4-5. Return Values from Get Device Type Command
Value | Meaning |
---|---|
SS_COMP | SCSI/ASPI request has completed without error. |
SS_INVALID_HA | Invalid host adapter number. |
SS_NO_DEVICE | SCSI device not installed. |
Example
This example gets the peripheral device type from host adapter #0, target ID #4, and LUN #0.
SRB_GDEVBlock MySRB;
DWORD ASPIStatus;
.
.
MySRB.SRB_Cmd = SC_GET_DEV_TYPE;
MySRB.SRB_HaId = 0;
MySRB.SRB_Flags = 0;
MySRB.SRB_Hdr_Rsvd = 0;
MySRB.SRB_Target = 4;
MySRB.SRB_Lun = 0;
ASPIStatus = SendASPI32Command ( (LPSRB) &MySRB );
.
/****************************************************************/
/* If MySRB.SRB_Status == SS_COMP, MySRB.SRB_DeviceType
/* will contain the peripheral device type.
/****************************************************************/
.
.