LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Hardware (http://www.linuxquestions.org/questions/linux-hardware-18/)
-   -   SCSI device drivers for tape drives (http://www.linuxquestions.org/questions/linux-hardware-18/scsi-device-drivers-for-tape-drives-337658/)

tornatom 06-27-2005 11:53 AM

SCSI device drivers for tape drives
 
I am trying to gain acces to a SCSI tape drive on a Redhat v3 linux computer. My goal is to gain access to the drive through the scsi generic(sg) driver. I have gained acces with the scsi tape(st) driver. I am suppose to write C++ code that accesses the driver though the scsi pass through interface.

The tape drive gets attached to /dev/st0 and when i run my program that uses the sg driver, when i open() the device it opens the st0 but it doesnt allow me to use any of the sg functions. How do i make the tape drive become attached to /dev/sg0 or any of those device files so that i can use the sg driver?

is it even possible to use the sg driver on linux to controll the tape drive?

is there a function with the st driver that allows my to write to the tape in C++?

thanks

michaelk 06-27-2005 03:37 PM

You can access the tape drive using the regular data file open/read/write/close functions.

Noth 06-27-2005 06:45 PM

Generally when you load the sg driver it tells you what is attached to what, you can see that output via dmesg. As for determining which sg device is attached to it at runtime, I couldn't tell you. You'll probably have to go through each one and feed it some inquiry command and see what type of device it is.

Code:

Attached scsi generic sg0 at scsi0, channel 0, id 0, lun 0,  type 0
Attached scsi generic sg1 at scsi0, channel 0, id 1, lun 0,  type 0
Attached scsi generic sg2 at scsi0, channel 0, id 2, lun 0,  type 0
Attached scsi generic sg3 at scsi0, channel 0, id 3, lun 0,  type 0



All times are GMT -5. The time now is 02:55 PM.