--- /dev/null
+# mtx completion by Jon Middleton <jjm@ixtab.org.uk>
+#
+# $Id: bash_completion,v 1.1 2004/02/15 05:43:25 bdale Exp $
+
+_mtx()
+{
+ local cur prev options tapes drives
+
+ COMPREPLY=()
+ cur=${COMP_WORDS[COMP_CWORD]}
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ options="-f nobarcode invert noattach --version inquiry noattach \
+ inventory status load unload eepos first last next"
+
+ tapes=$(mtx status | \
+ awk '/Storage Element [0-9]+:Full/ { printf "%s ", $3 }')
+ tapes=${tapes//:Full}
+
+ drives=$(mtx status | \
+ awk '/Data Transfer Element [0-9]+:(Full|Empty)/ { printf "%s ", $4 }')
+ drives=${drives//:Full}
+ drives=${drives//:Empty}
+
+ if [ $COMP_CWORD -gt 1 ]; then
+ case $prev in
+ load)
+ COMPREPLY=( $( compgen -W "$tapes" -- $cur ) )
+ ;;
+ unload|first|last|next)
+ COMPREPLY=( $( compgen -W "$drives" -- $cur ) )
+ ;;
+ -f)
+ true
+ ;;
+ *)
+ true
+ ;;
+ esac
+ else
+ COMPREPLY=( $( compgen -W "$options" -- $cur ) )
+ fi
+ return 0
+}
+complete -F _mtx mtx
+mtx (1.2.16rel-4) unstable; urgency=medium
+
+ * revert SG_SCSI_DEFAULT_TIMEOUT to 5 minutes since at least the Sony
+ TLS-9000 takes more than a minute to load sometimes, closes: #229169
+ * remove 'previous' from command summary, since it's not actually
+ implemented in the program, closes: #230041
+ * include bash_completion file from Jon Middleton, closes: #227456
+
+ -- Bdale Garbee <bdale@gag.com> Sat, 14 Feb 2004 22:36:23 -0700
+
mtx (1.2.16rel-3) unstable; urgency=low
* apply patch from Torsten Werner <twerner@debian.org> that elminates
+etc/bash_completion.d
usr/sbin
make install bindir=`pwd`/debian/mtx/bin prefix=`pwd`/debian/mtx/usr \
mandir=`pwd`/debian/mtx/usr/share/man
+ install -o root -g root -m 0644 debian/bash_completion \
+ debian/mtx/etc/bash_completion.d/mtx
# Build architecture-independent files here.
binary-indep: build install
mtx [ -f <loader-dev> ] first [<drive#>]\n\
mtx [ -f <loader-dev> ] last [<drive#>]\n\
mtx [ -f <loader-dev> ] next [<drive#>]\n\
- mtx [ -f <loader-dev> ] previous [<drive#>]\n\
mtx [ -f <loader-dev> ] [invert] load <storage-element-number> [<drive#>]\n\
mtx [ -f <loader-dev> ] [invert] unload [<storage-element-number>][<drive#>]\n\
mtx [ -f <loader-dev> ] [eepos eepos-number] transfer <storage-element-number> <storage-element-number>\n\
#define STILL_A_VALID_READ(s) (HIT_FILEMARK(s) || SHORT_READ(s) || HIT_EOD(s) || HIT_EOP(s) || HIT_EOM(s))
-#define SG_SCSI_DEFAULT_TIMEOUT SG_DEFAULT_TIMEOUT
+#define SG_SCSI_DEFAULT_TIMEOUT HZ*60*5 /* 5 minutes */
DEVICE_TYPE SCSI_OpenDevice(char *DeviceName)
{
- int timeout=SG_SCSI_DEFAULT_TIMEOUT; /* 5 minutes */
+ int timeout=SG_SCSI_DEFAULT_TIMEOUT;
int DeviceFD = open(DeviceName, O_RDWR);
if (DeviceFD < 0)
FatalError("cannot open SCSI device '%s' - %m\n", DeviceName);