Skip to content

Instantly share code, notes, and snippets.

@Folyd
Created September 17, 2015 11:36
Show Gist options
  • Save Folyd/6ee1f27fbacd698419d8 to your computer and use it in GitHub Desktop.
Save Folyd/6ee1f27fbacd698419d8 to your computer and use it in GitHub Desktop.

Revisions

  1. Folyd created this gist Sep 17, 2015.
    26 changes: 26 additions & 0 deletions debug_via_wifi.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,26 @@
    #!/usr/bin/env bash
    #Notice: if unable to connect to [ip]:5555,
    #try adb kill-server then try again.

    adb shell ip route > addrs.txt
    #Case 1:Nexus 7
    #192.168.88.0/23 dev wlan0 proto kernel scope link src 192.168.89.48

    #Case 2: Smartsian T1,Huawei C8813
    #default via 192.168.88.1 dev eth0 metric 30
    #8.8.8.8 via 192.168.88.1 dev eth0 metric 30
    #114.114.114.114 via 192.168.88.1 dev eth0 metric 30
    #192.168.88.0/23 dev eth0 proto kernel scope link src 192.168.89.152 metric 30
    #192.168.88.1 dev eth0 scope link metric 30

    ip_addrs=$(awk {'if( NF >=9){print $9;}'} addrs.txt)

    echo "the device ip address is $ip_addrs"

    echo "connecting..."

    rm addrs.txt

    adb tcpip 5555

    adb connect "$ip_addrs"