Android KitCat 4.4.2 ADB 官方所支持的所有Services格式翻譯
來源:程序員人生 發(fā)布時間:2014-12-17 08:43:29 閱讀次數(shù):3776次
在之前的文章中有轉(zhuǎn)帖網(wǎng)上同行制作的ADB協(xié)議表格<<adb概覽及協(xié)議參考>>,但不夠詳實,所以這里自己另外基于Android
4.4.2的技術(shù)文檔重新做1次翻譯。
HOST SERVICES:
主機服務(wù):
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服務(wù)器要求其內(nèi)部版本號。作為1個協(xié)議中的例外(請查看OVERVIEW.txt來查看ADB具體協(xié)議規(guī)則),服務(wù)器會返回1個代表其內(nèi)部版本號的4字節(jié)的106進制字符串,而不會像標(biāo)準(zhǔn)協(xié)議中會返回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服務(wù)器立刻退出。當(dāng)ADB升級完成后,如果ADB客戶端檢測到之前已過時的ADB服務(wù)器還在運行的時候會發(fā)送這個要求。
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
這兩個服務(wù)要求是類似的,都是要求ADB服務(wù)器返回1系列有效的安卓裝備和對應(yīng)的狀態(tài)信息,只是devices -l會在狀態(tài)信息中包括該裝備更多的信息,比如產(chǎn)品型號等。在正常返回OKAY以后,會緊隨著1個代表數(shù)據(jù)長度的4字節(jié)長的106進制數(shù),和對應(yīng)的如我們通過命令adb devices -l命令能看到的輸出,然后連接要求就會關(guān)閉。
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.
這個服務(wù)是以上的host:devices的1個變種,客戶端和ADB服務(wù)器的連接會1致保持,當(dāng)有增加/移除裝備或裝備狀態(tài)改變的時候會主動的往連接上的客戶端發(fā)送新的裝備列表信息(4字節(jié)16進制長度+內(nèi)容)。這樣做的話就能夠允許DDMS這些工具來實時跟蹤所有連接上來的裝備的狀態(tài),而不需要客戶端每次都去連接ADB服務(wù)器獲得對應(yīng)信息。
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個特殊的要求,當(dāng)1個新的摹擬器啟動的時候這個要求將會發(fā)送到ADB服務(wù)器。<port>對應(yīng)的是摹擬器的控制端口的1個10進制數(shù)字,例如本機轉(zhuǎn)發(fā)到正在運行的摹擬器的adbd的對應(yīng)的那個TCP轉(zhuǎn)發(fā)端口。這個機制讓ADB服務(wù)器可以清楚知道有哪一個摹擬器被啟動起來了。
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服務(wù)器切換當(dāng)前連接到<serial-number>指定的裝備/摹擬器。在OKAY應(yīng)對以后,客戶真?zhèn)€所有要求都會重定向到該裝備的adbd這個守護進程。(用來實現(xiàn)ADB命令行客戶真?zhèn)€-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服務(wù)器切換當(dāng)前連接到通過USB連接到主機的裝備。如果多于1個裝備通過USB連接到主機,調(diào)用將會失敗。(用來實現(xiàn)ADB命令行客戶真?zhèn)€-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服務(wù)器切換當(dāng)前連接到1個通過TCP協(xié)議連接上來的摹擬器。如果多于1個摹擬器在運行的話,調(diào)用將會失敗。(用來實現(xiàn)-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服務(wù)器切換當(dāng)前連接到已連接上主機的裝備或正在主機中運行的中摹擬器。如果有多于1個這類裝備存在,調(diào)用將會失敗。(在-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> :"是用來指定客戶端要求信息時的目標(biāo)ADB服務(wù)器所在的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個這類裝備的話調(diào)用將會失敗。
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個這類裝備的話調(diào)用將會失敗。相當(dāng)于直接履行" 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'.
當(dāng)通過ADB服務(wù)器向1個相干裝備要求信息的時候,'host:' 在這類情況下也能夠指‘任意1個連接上主機的的裝備或正在主機上運行的摹擬器'。
<host-prefix>:get-product
XXX
作官方就提供了上面的XXX,沒有更多的信息。本人在嘗試"adb get-product"時發(fā)現(xiàn)并沒有支持。
<host-prefix>:get-serialno
Returns the serial number of the corresponding device/emulator. Note that emulator serial numbers are of the form "emulator⑸554"
返回對應(yīng)的裝備/摹擬器的序列號。"<host-prefix>:"指的是上面3種特殊信息要求命令。注意摹擬器的序列號的格式形如"emulator⑸554"。類似于命令行履行"adb get-serialno"
<host-prefix>:get-devpath
Returns the device path of the corresponding device/emulator.
返回對應(yīng)裝備/摹擬器的裝備路徑,這里的裝備路徑指的是"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個代表指定裝備狀態(tài)的字串,"<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服務(wù)器把本地<local>指定的連接重定向到指定裝備的<remote>地址。在這里,"<host-prefix>"可以是以上描寫的用來指定目標(biāo)裝備/摹擬器的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類型的文件在文件系統(tǒng)中的路徑)
the format of <remote> is one of:
<remote>的格式以下:
- tcp:<port> -> TCP localhost:<port> on device
- tcp<port> ->目標(biāo)裝備的localhost:<port>
- local:<path> -> Unix local domain socket on device
- local:<path>
-> 目標(biāo)裝備的本地Unix Domain Socket
- jdwp:<pid> -> JDWP thread on VM process <pid>
- jdwp:<pid> -> 目標(biāo)裝備中進程號<PID>指定的JAVA虛擬機內(nèi)部的JDWP線程
or even any one of the local services described below.
乃至還支持下面描寫的任1個本地服務(wù)
<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點區(qū)分是如果已存在<local>的1個轉(zhuǎn)發(fā)的話調(diào)用會失敗。用來實現(xiàn)"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>指定的本地重定向連接。用來實現(xiàn)"adb forward --remove <local"命令
<host-prefix>:killforward-all
Remove all forward network connections. This is used to implement 'adb forward --remove-all'.
移除所有的重定向連接。用來實現(xiàn)"adb forward --remove-all"命令
<host-prefix>:list-forward
List all existing forward connections from this server. This returns something that looks like the following:
列出本機所有存在的轉(zhuǎn)發(fā)連接。返回格式以下:
- <hex4>: The length of the payload, as 4 hexadecimal chars.
- <hex4>: 返回結(jié)果長度,由4字節(jié)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>代表主機真?zhèn)€的連接點(比如tcp:90000)。<remote>代表裝備真?zhèn)€連接點。
Used to implement 'adb forward --list'.
這是用來實現(xiàn)"adb forward --list"命令的。
LOCAL SERVICES:
本地服務(wù):
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前綴的服務(wù)要求
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 ...',并且返回對應(yīng)輸出和毛病流。
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.
注意參數(shù)必須空格隔開。如果1個參數(shù)本身包括空格,那末它必須要用雙引號引發(fā)來。參數(shù)內(nèi)部不能包括雙引號,否則命令履行結(jié)果將沒法控制。
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會話。公道的重定向了標(biāo)準(zhǔn)輸入/標(biāo)準(zhǔn)輸出/標(biāo)注毛病。
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服務(wù)器就是使用這個協(xié)議來實現(xiàn)命令行客戶真?zhèn)€"adb shell"要求的,但固然它會先包裝整理好輸入的信息再發(fā)送到目標(biāo)裝備(請查看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去重新把裝備只讀文件系統(tǒng)掛載成可讀寫模式的文件系統(tǒng)。這個在履行"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個裝備文件并通過客戶端連接上該裝備來進行讀寫操作。通常這是用來調(diào)試用的,但可能不可以在所有裝備上運行,由于它需要特殊的權(quán)限才能履行。<path>指的是從文件系統(tǒng)根開始的全路徑。
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>。這對調(diào)試只能在裝備上顯示的網(wǎng)絡(luò)/代理問題很有用。
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個系統(tǒng)日記文件,并允許客戶端去直接讀取日記信息。用來實現(xiàn)"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):
這個服務(wù)是用來把framebuffer的截屏快照發(fā)送到客戶真?zhèn)€。它需要足夠的權(quán)限,且工作原理以下: 服務(wù)在返回OKAY以后會繼續(xù)發(fā)送16字節(jié)的2進制結(jié)構(gòu)數(shù)據(jù)的以下內(nèi)容到客戶端(小字節(jié)序格式)
- depth: uint32_t: framebuffer depth
- depth: uint32_t: framebuffer 深度
- size: uint32_t: framebuffer size in bytes
- size: uint32_t: framebuffer 大小(字節(jié))
- 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
在當(dāng)前的實現(xiàn)中,寬度永久是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通道發(fā)送1個字節(jié),這會觸發(fā)本服務(wù)去把framebuffer數(shù)據(jù)按其大小指定的字節(jié)數(shù)發(fā)送給客戶端。如果adbd守護進程沒有足夠的權(quán)限打開framebuffer裝備,那末連接會立即關(guān)閉。
jdwp:<pid>
Connects to the JDWP thread running in the VM of process <pid>.
連接目標(biāo)裝備中由進程號<PID>指定的JAVA虛擬機進程內(nèi)部的JDWP線程
track-jdwp
This is used to send the list of JDWP pids periodically to the client.
這個服務(wù)是用來周期性的往客戶端發(fā)送有啟用JDWP的進程的進程號列表。
The format of the returned data is the following:
返回數(shù)據(jù)格式以下:
- <hex4>: the length of all content as a 4-char hexadecimal string
- <hex4>: 代表返回數(shù)據(jù)長度的1個4字節(jié)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.
這個服務(wù)被DDMS用來知悉有哪些可調(diào)式的進程正在真實裝備/摹擬器上運行。
Note that there is no single-shot service to retrieve the list only once.
注意其實不存在另外1個服務(wù)來只獲得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
開啟文件同步服務(wù),用來實現(xiàn)"adb push"和" adb pull" 這兩個命令。由于這個服務(wù)相當(dāng)復(fù)雜,更詳細的信息請查看相干的SYNC.TXT文檔。
Item
|
Description
|
Warning
|
Author
|
天地會珠海分舵
|
轉(zhuǎn)載請注明出處!
|
Blog Address
|
http://blog.csdn.net/zhubaitian
|
生活不易,碼農(nóng)辛苦
如果您覺得本網(wǎng)站對您的學(xué)習(xí)有所幫助,可以手機掃描二維碼進行捐贈