diff --git a/mtx-1.3.12/mtx.c b/mtx-1.3.12/mtx.c index 22b9dbe..9a28258 100644 --- a/mtx-1.3.12/mtx.c +++ b/mtx-1.3.12/mtx.c @@ -80,8 +80,7 @@ static int argc; static char **argv; char *device=NULL; /* the device name passed as argument */ -int absolute_addressing=1; /* if not 0 - use absolute adresses of storage and tranport elements as known to the robot */ - +int absolute_addressing=0; /* if not 0 - use absolute adresses of storage and tranport elements as known to the robot */ /* Unfortunately this must be true for SGI, because SGI does not use an int :-(. */ @@ -1064,6 +1063,15 @@ int parse_args(void) return 0; } +void set_scsi_timeout(int timeout) /* in seconds */ +{ + set_timeout(timeout); +} + +void get_scsi_timeout(void) +{ + return get_timeout( ); +} int main(int ArgCount, char *ArgVector[]) diff --git a/mtx-1.3.12/scsi_linux.c b/mtx-1.3.12/scsi_linux.c index cc14ebf..21c1948 100644 --- a/mtx-1.3.12/scsi_linux.c +++ b/mtx-1.3.12/scsi_linux.c @@ -57,10 +57,21 @@ $Revision: 193 $ static int pack_id; static int sg_timeout; +int sg_scsi_default_timeout = SG_SCSI_DEFAULT_TIMEOUT; + +void set_timeout(int timeout) +{ + sg_scsi_default_timeout = HZ*timeout; +} + +int get_timeout(void) +{ + return(sg_scsi_default_timeout/HZ); +} DEVICE_TYPE SCSI_OpenDevice(char *DeviceName) { - int timeout = SG_SCSI_DEFAULT_TIMEOUT; + int timeout = sg_scsi_default_timeout; #ifdef SG_IO int k; /* version */ #endif @@ -93,7 +104,7 @@ void SCSI_Set_Timeout(int secs) void SCSI_Default_Timeout(void) { - sg_timeout = SG_SCSI_DEFAULT_TIMEOUT; + sg_timeout = sg_scsi_default_timeout; } void SCSI_CloseDevice(char *DeviceName, DEVICE_TYPE DeviceFD) @@ -256,13 +267,13 @@ int SCSI_ExecuteCommand(DEVICE_TYPE DeviceFD, int write_length = sizeof(struct sg_header)+CDB_Length; int i; /* a random index... */ - int result; /* the result of the write... */ + int result; /* the result of the write... */ struct sg_header *Header; /* we actually point this into Command... */ struct sg_header *ResultHeader; /* we point this into ResultBuf... */ /* First, see if we need to set our SCSI timeout to something different */ - if (sg_timeout != SG_SCSI_DEFAULT_TIMEOUT) + if (sg_timeout != sg_scsi_default_timeout) { /* if not default, set it: */ #ifdef DEBUG_TIMEOUT @@ -448,9 +459,9 @@ int SCSI_ExecuteCommand(DEVICE_TYPE DeviceFD, } /* See if we need to reset our SCSI timeout */ - if (sg_timeout != SG_SCSI_DEFAULT_TIMEOUT) + if (sg_timeout != sg_scsi_default_timeout) { - sg_timeout = SG_SCSI_DEFAULT_TIMEOUT; /* reset it back to default */ + sg_timeout = sg_scsi_default_timeout; /* reset it back to default */ #ifdef DEBUG_TIMEOUT fprintf(stderr,"Setting timeout to %d\n", sg_timeout);