xref: /OK3568_Linux_fs/yocto/meta-rockchip/recipes-devtools/android-tools/files/adbd.sh (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1#!/bin/sh -e
2### BEGIN INIT INFO
3# Provides:          adbd
4# Required-Start:    mountvirtfs
5# Required-Stop:
6# Should-Start:
7# Should-Stop:
8# Default-Start:     2 3 4 5
9# Default-Stop:      0 1 6
10# Short-Description: Android Debug Bridge
11### END INIT INFO
12
13PATH="/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin"
14
15test -f /var/usb-debugging-enabled || exit 0
16
17start_adbd()
18{
19	android-gadget-setup
20
21	start-stop-daemon -S -b -n adbd -a \
22		/usr/bin/env PROC_service.adb.tcp.port=5555 /usr/bin/adbd
23
24	android-gadget-start
25}
26
27stop_adbd()
28{
29	start-stop-daemon -K -o -n adbd
30
31	android-gadget-cleanup
32}
33
34case "$1" in
35	start)
36		echo -n "Starting Android Debug Bridge"
37		start_adbd
38		echo "."
39		;;
40	stop)
41		echo -n "Stopping Android Debug Bridge"
42		stop_adbd
43		echo "."
44		;;
45	restart|reload)
46		echo -n "Stopping Android Debug Bridge"
47		stop_adbd
48		echo "."
49		echo -n "Starting Android Debug Bridge"
50		start_adbd
51		echo "."
52		;;
53	*)
54		echo "Usage: $0 {start|stop|restart}"
55		exit 1
56esac
57
58exit 0
59