@@ -166,6 +166,35 @@ class DaisyExporter final : public ExporterBase {
166166 }
167167 }
168168
169+ bool hasDfuError ()
170+ {
171+ // dfu-util will always return 2, even if everything worked
172+ // We just test for the search for any dfu-util errors in
173+ // the console to decide if the export was successful
174+ StringArray errorMessages = {
175+ " No DFU capable USB device available" ,
176+ " More than one DFU capable USB device found!" ,
177+ " Cannot open device" ,
178+ " unable to initialize libusb:" ,
179+ " Cannot claim interface" ,
180+ " Cannot set alt interface zero" ,
181+ " Cannot set alternate interface" ,
182+ " error resetting " ,
183+ " error clear_status" ,
184+ " Lost device after RESET?" ,
185+ " Device still in Runtime Mode!" ,
186+ " can't send DFU_ABORT" ,
187+ " USB communication error" ,
188+ " Transfer size must be specified" ,
189+ " Cannot open file" ,
190+ " Error: File ID" ,
191+ " Unsupported mode:" ,
192+ " error resetting after download"
193+ };
194+
195+ return exportingView->hasConsoleMessage (errorMessages);
196+ }
197+
169198 int flashBootloader (auto bin, auto sourceDir, auto make, auto gccPath)
170199 {
171200 exportingView->reportStatus (" Flashing bootloader" );
@@ -183,7 +212,14 @@ class DaisyExporter final : public ExporterBase {
183212
184213 Time::waitForMillisecondCounter (Time::getMillisecondCounter () + 900 );
185214
186- return getExitCode ();
215+ auto const hadError = hasDfuError ();
216+
217+ if (!hadError && exportingView->hasConsoleMessage ({ " Error 74" })) {
218+ exportingView->logToConsole (" \x1b [1;36mnote:\x1b [0m Error 74 is not fatal and may be ignored\n " );
219+ }
220+
221+ bool const dfuSucceeded = exportingView->hasConsoleMessage ({ " File downloaded successfully" , " Download done." });
222+ return (hadError || !dfuSucceeded) ? 1 : 0 ;
187223 }
188224
189225 bool performExport (String const & pdPatch, String const & outdir, String const & name, String const & copyright, StringArray const & searchPaths) override
@@ -415,29 +451,7 @@ class DaisyExporter final : public ExporterBase {
415451 // Delay to get correct exit code
416452 Time::waitForMillisecondCounter (Time::getMillisecondCounter () + 300 );
417453
418- // dfu-util will always return 2, even if everything worked
419- // We just test for the search for any dfu-util errors in the console to decide if the export was successful
420- StringArray errorMessages = {
421- " No DFU capable USB device available" ,
422- " More than one DFU capable USB device found!" ,
423- " Cannot open device" ,
424- " unable to initialize libusb:" ,
425- " Cannot claim interface" ,
426- " Cannot set alt interface zero" ,
427- " Cannot set alternate interface" ,
428- " error resetting " ,
429- " error clear_status" ,
430- " Lost device after RESET?" ,
431- " Device still in Runtime Mode!" ,
432- " can't send DFU_ABORT" ,
433- " USB communication error" ,
434- " Transfer size must be specified" ,
435- " Cannot open file" ,
436- " Error: File ID" ,
437- " Unsupported mode:" ,
438- " error resetting after download"
439- };
440- auto flashExitCode = exportingView->hasConsoleMessage (errorMessages);
454+ auto const flashExitCode = hasDfuError ();
441455
442456 if (!flashExitCode && exportingView->hasConsoleMessage ({ " Error 74" })) {
443457 exportingView->logToConsole (" \x1b [1;36mnote:\x1b [0m Error 74 is not fatal and may be ignored\n " );
0 commit comments