Bluebie/micronucleus-t85 — pull request #20 by psychogenic (2013-02-19 19:09:31+00:00)
Title: Fix for linux erase/write issue.

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 successfully upload the firmware.

Output of program when uploading a small sketch (hex file) is now:

Binary sketch size: 756 bytes (of a 6,010 byte maximum)
Running Digispark Uploader...
Plug in device now...
> Please plug in the device ...
> Press CTRL+C to terminate the program.
> Device is found!
connecting: 40% complete
> Available space for user application: 6010 bytes
> Suggested sleep time between sending pages: 8ms
> Whole page count: 94
> Erase function sleep duration: 752ms
parsing: 60% complete
> Erasing the memory ...
erasing: 79% complete
>> Eep! Connection to device lost during erase! Not to worry
>> This happens on some computers - reconnecting...
erasing: 80% complete
> Starting to upload ...
writing: 100% complete
>> Micronucleus done. Thank you!

And the digispark acts as expected.