1 This file tries to document all requests a client can make
2 to the SDB server of an sdbd daemon. See the OVERVIEW.TXT document
3 to understand what's going on here.
8 Ask the SDB server for its internal version number.
10 As a special exception, the server will respond with a 4-byte
11 hex string corresponding to its internal version number, without
15 Ask the SDB server to quit immediately. This is used when the
16 SDB client detects that an obsolete server is running after an
20 Ask to return the list of available Android devices and their
21 state. After the OKAY, this is followed by a 4-byte hex len,
22 and a string that will be dumped as-is by the client, then
23 the connection is closed
26 This is a variant of host:devices which doesn't close the
27 connection. Instead, a new device list description is sent
28 each time a device is added/removed or the state of a given
29 device changes (hex4 + content). This allows tools like DDMS
30 to track the state of connected devices in real-time without
31 polling the server repeatedly.
34 This is a special query that is sent to the SDB server when a
35 new emulator starts up. <port> is a decimal number corresponding
36 to the emulator's SDB control port, i.e. the TCP port that the
37 emulator will forward automatically to the sdbd daemon running
38 in the emulator system.
40 This mechanism allows the SDB server to know when new emulator
43 host:transport:<serial-number>
44 Ask to switch the connection to the device/emulator identified by
45 <serial-number>. After the OKAY response, every client request will
46 be sent directly to the sdbd daemon running on the device.
47 (Used to implement the -s option)
50 Ask to switch the connection to one device connected through USB
51 to the host machine. This will fail if there are more than one such
52 devices. (Used to implement the -d convenience option)
55 Ask to switch the connection to one emulator connected through TCP.
56 This will fail if there is more than one such emulator instance
57 running. (Used to implement the -e convenience option)
60 Another host:transport variant. Ask to switch the connection to
61 either the device or emulator connect to/running on the host.
62 Will fail if there is more than one such device/emulator available.
63 (Used when neither -s, -d or -e are provided)
65 host-serial:<serial-number>:<request>
66 This is a special form of query, where the 'host-serial:<serial-number>:'
67 prefix can be used to indicate that the client is asking the SDB server
68 for information related to a specific device. <request> can be in one
69 of the format described below.
72 A variant of host-serial used to target the single USB device connected
73 to the host. This will fail if there is none or more than one.
76 A variant of host-serial used to target the single emulator instance
77 running on the host. This will fail if there is none or more than one.
80 When asking for information related to a device, 'host:' can also be
81 interpreted as 'any single device or emulator connected to/running on
84 <host-prefix>:get-product
87 <host-prefix>:get-serialno
88 Returns the serial number of the corresponding device/emulator.
89 Note that emulator serial numbers are of the form "emulator-5554"
91 <host-prefix>:get-state
92 Returns the state of a given device as a string.
94 <host-prefix>:forward:<local>;<remote>
95 Asks the SDB server to forward local connections from <local>
96 to the <remote> address on a given device.
98 There, <host-prefix> can be one of the
99 host-serial/host-usb/host-local/host prefixes as described previously
100 and indicates which device/emulator to target.
102 the format of <local> is one of:
104 tcp:<port> -> TCP connection on localhost:<port>
105 local:<path> -> Unix local domain socket on <path>
107 the format of <remote> is one of:
109 tcp:<port> -> TCP localhost:<port> on device
110 local:<path> -> Unix local domain socket on device
111 jdwp:<pid> -> JDWP thread on VM process <pid>
113 or even any one of the local services described below.
119 All the queries below assumed that you already switched the transport
120 to a real device, or that you have used a query prefix as described
123 shell:command arg1 arg2 ...
124 Run 'command arg1 arg2 ...' in a shell on the device, and return
125 its output and error streams. Note that arguments must be separated
126 by spaces. If an argument contains a space, it must be quoted with
127 double-quotes. Arguments cannot contain double quotes or things
130 Note that this is the non-interactive version of "sdb shell"
133 Start an interactive shell session on the device. Redirect
134 stdin/stdout/stderr as appropriate. Note that the SDB server uses
135 this to implement "sdb shell", but will also cook the input before
136 sending it to the device (see interactive_shell() in commandline.c)
139 Ask sdbd to remount the device's filesystem in read-write mode,
140 instead of read-only. This is usually necessary before performing
141 an "sdb sync" or "sdb push" request.
143 This request may not succeed on certain builds which do not allow
147 Opens a device file and connects the client directly to it for
148 read/write purposes. Useful for debugging, but may require special
149 privileges and thus may not run on all devices. <path> is a full
150 path from the root of the filesystem.
153 Tries to connect to tcp port <port> on localhost.
155 tcp:<port>:<server-name>
156 Tries to connect to tcp port <port> on machine <server-name> from
157 the device. This can be useful to debug some networking/proxy
158 issues that can only be revealed on the device itself.
161 Tries to connect to a Unix domain socket <path> on the device
165 localfilesystem:<path>
166 Variants of local:<path> that are used to access other Android
170 Opens one of the system logs (/dev/log/<name>) and allows the client
171 to read them directly. Used to implement 'sdb logcat'. The stream
172 will be read-only for the client.
175 This service is used to send snapshots of the framebuffer to a client.
176 It requires sufficient privileges but works as follow:
178 After the OKAY, the service sends 16-byte binary structure
179 containing the following fields (little-endian format):
181 depth: uint32_t: framebuffer depth
182 size: uint32_t: framebuffer size in bytes
183 width: uint32_t: framebuffer width in pixels
184 height: uint32_t: framebuffer height in pixels
186 With the current implementation, depth is always 16, and
187 size is always width*height*2
189 Then, each time the client wants a snapshot, it should send
190 one byte through the channel, which will trigger the service
191 to send it 'size' bytes of framebuffer data.
193 If the sdbd daemon doesn't have sufficient privileges to open
194 the framebuffer device, the connection is simply closed immediately.
197 This service is an exception because it only runs within the SDB server.
198 It is used to implement USB networking, i.e. to provide a network connection
199 to the device through the host machine (note: this is the exact opposite of
202 It is used to perform a gethostbyname(<address>) on the host and return
203 the corresponding IP address as a 4-byte string.
206 This service is used to upload a recovery image to the device. <size>
207 must be a number corresponding to the size of the file. The service works
210 - creating a file named /tmp/update
211 - reading 'size' bytes from the client and writing them to /tmp/update
212 - when everything is read successfully, create a file named /tmp/update.start
214 This service can only work when the device is in recovery mode. Otherwise,
215 the /tmp directory doesn't exist and the connection will be closed immediately.
218 Connects to the JDWP thread running in the VM of process <pid>.
221 This is used to send the list of JDWP pids periodically to the client.
222 The format of the returned data is the following:
224 <hex4>: the length of all content as a 4-char hexadecimal string
225 <content>: a series of ASCII lines of the following format:
228 This service is used by DDMS to know which debuggable processes are running
229 on the device/emulator.
231 Note that there is no single-shot service to retrieve the list only once.
234 This starts the file synchronisation service, used to implement "sdb push"
235 and "sdb pull". Since this service is pretty complex, it will be detailed
236 in a companion document named SYNC.TXT