This document mainly introduces USB gadget. You will learn how to configure and enable USB gadget Usage.
Follow Upgrade System to upgrade system.
Take VIM3 as an example.
Open /boot/env.txt
:
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
Take VIM3 as an example.
Open /boot/dtb/amlogic/kvim3.dtb.overlay.env
:
sudo vim /boot/dtb/amlogic/kvim3.dtb.overlay.env
Add otg-device
to overlays node to make USB OTG Device enable:
fdt_overlays=otg-device
sudo systemctl enable usb-gadget-khadas.service
If you have issues, please try the extra steps below:
wget https://dl.khadas.com/.fixup/libcutils.so -O /tmp/libcutils.so sudo cp /tmp/libcutils.so /usr/lib
Reboot to effect.
sync sudo reboot
Setup IP address manyally, e.g. setup IP address as 192.168.35.100
sudo ifconfig usb0 192.168.35.100 up
Also need to setup the IP address on your PC, e.g. 192.168.35.110
Check network connection:
khadas@Khadas:~$ ping -I usb0 192.168.35.110
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.110: icmp_seq=1 ttl=64 time=0.218 ms
64 bytes from 192.168.35.110: icmp_seq=2 ttl=64 time=0.308 ms
Try to access the devices via adb.
$ adb kill-server $ adb devices * daemon not running; starting now at tcp:5037 * daemon started successfully List of devices attached 363233573350 device $ adb shell root@Khadas:/# root@Khadas:/# root@Khadas:/# root@Khadas:/# root@Khadas:/# ls bin dtb.img lib proc srv bin.usr-is-merged etc lib.usr-is-merged root sys boot home media run tmp dev Image mnt sbin usr dtb initrd.img opt sbin.usr-is-merged var