# PX4 -> QGC connection through USB for VOXL2

Source: https://forum.modalai.com/topic/1115/px4-qgc-connection-through-usb-for-voxl2
Category: General Questions (https://forum.modalai.com/category/2/general-questions)
Posted: 2022-07-12 21:42:23 UTC by rohitpillai
Replies: 24 · Views: 3634

## rohitpillai · 2022-07-12 21:42:23 UTC

Is there a way to connect VOXL2 PX4 to QGC via USB? On the VOXL Flight this was done through the J1006 connector.

In addition to this, is there a J1003 (Connector on the VOXL Flight) equivalent on the VOXL2. This would allow me to connect a Crossfire Nano RX to it. 

Thanks!

## Reply by modaltb (ModalAI staff) · 2022-07-13 19:41:51 UTC

Not at this time.... but it's something I'm wanting to try out!!

I'm not clear if it's possible, but what I'm thinking of trying is UDP tunneling over ADB.

ADB supports TCP port forwarding, but our traffic from vehicle to QGC is UDP.... so I believe we can try a tunnel?

Here's the two links I was looking at trying:

https://developer.android.com/studio/command-line/adb#forwardports
http://www1.cs.columbia.edu/~lennox/udptunnel/

Throwing it out here in case someone already knows if this is possible or not!  If it is, I think it's an easy way to get the connection going....

## Reply by tom (ModalAI staff) · 2022-07-13 19:52:08 UTC

@rohitpillai Not exactly what you're looking for but you could also use one of the supported ethernet dongles attached via. USB to JST to a VOXL2 add-on board and route PX4 traffic through there to your ground station. As seen here: https://docs.modalai.com/voxl2-hardware-setup/#ethernet-connectivity

## Reply by rohitpillai · 2022-07-14 22:34:10 UTC

Thank you for your replies! I will check these links out.

## Reply by Sarika Sharma · 2026-01-28 10:45:47 UTC (in reply to modaltb)

@modaltb Hii, is there any update on this?

## Reply by tom (ModalAI staff) · 2026-02-03 21:51:11 UTC (in reply to Sarika Sharma)

@Sarika-Sharma It's not something we currently support

## Reply by Alex Kushleyev (ModalAI staff) · 2026-02-05 04:33:36 UTC (in reply to tom)

@Sarika-Sharma ,

We discussed this internally and we will make an effort to formalize enabling the instructions (in a script) in the near future, but there is a relatively short way of enabling TCP/IP communication between VOXL2 and a QGC host. Please try these instructions and let us know if that works for you or what issue you run in to.

Basically, there is a command to enable the usb gadget in the kernel and this creates the network interface which you then have to configure on both sides. You can change the IP range if necessary.

Alex

```
# VOXL2 Setup
# Begin by configuring the usb gadget
sed -i '/ln -s functions\/ffs.adb configs\/c.1\/f2/a \ ln -s functions\/ncm.0 configs\/c.1\/f3 2>\/dev\/null | true' /sbin/usb/compositions/901D

# Next setup a udev rule to give our NCM device a static IP (192.168.7.2)
echo 'ACTION=="add", SUBSYSTEM=="net", KERNEL=="usb0", RUN+="/bin/sh -c '"'"'sleep 2; /sbin/ifconfig usb0 192.168.7.2 netmask 255.255.255.0 up'"'"'"' > /etc/udev/rules.d/80-usb-ncm.rules

# Reboot VOXL2

# Check usb0 network device
voxl2:/$ ifconfig usb0
usb0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.7.2  netmask 255.255.255.0  broadcast 192.168.7.255
        inet6 fe80::935f:1a09:ab1d:d2fb  prefixlen 64  scopeid 0x20<link>
        ether 56:77:2d:6c:84:9b  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

# Host Side Configuration
- note that a network manager may rename the device from usb0 to something else..

ifconfig usb0
usb0: flags=4098<BROADCAST,MULTICAST>  mtu 1500
        ether fa:74:5a:f3:2b:88  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

#bring up the interface and set it to static ip
sudo ip addr add 192.168.7.1/24 dev usb0 
sudo ip link set usb0 up

# Can also use Network manager to configure the network interface for a static configuration
- address 192.168.7.1
- netmask 255.255.255.0
- gateway 192.168.7.1

# ping VOXL2 from linux host
- ping 192.168.7.2

#set up QGC
- use ip address:port : 192.168.7.2:14550

You can also use other network tools like ssh, etc, to communicate to the host, but this setup does not enable you to communicate from VOXL2 to outside world (using NAT to enable internet access via the host)
```

## Reply by Sarika Sharma · 2026-02-05 07:27:13 UTC (in reply to Alex Kushleyev)

Thankyou so much @Alex-Kushleyev 
This setup solves my use case where Wi-Fi is not available. Thanks for the support — looking forward to the scripted version in the future.

Best regards,
Sarika

## Reply by Sarika Sharma · 2026-02-05 11:04:40 UTC (in reply to Sarika Sharma)

What is the recommended workflow to switch  between usb0 and wlan0 ????
as when i tried to use voxl-wifi in station mode ,it configured succesfully. 
But current IP is still: 
voxl2-mini-test-fixture (TF-M0104):~$ voxl-my-ip
usb0: 192.168.7.2
voxl2-mini-test-fixture (TF-M0104):~$

## Reply by Alex Kushleyev (ModalAI staff) · 2026-02-06 14:21:14 UTC (in reply to Sarika Sharma)

@Sarika-Sharma ,

If you have multiple active network interfaces, then you need to set up routing rules using standard linux network tools (`ip route ..`). You can check the current routes using `ip route list` on voxl2.

`voxl-my-ip` script probably just returns the first available ip address. you can use `ifconfig` to check all the interfaces.

As an example... assuming your wifi ip range is 192.168.10.x (192.168.10.1 is the wifi router's ip address) and usb0 is 192.168.7.x

```
# route to the Linux host (192.168.7. subnet) via usb0
sudo ip route add 192.168.7.0/24 via 192.168.7.1 dev usb0

# default route for all other traffic via wlan0
sudo ip route add default via 192.168.10.1 dev wlan0
```

If you want to make these routes persistent you will have to edit `/etc/network/interfaces`.. Please check Linux networking documentation.

Alex

## Reply by bendraper · 2026-04-01 18:04:13 UTC (in reply to Alex Kushleyev)

@Alex-Kushleyev Should this work on a Voxl to Windows computer connection? I ran the sed and udev rule commands and how the voxl does indeed come up as an ethernet device upon connecting (UsbNcm Host Device) and I can set up the static IPs appropriately, but I cannot ping one to the other for some reason. I can still use the port as an ADB interface and I thought maybe that was the issue but doing adb kill-server on the windows side still doesn't do the trick

## Reply by bendraper · 2026-04-01 19:17:01 UTC (in reply to Alex Kushleyev)

@Alex-Kushleyev I saw a post from @tom from a few years ago discussing how there should be the necessary drivers to support an RNDIS gadget so I assume that is my issue. Any insight on how to enable that?

```
[Apr 1 19:15] configfs-gadget gadget: Wrong NDP SIGN
[ +12.232553] usbpd usbpd0: Type-C Source (default) connected
[  +0.019411] usbpd usbpd0: USB Type-C disconnect
[  +0.004363] android_work: sent uevent USB_STATE=DISCONNECTED
[  +0.001100] msm-dwc3 a600000.ssusb: DWC3 in low power mode
[  +3.492478] usbpd usbpd0: Type-C Source (medium - 1.5A) connected
[  +0.113740] msm-usb-ssphy-qmp 88e8000.ssphy: USB DP QMP PHY: Update TYPEC CTRL(3)
[  +0.057403] msm-dwc3 a600000.ssusb: DWC3 exited from low power mode
[  +0.068603] usbpd usbpd0: Type-C Source (high - 3.0A) connected
[  +0.238255] android_work: sent uevent USB_STATE=CONNECTED
[  +0.041534] configfs-gadget gadget: high-speed config #1: c
[  +0.000644] android_work: sent uevent USB_STATE=CONFIGURED
[  +0.195765] usbpd usbpd0: Type-C Source (medium - 1.5A) connected
[  +0.021780] usbpd usbpd0: Type-C Source (high - 3.0A) connected
[  +0.179818] configfs-gadget gadget: Wrong NDP SIGN
[  +0.000172] configfs-gadget gadget: Wrong NDP SIGN
[  +0.069075] configfs-gadget gadget: Wrong NDP SIGN
[  +0.002827] configfs-gadget gadget: Wrong NDP SIGN
[  +0.176097] configfs-gadget gadget: Wrong NDP SIGN
[  +0.001314] configfs-gadget gadget: Wrong NDP SIGN
[  +0.001331] configfs-gadget gadget: Wrong NDP SIGN
[  +0.250721] configfs-gadget gadget: Wrong NDP SIGN
[  +0.491456] configfs-gadget gadget: Wrong NDP SIGN
[  +0.000164] configfs-gadget gadget: Wrong NDP SIGN
[  +0.000446] configfs-gadget gadget: Wrong NDP SIGN
[  +0.067507] configfs-gadget gadget: Wrong NDP SIGN
[  +0.000984] configfs-gadget gadget: Wrong NDP SIGN
[  +0.012649] configfs-gadget gadget: Wrong NDP SIGN
[  +0.183993] configfs-gadget gadget: Wrong NDP SIGN
[  +0.001107] configfs-gadget gadget: Wrong NDP SIGN
[  +0.211788] configfs-gadget gadget: Wrong NDP SIGN
[  +0.030077] configfs-gadget gadget: Wrong NDP SIGN
```

## Reply by Alex Kushleyev (ModalAI staff) · 2026-04-01 19:50:53 UTC (in reply to bendraper)

@bendraper , If you see an ethernet connection to VOXL2 show up on your Windows host, then the usb gadget is properly configured on VOXL2. Perhaps something else is going on. Are you assigning a static ip on your host that is on the same subnet as VOXL2?

You should try to repeat the same test on a linux machine (or virtual machine) to see if you can get a working connection.

Alex

## Reply by bendraper · 2026-04-01 19:57:19 UTC (in reply to Alex Kushleyev)

@Alex-Kushleyev Yea I can get a connection on a linux machine with no issue. I do need to get it working on a Windows machine  for my purposes though. I definitely have the static IP setup correctly. I tried populating the gateway and also not populating it. I confirmed in powershell that there is indeed a route present for that traffic, but they do not want to communicate with each other. Some quick research seems to suggest Windows is very finicky with the CDC NCM protocol and it is more suited to work with an RNDIS interface. Were you able to ping/ssh to a voxl via an ethernet interface on the usb-c port to a windows machine using just the commands you listed above in this post?

## Reply by Alex Kushleyev (ModalAI staff) · 2026-04-01 20:34:44 UTC (in reply to bendraper)

@bendraper , I just tried this on a Windows 11 VM and even though i was able to see a network device appear in the VM and i configured the IPv4 properties, I cannot ping or ssh. It seems consistent with what you are seeing.

## Reply by bendraper · 2026-04-01 21:02:51 UTC (in reply to Alex Kushleyev)

@Alex-Kushleyev It looks like someone on the forums maybe had success setting up the interface as an RNDIS gadget. I'll try to mess with it some more but let me know if you find a solution. Thanks!

## Reply by Alex Kushleyev (ModalAI staff) · 2026-04-02 13:41:02 UTC (in reply to bendraper)

@bendraper , I will ask around.

## Reply by bendraper · 2026-04-02 14:32:29 UTC (in reply to Alex Kushleyev)

@Alex-Kushleyev So I can see a gadget functionality called gsi.rndis (I'd expect something called rndis.0 or something but maybe that is irrelevant) but when I change the line in /sbin/usb/compositions/901D to use gsi.rndis instead of ncm.0, my network interface on windows disappears and I can no longer ADB. I'd imagine there's something at the kernal level that doesn't like that but I'm out of my wheelhouse there. Setting it back to ncm.0 returns to the previous state but still cannot ping. Wireshark doesn't even see anything happening over that interface

## Reply by Zachary Lowell 0 · 2026-04-06 15:32:10 UTC

Hi All - gonna spend a bit of time looking into this today so I can get some context on the problem.

Zach

## Reply by qt · 2026-04-09 17:54:34 UTC (in reply to Alex Kushleyev)

@Alex-Kushleyev 
That's not perfect but I created a shell script based on https://docs.modalai.com/qgc-via-adb/ for the drone configuraiton.
For my PC configuration, I created an udev rule to force an interface name since usb0 is renamed in "enx******". My udev rule can only work with my drone (I think). To define IP address, I add a conf file in /etc/systemd/network/
I have only tested on my linux and it works perfectly :
```bash
#!/usr/bin/env bash
set -euo pipefail

# See ModalAI doc : https://docs.modalai.com/qgc-via-adb/

UDEV_RULE_DRONE="/etc/udev/rules.d/80-usb-ncm.rules"
UDEV_RULE_PC="/etc/udev/rules.d/99-voxl-usb-ncm.rules"
SYSTEMD_CONF_PC="/etc/systemd/network/10-voxl0.network"

USB_COMP_QUALCOM="/sbin/usb/compositions/901D"

# Network configuration
USB_IFACE="usb0"
USB_NET="192.168.7.0/24"
PC_IP="192.168.7.1"
DRONE_IP="192.168.7.2"
NM_CONN_NAME="voxl-usb-ncm"

show_help() {
    echo "Usage: $0 [--pc] [--drone] [--uninstall]"
    echo
    echo "Enable USB NCM networking for ModalAI VOXL / Starling 2 Max"
    echo
    echo "Options:"
    echo "  --pc         Configure host PC only"
    echo "  --drone      Configure drone via adb only"
    echo "  --uninstall  Remove configuration"
    echo "  --help       Show this help"
    echo
    echo "Defaults: if neither --pc nor --drone is provided, both are processed."
}

do_pc_install() {
    echo "[INFO][PC] Installing udev rule for VOXL USB NCM"

    cat > "$UDEV_RULE_PC" <<EOF
SUBSYSTEM=="net", ACTION=="add", ATTRS{idVendor}=="05c6", ATTRS{idProduct}=="901d", ATTRS{serial}=="890d035c", NAME="voxl0"
EOF

    echo "[INFO][PC] Creating systemd-networkd config for voxl0"

    cat > "$SYSTEMD_CONF_PC" <<EOF
[Match]
Name=voxl0

[Network]
Address=${PC_IP}/24
LinkLocalAddressing=no
IPv6AcceptRA=no
EOF

    echo "[INFO][PC] Reloading udev rules"
    udevadm control --reload-rules
    udevadm trigger

    echo "[INFO][PC] Restarting systemd-networkd"
    systemctl restart systemd-networkd

    echo "[INFO][PC] PC installation complete"
}

do_pc_uninstall() {
    echo "[INFO][PC] Removing PC configuration"

    if [ -f "$UDEV_RULE_PC" ]; then
      rm -f "$UDEV_RULE_PC"
      echo "[INFO][PC] Removed udev rule"
    fi

    if [ -f "$SYSTEMD_CONF_PC" ]; then
      rm -f "$SYSTEMD_CONF_PC"
      echo "[INFO][PC] Removed systemd-networkd config"
    fi

    echo "[INFO][PC] Reloading udev rules"
    udevadm control --reload-rules
    udevadm trigger

    echo "[INFO][PC] Restarting systemd-networkd"
    systemctl restart systemd-networkd

    echo "[INFO][PC] PC uninstallation complete"
}

do_drone_install() {
    echo "[INFO][DRONE] Enabling USB NCM networking on VOXL via adb"

    adb root
    adb remount

    echo "[INFO][DRONE] Updating USB composition in Qualcomm script \
$USB_COMP_QUALCOM configure the usb gadget with \
the addition of the function NCM"
    echo "[INFO][DRONE] In $USB_COMP_QUALCOM, \
add the line 'ln -s functions/ncm.0 configs/c.1/f3 2>/dev/null | true' \
just after the line 'ln -s functions/ffs.adb configs/c.1/f2'"
    
    adb shell "sed -i '/ln -s functions\\/ffs.adb configs\\/c.1\\/f2/a \
    \\        ln -s functions\\/ncm.0 configs\\/c.1\\/f3 2>\\/dev\\/null | true' \
    $USB_COMP_QUALCOM"

    echo "[INFO][DRONE] Creating udev rule $UDEV_RULE_DRONE for usb0 with IP ${DRONE_IP}"
    
    adb shell "cat << 'EOF' > $UDEV_RULE_DRONE
ACTION==\"add\", SUBSYSTEM==\"net\", KERNEL==\"usb0\", \
RUN+=\"/bin/sh -c 'sleep 2; /sbin/ifconfig usb0 ${DRONE_IP} netmask 255.255.255.0 up'\"
EOF"

    echo "[INFO][DRONE] NCM enabled — reboot required"
}

do_drone_uninstall() {
    echo "[INFO][DRONE] Removing NCM configuration"

    adb root
    adb remount

    echo "[INFO][DRONE] Removing udev rule $UDEV_RULE_DRONE"
    adb shell "rm -f $UDEV_RULE_DRONE || true"

    echo "[INFO][DRONE] Reverting USB composition (901D)"
    adb shell "
    sed -i '/ln -s functions\\/ncm.0 configs\\/c.1\\/f3/d' \
    $USB_COMP_QUALCOM
    "

    echo "[INFO][DRONE] USB NCM configuration removed"
    echo "[INFO][DRONE] Reboot required to fully apply changes"
}

# Arg parsing
TARGET_PC=false
TARGET_DRONE=false
DO_UNINSTALL=false

for arg in "$@"; do
  case "$arg" in
    --help) show_help; exit 0 ;;
    --pc) TARGET_PC=true ;;
    --drone) TARGET_DRONE=true ;;
    --uninstall) DO_UNINSTALL=true ;;
    *)
      echo "[ERROR] Unknown argument: $arg";
      show_help;
      exit 1 ;;
  esac
done

# Default to both if none selected
if ! $TARGET_PC && ! $TARGET_DRONE; then
  TARGET_PC=true
  TARGET_DRONE=true
fi

# Execute
if $DO_UNINSTALL; then
  $TARGET_PC && do_pc_uninstall
  $TARGET_DRONE && do_drone_uninstall
else
  $TARGET_PC && do_pc_install
  $TARGET_DRONE && do_drone_install
fi

echo "[INFO] All done."
``
```

## Reply by bendraper · 2026-04-13 17:58:18 UTC (in reply to Zachary Lowell 0)

@Zachary-Lowell-0 Hey Zach did you discover anything in this effort? I played around with recompiling the kernel to include the CONFIG_USB_CONFIGFS_RNDIS=y flag and confirmed it took on my Voxl 2 Mini, and can see the existence of a new rndis.rndis function in the usb gadget functions directory, but when I try to reconfigure the 901D config file, I end up just breaking the USB port entirely.

## Reply by Zachary Lowell 0 · 2026-04-14 14:13:04 UTC

@qt said in [PX4 \-> QGC connection through USB for VOXL2](/post/25720):
> name

@bendraper I kind of redid exactly what you described above and ran into very similar issue in the sense that it basically rocked my usb-c port. All this to say, I think we should choose a different route - is it possible instead to route the packets via adb over the USB-C port instead to basically get the same result? Point the software to the serial connection and leverage ADB to pull the packets that are forwarded? Basically creating our own sudo rndis connection almost.

Zach

## Reply by bendraper · 2026-04-14 20:24:40 UTC (in reply to Zachary Lowell 0)

@Zachary-Lowell-0 This would probably work but for my use case I cannot guarantee ADB being an option unfortunately.

## Reply by Alex Kushleyev (ModalAI staff) · 2026-04-17 18:41:39 UTC (in reply to bendraper)

@bendraper , have you considered running a docker container (VM) on your Windows machine with a minimal Linux kernel that would use the Linux drivers for NCM and create the proper network connection between VOXL2 and Linux container. Then you could potentially set up the routing table in Windows so that it can access the device via the Linux container and linux container may need to have some networking magic down as well to pass through the communication?

Alex

## Reply by Zachary Lowell 0 · 2026-04-20 14:55:55 UTC

^^^ This is the next best option outside of ADB IMO - nice suggestion @Alex-Kushleyev
