Networking over USB


#1

Under Android when I plug a micro-USB cable into the micro USB connector on the 410c DragonBoard several devices show up on the host computer (PC), and it is then possible to connect to the DragonBoard with utilities such as adb. Hence I know that the hardware is capable.

However when I plug the same DragonBoard 410c running Debian Linux into the same PC port with the same micro-USB cable, no devices show up on the PC. This tells me that there are no ‘drivers’ attached to the hardware and the host computer cannot enumerate the DragonBoard.

How and what do I need to enable to get the DragonBoard to show up on my PC?

I am trying to run a 410c system “headless” with networking through the USB. Ideally I would like the 410c to appear to the host PC as an Ethernet adapter, or a CDC class device with Network Control Model (NCM), and allow me to “ssh -X” into the board. I would accept the DragonBoard showing up as a simple com port that I could run ppp over.

I recognize that I will lose access to the two USB type B ports on the board, but that is acceptable for this project.

What do you suggest?


#2

hi @ljking, it should be possible to run adb on ‘mainline’ linux. that used to work some time ago, but it’s been a while… but that could be one option to investigate.

USB networking over USB (device mode) is also possible and that is known to work fine. There is even a wiki page with some instructions:

e.g. Method 2.

I haven’t tested this exact set of instructions, but they look sane.

I found some additional tips on http://linux-sunxi.org/USB_Gadget/Ethernet#Loading_the_driver_.28on_the_device.29, so that it can be setup to load automatically.

cheers


#3

Well this is somewhat embarrassing, I usually have read all of the documentation, but somehow I missed the item you referenced. But not too embarrassing because it doesn’t work. so I would be asking questions in any event.

The page instructions say that some of the steps should be red or blue depending on which side you execute them. All of the instructions are black.

The first significant step is the “sudo modprobe g_ether” returns with no errors, or messages.

the next step is “ifconfig usb0”, but this needs to be “sudo ifconfig usb0”. I get the following message from ifconfig:

usb0: flags=4098<BROADCAST,MULTICAST>  mtu 1500
        ether 5a:1d:80:11:a9:14  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

Different format, but it seems to be OK.

I tried conecting both a Win10 laptop, and a Ubuntu Desktop, but both report that the is no new device attached when I plug in. The DragonBoard does see some things happening when I unplug the cable I get this (which seams reasonable):

Sep 19 19:24:12 linaro-alip kernel: [ 1321.411032] msm_otg 78d9000.phy: Avail curr from USB = 0
Sep 19 19:24:12 linaro-alip kernel: [ 1321.411114] msm_hsusb_host 78d9000.ehci: EHCI Host Controller
Sep 19 19:24:12 linaro-alip kernel: [ 1321.415907] msm_hsusb_host 78d9000.ehci: new USB bus registered, assigned bus number 1
Sep 19 19:24:12 linaro-alip kernel: [ 1321.423165] msm_hsusb_host 78d9000.ehci: irq 150, io mem 0x078d9000
Sep 19 19:24:12 linaro-alip kernel: [ 1321.442676] msm_hsusb_host 78d9000.ehci: USB 2.0 started, EHCI 1.00
Sep 19 19:24:12 linaro-alip kernel: [ 1321.452039] hub 1-0:1.0: USB hub found
Sep 19 19:24:12 linaro-alip kernel: [ 1321.458014] hub 1-0:1.0: 1 port detected
Sep 19 19:24:12 linaro-alip kernel: [ 1321.790649] usb 1-1: new high-speed USB device number 2 using msm_hsusb_host
Sep 19 19:24:12 linaro-alip kernel: [ 1321.940060] hub 1-1:1.0: USB hub found
Sep 19 19:24:12 linaro-alip kernel: [ 1321.940253] hub 1-1:1.0: 3 ports detected
Sep 19 19:24:12 linaro-alip kernel: [ 1322.234650] usb 1-1.2: new full-speed USB device number 3 using msm_hsusb_host
Sep 19 19:24:13 linaro-alip kernel: [ 1322.354198] input: Logitech USB Receiver as /devices/platform/soc/78d9000.ehci/usb1/1-1/1-1.2/1-1.2:1.0/0003:046D:C52B.000D/input/input10
Sep 19 19:24:13 linaro-alip kernel: [ 1322.413610] hid-generic 0003:046D:C52B.000D: input: USB HID v1.11 Keyboard [Logitech USB Receiver] on usb-78d9000.ehci-1.2/input0
Sep 19 19:24:13 linaro-alip kernel: [ 1322.426668] input: Logitech USB Receiver as /devices/platform/soc/78d9000.ehci/usb1/1-1/1-1.2/1-1.2:1.1/0003:046D:C52B.000E/input/input11
Sep 19 19:24:13 linaro-alip kernel: [ 1322.487948] hid-generic 0003:046D:C52B.000E: input: USB HID v1.11 Mouse [Logitech USB Receiver] on usb-78d9000.ehci-1.2/input1

And when I plug the cable back in I get this:

