Question

I am writing a program which will print host, channel number, id number, lun of a SCSI device.

cat /proc/scsi/scsi 

giving the information about it. But i want print it through c program. I'm getting vendor id, device type, revision level... but not lun , bus no etc.

Is there any ioctl command to get lun, bus, id numbers?

Was it helpful?

Solution

Did you try the ioctls for SCSI generic :

http://sg.danny.cz/sg/p/sg_v3_ho.html#ioctl ?

SCSI_IOCTL_GET_IDLUN, SG_GET_SCSI_ID should do the trick.

I did not use any SCSI HW in the last years though, and I hope the documentation is still valid for current kernels. I don't see any reason to have changed the ioctls though.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top