[mythtv] scsi, firewire drive and usb drive
Xavier Hervy
maxpower44 at tiscali.fr
Fri Jul 16 12:53:24 EDT 2004
>
> Yes, my drive is plugged in before booting.
>
> I *think* that the FireWire drive gets /dev/sda even if I plug it in
> after booting. I will try to remember to test that when I get home.
>
Joseph,
Have you time to try it ?
I would like you do an other test for me. can you build and run
scsionsd.c and scsionsg.c and send me the result ?
Thanks in advance.
Xavier
-------------- next part --------------
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <linux/ioctl.h>
#include <scsi/scsi_ioctl.h>
#include <scsi/sg.h>
#include <scsi/scsi.h>
typedef struct scsi_lun{
int four;
int host;
}my_lun;
int fd;
char device [50];
char * devicebase = "/dev/sd%c";
main(){
int i;
for (i = 0; i <26; i++)
{
sprintf(device,devicebase,(char)(97+i));
printf("try on %s\n",device);
fd = open(device,O_RDWR);
if(fd != -1)
{
int ret;
ret = ioctl(fd, SCSI_IOCTL_TEST_UNIT_READY);
if (ret==0)
{
printf("Unit ready\n");
if (ret != 0)
printf("Error in bulk transfer\n");
else
{
my_lun lun;
ret = ioctl(fd, SCSI_IOCTL_GET_IDLUN,&lun);
if (ret==0){
printf ("lun %d %d\n",lun.four,lun.host);
}
Sg_scsi_id id;
ret = ioctl(fd, SG_GET_SCSI_ID,&id);
if (ret==0)
{
printf("host_no %d\nchannel %d\nscsi_is %s \nlun %d \nid scsitype %d \n ", id.host_no,id.channel,id.scsi_id,id.lun,id.scsi_type);
if (id.scsi_type == TYPE_DISK)
printf("DISK\n");
else
printf("autre\n");
}else{
printf("SG_GET_SCSI_ID Failed\n");
}
}
}
else
{
printf("unit busy ?\n");
}
close(fd);
}
else
{
printf("Can't open device\n");
}
}
}
-------------- next part --------------
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <linux/ioctl.h>
#include <scsi/scsi_ioctl.h>
#include <scsi/sg.h>
#include <scsi/scsi.h>
typedef struct scsi_lun{
int four;
int host;
}my_lun;
int fd;
char device [50];
char * devicebase = "/dev/sg%d";
main(){
int i;
for (i = 0; i <10; i++)
{
sprintf(device,devicebase,i);
printf("try on %s\n",device);
fd = open(device,O_RDWR);
if(fd != -1)
{
int ret;
ret = ioctl(fd, SCSI_IOCTL_TEST_UNIT_READY);
if (ret==0)
{
printf("Unit ready\n");
if (ret != 0)
printf("Error in bulk transfer\n");
else
{
my_lun lun;
ret = ioctl(fd, SCSI_IOCTL_GET_IDLUN,&lun);
if (ret==0){
printf ("lun %d %d\n",lun.four,lun.host);
}
Sg_scsi_id id;
ret = ioctl(fd, SG_GET_SCSI_ID,&id);
if (ret==0)
{
printf("host_no %d\nchannel %d\nscsi_is %s \nlun %d \nid scsitype %d \n ", id.host_no,id.channel,id.scsi_id,id.lun,id.scsi_type);
if (id.scsi_type == TYPE_DISK)
printf("DISK\n");
else
printf("autre\n");
}else{
printf("SG_GET_SCSI_ID Failed\n");
}
}
}
else
{
printf("unit busy ?\n");
}
close(fd);
}
else
{
printf("Can't open device\n");
}
}
}
More information about the mythtv-dev
mailing list