Sep 19 19:24:20 linaro-alip kernel: [ 1329.699059] msm_hsusb_host 78d9000.ehci: remove, state 1
Sep 19 19:24:20 linaro-alip kernel: [ 1329.699179] usb usb1: USB disconnect, device number 1
Sep 19 19:24:20 linaro-alip kernel: [ 1329.703903] usb 1-1: USB disconnect, device number 2
Sep 19 19:24:20 linaro-alip kernel: [ 1329.708544] usb 1-1.2: USB disconnect, device number 3
Sep 19 19:24:20 linaro-alip kernel: [ 1329.918384] msm_hsusb_host 78d9000.ehci: USB bus 1 deregistered
Sep 19 19:24:20 linaro-alip kernel: [ 1330.066630] msm_otg 78d9000.phy: Avail curr from USB = 100

I expected a little more activity right after the msm_otg connection, but this doesn’t seem to be happening. I did take a quick look at “make menuconfig”, and all the right things seem to be turned on.

Full disclosure: I am an employee of Qualcomm Canada, any opinions I may heve expressed in this or any other post may not reflect the opinions of my employer.


#4

I reloaded the Debian 17.06.1 (the same build I had been using), and tried again. This time “sudo modprobe g_ether” worked as expected.

root@linaro-alip:~# sudo modprobe g_ether
[   61.167172] using random self ethernet address
[   61.167229] using random host ethernet address
[   61.173003] usb0: HOST MAC 1a:6f:08:d0:14:ee
[   61.177150] usb0: MAC 32:01:88:d4:82:68
[   61.180285] using random self ethernet address
[   61.183772] using random host ethernet address
[   61.188419] g_ether gadget: Ethernet Gadget, version: Memorial Day 2008
[   61.192617] g_ether gadget: g_ether ready
root@linaro-alip:~# [   62.512046] g_ether gadget: high-speed config #2: RNDIS
[   62.512200] msm_otg 78d9000.phy: Avail curr from USB = 500
[   74.173057] msm_otg 78d9000.phy: Avail curr from USB = 2
[   75.063716] g_ether gadget: high-speed config #2: RNDIS
[   75.063865] msm_otg 78d9000.phy: Avail curr from USB = 500
[   79.224306] g_ether gadget: high-speed config #2: RNDIS
[   88.323301] random: crng init done
[  156.461604] g_ether gadget: high-speed config #2: RNDIS

Under Windows I now have a device:

Next challenge is to make a ssh connection to the RNDIS device, I haven’t figured that step out yet.

Full disclosure: I am an employee of Qualcomm Canada, any opinions I may heve expressed in this or any other post may not reflect the opinions of my employer.


#5

The basic solution is to use the micro-USB port on the DragonBoard as a virtual network connection to the host PC. Once you have a network connection to the PC you can run full X11 programs like the browser (chromium). I have only tested this on Windows 10, but I think it should be OK for other operating systems. Steps:

  1. Connect to the console serial port on a mezzanine. I’ll call this the putty connection.
  2. Make sure you have set up WSL and XMING on the host laptop see the steps below.
  3. Connect the second micro-USB cable from your laptop to the device port on the DragonBoard (this stops operation of any USB devices on the host ports)
  4. On the putty connection make the following changes (I am not sure if 4a and 4b are necessary)
    a. In the file /etc/network/interfaces add the following lines:
    auto usb0
    iface usb0 inet static
    address 192.168.44.2
    netmask 255.255.255.0
    gateway 192.168.44.3
    network 192.168.44.0
    broadcast 192.168.44.2
    b. In the file /etc/resolv.conf add the following line
    nameserver 192.168.44.2
    c. Run the command: sudo modprobe g_ether
    d. Run the command: sudo dhclient usb0 &
    e. Run the command: sudo ifconfig usb0 192.168.44.30 netmask 255.255.255.0
  5. Ensure that XMing is running on the host PC and start a bash terminal (WSL)
  6. On the bash terminal do the following
    a. run the command: ssh -X linaro@192.168.44.30
    b. log into the Dragonboard (password: linaro)
    c. Use the nmtui program to connect to the WiFi router
    d. Start the program chromium& and then log into the interstitial server.
  7. Once you are logged into the network you can continue to use the bash terminal over USB

Bugs: when you disconnect the laptop from the micro USB connection you can’t get it back without rebooting the dragonboard and redoing steps 4c,4d,and 4e. If someone can suggest a way to make the changes stick that would be good.

I also managed X11 running on my Windows 10 laptop through WiFi, it was really easy (well, to be honest, it wasn’t that easy the first time because I had one little thing wrong, but once I figured it out everything worked).

  1. Install WSL under Windows 10 see instructions at: https://msdn.microsoft.com/en-us/commandline/wsl/install_guide
  2. Install XMING (X11 windowing system) see: https://sourceforge.net/projects/xming/
  3. Start the Ubuntu bash shell (WSL) and edit the .bashrc on the laptop, add the following line to the bottom:
    export DISPLAY=localhost:0.0
  4. Determine the ip address of the Dragonboard by running the following command on the serial terminal (putty)
    ip addr
  5. Turn on X11Forwarding in /etc/ssh/sshd_config (I think this is turned on by default, or maybe when I installed the x11-utils, need to verify)
    X11Forwarding yes
    X11DisplayOffset 10
  6. Restart the DragonBoard so the sshd changes take effect.
  7. Start ssh under bash on the laptop and login (password linaro)
    ssh -X linaro@
  8. Test your X11 server and connection by running a simple program on the DragonBoard 410c:
    sudo apt-get install -y x11-apps
    xeyes

Full disclosure: I am an employee of Qualcomm Canada, any opinions I may heve expressed in this or any other post may not reflect the opinions of my employer.