USB Gadget

From postmarketOS

USB Gadget can turn your phone into a USB device if it has an available UDC (USB device controller), serving different functions to the USB Host (e.g. your PC/laptop). It can provide network to the host, or act like a keyboard/mouse/touchpad, a USB flash drive, a webcam, or a second display.

Prerequisites

  • Check your kernel config has USB_GADGET enabled.
$ zcat /proc/config.gz  | grep USB_GADGET
CONFIG_USB_GADGET=m
$ zcat /proc/config.gz  | grep USB_CONFIGFS
CONFIG_USB_CONFIGFS=m
  • Check your device has UDC, for example
$ ls /sys/class/udc
ci_hdrc.0

Applications

For most of them, you can just refer to the linux kernel document.

USB Network

Related kernel config option: CONFIG_USB_CONFIGFS_RNDIS

See USB Network.

USB GUD

GUD is an open USB display protocol. With GUD you can turn your phone into a second display. Detailed guide is at here