diff options
Diffstat (limited to 'recipes/adbd/files/adb-init')
-rwxr-xr-x | recipes/adbd/files/adb-init | 22 |
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 | |||
3 | DAEMON=/usr/bin/adbd | ||
4 | |||
5 | VENDOR=0x18d1 | ||
6 | PRODUCT=0x0000 | ||
7 | SERIAL=$(hostname)-$(sed -e 's/://g' /sys/class/net/eth0/address) | ||
8 | |||
2 | case "$1" in | 9 | case "$1" in |
3 | start) | 10 | start) |
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 | ;; |
13 | stop) | 19 | stop) |
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 | ;; |
25 | restart) | ||
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 |
21 | esac | 33 | esac |
22 | exit 0 | 34 | exit 0 |