[comp.sys.hp] cartridge tape status

bob@vortex.uoregon.edu (bob riegelmann) (08/09/90)

Is their some kind sole who has figured a way to tell if a tape has been loaded
in a hp 9145 ct drive without unloading the tape, and would be willing to
share?  

I'm sure this can be done using the CS80 command set,  but tcio does not
provide for that,  and  I don't want to write any HP-IB code if I can 
avoid it :-)  

thanks. 

bob riegelmann


Bob Riegelmann  -- Physics Dept; Univ of Oregon; Eugene, Ore 
bob@vortex.uoregon.edu  bob@128.223.20.82
My mind is more complicated than I first imagined, I think it's more 
complicated than I can imagine. -- me

rjn@hpfcso.HP.COM (Bob Niland) (08/09/90)

re: > Is their some kind sole who has figured a way to tell if a tape has
    > been loaded in a hp 9145 ct drive without unloading the tape, and
    > would be willing to share?

diskinfo (1M) reports media status and capacity.

Regards,                                              Hewlett-Packard
Bob Niland      Internet: rjn@hpfcrjn.FC.HP.COM       3404 East Harmony Road
                UUCP: [hplabs|hpfcse]!hpfcrjn!rjn     Ft Collins CO 80525-9599

rer@hpfcdc.HP.COM (Rob Robason) (08/10/90)

You might try diskinfo(1M), I didn't have an opportunity to.

ted@hpwrce.HP.COM ( Ted Johnson) (08/10/90)

>Is their some kind sole who has figured a way to tell if a tape has been loaded
>in a hp 9145 ct drive without unloading the tape, and would be willing to
>share?  

One ugly way that works (on a s300 & hp-ux 7.0) is to do something
like the following (warning!  This code is from memory, and is untested,
unsupported, etc., etc.)

#include <stdio.h> 
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <string.h>

#define SIZE 8192  /*you have to read 8k bytes via the cs80 raw device
                     driver, else it'll fail.*/

main()
{
int fd, nbytes;
char buf[SIZE];

	fd = open("/dev/update.src",O_RDWR | O_NONBLOCK);
	nybtes = read(fd, buf, SIZE);
	if (nbytes == -1) {
		printf("read failed, so no tape in drive\n");
	else {
		printf("tape is in drive and loaded\n");
	}
	close(fd); 

	/*the following open() *rewinds* the tape  */
	fd = open("/dev/update.src",O_RDWR | O_NONBLOCK);

}

-Ted Johnson
 #include <std_disclaimer.h>  ;-)