robots: noindex
ffx driver
指令可擷取 Fuchsia 裝置上各種類型的驅動程式資訊。
概念
ffx driver
指令可擷取目前可用或目標 Fuchsia 裝置 (或 模擬器) 上「執行」的驅動程式相關資訊。不過,ffx driver
指令預期您可以從主機上建立目標 Fuchsia 裝置的 SSH 連線。如要驗證此裝置連線,可以執行 ffx target show
指令。
使用 ffx driver
指令之前,建議您熟悉驅動程式架構 (DFv2) 中的基本概念,特別是下列概念:
- 裝置節點:裝置節點代表硬體元件、虛擬裝置或硬體裝置的一部分。
- 節點拓撲:節點拓撲會描述系統中裝置節點之間的父項/子項關係。
- 驅動程式代管程序:做為 Fuchsia 元件執行的驅動程式主機,可區隔 Fuchsia 系統中的驅動程式。在 Fuchsia 中,每個驅動程式都位於驅動程式主機中,且單一驅動程式主機中可同時放置多個驅動程式。
查看驅動程式
如要查看 Fuchsia 裝置上可用的所有驅動程式,請執行下列指令:
ffx driver list
這個指令會輸出類似以下的內容:
$ ffx driver list
fuchsia-boot:///alc5663#meta/alc5663.cm
fuchsia-boot:///asix-88179#meta/asix-88179.cm
fuchsia-boot:///asix-88772b#meta/asix-88772b.cm
fuchsia-boot:///block-core#meta/block.core.cm
fuchsia-boot:///bt-transport-usb#meta/bt-transport-usb.cm
fuchsia-boot:///bus-pci#meta/bus-pci.cm
fuchsia-boot:///buttons#meta/buttons.cm
fuchsia-boot:///clock#meta/clock.cm
fuchsia-boot:///ctaphid#meta/ctaphid.cm
fuchsia-boot:///display-coordinator#meta/display-coordinator.cm
fuchsia-boot:///e1000#meta/e1000.cm
fuchsia-boot:///ftdi#meta/ftdi.cm
fuchsia-boot:///fvm#meta/fvm.cm
...
如要查看 Fuchsia 裝置上可用的所有驅動程式,並取得更詳細的資訊,請搭配 -v
旗標執行指令:
ffx driver list -v
這個指令會輸出類似以下的內容:
$ ffx driver list -v
URL : fuchsia-pkg://fuchsia.com/iwlwifi#meta/iwlwifi.cm
DF Version: 2
Device Categories: [misc]
Bind rules bytecode:
fuchsia.BIND_FIDL_PROTOCOL == 4
fuchsia.BIND_PCI_VID == 32902
Jump if fuchsia.BIND_PCI_DID == 2394 to ??
Jump if fuchsia.BIND_PCI_DID == 2395 to ??
Jump if fuchsia.BIND_PCI_DID == 9469 to ??
Jump if fuchsia.BIND_PCI_DID == 9510 to ??
Jump if fuchsia.BIND_PCI_DID == 41200 to ??
Abort
Label ??
fuchsia.BIND_COMPOSITE == 1
URL : fuchsia-boot:///virtio_rng#meta/virtio_rng.cm
DF Version: 1
Device Categories: [misc]
Bind rules bytecode:
Node (primary): pci
fuchsia.BIND_FIDL_PROTOCOL == 4
fuchsia.BIND_PCI_VID == 6900
Jump if fuchsia.BIND_PCI_DID == 4164 to ??
Jump if fuchsia.BIND_PCI_DID == 4101 to ??
...
查看執行中的驅動程式
如要查看 Fuchsia 裝置上目前執行 (載入) 的所有驅動程式,請搭配 -loaded
標記執行指令:
ffx driver list --loaded
這個指令會輸出類似以下的內容:
$ ffx driver list --loaded
fuchsia-boot:///#meta/block.core.cm
fuchsia-boot:///#meta/bus-pci.cm
fuchsia-boot:///#meta/display.cm
fuchsia-boot:///#meta/fvm.cm
fuchsia-boot:///#meta/goldfish-display.cm
fuchsia-boot:///#meta/goldfish.cm
fuchsia-boot:///#meta/goldfish_address_space.cm
fuchsia-boot:///#meta/goldfish_control.cm
fuchsia-boot:///#meta/goldfish_sensor.cm
fuchsia-boot:///#meta/goldfish_sync.cm
fuchsia-boot:///#meta/hid-input-report.cm
fuchsia-boot:///#meta/hid.cm
fuchsia-boot:///#meta/intel-hda.cm
...
查看驅動程式主機
如要查看在 Fuchsia 裝置上執行的所有驅動程式主機,以及主機所代管的驅動程式,請執行下列指令:
ffx driver list-hosts
這個指令會輸出類似以下的輸出內容:
$ ffx driver list-hosts
Driver Host: 5416
fuchsia-boot:///#meta/bus-pci.cm
fuchsia-boot:///#meta/display.cm
fuchsia-boot:///#meta/goldfish-display.cm
fuchsia-boot:///#meta/goldfish.cm
fuchsia-boot:///#meta/goldfish_control.cm
...
Driver Host: 8248
fuchsia-boot:///#meta/intel-rtc.cm
Driver Host: 8317
fuchsia-boot:///#meta/pc-ps2.cm
Driver Host: 9604
fuchsia-boot:///#meta/block.core.cm
fuchsia-boot:///#meta/fvm.cm
fuchsia-boot:///#meta/virtio_block.cm
...
查看節點拓撲
如要查看 Fuchsia 裝置的整個節點拓撲,請執行下列指令:
ffx driver dump
這個指令會輸出類似以下的內容:
$ ffx driver dump
[dev] pid=5521 fuchsia-boot:///platform-bus#meta/platform-bus.cm
[sys] pid=None unbound
[platform] pid=None unbound
[ram-disk] pid=7584 fuchsia-boot:///ramdisk#meta/ramdisk.cm
[ramctl] pid=None unbound
[00_00_2e] pid=None unbound
[virtual-audio] pid=25117 fuchsia-pkg://fuchsia.com/virtual_audio#meta/virtual_audio_driver.cm
[virtual_audio] pid=None unbound
[bt-hci-emulator] pid=None unbound
[fake-battery] pid=24707 fuchsia-pkg://fuchsia.com/fake-battery#meta/fake_battery.cm
[fake-battery] pid=None unbound
[power-simulator] pid=None unbound
[pt] pid=5521 fuchsia-boot:///platform-bus-x86#meta/pl
...
查看特定節點下的節點拓撲
如要只查看特定節點下節點拓樸的子圖,請執行下列指令:
ffx driver dump <NODE_NAME>
將 NODE_NAME
替換為目標節點的名稱,例如:
$ ffx driver dump goldfish-control
[goldfish-control] pid=5521 fuchsia-boot:///goldfish_display#meta/goldfish-display.cm
[goldfish-display] pid=5521 fuchsia-boot:///display-coordinator#meta/display-coordinator.cm
[display-coordinator] pid=None unbound
...
繪製節點拓撲的圖形
如要繪製節點拓樸圖,請執行下列指令:
ffx driver driver dump --graph
這個指令會輸出類似以下的內容:
$ ffx driver driver dump --graph
digraph {
forcelabels = true; splines="ortho"; ranksep = 1.2; nodesep = 0.5;
node [ shape = "box" color = " #2a5b4f" penwidth = 2.25 fontname = "prompt medium" fontsize = 10 margin = 0.22 ];
edge [ color = " #37474f" penwidth = 1 style = dashed fontname = "roboto mono" fontsize = 10 ];
"3675787314320" [label="dev"]
"3675787305008" [label="sys"]
"3675787315872" [label="platform"]
"3675787309664" [label="ram-disk"]
"3675787306560" [label="00_00_2e"]
"3675787308112" [label="virtual-audio"]
"3675787312768" [label="bt-hci-emulator"]
"3675787311216" [label="fake-battery"]
"3675787325184" [label="pt"]
"3675787317424" [label="00_00_1b"]
...
如要將這項輸出內容轉換為 png
檔案,您可以安裝 dot
指令,並將輸出內容傳遞至產生 png
檔案。此外,您也可以將輸出內容貼到 GraphViz。
查看裝置節點
如要查看 Fuchsia 裝置上所有裝置節點的屬性,請執行下列指令:
ffx driver list-devices
這個指令會輸出類似以下的內容:
$ ffx driver list-devices
dev
dev.sys
dev.sys.platform
dev.sys.platform.ram-disk
dev.sys.platform.00_00_2e
dev.sys.platform.virtual-audio
dev.sys.platform.bt-hci-emulator
dev.sys.platform.fake-battery
dev.sys.platform.pt
dev.sys.platform.00_00_1b
dev.sys.platform.ram-disk.ramctl
dev.sys.platform.virtual-audio.virtual_audio
dev.sys.platform.fake-battery.fake-battery
dev.sys.platform.fake-battery.power-simulator
dev.sys.platform.pt.PCI0
dev.sys.platform.pt.acpi
dev.sys.platform.00_00_1b.sysmem
dev.sys.platform.pt.PCI0.bus
dev.sys.platform.pt.acpi.acpi-_SB_
dev.sys.platform.pt.acpi.acpi-_TZ_
dev.sys.platform.00_00_1b.sysmem.sysmem-banjo
dev.sys.platform.00_00_1b.sysmem.sysmem-fidl
dev.sys.platform.pt.PCI0.bus.00_00.0
dev.sys.platform.pt.PCI0.bus.00_01.0
dev.sys.platform.pt.PCI0.bus.00_02.0
...
如要查看裝置節點的屬性及詳細資訊,請搭配 -v
標記執行指令:
ffx driver list-devices -v
這個指令會輸出類似以下的內容:
$ ffx driver list-devices -v
...
Name : i2c-child
Moniker : root.sys.platform.platform-passthrough.acpi.acpi-FWCF.i2c-child
Driver : None
3 Properties
[ 1/ 3] : Key "fuchsia.hardware.i2c" Value Enum(fuchsia.hardware.i2c.Device.ZirconTransport)
[ 2/ 3] : Key fuchsia.BIND_I2C_ADDRESS Value 0x0000ff
[ 3/ 3] : Key "fuchsia.driver.framework.dfv2" Value true
...
查看特定路徑下的裝置節點
如要查看在節點拓撲中依特定路徑篩選的裝置節點,請在指令中加入確切的拓樸路徑或裝置名稱:
ffx driver list-devices <NODE>
將 NODE
替換為拓樸路徑或裝置名稱。例如,下列範例顯示結果會根據 acpi
的拓樸路徑進行篩選:
$ ffx driver list-devices acpi
dev.sys.platform.pt.acpi
dev.sys.platform.pt.acpi.acpi-_SB_
dev.sys.platform.pt.acpi.acpi-_TZ_
dev.sys.platform.pt.acpi.acpi-_SB_.pt
dev.sys.platform.pt.acpi.acpi-_SB_.acpi-PCI0
dev.sys.platform.pt.acpi.acpi-_SB_.acpi-HPET
dev.sys.platform.pt.acpi.acpi-_SB_.acpi-LNKE
dev.sys.platform.pt.acpi.acpi-_SB_.acpi-LNKF
dev.sys.platform.pt.acpi.acpi-_SB_.acpi-LNKG
dev.sys.platform.pt.acpi.acpi-_SB_.acpi-LNKH
dev.sys.platform.pt.acpi.acpi-_SB_.acpi-GSIE
dev.sys.platform.pt.acpi.acpi-_SB_.acpi-GSIF
dev.sys.platform.pt.acpi.acpi-_SB_.acpi-GSIG
dev.sys.platform.pt.acpi.acpi-_SB_.acpi-GSIH
...
您也可以將這個引數與 -v
標記結合,以取得更詳細的資訊,例如:
$ ffx driver list-devices acpi -v
Name : acpi
Moniker : dev.sys.platform.pt.acpi
Driver : unbound
2 Properties
[ 1/ 2] : Key fuchsia.BIND_PROTOCOL Value 0x00001c
[ 2/ 2] : Key "fuchsia.platform.DRIVER_FRAMEWORK_VERSION" Value 0x000002
1 Offers
Service: fuchsia.driver.compat.Service
Source: dev.sys.platform.pt
Instances: default
Name : acpi-_SB_
Moniker : dev.sys.platform.pt.acpi.acpi-_SB_
Driver : unbound
2 Properties
[ 1/ 2] : Key fuchsia.BIND_PROTOCOL Value 0x00001c
[ 2/ 2] : Key "fuchsia.platform.DRIVER_FRAMEWORK_VERSION" Value 0x000002
1 Offers
Service: fuchsia.driver.compat.Service
Source: dev.sys.platform.pt
Instances: default
...
查看複合節點
如要查看 Fuchsia 裝置上的所有複合節點,請執行下列指令:
ffx driver list-composites
這個指令會輸出類似以下的內容:
$ ffx driver list-composites
...
acpi-GFRO-composite
acpi-CPUS-composite
acpi-_TZ_-composite
goldfish-control-2
00:00.0
00:01.0
00:02.0
00:03.0
00:04.0
00:05.0
00:06.0
00:0b.0
...
如要查看包含詳細資訊的複合節點,請搭配 -v
標記執行指令:
ffx driver list-composites -v
這個指令會輸出類似以下的內容:
$ ffx driver list-composites -v
...
Name : 00_02_0
Driver : fuchsia-boot:///#meta/virtio_block.cm
Device : dev/sys/platform/pt/PCI0/bus/00:02.0/00_02_0
Parents : 3
Parent 0 : sysmem
Device : dev/sys/platform/00:00:1b/sysmem/sysmem-fidl
Parent 1 : pci (Primary)
Device : dev/sys/platform/pt/PCI0/bus/00:02.0
Parent 2 : acpi
Device : dev/sys/platform/pt/acpi/acpi-_SB_/acpi-PCI0/acpi-S10_/pt
...
查看複合節點規格
如要查看 Fuchsia 裝置上所有複合節點規格,請執行下列指令:
ffx driver list-composite-node-specs
這個指令會輸出類似以下的內容:
$ ffx driver list-composite-node-specs
...
00_1f_0 : None
00_1f_2 : fuchsia-boot:///ahci#meta/ahci.cm
00_06_0 : None
00_02_0 : fuchsia-boot:///virtio_block#meta/virtio_block.cm
00_1f_3 : None
00_05_0 : fuchsia-boot:///virtio_input#meta/virtio_input.cm
00_0b_0 : fuchsia-boot:///goldfish_address_space#meta/goldfish_address_space.cm
00_01_0 : fuchsia-boot:///intel-hda#meta/intel-hda.cm
00_03_0 : fuchsia-boot:///virtio_input#meta/virtio_input.cm
00_04_0 : fuchsia-boot:///virtio_netdevice#meta/virtio_netdevice.cm
00_00_0 : None
...
如要查看複合節點規格,並取得更詳細的資訊,請搭配 -v
標記執行指令:
ffx driver list-composite-node-specs -v
這個指令會輸出類似以下的內容:
$ ffx driver list-composite-node-specs -v
...
Name : ft3x27_touch
Driver : fuchsia-boot:///#meta/focaltech.cm
Nodes : 2
Node 0 : "i2c" (Primary)
3 Bind Rules
[ 1/ 3] : Accept "fuchsia.BIND_FIDL_PROTOCOL" { 0x000003 }
[ 2/ 3] : Accept "fuchsia.BIND_I2C_BUS_ID" { 0x000001 }
[ 3/ 3] : Accept "fuchsia.BIND_I2C_ADDRESS" { 0x000038 }
2 Properties
[ 1/ 2] : Key "fuchsia.BIND_FIDL_PROTOCOL" Value 0x000003
[ 2/ 2] : Key "fuchsia.BIND_I2C_ADDRESS" Value 0x000038
Node 1 : "gpio-int"
2 Bind Rules
[ 1/ 2] : Accept "fuchsia.BIND_PROTOCOL" { 0x000014 }
[ 2/ 2] : Accept "fuchsia.BIND_GPIO_PIN" { 0x000004 }
2 Properties
[ 1/ 2] : Key "fuchsia.BIND_PROTOCOL" Value 0x000014
[ 2/ 2] : Key "fuchsia.gpio.FUNCTION" Value "fuchsia.gpio.FUNCTION.TOUCH_INTERRUPT"
...
附錄
將元件註冊為驅動程式
如要註冊某個元件做為 Fuchsia 裝置的驅動程式庫,請執行下列指令:
ffx driver register <URL>
將 URL
替換為 Fuchsia 套件伺服器的元件網址,例如:
$ ffx driver register fuchsia-pkg://fuchsia.com/my_example#meta/my_new_driver.cm
停用驅動程式庫
如要停用 (也就是取消註冊) Fuchsia 裝置的驅動程式庫,請執行下列指令:
ffx driver disable <URL>
將 URL
替換為 Fuchsia 套件伺服器的元件網址,例如:
$ ffx driver disable fuchsia-pkg://fuchsia.com/my_example#meta/my_driver.cm