{"action":"created","issue":{"url":"https://api.github.com/repos/tessel/t2-cli/issues/493","repository_url":"https://api.github.com/repos/tessel/t2-cli","labels_url":"https://api.github.com/repos/tessel/t2-cli/issues/493/labels{/name}","comments_url":"https://api.github.com/repos/tessel/t2-cli/issues/493/comments","events_url":"https://api.github.com/repos/tessel/t2-cli/issues/493/events","html_url":"https://github.com/tessel/t2-cli/issues/493","id":122834231,"number":493,"title":"RFC: tessel unbrick","user":{"login":"johnnyman727","id":432909,"avatar_url":"https://avatars.githubusercontent.com/u/432909?v=3","gravatar_id":"","url":"https://api.github.com/users/johnnyman727","html_url":"https://github.com/johnnyman727","followers_url":"https://api.github.com/users/johnnyman727/followers","following_url":"https://api.github.com/users/johnnyman727/following{/other_user}","gists_url":"https://api.github.com/users/johnnyman727/gists{/gist_id}","starred_url":"https://api.github.com/users/johnnyman727/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/johnnyman727/subscriptions","organizations_url":"https://api.github.com/users/johnnyman727/orgs","repos_url":"https://api.github.com/users/johnnyman727/repos","events_url":"https://api.github.com/users/johnnyman727/events{/privacy}","received_events_url":"https://api.github.com/users/johnnyman727/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":11,"created_at":"2015-12-17T22:15:32Z","updated_at":"2016-04-07T08:38:53Z","closed_at":null,"body":"I think we should add a command to unbrick a Tessel if either the openwrt image or the firmware image is somehow corrupted. \r\n\r\nA corrupted openWRT image can be easily fixed with a script like [this one](https://github.com/tessel/t2-firmware/blob/master/scripts/flash.py) because @kevinmehall already wrote a utility to write directly to the OpenWRT Flash from the coprocessor. We could either port it to JS or just include that linked Python file directly. We will need to place the u-boot.bin image either on our build server or ship it with the CLI. \r\n\r\nA corrupted coprocessor image can be fixed using `openocd` from the OpenWRT image but this is more involved and you would *need* to have LAN access to OpenWRT. openocd would have to be installed with opkg (or included by default). Then we would use openocd to load an image file. Basic instructions for this [can be found here](https://gist.github.com/johnnyman727/23de244b454fd382e57d).\r\n\r\nWe can do the same as the above for a corrupted bootloader by substituting the bootloader image.\r\n\r\nI suggest the following commands:\r\n```\r\ntessel unbrick --openwrt // Unbricks the linux bootloader and file system\r\ntessel unbrick --firmware // Unbricks coprocessor firmware\r\ntessel unbrick --bootloader // Unbricks coprocess bootloader \r\n```"},"comment":{"url":"https://api.github.com/repos/tessel/t2-cli/issues/comments/206760867","html_url":"https://github.com/tessel/t2-cli/issues/493#issuecomment-206760867","issue_url":"https://api.github.com/repos/tessel/t2-cli/issues/493","id":206760867,"user":{"login":"Student007","id":5132566,"avatar_url":"https://avatars.githubusercontent.com/u/5132566?v=3","gravatar_id":"","url":"https://api.github.com/users/Student007","html_url":"https://github.com/Student007","followers_url":"https://api.github.com/users/Student007/followers","following_url":"https://api.github.com/users/Student007/following{/other_user}","gists_url":"https://api.github.com/users/Student007/gists{/gist_id}","starred_url":"https://api.github.com/users/Student007/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Student007/subscriptions","organizations_url":"https://api.github.com/users/Student007/orgs","repos_url":"https://api.github.com/users/Student007/repos","events_url":"https://api.github.com/users/Student007/events{/privacy}","received_events_url":"https://api.github.com/users/Student007/received_events","type":"User","site_admin":false},"created_at":"2016-04-07T08:38:52Z","updated_at":"2016-04-07T08:38:52Z","body":"> What were the symptoms you experienced?\r\n\r\nIt [hangs](https://github.com/tessel/t2-cli/blob/master/lib/discover.js#L105) forever by waiting for open Tessel connections while provisioning. But this also happened while doing `t2 list` when the bricked Tessel was plugged.\r\n\r\n> DEBUG=* t2 provision\r\nINFO Looking for your Tessel...\r\n  discovery Will scan for USB devices +0ms\r\n  discovery:usb Device found. +3ms\r\n  discovery Connection opened: +8ms undefined\r\n  discovery Fetching name: +0ms undefined\r\n  commands:usb [ 'uci', 'get', 'system.@system[0].hostname' ] +1ms\r\n  usb_process Opening process for +5ms ucigetsystem.@system[0].hostname\r\n  discovery Timeout hit! Waiting for pending to finish... +2s"}}