查看驾驶员信息

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