Skip to content

Instantly share code, notes, and snippets.

@13rac1
Created January 4, 2016 22:28
Show Gist options
  • Save 13rac1/c455b7c627656b29e4f1 to your computer and use it in GitHub Desktop.
Save 13rac1/c455b7c627656b29e4f1 to your computer and use it in GitHub Desktop.
Automate pairing Android and Wear emulators with Expect
#!/usr/bin/expect
# Automates pairing Android and Wear emulators.
# Complete process described here: http://stackoverflow.com/questions/25205888/pairing-android-and-wear-emulators
# Run: ./androidwear DEVICEPORT
# Expect timeout, set short.
set timeout 4
# Device port on localhost [REQUIRED]
set deviceport [lindex $argv 0]
# Start telnet and connect to device
spawn telnet localhost $deviceport
# Wait for OK to start
expect "OK"
# Send the port redirect command
send "redir add tcp:5601:5601\n"
# Wait for results
expect "OK"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment