-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathtether
More file actions
executable file
·26 lines (21 loc) · 743 Bytes
/
tether
File metadata and controls
executable file
·26 lines (21 loc) · 743 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/bin/bash
openTether="am start -n com.android.settings/.TetherSettings"
pause="sleep 1"
inputKey="input keyevent KEYCODE_"
function log {
echo "$1" >> /tmp/tether.log
}
date=`date`
output=`adb shell "$openTether; $pause; ${inputKey}DPAD_UP; $pause; ${inputKey}ENTER" 2>&1`
log
log "[$date]"
log "$output"
# To run this script every time you connect your device,
# put the following line in e.g. /etc/udev/rules.d/tether.rules
#
# ACTION=="add", ATTRS{idVendor}=="dead", ATTRS{idProduct}=="beef", RUN+="/path/to/tether"
#
# You can get the vendor:product id when the device is in debug (non-tethering) mode
# by running `lsusb`. You'll get some output with a line like:
#
# Bus 001 Device 044: ID dead:beef Google Inc. Nexus 4 (debug)