| 52 |
#define CDRECORD_WRITE_DVD "Does write DVD-R media" |
#define CDRECORD_WRITE_DVD "Does write DVD-R media" |
| 53 |
#define CDRECORD_NOT_WRITE_DVD "Does not write DVD-R media" |
#define CDRECORD_NOT_WRITE_DVD "Does not write DVD-R media" |
| 54 |
#define CDRECORD_NOT_WRITE_DUMMY "Does not support test writing" |
#define CDRECORD_NOT_WRITE_DUMMY "Does not support test writing" |
|
#define CDRECORD_WRITE_DUMMY "Does support test writing" |
|
| 55 |
#define CDRECORD_MAX_CDREAD_SPEED "Maximum read speed:" |
#define CDRECORD_MAX_CDREAD_SPEED "Maximum read speed:" |
| 56 |
#define CDRECORD_MAX_CDREAD_SPEED_CD "(CD" |
#define CDRECORD_MAX_CDREAD_SPEED_CD "(CD" |
| 57 |
#define CDRECORD_MAX_CDREAD_SPEED_DVD " DVD " |
#define CDRECORD_MAX_CDREAD_SPEED_DVD " DVD " |
| 80 |
{ "dev=/dev/hdj", "/dev/hdj", "IDE", 100 }, |
{ "dev=/dev/hdj", "/dev/hdj", "IDE", 100 }, |
| 81 |
#endif |
#endif |
| 82 |
#if LINUX_SCSI /* SCSI alias with linux */ |
#if LINUX_SCSI /* SCSI alias with linux */ |
| 83 |
{ "dev=/dev/scd0", "/dev/scd0", "SCSID", 90 }, |
{ "dev=/dev/scd0", "/dev/scd0", "SCSI-D", 90 }, |
| 84 |
{ "dev=/dev/scd1", "/dev/scd1", "SCSID", 90 }, |
{ "dev=/dev/scd1", "/dev/scd1", "SCSI-D", 90 }, |
| 85 |
{ "dev=/dev/scd2", "/dev/scd2", "SCSID", 90 }, |
{ "dev=/dev/scd2", "/dev/scd2", "SCSI-D", 90 }, |
| 86 |
{ "dev=/dev/scd3", "/dev/scd3", "SCSID", 90 }, |
{ "dev=/dev/scd3", "/dev/scd3", "SCSI-D", 90 }, |
| 87 |
{ "dev=/dev/scd4", "/dev/scd4", "SCSID", 90 }, |
{ "dev=/dev/scd4", "/dev/scd4", "SCSI-D", 90 }, |
| 88 |
{ "dev=/dev/scd5", "/dev/scd5", "SCSID", 90 }, |
{ "dev=/dev/scd5", "/dev/scd5", "SCSI-D", 90 }, |
| 89 |
{ "dev=/dev/scd6", "/dev/scd6", "SCSID", 90 }, |
{ "dev=/dev/scd6", "/dev/scd6", "SCSI-D", 90 }, |
| 90 |
{ "dev=/dev/sr0", "/dev/sr0", "SCSIS", 92 }, |
{ "dev=/dev/sr0", "/dev/sr0", "SCSI-S", 92 }, |
| 91 |
{ "dev=/dev/sr1", "/dev/sr1", "SCSIS", 92 }, |
{ "dev=/dev/sr1", "/dev/sr1", "SCSI-S", 92 }, |
| 92 |
{ "dev=/dev/sr2", "/dev/sr2", "SCSIS", 92 }, |
{ "dev=/dev/sr2", "/dev/sr2", "SCSI-S", 92 }, |
| 93 |
{ "dev=/dev/sr3", "/dev/sr3", "SCSIS", 92 }, |
{ "dev=/dev/sr3", "/dev/sr3", "SCSI-S", 92 }, |
| 94 |
{ "dev=/dev/sr4", "/dev/sr4", "SCSIS", 92 }, |
{ "dev=/dev/sr4", "/dev/sr4", "SCSI-S", 92 }, |
| 95 |
{ "dev=/dev/sr5", "/dev/sr5", "SCSIS", 92 }, |
{ "dev=/dev/sr5", "/dev/sr5", "SCSI-S", 92 }, |
| 96 |
{ "dev=/dev/sr6", "/dev/sr6", "SCSIS", 92 }, |
{ "dev=/dev/sr6", "/dev/sr6", "SCSI-S", 92 }, |
| 97 |
{ "dev=/dev/sg0", "/dev/sg0", "SCSIG", 94 }, |
{ "dev=/dev/sg0", "/dev/sg0", "SCSI-G", 94 }, |
| 98 |
{ "dev=/dev/sg1", "/dev/sg1", "SCSIG", 94 }, |
{ "dev=/dev/sg1", "/dev/sg1", "SCSI-G", 94 }, |
| 99 |
{ "dev=/dev/sg2", "/dev/sg2", "SCSIG", 94 }, |
{ "dev=/dev/sg2", "/dev/sg2", "SCSI-G", 94 }, |
| 100 |
{ "dev=/dev/sg3", "/dev/sg3", "SCSIG", 94 }, |
{ "dev=/dev/sg3", "/dev/sg3", "SCSI-G", 94 }, |
| 101 |
{ "dev=/dev/sg4", "/dev/sg4", "SCSIG", 94 }, |
{ "dev=/dev/sg4", "/dev/sg4", "SCSI-G", 94 }, |
| 102 |
{ "dev=/dev/sg5", "/dev/sg5", "SCSIG", 94 }, |
{ "dev=/dev/sg5", "/dev/sg5", "SCSI-G", 94 }, |
| 103 |
{ "dev=/dev/sg6", "/dev/sg6", "SCSIG", 94 }, |
{ "dev=/dev/sg6", "/dev/sg6", "SCSI-G", 94 }, |
| 104 |
|
|
| 105 |
#endif |
#endif |
| 106 |
{ "dev=ATA:", "ATA:", "ATA", 60 }, /* ide sg */ |
{ "dev=ATA:", "ATA:", "ATA", 60 }, /* ide sg */ |
| 131 |
} |
} |
| 132 |
|
|
| 133 |
/* recherche des lecteurs */ |
/* recherche des lecteurs */ |
| 134 |
gboolean extractlecteur(gchar *Achaine, gchar **Adev, gchar **Amarque, gchar **Amodel, |
gboolean cdrecord_extractlecteur(gchar *Achaine, gchar **Adev, gchar **Amarque, gchar **Amodel, |
| 135 |
gchar **Aquoi) |
gchar **Aquoi) |
| 136 |
{ |
{ |
| 137 |
gchar *s = Achaine; |
gchar *s = Achaine; |
| 184 |
|
|
| 185 |
g_strstrip(Lbuffer); |
g_strstrip(Lbuffer); |
| 186 |
_DEB("scan lecteur = %s\n", Lbuffer); |
_DEB("scan lecteur = %s\n", Lbuffer); |
| 187 |
if (extractlecteur(Lbuffer, &Ldev, &Lmarque, &Lmodel, &Lquoi) == TRUE) { |
if (cdrecord_extractlecteur(Lbuffer, &Ldev, &Lmarque, &Lmodel, &Lquoi) == TRUE) { |
| 188 |
|
|
| 189 |
insert_or_update_drive(Ldev, Lmarque, Lmodel, Lquoi, Ldrivedesc); |
matos_insert_or_update_drive(Ldev, Lmarque, Lmodel, Lquoi, Ldrivedesc); |
| 190 |
|
|
| 191 |
_DEB("oui un lecteur"); |
_DEB("oui un lecteur"); |
| 192 |
|
|
| 214 |
Tsearchdrive *Lcurentry; |
Tsearchdrive *Lcurentry; |
| 215 |
gint *Lcont = (gint *)sc_grave_get_data(Ag, "cont"); |
gint *Lcont = (gint *)sc_grave_get_data(Ag, "cont"); |
| 216 |
gboolean *Labort = (gboolean *)sc_grave_get_data(Ag, "gabort"); |
gboolean *Labort = (gboolean *)sc_grave_get_data(Ag, "gabort"); |
| 217 |
|
|
| 218 |
free_drives(FALSE); |
free_drives(FALSE); |
| 219 |
for (Lcurentry = listesearchdrives; Lcurentry->detectline && *Labort == FALSE; Lcurentry++) { |
for (Lcurentry = listesearchdrives; Lcurentry->detectline && *Labort == FALSE; Lcurentry++) { |
| 220 |
Lcommandline = g_strdup_printf("%s -scanbus %s", conf_get_string("cdrecord"), Lcurentry->detectline); |
Lcommandline = g_strdup_printf("%s -scanbus %s", conf_get_string("cdrecord"), Lcurentry->detectline); |
| 264 |
gchar *scd = NULL, *sdvd = NULL, *f; |
gchar *scd = NULL, *sdvd = NULL, *f; |
| 265 |
gint Lexit = 0; |
gint Lexit = 0; |
| 266 |
gboolean Lstatus; |
gboolean Lstatus; |
|
gint Ltype = 0; |
|
| 267 |
|
|
| 268 |
Lcommandline = g_strdup_printf("%s -prcap dev=%s", conf_get_string("cdrecord"), Adev); |
{ |
| 269 |
|
GSList *ab; |
| 270 |
|
gchar *abla; |
| 271 |
|
for (ab = Adrive->dev; ab; ab = g_slist_next(ab)) { |
| 272 |
|
abla = ab->data; |
| 273 |
|
fprintf(stderr, "==>%s\n", abla); |
| 274 |
|
} |
| 275 |
|
} |
| 276 |
|
|
| 277 |
|
Lcommandline = g_strdup_printf("%s -prcap dev=%s", conf_get_string("cdrecord"), |
| 278 |
|
Adev ? Adev : DRIVE_DEV(Adrive)); |
| 279 |
|
|
| 280 |
_DEB("==================%s\n", Lcommandline); |
_DEB("==================%s\n", Lcommandline); |
| 281 |
Lstatus = g_spawn_command_line_sync(Lcommandline, &Lout, &Lerr, &Lexit, Aerror); |
Lstatus = g_spawn_command_line_sync(Lcommandline, &Lout, &Lerr, &Lexit, Aerror); |
| 286 |
return FALSE; |
return FALSE; |
| 287 |
} |
} |
| 288 |
|
|
| 289 |
if (strstr(Lout, CDRECORD_READ_CD)) Ltype += _READ_CDR; |
if (strstr(Lout, CDRECORD_READ_CD)) Adrive->type |= _READ_CDR; |
| 290 |
if (strstr(Lout, CDRECORD_WRITE_CDR)) Ltype += _WRITE_CDR; |
if (strstr(Lout, CDRECORD_WRITE_CDR)) Adrive->type |= _WRITE_CDR; |
| 291 |
if (strstr(Lout, CDRECORD_WRITE_CDRW)) Ltype += _WRITE_CDRW; |
if (strstr(Lout, CDRECORD_WRITE_CDRW)) Adrive->type |= _WRITE_CDRW; |
| 292 |
if (strstr(Lout, CDRECORD_WRITE_DUMMY)) Ltype += _WRITE_DUMMY; |
if (strstr(Lout, CDRECORD_READ_DVD)) Adrive->type |= _READ_DVD; |
| 293 |
if (strstr(Lout, CDRECORD_READ_DVD)) Ltype += _READ_DVD; |
if (strstr(Lout, CDRECORD_WRITE_DVD)) Adrive->type |= _WRITE_DVD; |
|
if (strstr(Lout, CDRECORD_WRITE_DVD)) Ltype += _WRITE_DVD; |
|
| 294 |
|
|
| 295 |
/* vitesse de lecture maximum CD */ |
/* vitesse de lecture maximum CD */ |
| 296 |
if ((scd=strstr(Lout, CDRECORD_MAX_CDREAD_SPEED))) { |
if ((scd=strstr(Lout, CDRECORD_MAX_CDREAD_SPEED))) { |
| 315 |
|
|
| 316 |
if (!scd) return FALSE; |
if (!scd) return FALSE; |
| 317 |
|
|
|
Adrive->type += Ltype; /* type: lecteur ou graveur */ |
|
| 318 |
Adrive->vitesse = atoi(scd); /* vitesse de lecture ou de gravure maximum */ |
Adrive->vitesse = atoi(scd); /* vitesse de lecture ou de gravure maximum */ |
| 319 |
Adrive->vitessedvd = sdvd ? atoi(sdvd) : -1; |
Adrive->vitessedvd = sdvd ? atoi(sdvd) : -1; |
| 320 |
_DEB("== le type => %d\n", Ltype); |
_DEB("== le type => %d\n", Adrive->type); |
| 321 |
_DEB("== donc la vitesse de lecture => %d\n", Adrive->vitesse ); |
_DEB("== donc la vitesse de lecture => %d\n", Adrive->vitesse ); |
| 322 |
|
|
| 323 |
|
|
| 324 |
/* ok maintenant on regarde si le lecteur supporte le burnfree, si oui on l'utilisera |
/* ok maintenant on regarde si le lecteur supporte le burnfree, si oui on l'utilisera |
| 325 |
* lors des gravures */ |
* lors des gravures */ |
| 326 |
Lcommandline = g_strdup_printf("%s -checkdrive dev=%s driveropts=help", conf_get_string("cdrecord"), Adev); |
Lcommandline = g_strdup_printf("%s -checkdrive dev=%s driveropts=help", conf_get_string("cdrecord"), |
| 327 |
|
Adev ? Adev : DRIVE_DEV(Adrive)); |
| 328 |
_DEB("==================%s\n", Lcommandline); |
_DEB("==================%s\n", Lcommandline); |
| 329 |
Lstatus = g_spawn_command_line_sync(Lcommandline, &Lout, &Lerr, &Lexit, Aerror); |
Lstatus = g_spawn_command_line_sync(Lcommandline, &Lout, &Lerr, &Lexit, Aerror); |
| 330 |
g_free(Lcommandline); |
g_free(Lcommandline); |
| 331 |
if (Lstatus == TRUE) { |
if (Lstatus == TRUE) { |
| 332 |
if (strstr(Lout, CDRECORD_BURNFREE)) Ltype += _BURN_FREE; |
if (strstr(Lout, CDRECORD_BURNFREE)) Adrive->type |= _BURN_FREE; |
| 333 |
} |
} |
| 334 |
g_free(Lout); |
g_free(Lout); |
| 335 |
g_free(Lerr); |
g_free(Lerr); |
| 463 |
g_free(Ltxt); |
g_free(Ltxt); |
| 464 |
|
|
| 465 |
Lblank = get_blank_type(Ag, Lmediadetect1); |
Lblank = get_blank_type(Ag, Lmediadetect1); |
| 466 |
|
|
| 467 |
|
/* try to umount device before device access */ |
| 468 |
|
matos_umount_device(Ldevice, NULL); |
| 469 |
|
|
| 470 |
Lcommandline = g_strdup_printf("%s dev=%s -v gracetime=2 %s%s %s %s %s %s %s %s %s %s '%s' %s", |
Lcommandline = g_strdup_printf("%s dev=%s -v gracetime=2 %s%s %s %s %s %s %s %s %s %s '%s' %s", |
| 471 |
conf_get_string("cdrecord"), DRIVE_DEV(Ldevice), |
conf_get_string("cdrecord"), DRIVE_DEV(Ldevice), |
| 472 |
*Lbufvitesse != '0' ? "speed=" : "", *Lbufvitesse != '0' ? Lbufvitesse : "", |
*Lbufvitesse != '0' ? "speed=" : "", *Lbufvitesse != '0' ? Lbufvitesse : "", |
| 894 |
break; |
break; |
| 895 |
} |
} |
| 896 |
|
|
| 897 |
|
/* try to umount device before device access */ |
| 898 |
|
matos_umount_device(Ldevice, NULL); |
| 899 |
|
|
| 900 |
Lstatus = g_spawn_async_with_pipes(Lrepertoire, Lcmd, NULL, /* env argument */ |
Lstatus = g_spawn_async_with_pipes(Lrepertoire, Lcmd, NULL, /* env argument */ |
| 901 |
(GSpawnFlags ) (G_SPAWN_DO_NOT_REAP_CHILD), |
(GSpawnFlags ) (G_SPAWN_DO_NOT_REAP_CHILD), |
| 902 |
NULL, NULL, Lpid, NULL, &g_out, &g_err, Aerror); |
NULL, NULL, Lpid, NULL, &g_out, &g_err, Aerror); |
| 1050 |
return FALSE; |
return FALSE; |
| 1051 |
} |
} |
| 1052 |
|
|
| 1053 |
|
/* try to umount device before device access */ |
| 1054 |
|
matos_umount_device(Ldevice, NULL); |
| 1055 |
|
|
| 1056 |
Lstatus = g_spawn_async_with_pipes(NULL, Lcmd, NULL, /* env argument */ |
Lstatus = g_spawn_async_with_pipes(NULL, Lcmd, NULL, /* env argument */ |
| 1057 |
(GSpawnFlags ) (G_SPAWN_DO_NOT_REAP_CHILD), |
(GSpawnFlags ) (G_SPAWN_DO_NOT_REAP_CHILD), |
| 1058 |
NULL, NULL, Lpid, NULL, &g_out, &g_err, Aerror); |
NULL, NULL, Lpid, NULL, &g_out, &g_err, Aerror); |
| 1134 |
return FALSE; |
return FALSE; |
| 1135 |
} |
} |
| 1136 |
|
|
| 1137 |
|
/* try to umount device before device access */ |
| 1138 |
|
matos_umount_device(Ldevice, NULL); |
| 1139 |
|
|
| 1140 |
Lstatus = g_spawn_async_with_pipes(NULL, Lcmd, NULL, /* env argument */ |
Lstatus = g_spawn_async_with_pipes(NULL, Lcmd, NULL, /* env argument */ |
| 1141 |
(GSpawnFlags ) (G_SPAWN_DO_NOT_REAP_CHILD), |
(GSpawnFlags ) (G_SPAWN_DO_NOT_REAP_CHILD), |
| 1142 |
NULL, NULL, Lpid, NULL, &g_out, &g_err, Aerror); |
NULL, NULL, Lpid, NULL, &g_out, &g_err, Aerror); |