yes the device does show mounted. I can send files to/from the device i.e. read/write to device with standard copy/paste/cut opreations on JDE on solaris 10 but if i compile the code on gcc and run it on terminal for scsi communication using ioctl with the device the open command works but the ioctl command returns negative value.
Also the rmformat command shows the device detected and displays all the parameters
---------- Post updated at 11:40 PM ---------- Previous update was at 11:18 PM ----------
Volmgt Node: /vol/dev/aliases/rmdisk0
Logical Node: /dev/rdsk/c2t0d0p0
Physical Node: /pci@0,0/pci1028,211@1a,7/storage@3/disk@0,0
Connected Device: NS 1.00
Device Type: Removable
this information is displayed when rmformat command is executed
---------- Post updated 02-25-15 at 02:59 AM ---------- Previous update was 02-24-15 at 11:40 PM ----------
Below is my code
________________________________________________________
int fd, res, i;
const int t_length = 512; // 512 bytes transferred
const unsigned char blocks = 1; // Blocks transferred
unsigned char rdCmdBlk[SCSI_CDB_LEN] = { 0x28, // Command
0, 0, 0, 0, 0, 0, 0, 0, 0 };
unsigned char sense_b[SENSE_BUFF_LEN];
sg_io_hdr_t io_hdr;
// Open device
fd = open(deviceName , O_RDWR|O_SYNC);
printf("fd in write is : %d\n" , fd);
// Prepare SCSI READ (10) command
rdCmdBlk[2] = 0x00; // LBA
rdCmdBlk[3] = 0x00; // LBA
rdCmdBlk[4] = 0x00; // LBA
rdCmdBlk[5] = 0x66; // LBA
rdCmdBlk[8] = blocks; // transfer length
// Prepare the sg_io_hdr_t structure
memset(&io_hdr, 0, sizeof(sg_io_hdr_t));
io_hdr.interface_id = 'S';
io_hdr.cmd_len = sizeof(rdCmdBlk);
io_hdr.mx_sb_len = sizeof(sense_b);
io_hdr.dxfer_direction = SG_DXFER_FROM_DEV;
io_hdr.dxfer_len = t_length;
io_hdr.dxferp = dataTxChallenge;
io_hdr.cmdp = rdCmdBlk;
io_hdr.sbp = sense_b;
io_hdr.timeout = 5000;
// Sends the command to device
if ((res = ioctl(fd, SG_IO, &io_hdr)) < 0)
{
close(fd);
}
printf("IOCTL RESULT : %d",res);
printf("ERROR NO : %d",errno);
_______________________________________________________
The return value of ioctl is -1 and errno is 25 which is
#define ENOTTY 25 /* Inappropriate ioctl for device */