Android KitCat 4.4.2 ADB 官方所支持的所有Services格式翻译
来源:程序员人生 发布时间:2014-12-17 08:43:29 阅读次数:3625次
在之前的文章中有转帖网上同行制作的ADB协议表格<<adb概览及协议参考>>,但不够详实,所以这里自己另外基于Android
4.4.2的技术文档重新做1次翻译。
HOST SERVICES:
主机服务:
host:version
Ask the ADB server for its internal version number. As a special exception, the server will respond with a 4-byte hex string corresponding to its internal version number, without any OKAY or FAIL.
向ADB服务器要求其内部版本号。作为1个协议中的例外(请查看OVERVIEW.txt来查看ADB具体协议规则),服务器会返回1个代表其内部版本号的4字节的106进制字符串,而不会像标准协议中会返回OKAY或FAIL
host:kill
Ask the ADB server to quit immediately. This is used when the ADB client detects that an obsolete server is running after an upgrade.
要求ADB服务器立刻退出。当ADB升级完成后,如果ADB客户端检测到之前已过时的ADB服务器还在运行的时候会发送这个要求。
host:devices
host:devices-l
Ask to return the list of available Android devices and their state. devices-l includes the device paths in the state. After the OKAY, this is followed by a 4-byte hex len, and a string that will be dumped as-is by the
client, then the connection is closed
这两个服务要求是类似的,都是要求ADB服务器返回1系列有效的安卓装备和对应的状态信息,只是devices -l会在状态信息中包括该装备更多的信息,比如产品型号等。在正常返回OKAY以后,会紧随着1个代表数据长度的4字节长的106进制数,和对应的如我们通过命令adb devices -l命令能看到的输出,然后连接要求就会关闭。
host:track-devices
This is a variant of host:devices which doesn't close the connection. Instead, a new device list description is sent each time a device is added/removed or the state of a given device changes (hex4 + content). This allows
tools like DDMS to track the state of connected devices in real-time without polling the server repeatedly.
这个服务是以上的host:devices的1个变种,客户端和ADB服务器的连接会1致保持,当有增加/移除装备或装备状态改变的时候会主动的往连接上的客户端发送新的装备列表信息(4字节16进制长度+内容)。这样做的话就能够允许DDMS这些工具来实时跟踪所有连接上来的装备的状态,而不需要客户端每次都去连接ADB服务器获得对应信息。
host:emulator:<port>
This is a special query that is sent to the ADB server when a new emulator starts up. <port> is a decimal number corresponding to the emulator's ADB control port, i.e. the TCP port that the emulator will forward automatically
to the adbd daemon running in the emulator system. This mechanism allows the ADB server to know when new emulator instances start.
这是1个特殊的要求,当1个新的摹拟器启动的时候这个要求将会发送到ADB服务器。<port>对应的是摹拟器的控制端口的1个10进制数字,例如本机转发到正在运行的摹拟器的adbd的对应的那个TCP转发端口。这个机制让ADB服务器可以清楚知道有哪一个摹拟器被启动起来了。
host:transport:<serial-number>
Ask to switch the connection to the device/emulator identified by <serial-number>. After the OKAY response, every client request will be sent directly to the adbd daemon running on the device. (Used to implement the
-s option)
要求ADB服务器切换当前连接到<serial-number>指定的装备/摹拟器。在OKAY应对以后,客户真个所有要求都会重定向到该装备的adbd这个守护进程。(用来实现ADB命令行客户真个-s选项)
host:transport-usb
Ask to switch the connection to one device connected through USB to the host machine. This will fail if there are more than one such devices. (Used to implement the -d convenience option)
要求ADB服务器切换当前连接到通过USB连接到主机的装备。如果多于1个装备通过USB连接到主机,调用将会失败。(用来实现ADB命令行客户真个-d这个方便使用的选项)
host:transport-local
Ask to switch the connection to one emulator connected through TCP. This will fail if there is more than one such emulator instance running. (Used to implement the -e convenience option)
要求ADB服务器切换当前连接到1个通过TCP协议连接上来的摹拟器。如果多于1个摹拟器在运行的话,调用将会失败。(用来实现-e这个方便使用的选项)
host:transport-any
Another host:transport variant. Ask to switch the connection to either the device or emulator connect to/running on the host. Will fail if there is more than one such device/emulator available. (Used when neither -s,
-d or -e are provided)
另外1个host:transport的变种。要求ADB服务器切换当前连接到已连接上主机的装备或正在主机中运行的中摹拟器。如果有多于1个这类装备存在,调用将会失败。(在-s,-d或-e选项都没有提供的时候使用)
host-serial:<serial-number>:<request>
This is a special form of query, where the 'host-serial:<serial-number>:' prefix can be used to indicate that the client is asking the ADB server for information related to a specific device. <request> can be in one of
the format described below.
这是1个特殊的要求,前缀"host-serial:<serial-number> :"是用来指定客户端要求信息时的目标ADB服务器所在的1个特定装备。<request>可以是以下描写的任1方法。
host-usb:<request>
A variant of host-serial used to target the single USB device connected to the host. This will fail if there is none or more than one.
host-serial的1个变种,指定的是1个连接上主机的USB装备。如果没有或有多于1个这类装备的话调用将会失败。
host-local:<request>
A variant of host-serial used to target the single emulator instance running on the host. This will fail if there is none or more than one.
另外一个host-serial的变种,这次指定的是1个在主机运行的摹拟器。如果没有或有多于1个这类装备的话调用将会失败。相当于直接履行" adb get-product"或“adb get-serilano"等
host:<request>
When asking for information related to a device, 'host:' can also be interpreted as 'any single device or emulator connected to/running on
the host'.
当通过ADB服务器向1个相干装备要求信息的时候,'host:' 在这类情况下也能够指‘任意1个连接上主机的的装备或正在主机上运行的摹拟器'。
<host-prefix>:get-product
XXX
作官方就提供了上面的XXX,没有更多的信息。本人在尝试"adb get-product"时发现并没有支持。
<host-prefix>:get-serialno
Returns the serial number of the corresponding device/emulator. Note that emulator serial numbers are of the form "emulator⑸554"
返回对应的装备/摹拟器的序列号。"<host-prefix>:"指的是上面3种特殊信息要求命令。注意摹拟器的序列号的格式形如"emulator⑸554"。类似于命令行履行"adb get-serialno"
<host-prefix>:get-devpath
Returns the device path of the corresponding device/emulator.
返回对应装备/摹拟器的装备路径,这里的装备路径指的是"adb device -l"列出的最后1部份,如"device product:OPPO_12025 model:X909 device:X909"。 "<host-prefix>:"指的是上面3种特殊信息要求命令。类似于命令行履行"adb get-devpath"。
<host-prefix>:get-state
Returns the state of a given device as a string.
返回1个代表指定装备状态的字串,"<host-prefix>:"指的是上面3种特殊信息要求命令。类似于命令行履行"adb get-stat"。
<host-prefix>:forward:<local>;<remote>
Asks the ADB server to forward local connections from <local> to the <remote> address on a given device.There, <host-prefix> can be one of the host-serial/host-usb/host-local/host prefixes as described previously and
indicates which device/emulator to target.
要求ADB服务器把本地<local>指定的连接重定向到指定装备的<remote>地址。在这里,"<host-prefix>"可以是以上描写的用来指定目标装备/摹拟器的host-serial/host-usb/host-local/host。
the format of <local> is one of:
其中<local>的格式可以是以下任1种:
- tcp:<port> -> TCP connection on localhost:<port>
- tcp:<port> -> 本地主机的<port>端口的TCP连接
- local:<path> -> Unix local domain socket on <path>
- local:<path>
-> 基于地址<path>的本地主机的Unix域套接字连接(UNIX Domain Socket的地址是1个socket类型的文件在文件系统中的路径)
the format of <remote> is one of:
<remote>的格式以下:
- tcp:<port> -> TCP localhost:<port> on device
- tcp<port> ->目标装备的localhost:<port>
- local:<path> -> Unix local domain socket on device
- local:<path>
-> 目标装备的本地Unix Domain Socket
- jdwp:<pid> -> JDWP thread on VM process <pid>
- jdwp:<pid> -> 目标装备中进程号<PID>指定的JAVA虚拟机内部的JDWP线程
or even any one of the local services described below.
乃至还支持下面描写的任1个本地服务
<host-prefix>:forward:norebind:<local>;<remote>
Same as <host-prefix>:forward:<local>;<remote> except that it will fail it there is already a forward connection from <local>. Used to implement 'adb forward --no-rebind <local> <remote>'
类似<host-prefix>:forward:<local>;<remote> ,有1点区分是如果已存在<local>的1个转发的话调用会失败。用来实现"adb forward --no-rebind <local> <remote>"
<host-prefix>:killforward:<local>
Remove any existing forward local connection from <local>. This is used to implement 'adb forward --remove <local>'
移除所有<local>指定的本地重定向连接。用来实现"adb forward --remove <local"命令
<host-prefix>:killforward-all
Remove all forward network connections. This is used to implement 'adb forward --remove-all'.
移除所有的重定向连接。用来实现"adb forward --remove-all"命令
<host-prefix>:list-forward
List all existing forward connections from this server. This returns something that looks like the following:
列出本机所有存在的转发连接。返回格式以下:
- <hex4>: The length of the payload, as 4 hexadecimal chars.
- <hex4>: 返回结果长度,由4字节16进制字符组成
- <payload>: A series of lines of the following format:
- <serial> " " <local> " " <remote> "
" :Where <serial> is a device serial number. <local> is the host-specific endpoint (e.g. tcp:9000). <remote> is the device-specific endpoint.
- <payload>: 1连串以下格式的行:
- <serial> " " <local> " " <remote> "
":<serial>代表装备序列号。<local>代表主机真个的连接点(比如tcp:90000)。<remote>代表装备真个连接点。
Used to implement 'adb forward --list'.
这是用来实现"adb forward --list"命令的。
LOCAL SERVICES:
本地服务:
All the queries below assumed that you already switched the transport to a real device, or that you have used a query prefix as described above.
下面的所有要求是建立在你已把传输切换到1个真实装备上,或你使用了以上描写的1个query前缀的服务要求
shell:command arg1 arg2 ...
Run 'command arg1 arg2 ...' in a shell on the device, and return its output and error streams.
在装备的shell中运行'command arg1 arg2 ...',并且返回对应输出和毛病流。
Note that arguments must be separated by spaces. If an argument contains a space, it must be quoted with double-quotes. Arguments cannot contain double quotes or things will go very wrong.
注意参数必须空格隔开。如果1个参数本身包括空格,那末它必须要用双引号引发来。参数内部不能包括双引号,否则命令履行结果将没法控制。
Note that this is the non-interactive version of "adb shell"
注意这是"adb shell"的1个非交互式版本
shell:
Start an interactive shell session on the device. Redirect stdin/stdout/stderr as appropriate.
开启装备的1个交互shell会话。公道的重定向了标准输入/标准输出/标注毛病。
Note that the ADB server uses this to implement "adb shell", but will also cook the input before sending it to the device (see interactive_shell() in commandline.c)
注意ADB服务器就是使用这个协议来实现命令行客户真个"adb shell"要求的,但固然它会先包装整理好输入的信息再发送到目标装备(请查看commandline.c的interactive_shell())
remount:
Ask adbd to remount the device's filesystem in read-write mode, instead of read-only. This is usually necessary before performing an "adb sync" or "adb push" request.
This request may not succeed on certain builds which do not allow that.
要求adbd去重新把装备只读文件系统挂载成可读写模式的文件系统。这个在履行"adb sync"或"adb push"要求之前通常是很有必要先履行的。这个要求在1些版本中或许由于不支持而会失败
dev:<path>
Opens a device file and connects the client directly to it for read/write purposes. Useful for debugging, but may require special privileges and thus may not run on all devices. <path> is a full path from the root
of the filesystem.
打开1个装备文件并通过客户端连接上该装备来进行读写操作。通常这是用来调试用的,但可能不可以在所有装备上运行,由于它需要特殊的权限才能履行。<path>指的是从文件系统根开始的全路径。
tcp:<port>
Tries to connect to tcp port <port> on localhost.
尝试连接上本机的tcp端口<port>
tcp:<port>:<server-name>
Tries to connect to tcp port <port> on machine <server-name> from the device. This can be useful to debug some networking/proxy issues that can only be revealed on the device itself.
尝试连接上<server-name>指定的装备的tecp端口<port>。这对调试只能在装备上显示的网络/代理问题很有用。
local:<path>
Tries to connect to a Unix domain socket <path> on the device
尝试连接上装备上的<path>地址指定的Unix域套接字
localreserved:<path>
localabstract:<path>
localfilesystem:<path>
Variants of local:<path> that are used to access other Android socket namespaces.
local:<path>的几个变种,用来访问安卓其他命名空间指定的套接字。
log:<name>
Opens one of the system logs (/dev/log/<name>) and allows the client to read them directly. Used to implement 'adb logcat'. The stream will be read-only for the client.
打开/dev/log/<name>指定的1个系统日记文件,并允许客户端去直接读取日记信息。用来实现"adb logcat"这个命令。日记流对客户端是只读的。
framebuffer:
This service is used to send snapshots of the framebuffer to a client. It requires sufficient privileges but works as follow: After the OKAY, the service sends 16-byte binary structure containing the following fields
(little-endian format):
这个服务是用来把framebuffer的截屏快照发送到客户真个。它需要足够的权限,且工作原理以下: 服务在返回OKAY以后会继续发送16字节的2进制结构数据的以下内容到客户端(小字节序格式)
- depth: uint32_t: framebuffer depth
- depth: uint32_t: framebuffer 深度
- size: uint32_t: framebuffer size in bytes
- size: uint32_t: framebuffer 大小(字节)
- width: uint32_t: framebuffer width in pixels
- width: uint32_t:
framebuffer宽度(像素)
- height: uint32_t: framebuffer height in pixels
- height: uint32_t: framebuffer 高度(像素)
With the current implementation, depth is always 16, and size is always width*height*2
在当前的实现中,宽度永久是16,大小用永久是宽度*高度*2
Then, each time the client wants a snapshot, it should send one byte through the channel, which will trigger the service to send it 'size' bytes of framebuffer data. If the adbd daemon doesn't have sufficient privileges
to open the framebuffer device, the connection is simply closed immediately.
每次客户端想要1个截屏快照时,它将会通过Socket通道发送1个字节,这会触发本服务去把framebuffer数据按其大小指定的字节数发送给客户端。如果adbd守护进程没有足够的权限打开framebuffer装备,那末连接会立即关闭。
jdwp:<pid>
Connects to the JDWP thread running in the VM of process <pid>.
连接目标装备中由进程号<PID>指定的JAVA虚拟机进程内部的JDWP线程
track-jdwp
This is used to send the list of JDWP pids periodically to the client.
这个服务是用来周期性的往客户端发送有启用JDWP的进程的进程号列表。
The format of the returned data is the following:
返回数据格式以下:
- <hex4>: the length of all content as a 4-char hexadecimal string
- <hex4>: 代表返回数据长度的1个4字节16进制字串
- <content>: a series of ASCII lines of the following format: <pid> "
"
- <content>: 1系列的ASCLL字串行,每行的格式以下: <pid> "
"
This service is used by DDMS to know which debuggable processes are running on the device/emulator.
这个服务被DDMS用来知悉有哪些可调式的进程正在真实装备/摹拟器上运行。
Note that there is no single-shot service to retrieve the list only once.
注意其实不存在另外1个服务来只获得1次这个列表。
sync:
This starts the file synchronisation service, used to implement "adb push" and "adb pull". Since this service is pretty complex, it will be detailed in a companion document named SYNC.TXT
开启文件同步服务,用来实现"adb push"和" adb pull" 这两个命令。由于这个服务相当复杂,更详细的信息请查看相干的SYNC.TXT文档。
Item
|
Description
|
Warning
|
Author
|
天地会珠海分舵
|
转载请注明出处!
|
Blog Address
|
http://blog.csdn.net/zhubaitian
|
生活不易,码农辛苦
如果您觉得本网站对您的学习有所帮助,可以手机扫描二维码进行捐赠