Implemented debugging messages for ATA enumeration
This commit is contained in:
parent
f77dd3134b
commit
ceb5159770
@ -133,10 +133,9 @@ static int linux_sg_accept_any_type = 0;
|
|||||||
*/
|
*/
|
||||||
static char linux_ata_device_family[80] = {"/dev/hd%c"};
|
static char linux_ata_device_family[80] = {"/dev/hd%c"};
|
||||||
|
|
||||||
/* >>> Not implemented yet:
|
/* Set this to 1 in order to get on stderr messages from ata_enumerate()
|
||||||
Set this to 1 in order to get on stderr messages from ata_enumerate()i
|
|
||||||
static int linux_ata_enumerate_verbous = 0;
|
|
||||||
*/
|
*/
|
||||||
|
static int linux_ata_enumerate_verbous = 0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -413,23 +412,39 @@ static void ata_enumerate(void)
|
|||||||
int i, fd;
|
int i, fd;
|
||||||
char fname[10];
|
char fname[10];
|
||||||
|
|
||||||
|
if (linux_ata_enumerate_verbous)
|
||||||
|
fprintf(stderr, "libburn_debug: linux_ata_device_family = %s\n",
|
||||||
|
linux_ata_device_family);
|
||||||
|
|
||||||
if (linux_ata_device_family[0] == 0)
|
if (linux_ata_device_family[0] == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (i = 0; i < 26; i++) {
|
for (i = 0; i < 26; i++) {
|
||||||
sprintf(fname, linux_ata_device_family, 'a' + i);
|
sprintf(fname, linux_ata_device_family, 'a' + i);
|
||||||
|
if (linux_ata_enumerate_verbous)
|
||||||
|
fprintf(stderr, "libburn_debug: %s : ", fname);
|
||||||
|
|
||||||
/* ts A51221 */
|
/* ts A51221 */
|
||||||
if (burn_drive_is_banned(fname))
|
if (burn_drive_is_banned(fname)) {
|
||||||
|
if (linux_ata_enumerate_verbous)
|
||||||
|
fprintf(stderr, "not in whitelist\n");
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
fd = sg_open_drive_fd(fname, 1);
|
fd = sg_open_drive_fd(fname, 1);
|
||||||
if (fd == -1)
|
if (fd == -1) {
|
||||||
|
if (linux_ata_enumerate_verbous)
|
||||||
|
fprintf(stderr,"open failed, errno=%d '%s'\n",
|
||||||
|
errno, strerror(errno));
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
/* found a drive */
|
/* found a drive */
|
||||||
ioctl(fd, HDIO_GET_IDENTITY, &tm);
|
ioctl(fd, HDIO_GET_IDENTITY, &tm);
|
||||||
|
|
||||||
/* not atapi */
|
/* not atapi */
|
||||||
if (!(tm.config & 0x8000) || (tm.config & 0x4000)) {
|
if (!(tm.config & 0x8000) || (tm.config & 0x4000)) {
|
||||||
|
if (linux_ata_enumerate_verbous)
|
||||||
|
fprintf(stderr, "not marked as ATAPI\n");
|
||||||
sg_close_drive_fd(fname, -1, &fd, 0);
|
sg_close_drive_fd(fname, -1, &fd, 0);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -437,11 +452,22 @@ static void ata_enumerate(void)
|
|||||||
/* if SG_IO fails on an atapi device, we should stop trying to
|
/* if SG_IO fails on an atapi device, we should stop trying to
|
||||||
use hd* devices */
|
use hd* devices */
|
||||||
if (sgio_test(fd) == -1) {
|
if (sgio_test(fd) == -1) {
|
||||||
|
if (linux_ata_enumerate_verbous)
|
||||||
|
fprintf(stderr,
|
||||||
|
"FATAL: sgio_test() failed: errno=%d '%s'\n",
|
||||||
|
errno, strerror(errno));
|
||||||
sg_close_drive_fd(fname, -1, &fd, 0);
|
sg_close_drive_fd(fname, -1, &fd, 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (sg_close_drive_fd(fname, -1, &fd, 1) <= 0)
|
if (sg_close_drive_fd(fname, -1, &fd, 1) <= 0) {
|
||||||
|
if (linux_ata_enumerate_verbous)
|
||||||
|
fprintf(stderr,
|
||||||
|
"cannot close properly, errno=%d '%s'\n",
|
||||||
|
errno, strerror(errno));
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
if (linux_ata_enumerate_verbous)
|
||||||
|
fprintf(stderr, "accepting as drive without SCSI address\n");
|
||||||
enumerate_common(fname, -1, -1, -1, -1, -1);
|
enumerate_common(fname, -1, -1, -1, -1, -1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user