How to get USB OTG port to work in Device mode?


I am trying to get USB OTG to work on the Khadas VIM so I can SSH into the box from my MacBook via the USB-A-to-USB-C cable. I am familiar with doing so on the Raspberry Pi Zero using these instructions:

However, after setting up boot for Khadas VIM I do not find a config.txt nor a cmdline.txt file. Is there an alternative way to do for Khadas VIM?

If this is not appropriate for the Khadas VIM forums maybe point me to more appropriate forums, please?

How to use the OTG port in device mode

I’m not sure I understand. What OS is on the Vim?


Hi, Mike:
It’s quite different OS between Khadas VIM and RPi.

If you wanna SSH feature, just make sure:

  • You have installed SSH package on your OS
  • Ensure your VIM is network connected
  • run ssh user@ip-of-your-vim to login into VIM from remote

Anyway, it’s same approach with Linux Ditro to setup SSH for VIM.

Good luck!


If you connect an additional key, you can remotely run programs with a graphical interface

ssh -X user@ip_vim

You can not only run console programs, but with a graphical interface (firefox, etc).

ssh -X root@ip_vim

(synaptic gparted etc)


Sorry for not being clear. I have Ubuntu 16.04 on an SD Card using this process. Ubuntu, based on Debian is similar to Raspbian so I was looking for same configuration files but did not find them.


I can do that already and have been configuring the software on the device using SSH in that manner. For those who want to know how to do this on Ubuntu, here are the instructions that I found and followed and they work perfectly.

Unfortunately, one of the features of our desired product offering that we hope to base on Khadas VIM is for our users to be able to turn off WiFi and access SSH using only a wired USB OTG connection. This will allow the device to work with no local network connection or prior configuration, and make it so that no one can hack into it over WiFi.

We already have a Raspberry Pi Zero configured to work in exactly this way, but for many reasons the RPiZero is not a viable solution for us.

When we see that Khadas VIM has an OTG port as part of its specification why should we not be able to configure it to have TCP over USB OTG?


Hi, Mike:

  • SSH over USB OTG on VIM, we still need more research on it, as we are in Chinese Sprint Festival util 5 Feb, so we need reply you after then.
  • As the debian OS, both Ubuntu on VIM is quite common setup with RPi, but, the different part of bootloader/u-boot, VIM with different approach to load OS
    • RPi: use external boot.ini for ENV configuration
    • VIM with Ubuntu: user internal ENV configuration
    • VIM with LibreELEC, use external boot.ini ENV


Thank you! Looking forward to this.

Hope you had a very good Chinese Sprint Festival!


is there anything new here since 2 months ago ?
I power my VIM pro board using 2 pins from its 40 pin header,
It boots ok,
and I can open a shell session to the board from a linux PC using minicom and an an usb-ttl 3.3V cable.
Then I connect the usb-c cable provided with the board and try to create a point to point network thru it and between the VIM and my linux PC.

I also am familiar with doing the same on my RPI0 board running raspbian jessie and also on my Beaglebone black running ubuntu.

The problem with VIM is that I cannot find how make the usb-c socket as slave and behave as a virtual ethernet port.

Please check if it is even possible, my OS is ubuntu server (see below) , running from emmc
uname -a …
Linux Khadas 3.14.29 #126 SMP PREEMPT Sat Feb 11 00:33:23 CST 2017 aarch64 aarcx



Hi, Ravelo:
One of our guy did try to port the OTG-SSH from Pi Zero to Khadas VIM, but I finally hang it on as he was stuck at some problems then:

  • As the kernel version is quite different, VIM is still 3.1x, but Pi Zero is 4.x
  • the OTG driver architecture also comes with some different

Anyway, I think we will continue the effort and also hope some forks who know this well can help to figure it out.



tks for answer gouwa,
let’s hope then that compatibility with mainline linux kernel for vim will be ok very soon and we’ll benefit from latest kernel which come with more support for usb otb on s905x based boards like odroid c2


trying to get ethernet via usb (g_ether) work, as part of the usb gadgets.

modprobe g_ether
not found in /lib/modules/3.14.29

it’s available in the official armbian kernels, but i cannot find it in balbes150 builds, which are quite useful in many ways.

setting up a “sandwich stack”: simply connect one khadas vim to another and have a mini cluster, powered by one 2,5A source. usb net would be the obvious choice here using the usb-a to usb-c OTG cable.

one wifi adapter is used for AP. the other could be used as a wifi bridge, but ethernet is more reliable.
the speed of usbnet between both boxes should be comparable to fast ethernet.

use cases would be to use one box as a tv box, and the other as a tvheadend server, or a headless kodi, containing the mysql server, which scrapes sources to put them into a cache for faster retrieval, others might like to experiment with a small docker swarm. since clustering is already planned with the khadas case, ethernet over usb (OTG) should be available.

maybe someone who has been there before, can walk me through the various build environments to configure the kernel accordingly :wink:


Did anyone manage to get this working? I want to use ethernet networking to connect a number of VIMs together to save on cabling in a project so need to get this working

thanks :slight_smile:


looks like i need to enable USB gadget mode in the kernel and enable the USB ethernet gadget, but cant get a .config file that works and menuconfig setup that follows exmaples off the web just results in a restart of the config process when building debs, e.g.

will keep trying - as when i get a working kernel build then i dont get usb0 as a network device - so something wrong


Nope. I gave up on it because I realized there were too many hurdles to get a Khadas working my use-case. That said, we have yet to find something that will.


Have got USB0 as a device - now to get it working with the host…

Needed CONFIG_USB_ETH set in the kernel config along with gadget support