diff options
Diffstat (limited to 'recipes/adbd/files/adb-init')
-rwxr-xr-x | recipes/adbd/files/adb-init | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/recipes/adbd/files/adb-init b/recipes/adbd/files/adb-init index 6faed60..92500d7 100755 --- a/recipes/adbd/files/adb-init +++ b/recipes/adbd/files/adb-init | |||
@@ -2,25 +2,27 @@ | |||
2 | 2 | ||
3 | DAEMON=/usr/bin/adbd | 3 | DAEMON=/usr/bin/adbd |
4 | 4 | ||
5 | VENDOR=0x18d1 | 5 | . /etc/default/adbd |
6 | PRODUCT=0x0000 | ||
7 | SERIAL=$(hostname)-$(sed -e 's/://g' /sys/class/net/eth0/address) | ||
8 | 6 | ||
9 | case "$1" in | 7 | case "$1" in |
10 | start) | 8 | start) |
11 | modprobe g_ffs idVendor=${VENDOR} idProduct=${PRODUCT} iSerialNumber=${SERIAL} | 9 | if [ "$USE_ETHERNET" = "no" ]; then |
12 | mkdir -p /dev/usb-ffs | 10 | modprobe g_ffs idVendor=${VENDOR} idProduct=${PRODUCT} iSerialNumber=${SERIAL} |
13 | chmod 770 /dev/usb-ffs | 11 | mkdir -p /dev/usb-ffs |
14 | mkdir -p /dev/usb-ffs/adb | 12 | chmod 770 /dev/usb-ffs |
15 | chmod 770 /dev/usb-ffs/adb | 13 | mkdir -p /dev/usb-ffs/adb |
16 | mount -t functionfs adb /dev/usb-ffs/adb -o uid=0,gid=0 | 14 | chmod 770 /dev/usb-ffs/adb |
15 | mount -t functionfs adb /dev/usb-ffs/adb -o uid=0,gid=0 | ||
16 | fi | ||
17 | start-stop-daemon --start --quiet --exec $DAEMON & | 17 | start-stop-daemon --start --quiet --exec $DAEMON & |
18 | ;; | 18 | ;; |
19 | stop) | 19 | stop) |
20 | start-stop-daemon --stop --quiet --exec $DAEMON | 20 | start-stop-daemon --stop --quiet --exec $DAEMON |
21 | sleep 1 | 21 | if [ "$USE_ETHERNET" = "no" ]; then |
22 | umount /dev/usb-ffs/adb | 22 | sleep 1 |
23 | rmmod g_ffs | 23 | umount /dev/usb-ffs/adb |
24 | rmmod g_ffs | ||
25 | fi | ||
24 | ;; | 26 | ;; |
25 | restart) | 27 | restart) |
26 | start-stop-daemon --stop --quiet --exec $DAEMON | 28 | start-stop-daemon --stop --quiet --exec $DAEMON |