diff options
author | Jenna Fox <a@creativepony.com> | 2013-02-19 15:18:36 -0800 |
---|---|---|
committer | Jenna Fox <a@creativepony.com> | 2013-02-19 15:18:36 -0800 |
commit | 6117fad11dffab29f9d1f71d678d732c453be260 (patch) | |
tree | e3b7e5a6b5b5a915a997ef40fec7f9ddb79c4a9a | |
parent | a63217a9697021c99943f83c73340b0d65cb6577 (diff) | |
parent | 7b6c8b9897b43c8c8d920850fce9fde9d96d9485 (diff) | |
download | micronucleus-6117fad11dffab29f9d1f71d678d732c453be260.tar.gz micronucleus-6117fad11dffab29f9d1f71d678d732c453be260.tar.bz2 micronucleus-6117fad11dffab29f9d1f71d678d732c453be260.zip |
Merge pull request #20 from psychogenic/master
Fix for linux erase/write issue.
-rw-r--r-- | commandline/library/micronucleus_lib.c | 10 |
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; |