tree: 376114066bc06771e4373f62a3a120c71b346b71 [path history] [tgz]
  1. fuzzers/
  2. init/
  3. seccomp/
  4. tmpfiles.d/
  5. .project_alias
  6. 99-adbd.rules
  7. adbd.cc
  8. adbd.h
  9. adbd_main.cc
  10. arcvm_sock_to_usb.cc
  11. arcvm_sock_to_usb.h
  12. arcvm_sock_to_usb_test.cc
  13. arcvm_usb_to_sock.cc
  14. arcvm_usb_to_sock.h
  15. arcvm_usb_to_sock_test.cc
  16. BUILD.gn
  17. dbc.cc
  18. dbc.h
  19. OWNERS
  20. README.md
  21. udev_monitor.cc
  22. udev_monitor.h
arc/adbd/README.md

ARC adbd

ConfigFS / FunctionFS proxy for Developer Mode

This sets up the ADB gadget to allow Chromebooks that have the necessary hardware / kernel support to be able to use ADB over USB. This avoids exposing ConfigFS into the container.

See https://android.googlesource.com/platform/system/core/+/HEAD/adb/daemon/usb.cpp for more information.

ADB over USB with DbC

xHCI (host mode) Debug capabilities can be used for adb functionalities without switching to xDCI (device mode). This mode requires a USB 3.x A-to-C or C-to-C cable to connect the host system to the debug target (ChromeOS device). Alternatively, a USB 3.x A-to-A debug cable can be used.

To enable DbC, the kernel is built with CONFIG_USB_XHCI_DBGCAP config and the DbC Vendor ID is updated to Google Vendor ID (0x18d1). For more details, refer Documentation/ABI/testing/sysfs-bus-pci-drivers-xhci_hcd.

When DbC is configured, the /dev/ttyDBC0 serial device is created on the debug target (Chromebook). In order to avoid exposing /dev to adbd, we create /dev/dbc folder using tmpfiles and create an alias to ttyDBC0 node inside /dev/dbc using udev rules.

The Dbc daemon file watches the dbc device node and sets up the ARCVM ADB bridge for DbC when the serial device shows up. A Udev thread is also setup to monitor usb hotplug events and handle the USB role changes required for host to host mode setup.

Configuration

This service expects a file in /etc/arc/adbd.json to configure the service. The file should be a JSON with the following format:

{
  # Required, the USB product identifier for the SoC.
  "usbProductId": "0x520B",
  # Optional, a list of kernel modules that need to be loaded prior to starting
  # to setup the USB gadget.
  "kernelModules": [
    # Each one of these objects will become an invocation to modprobe(8).
    {
      # Required, the name of the kernel module.
      "name": "g_ffs",
      # Optional, the list of additional parameters to modprobe(8). These can be
      # used to further configure the module.
      "parameters": [
        "functions=adb"
      ]
    }
  ],
  # Required, ADB over USB using DbC support enable
  "adbOverDbcSupport": true,
  # Required with DbC support enabled, PCI Bus Device ID for DbC
  "pciBusDeviceId": "0000:00:0d.0"
}