查看驅動程式庫資訊

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