====== VIM3/3L USB Gadget ====== ===== Introduction ===== This document mainly introduces USB gadget. You will learn how to configure and enable USB gadget Usage. ===== System Configuration ===== ==== Upgrade System ==== Follow [[/products/sbc/common/configurations/upgrade-system|Upgrade System]] to upgrade system. ==== Configure DTS Overlays ==== Open ''/boot/env.txt'': ```shell sudo vim /boot/env.txt ``` Add ''otg-device'' to overlays node to make USB OTG Device enable: ``` overlays=uart3 pwm_f i2c3 os08a10 --> overlays=uart3 pwm_f i2c3 os08a10 otg-device ``` ==== Enable Service ==== ```shell wget https://dl.khadas.com/.fixup/libcutils.so -O /tmp/libcutils.so sudo cp /tmp/libcutils.so /usr/lib sudo systemctl enable usb-gadget-khadas.service ``` Reboot to effect. ```shell sync sudo reboot ``` ===== RNDIS Setup IP Address ===== Setup IP address manyally, e.g. setup IP address as ''192.168.35.100'' ```shell sudo ifconfig usb0 192.168.35.100 up ``` Also need to setup the IP address on your PC, e.g. ''192.168.35.1'' Check network connection: ```shell khadas@Khadas:~$ ping -I usb0 192.168.35.1 PING 192.168.35.1 (192.168.35.1) from 192.168.35.100 usb0: 56(84) bytes of data. 64 bytes from 192.168.35.1: icmp_seq=1 ttl=64 time=0.218 ms 64 bytes from 192.168.35.1: icmp_seq=2 ttl=64 time=0.308 ms 64 bytes from 192.168.35.1: icmp_seq=3 ttl=64 time=0.209 ms 64 bytes from 192.168.35.1: icmp_seq=4 ttl=64 time=0.301 ms 64 bytes from 192.168.35.1: icmp_seq=5 ttl=64 time=0.295 ms 64 bytes from 192.168.35.1: icmp_seq=6 ttl=64 time=0.222 ms 64 bytes from 192.168.35.1: icmp_seq=7 ttl=64 time=0.289 ms 64 bytes from 192.168.35.1: icmp_seq=8 ttl=64 time=0.297 ms 64 bytes from 192.168.35.1: icmp_seq=9 ttl=64 time=0.240 ms 64 bytes from 192.168.35.1: icmp_seq=10 ttl=64 time=0.280 ms ``` ===== Usage of ADB ===== Try to access the devices via adb. ```shell $ adb devices * daemon not running; starting now at tcp:5037 * daemon started successfully List of devices attached 37304e424e50 device $ adb shell # # # ls bin dev etc lib mnt proc run srv tmp usr zImage boot dtb.img home media opt root sbin sys uInitrd var # ```