Khadas Docs

Amazing Khadas, always amazes you!

User Tools

Site Tools


Sidebar

products:sbc:vim4:configurations:usb-gadget

This is an old revision of the document!


VIM4 USB Gadget

Introduction

This document mainly introduces the usage of USB gadget.

System Configuration

Upgrade System

Follow Upgrade System to upgrade the system to latest version.

Enable USB Gadget Service

You can follow the command below to enable the USB Gadget service.

sudo systemctl enable usb-gadget-khadas.service

Reboot to effect.

sync
sudo reboot
2022/07/06 02:12 · nick

RNDIS Setup IP Address

Setup IP address manyally, e.g. setup IP address as 192.168.35.100

sudo ifconfig usb0 192.168.35.100 up

You 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.110 (192.168.35.110) from 192.168.35.100 usb0: 56(84) bytes of data.
64 bytes from 192.168.35.110: icmp_seq=1 ttl=64 time=1.19 ms
64 bytes from 192.168.35.110: icmp_seq=2 ttl=64 time=1.33 ms
64 bytes from 192.168.35.110: icmp_seq=3 ttl=64 time=1.21 ms
64 bytes from 192.168.35.110: icmp_seq=4 ttl=64 time=1.22 ms
64 bytes from 192.168.35.110: icmp_seq=5 ttl=64 time=1.28 ms
^C
--- 192.168.35.110 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4007ms
rtt min/avg/max/mdev = 1.193/1.245/1.328/0.050 ms

Usage of ADB

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
12036c819990    device
$ adb shell
root@Khadas:/#
root@Khadas:/#
root@Khadas:/#
root@Khadas:/#

Troubleshooting

If adb not work on windows, you can edit /usr/local/bin/usb-gadget to comment ln -s $F_RNDIS $GADGET/configs/c.1/ and reboot.

diff --git a/archives/filesystem/special/VIM-COMMON/usr/local/bin/usb-gadget b/archives/filesystem/special/VIM-COMMON/usr/local/bin/usb-gadget
index 520a9b9a..299569f0 100755
--- a/usr/local/bin/usb-gadget
+++ b/usr/local/bin/usb-gadget
@@ -57,7 +57,7 @@ echo "RNDIS" > $F_RNDIS/os_desc/interface.rndis/compatible_id
 echo "5162001" > $F_RNDIS/os_desc/interface.rndis/sub_compatible_id
 
 # Bind function to configuration
-ln -s $F_RNDIS $GADGET/configs/c.1/
+#ln -s $F_RNDIS $GADGET/configs/c.1/
 ln -s $GADGET/configs/c.1/ $GADGET/os_desc
 
 # Enable the Gadget
diff --git a/config/boards/VIM3.inc b/config/boards/VIM3.inc
index fa141c69..c15285aa 100644
Last modified: 2025/07/11 03:39 by nick