This is an old revision of the document!
This document mainly introduces the usage of USB gadget.
From version 1.7.5, USB gadget is enabled by default, no need any setup, you can just skip the overlay and service setup.
Follow Upgrade System to upgrade the system to latest version.
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
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:/#
Edit /etc/profile.d/usbdevice.sh
and uncomment #export USB_FUNCS=“rndis”
to enable RNDIS and reboot.
diff --git a/etc/profile.d/usbdevice.sh b/etc/profile.d/usbdevice.sh index d10b84df..06d1ab22 100644 --- a/etc/profile.d/usbdevice.sh +++ b/etc/profile.d/usbdevice.sh @@ -11,8 +11,8 @@ # @ UMS_RO: The flag of read only. 0->Read & Write, 1->Read Only. export USE=1 export USB_FUNCS="adb" -#export USB_FUNCS="rndis" +export USB_FUNCS="rndis" #export USB_FUNCS="ums" #export USB_FUNCS="adb ums" export UMS_MOUNT=0
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
If adb not work on windows, you can edit /etc/profile.d/usbdevice.sh
to comment export USB_FUNCS=“rndis”
and reboot.
diff --git a/etc/profile.d/usbdevice.sh b/etc/profile.d/usbdevice.sh index d10b84df..06d1ab22 100644 --- a/etc/profile.d/usbdevice.sh +++ b/etc/profile.d/usbdevice.sh @@ -11,8 +11,8 @@ # @ UMS_RO: The flag of read only. 0->Read & Write, 1->Read Only. export USE=1 export USB_FUNCS="adb" +#export USB_FUNCS="rndis" #export USB_FUNCS="ums" #export USB_FUNCS="adb ums" export UMS_MOUNT=0