Skip to content

Instantly share code, notes, and snippets.

@KDawg
Created November 7, 2012 04:02
Show Gist options
  • Save KDawg/4029505 to your computer and use it in GitHub Desktop.
Save KDawg/4029505 to your computer and use it in GitHub Desktop.
Weinre Remote Debugging for Older Phones

Remote debugging USB-connected "older handsets" via Weinre

Download Weinre Binary

Everything on SgGuest

  • Seemingly flattens and makes easier the connectivity situation
  • SgGuest wifi credentials available from Cindy or me for TripCase team, otherwise see I/T
  • Cellphone on that wifi network
  • MacBook Pro on that wifi network

MBP WebSharing

  • "System Preferences" -> "Sharing" -> "Web Sharing" clicked on (one time only)
  • Also clearly reports the MBP ip addr assigned by SgGuest: for example mine was 192.168.39.181

Browse Local Weinre host

  • On the desktop web browse here: http://192.168.39.181:8080/client/#anonymous
  • NOTE: weinre server cheat-sheet on local laptop ala: http://192.168.39.181:8080
  • From that page launch the client clicking on "debug client user interface"
  • When the cellphone target shows up this client interface is how you access the DOM, and see JavaScript console.logs, which are the heart of our logic debug process in this context

Include the Weinre JavaScript library

  • Put a line in the bottom of touch webapp index.html like this:
< script src="http://192.168.0.243:8080/target/target-script-min.js#anonymous" >< /script >
  • This is the facility establishing a link from the webapp target to the debugging server and thus the debug client
  • Will probably need to search all project .JS files in our webapp removing the "use strict" because the weinre library is a touch old and incompatible in this way

Start the Rails Server

  • You must have that set up and working on your machine correctly
  • Best of all serves up all latest and greatest localhost touch2 client files
  • Means design -> edit -> test -> debug cycle is quick as possible keeping the master repro clean

Cellphone Launching from MBP

  • Means client app_config.js must be set to "local" environment for the rails server

  • Open the cellphone browser

  • Browse to the ip address assigned to it ala: 192.168.0.243:3000/touch2/

  • Now your debugging session truly begins!

@klovering
Copy link

Couple things to note:

Node.js needs to be installed (http://nodejs.org/)

More than likely you'll need to create a ~/.weinre/server.properties file in order to get your IP to pull up correctly. The defaults for the file are as follows:

boundHost: -all-
httpPort: 8080
reuseAddr: true
readTimeout: 1
deathTimeout: 5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment