Skip to content

Instantly share code, notes, and snippets.

@dotdoom
Last active July 31, 2016 19:34
Show Gist options
  • Select an option

  • Save dotdoom/03586597c00a2ca8312325eb373ed910 to your computer and use it in GitHub Desktop.

Select an option

Save dotdoom/03586597c00a2ca8312325eb373ed910 to your computer and use it in GitHub Desktop.

Revisions

  1. dotdoom revised this gist Jul 31, 2016. 1 changed file with 8 additions and 3 deletions.
    11 changes: 8 additions & 3 deletions adbtcpipd
    Original file line number Diff line number Diff line change
    @@ -1,13 +1,18 @@
    #!/usr/bin/env bash

    sleep 5

    if /sbin/ifconfig usb0 &>/dev/null; then
    # usb0 is present - we are in slave mode, this script won't work.
    exit
    fi

    led() {
    local brightness=0
    [ "$1" -eq 0 ] && brightness=1
    echo "$brightness" >/sys/class/leds/LED/brightness
    }

    # Give a chance to connect something else.
    sleep 60
    /sbin/modprobe -r ledtrig_heartbeat

    while :; do
    @@ -18,4 +23,4 @@ while :; do
    led 0
    sleep 2
    fi
    done
    done
  2. dotdoom revised this gist Jul 29, 2016. 1 changed file with 8 additions and 2 deletions.
    10 changes: 8 additions & 2 deletions adbtcpipd
    Original file line number Diff line number Diff line change
    @@ -1,9 +1,15 @@
    #!/usr/bin/env bash

    led() {
    echo "$@" >/sys/class/leds/red_led/brightness
    local brightness=0
    [ "$1" -eq 0 ] && brightness=1
    echo "$brightness" >/sys/class/leds/LED/brightness
    }

    # Give a chance to connect something else.
    sleep 60
    /sbin/modprobe -r ledtrig_heartbeat

    while :; do
    if adb tcpip 5554 &>/dev/null; then
    led 1
    @@ -12,4 +18,4 @@ while :; do
    led 0
    sleep 2
    fi
    done
    done
  3. dotdoom created this gist Jul 20, 2016.
    15 changes: 15 additions & 0 deletions adbtcpipd
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,15 @@
    #!/usr/bin/env bash

    led() {
    echo "$@" >/sys/class/leds/red_led/brightness
    }

    while :; do
    if adb tcpip 5554 &>/dev/null; then
    led 1
    sleep 10
    else
    led 0
    sleep 2
    fi
    done