cdrkit-1.1.11-format.patch 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. diff -up cdrkit-1.1.11/wodim/drv_mmc.c.format cdrkit-1.1.11/wodim/drv_mmc.c
  2. --- cdrkit-1.1.11/wodim/drv_mmc.c.format 2011-05-18 16:49:14.591822130 +0200
  3. +++ cdrkit-1.1.11/wodim/drv_mmc.c 2011-05-18 16:49:14.596822130 +0200
  4. @@ -1507,6 +1507,11 @@ getdisktype_mdvd(SCSI *usalp, cdr_t *dp)
  5. dstat_t *dsp = dp->cdr_dstat;
  6. struct track_info track_info;
  7. +
  8. + extern char *buf;
  9. + struct disk_info *dip;
  10. + int profile;
  11. +
  12. if(lverbose)
  13. printf("HINT: use dvd+rw-mediainfo from dvd+rw-tools for information extraction.\n");
  14. /* if(getdisktype_mmc(usalp, dp)<0)
  15. @@ -1521,6 +1526,18 @@ getdisktype_mdvd(SCSI *usalp, cdr_t *dp)
  16. dsp->ds_disktype&= ~DT_CD;
  17. dsp->ds_disktype|= DT_DVD;
  18. + profile = get_curprofile(usalp);
  19. + if (profile == 0x1A) {
  20. + dip = (struct disk_info *)buf;
  21. + if (get_diskinfo(usalp, dip) < 0)
  22. + return (-1);
  23. + if (dip->disk_status == DS_EMPTY) { /* Unformatted */
  24. + dsp->ds_flags |= DSF_NEED_FORMAT;
  25. + if(lverbose)
  26. + printf("The medium is empty, it will be auto formatted.\n");
  27. + }
  28. + }
  29. +
  30. return (ret);
  31. }
  32. diff -up cdrkit-1.1.11/wodim/scsi_cdr.c.format cdrkit-1.1.11/wodim/scsi_cdr.c
  33. --- cdrkit-1.1.11/wodim/scsi_cdr.c.format 2011-05-18 16:49:14.601822130 +0200
  34. +++ cdrkit-1.1.11/wodim/scsi_cdr.c 2011-05-18 16:49:14.600822130 +0200
  35. @@ -1328,7 +1328,7 @@ scsi_format(SCSI *usalp, caddr_t addr, i
  36. }
  37. sleep(10);
  38. printf("\rFormating in progress: 100.00 %% done. \n");
  39. - if (pid) exit (0);
  40. + if (pid > 0) exit (0);
  41. return ret;
  42. }
  43. diff -up cdrkit-1.1.11/wodim/wodim.c.format cdrkit-1.1.11/wodim/wodim.c
  44. --- cdrkit-1.1.11/wodim/wodim.c.format 2011-05-18 16:49:14.584822130 +0200
  45. +++ cdrkit-1.1.11/wodim/wodim.c 2011-05-18 17:21:59.510821630 +0200
  46. @@ -946,6 +946,40 @@ int main(int argc, char *argv[])
  47. print_toc(usalp, dp);
  48. comexit(0);
  49. }
  50. +
  51. + if ((flags & F_FORMAT) || (dp->cdr_dstat->ds_flags & DSF_NEED_FORMAT)) {
  52. + printf("wodim: media format asked\n");
  53. + /*
  54. + * Do not abort if OPC failes. Just give it a chance
  55. + * for better laser power calibration than without OPC.
  56. + *
  57. + * Ricoh drives return with a vendor unique sense code.
  58. + * This is most likely because they refuse to do OPC
  59. + * on a non blank media.
  60. + */
  61. + usalp->silent++;
  62. + do_opc(usalp, dp, flags);
  63. + usalp->silent--;
  64. + wait_unit_ready(usalp, 120);
  65. + if (gettimeofday(&starttime, (struct timezone *)0) < 0)
  66. + errmsg("Cannot get start time\n");
  67. +
  68. + if ((*dp->cdr_format)(usalp, dp, formattype) < 0) {
  69. + errmsgno(EX_BAD, "Cannot format disk, aborting.\n");
  70. + comexit(EX_BAD);
  71. + }
  72. + if (gettimeofday(&fixtime, (struct timezone *)0) < 0)
  73. + errmsg("Cannot get format time\n");
  74. + if (lverbose)
  75. + prtimediff("Formatting time: ", &starttime, &fixtime);
  76. +
  77. + if (!wait_unit_ready(usalp, 240) || tracks == 0) {
  78. + comexit(0);
  79. + }
  80. + if (gettimeofday(&starttime, (struct timezone *)0) < 0)
  81. + errmsg("Cannot get start time\n");
  82. + }
  83. +
  84. #ifdef XXX
  85. if ((*dp->cdr_check_session)() < 0) {
  86. comexit(EX_BAD);
  87. @@ -1230,38 +1264,6 @@ int main(int argc, char *argv[])
  88. comexit(0);
  89. }
  90. }
  91. - if (flags & F_FORMAT) {
  92. - printf("wodim: media format asked\n");
  93. - /*
  94. - * Do not abort if OPC failes. Just give it a chance
  95. - * for better laser power calibration than without OPC.
  96. - *
  97. - * Ricoh drives return with a vendor unique sense code.
  98. - * This is most likely because they refuse to do OPC
  99. - * on a non blank media.
  100. - */
  101. - usalp->silent++;
  102. - do_opc(usalp, dp, flags);
  103. - usalp->silent--;
  104. - wait_unit_ready(usalp, 120);
  105. - if (gettimeofday(&starttime, (struct timezone *)0) < 0)
  106. - errmsg("Cannot get start time\n");
  107. -
  108. - if ((*dp->cdr_format)(usalp, dp, formattype) < 0) {
  109. - errmsgno(EX_BAD, "Cannot format disk, aborting.\n");
  110. - comexit(EX_BAD);
  111. - }
  112. - if (gettimeofday(&fixtime, (struct timezone *)0) < 0)
  113. - errmsg("Cannot get format time\n");
  114. - if (lverbose)
  115. - prtimediff("Formatting time: ", &starttime, &fixtime);
  116. -
  117. - if (!wait_unit_ready(usalp, 240) || tracks == 0) {
  118. - comexit(0);
  119. - }
  120. - if (gettimeofday(&starttime, (struct timezone *)0) < 0)
  121. - errmsg("Cannot get start time\n");
  122. - }
  123. /*
  124. * Reset start time so we will not see blanking time and
  125. * writing time counted together.