summaryrefslogtreecommitdiffstats
path: root/recipes/adbd/files/adb-init
diff options
context:
space:
mode:
Diffstat (limited to 'recipes/adbd/files/adb-init')
-rwxr-xr-xrecipes/adbd/files/adb-init22
1 files changed, 17 insertions, 5 deletions
diff --git a/recipes/adbd/files/adb-init b/recipes/adbd/files/adb-init
index 6f2910e..e88df23 100755
--- a/recipes/adbd/files/adb-init
+++ b/recipes/adbd/files/adb-init
@@ -1,22 +1,34 @@
1#!/bin/sh 1#!/bin/sh
2
3DAEMON=/usr/bin/adbd
4
5VENDOR=0x18d1
6PRODUCT=0x0000
7SERIAL=$(hostname)-$(sed -e 's/://g' /sys/class/net/eth0/address)
8
2case "$1" in 9case "$1" in
3start) 10start)
4 insmod $(busybox find /lib/modules/$(uname -r) -name "g_ffs.ko") idVendor=0x18d1 idProduct=0x4e26 iSerialNumber=$(hostname) 11 insmod $(busybox find /lib/modules/$(uname -r) -name "g_ffs.ko") idVendor=${VENDOR} idProduct=${PRODUCT} iSerialNumber=${SERIAL}
5 mkdir -p /dev/usb-ffs 12 mkdir -p /dev/usb-ffs
6 chmod 770 /dev/usb-ffs 13 chmod 770 /dev/usb-ffs
7 mkdir -p /dev/usb-ffs/adb 14 mkdir -p /dev/usb-ffs/adb
8 chmod 770 /dev/usb-ffs/adb 15 chmod 770 /dev/usb-ffs/adb
9 mount -t functionfs adb /dev/usb-ffs/adb -o uid=0,gid=0 16 mount -t functionfs adb /dev/usb-ffs/adb -o uid=0,gid=0
10 17 start-stop-daemon --start --quiet --exec $DAEMON &
11 /usr/bin/adbd &
12 ;; 18 ;;
13stop) 19stop)
14 killall adbd 20 start-stop-daemon --stop --quiet --exec $DAEMON
21 sleep 1
15 umount /dev/usb-ffs/adb 22 umount /dev/usb-ffs/adb
16 rmmod g_ffs 23 rmmod g_ffs
17 ;; 24 ;;
25restart)
26 start-stop-daemon --stop --quiet --exec $DAEMON
27 sleep 1
28 start-stop-daemon --start --quiet --exec $DAEMON &
29 ;;
18*) 30*)
19 echo "Usage: $0 {start|stop}" 31 echo "Usage: $0 {start|stop|restart}"
20 exit 1 32 exit 1
21esac 33esac
22exit 0 34exit 0