This is an old revision of the document!
ADB (Android Debug Bridge) is enabled by default. You can access the device directly via ADB:
$ adb kill-server $ adb devices
Expected output:
* daemon not running; starting now at tcp:5037 * daemon started successfully List of devices attached 12036c819990 device
To obtain a shell on the device:
$ adb shell
You should see a prompt like: root@Khadas:/#
You can dynamically switch USB gadget functions by writing the desired mode to the file /tmp/.usb_config and restarting the 'usbdevice' service.
echo usb_rndis_en > /tmp/.usb_config sudo usbdevice restart
echo usb_acm_en > /tmp/.usb_config sudo usbdevice restart
echo usb_uac_en > /tmp/.usb_config sudo usbdevice restart
echo usb_uvc_en > /tmp/.usb_config sudo usbdevice restart
After enabling UVC, start the UVC gadget application:
uvc-gadget rockchip/functions/uvc.0 -d /dev/videoX
Note: ReplaceXwith the actual video device node number (e.g. /dev/video0).
echo usb_ums_en > /tmp/.usb_config sudo mkdir -p /userdata/ dd if=/dev/zero of=/userdata/ums_shared.img bs=1M count=1024
UMS mode requires an empty disk image file (ums_shared.img in the example above, 1GB size). This file will be presented to the host system as a removable storage drive.
After enabling the RNDIS function, you need to configure the IP address manually on both the device and the host PC.
Such as set the IP address for the usb0 interface (e.g., to 192.168.35.100):
sudo ifconfig usb0 192.168.35.100 up
On the host PC, configure the corresponding USB network interface with an IP address on the same subnet (e.g., 192.168.35.110).
Test the connection form the device to the host:
ping -I usb0 192.168.35.110