Khadas Docs

Amazing Khadas, always amazes you!

User Tools

Site Tools


products:sbc:vim3:configurations:usb-gadget

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
products:sbc:vim3:configurations:usb-gadget [2023/04/16 22:33]
nick
products:sbc:vim3:configurations:usb-gadget [2025/07/11 03:40] (current)
nick [Troubleshooting]
Line 12: Line 12:
  
 ==== Configure DTS Overlays ==== ==== Configure DTS Overlays ====
 +
 +<tabbox VIM3/3L with 4.9 kernel>
 +
 +Take VIM3 as an example.
  
 Open ''/boot/env.txt'': Open ''/boot/env.txt'':
Line 24: Line 28:
 overlays=uart3 pwm_f i2c3 os08a10 --> overlays=uart3 pwm_f i2c3 os08a10 otg-device overlays=uart3 pwm_f i2c3 os08a10 --> overlays=uart3 pwm_f i2c3 os08a10 otg-device
 ``` ```
 +<tabbox VIM3/3L with 5.15 kernel>
 +
 +Take VIM3 as an example.
 +
 +Open ''/boot/dtb/amlogic/kvim3.dtb.overlay.env'':
 +
 +```shell
 +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
 +```
 +
 +</tabbox>
  
 ==== Enable Service ==== ==== Enable Service ====
 +
 +```shell
 +sudo systemctl enable usb-gadget-khadas.service
 +```
 +
 +<WRAP important >
 +If you have issues, please try the extra steps below:
  
 ```shell ```shell
 wget https://dl.khadas.com/.fixup/libcutils.so -O /tmp/libcutils.so wget https://dl.khadas.com/.fixup/libcutils.so -O /tmp/libcutils.so
 sudo cp /tmp/libcutils.so /usr/lib sudo cp /tmp/libcutils.so /usr/lib
-sudo systemctl enable usb-gadget-khadas.service 
 ``` ```
 +</WRAP>
 +
  
 Reboot to effect. Reboot to effect.
Line 48: Line 77:
 ``` ```
  
-Also need to setup the IP address on your PC, e.g. ''192.168.35.1''+Also need to setup the IP address on your PC, e.g. ''192.168.35.110''
  
 Check network connection: Check network connection:
  
 ```shell ```shell
-khadas@Khadas:~$ ping -I usb0 192.168.35.1+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. 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.110: 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.110: 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 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
 +```
 +
 +===== 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
 +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
 +```
Last modified: 2023/04/16 22:33 by nick