How to get SCSI-Host nr from generic SCSI device?

How to get SCSI-Host nr from generic SCSI device?

Post by Thomas Niederreite » Thu, 10 Jul 1997 04:00:00



Hi,
can any SCSI-Expert out there help me?
All I want to do is finding to a specific generic device its host,id,lun
and channel.

I found the SCSI_IOCTL_GET_IDLUN very helpful, but this does not output
the host...at least not in a format I understand it.

Here is my simple test-programm:
-------------

#include <stdio.h>
#include <scsi/scsi.h>

struct  sg_id {
                long    l1; /* target | lun << 8 | channel << 16 | low_ino << 24
 */
                long    l2; /* Unique id */

Quote:} sg_id;

main() {
int fd;

        fd = open ("/dev/sg0",2);
        ioctl(fd, SCSI_IOCTL_GET_IDLUN, &sg_id);
        close(fd);

        printf("l1: 0x%lX l2: 0x%lX\n", sg_id.l1, sg_id.l2);

Quote:}

---------

When I run it I get:

l1: 0x7000000 l2: 0x0

Fine..this means my device /dev/sg0 is ID 0, Lun 0, Channel 0. Very good
so far...but what does the "low_ino" of 0x07 mean?
Is there a way to conclude from the 0x07 to Host 0?

I have run this programm for different devices on linux (all 2.0.x) with
more than one controllers:

-> For different controllers the low_ino changes, with seems to be fine, but
I still dont know which low_ino corresponds to which host!

Thanx for any answer,

Thomas

  ___ ___              
 /   |   \  ___________   | REAL   : Thomas Niederreiter: Munich, Germany  

\    Y    (  <_> )  | \/  | MUD/IRC: Hor/_Hor  
 \___|_  / \____/|__|     |
       \/ All I want is a warm bed and a kind word and unlimited power        
                      -- Ashleigh Brilliant

 
 
 

1. How to recognize SCSI CD-ROM as a "Generic SCSI" device?

I am attempting to use the "cdda2wav" program to read digital audio
data directly from my Plextor SCSI CD-ROM.  In order to do this, I
need to read from the CD-ROM as a "generic SCSI" device, i.e.
/dev/sg0 or /dev/sg1.  I also have a SCSI hard disk.  Both the hard
disk and CD-ROM are accessable after booting, the SCSI drive gets
automatically mounted, and the CD-ROM can be manually mounted.
However, I created the various /dev/sg devices (with 'mknod /dev/sg0 b 21 0',
'mknod /dev/sg1 b 21 1', etc.), but they are always "not accessable",
when cdda2wav tries to open them.  The SCSI controller card is a
Buslogic 946C.

Thanks in advance,

Carl

2. Can't see root hd on Dell Precision Workstation

3. SCSI-CDROM Media change not detected! (generic scsi!)

4. I can't find datafiles in filesystem

5. Problem with SCSI Acard and linux 2.2.x(Maybe generic SCSI bug)

6. How to connect IDE CD ROM

7. IDE Generic SCSI devices (emulated)

8. AIX LVM Question

9. Solaris 8 uscsi does not work with /dev/sg device (SCSI generic)

10. SCO OpenServer 5 Generic SCSI device Query.

11. generic SCSI for ATAPI devices

12. Generic SCSI devices

13. mounting a SCSI generic device