summaryrefslogtreecommitdiffstats
path: root/commandline/library/micronucleus_lib.c
diff options
context:
space:
mode:
authorMalaclypse The Younger <pat.github@psychogenic.net>2013-02-19 14:01:36 -0500
committerMalaclypse The Younger <pat.github@psychogenic.net>2013-02-19 14:01:36 -0500
commit7b6c8b9897b43c8c8d920850fce9fde9d96d9485 (patch)
treee3b7e5a6b5b5a915a997ef40fec7f9ddb79c4a9a /commandline/library/micronucleus_lib.c
parenta63217a9697021c99943f83c73340b0d65cb6577 (diff)
downloadmicronucleus-7b6c8b9897b43c8c8d920850fce9fde9d96d9485.tar.gz
micronucleus-7b6c8b9897b43c8c8d920850fce9fde9d96d9485.tar.bz2
micronucleus-7b6c8b9897b43c8c8d920850fce9fde9d96d9485.zip
Tests on all Linux machines available led to errors such as:
Erasing the memory ... erasing: 66% complete Error erasing: -84>> Abort mission! error has occured ... Please unplug the device and restart the program. Whereas Windows can recover from this condition with Eep! Connection to device lost during erase! Not to worry This happens on some computers - reconnecting... the Linux version could not correctly interpret the -84 error code returned by the USBDEVFS_CONTROL call. This modification fixes this, re-interpreting the -84 code to -2 and allowing the program to reconnect and succesfully upload the firmware.
Diffstat (limited to 'commandline/library/micronucleus_lib.c')
-rw-r--r--commandline/library/micronucleus_lib.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/commandline/library/micronucleus_lib.c b/commandline/library/micronucleus_lib.c
index 6f1ac8d..462190b 100644
--- a/commandline/library/micronucleus_lib.c
+++ b/commandline/library/micronucleus_lib.c
@@ -89,7 +89,15 @@ int micronucleus_eraseFlash(micronucleus* deviceHandle, micronucleus_callback pr
i += 0.01;
}
- if (res == -5)
+ /* Under Linux, the erase process is often aborted with errors such as:
+ usbfs: USBDEVFS_CONTROL failed cmd micronucleus rqt 192 rq 2 len 0 ret -84
+ This seems to be because the erase is taking long enough that the device
+ is disconnecting and reconnecting. Under Windows, micronucleus can see this
+ and automatically reconnects prior to uploading the program. To get the
+ the same functionality, we must flag this state (the "-84" error result) by
+ converting the return to -2 for the upper layer.
+ */
+ if (res == -5 || res == -84)
return -2;
if (res != 0)
return -1;