Created
January 1, 2015 19:40
-
-
Save azat/02a103ba0f9c235f5f24 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -e | |
PATH=/usr/bin:/bin:/usr/sbin:/sbin | |
interface=${1:-"usb0"} | |
if [ ! -d /sys/class/net/$interface ]; then | |
cat - >&2 <<EOL | |
You don't have $interface, seems that you miss some of steps: | |
1) make sure you have usbnet, cdc_ether, rndis_host drivers loaded (in this order): | |
for i in usbnet cdc_ether rndis_host; do modprobe \$i; done | |
2) make sure you phone is connected and you enable "USB Internet" on it | |
EOL | |
exit 1 | |
fi | |
echo "Configuring $interface" | |
sudo ifconfig usb0 192.168.111.1 netmask 255.255.255.0 up | |
echo "Suppose that you already have dhcpd server configured for $interface, restarting it" | |
service isc-dhcp-server restart | |
echo "Configuring device (make sure usb debugging enabled)" | |
adb shell netcfg rndis0 dhcp |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment