# re-spot installer: puts the re-spot app on an Echo Spot (2017) that already runs LineageOS. # Run in PowerShell (not as administrator): # irm https://spot.wrightserver.org/setup.ps1 | iex # It downloads Android's adb tool (from Google) and the re-spot app (from this site) into # %LOCALAPPDATA%\re-spot, installs the app on the Spot over USB, and makes it the home screen. $ErrorActionPreference = 'Stop' $ProgressPreference = 'SilentlyContinue' $site = 'https://spot.wrightserver.org' $dir = Join-Path $env:LOCALAPPDATA 're-spot' New-Item -ItemType Directory -Force $dir | Out-Null function Step($t) { Write-Host "`n== $t" -ForegroundColor Yellow } function Fail($t) { Write-Host "`n$t" -ForegroundColor Red; Read-Host 'Press Enter to close'; exit 1 } Write-Host 're-spot setup' -ForegroundColor Cyan Step 'Getting adb (Android platform-tools from Google)' $adb = Join-Path $dir 'platform-tools\adb.exe' if (-not (Test-Path $adb)) { $zip = Join-Path $dir 'platform-tools.zip' Invoke-WebRequest 'https://dl.google.com/android/repository/platform-tools-latest-windows.zip' -OutFile $zip -UseBasicParsing Expand-Archive $zip $dir -Force } & $adb start-server 2>$null | Out-Null Write-Host 'ok' Step 'Looking for the Spot' Write-Host 'Plug the Spot into this PC with a micro-USB DATA cable (the port is under the cover on the back).' Write-Host 'If the Spot asks "Allow USB debugging?", tick "Always allow" and tap Allow.' $serial = $null for ($i = 0; $i -lt 90 -and -not $serial; $i++) { $lines = & $adb devices | Select-Object -Skip 1 | Where-Object { $_ -match '\S' } $ready = $lines | Where-Object { $_ -match '\tdevice$' } | Select-Object -First 1 if ($ready) { $serial = ($ready -split '\t')[0]; break } if ($lines -match 'unauthorized' -and $i % 5 -eq 0) { Write-Host ' Waiting for you to tap Allow on the Spot...' } elseif ($i % 10 -eq 0) { Write-Host ' Waiting for the Spot...' } Start-Sleep 2 } if (-not $serial) { Fail ("No Spot found. Check that USB debugging is on (Settings > System > Developer options), try another cable, " + "and if Windows shows an unknown device, install Google's USB driver: https://developer.android.com/studio/run/win-usb") } $model = (& $adb -s $serial shell getprop ro.product.device).Trim() if ($model -ne 'rook') { Write-Host "This device reports '$model', not an Echo Spot (rook). re-spot is made for the Spot's round screen." -ForegroundColor Yellow if ((Read-Host 'Install anyway? (y/N)') -ne 'y') { exit 0 } } Write-Host "Found $serial ($model)" Step 'Downloading the re-spot app' $apk = Join-Path $dir 'respot.apk' Invoke-WebRequest "$site/download/respot.apk" -OutFile $apk -UseBasicParsing Write-Host "ok ($([math]::Round((Get-Item $apk).Length / 1KB)) KB)" Step 'Installing on the Spot' & $adb -s $serial install -r $apk if ($LASTEXITCODE) { Fail 'Install failed (see the message above).' } & $adb -s $serial shell cmd package set-home-activity com.spot.home/.MainActivity | Out-Null & $adb -s $serial shell settings put secure immersive_mode_confirmations confirmed | Out-Null & $adb -s $serial shell am start -n com.spot.home/.MainActivity | Out-Null Write-Host "`nDone! The Spot now shows re-spot." -ForegroundColor Green Write-Host 'Next: on the Spot, long-press an empty spot > re-spot website > Get a link code,' Write-Host "then sign in at $site and enter the code under 'Link a Spot'." Read-Host "`nPress Enter to close"