Skip to content

Commit

Permalink
Fix-bricked-restore (#826)
Browse files Browse the repository at this point in the history
* set enable write

* wait for erase to finish before continuing
  • Loading branch information
dbuentello authored and rwaldron committed Aug 22, 2016
1 parent f14b981 commit e4757c0
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/tessel/restore.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ exportables.validateDeviceId = function(usb) {

// 9.6.3 Bulk Erase (BE 60h or C7h)
exportables.bulkEraseFlash = function(usb) {
return exportables.transaction(usb, COMMAND_BE);
return (exportables.transaction(usb, COMMAND_BE)).then(() => exportables.waitTransactionComplete(usb));
};

// NOTE: The following commands do not directly interact with the flash memory registers
Expand Down Expand Up @@ -220,7 +220,11 @@ exportables.flash = function(tessel, buffers) {
buffers.partition = exportables.partition(mac1, mac2);

return Promise.resolve().then(() => {
log.info('Bulk Erasing Flash Memory...');
log.info('Setting WRITE_ENABLED');
return exportables.enableWrite(usb);
})
.then(() => {
log.info('Bulk Erasing Flash Memory (this may take a minute)...');
return exportables.bulkEraseFlash(usb);
})
.then(() => {
Expand Down

0 comments on commit e4757c0

Please sign in to comment.