Add files via upload

This commit is contained in:
Alexander Moibenko
2019-11-08 10:19:25 -06:00
committed by GitHub
parent 9b1e508466
commit 2ce5e5dfb1
2 changed files with 37 additions and 1 deletions

View File

@@ -622,7 +622,22 @@ void Move(int src, int dest) {
}
}
void Test_UnitReady(void)
{
int result;
result = testUnitReady(MediumChangerFD);
if (result == 0)
{
printf("Ready:yes\n");
}
else
{
printf("Ready:no\n");
}
}
/* okay, now for the Load, Unload, etc. logic: */
static void Load(void)

View File

@@ -1870,7 +1870,7 @@ int ClearUnitAttention(DEVICE_TYPE fd, RequestSense_T *RequestSense)
&unit_attention_sense, sizeof(unit_attention_sense),
RequestSense) != 0)
{
fprintf(stderr, "RequestSense (0x03) failed\n");
fprintf(stderr, "RequestSense (0x03) failed\n");
return -1; /* could not do! */
}
@@ -1884,6 +1884,27 @@ int ClearUnitAttention(DEVICE_TYPE fd, RequestSense_T *RequestSense)
}
/* Test unit ready: This will tell us whether the tape drive
* is currently ready to read or write.
*/
int testUnitReady(DEVICE_TYPE fd)
{
RequestSense_T sense;
CDB_T CDB;
unsigned char buffer[6];
CDB[0] = 0x00; /* TEST_UNIT_READY */
CDB[1] = 0;
CDB[2] = 0;
CDB[3] = 0; /* 1-5 all unused. */
CDB[4] = 0;
CDB[5] = 0;
slow_bzero((char *)&sense,sizeof(RequestSense_T));
return SCSI_ExecuteCommand(fd,Input,&CDB,6,buffer,0,&sense);
}
static char Spaces[] = " ";
void PrintHex(int Indent, unsigned char *Buffer, int Length)