USB Networking¶
Connect your PicoCalc directly to your computer via USB for fast, convenient network access without requiring WiFi or additional network infrastructure.
Overview¶
Calculinux includes built-in USB gadget networking support that makes your PicoCalc appear as a USB Ethernet adapter when connected to a host computer. This provides:
- 🔌 Direct connection - No WiFi or router needed
- 🚀 Fast transfer speeds - USB 2.0 High-Speed (480 Mbps)
- 🔒 Secure - Direct connection without wireless exposure
- 🌐 Internet sharing - Host can share its internet connection
- 💻 Cross-platform - Works with Linux, macOS, and Windows
The USB gadget uses a single configuration mode where you can select the network protocol:
- ECM (CDC-Ether) - Default, native Linux/macOS protocol (recommended)
- RNDIS - Windows compatibility (configure via
/etc/default/usb-gadget-network)
By default, the device uses ECM which works natively on Linux and macOS without additional drivers. For Windows support, you can switch to RNDIS mode.
Quick Start¶
- Connect your PicoCalc to your computer via USB cable
- Configure the network interface on your host (see platform-specific sections below)
- Connect to your PicoCalc:
Network Configuration¶
The PicoCalc USB network interface is configured to support both static IP and DHCP:
- Static IP: 192.168.7.2/24 (fallback)
- DHCP: Automatically configured if host provides DHCP server
- Interface:
usb0
Your host computer should be configured with:
- IP Address: 192.168.7.1/24 (for static configuration)
- DHCP Server: Optional, for automatic configuration
Host Configuration¶
Linux Desktop¶
GNOME (NetworkManager)¶
GNOME's default NetworkManager makes USB networking simple:
Automatic Setup (Recommended)¶
- Connect your PicoCalc via USB
- Click the network icon in the top bar
- Look for a new wired connection (may show as "USB Ethernet" or "Wired connection 2")
- Click the connection to view settings
-
Click the gear icon ⚙️ next to the connection
-
Option A: With Internet Sharing (DHCP)
-
Go to the IPv4 tab
- Set Method to: Shared to other computers
- Click Apply
This automatically:
- Assigns an IP to the host (typically 10.42.0.1)
- Runs a DHCP server for the PicoCalc
- Shares your internet connection via NAT
Your PicoCalc will automatically get an IP address via DHCP!
-
Option B: Direct Connection (Static)
-
Go to the IPv4 tab
- Set Method to: Manual
- Click Add under Addresses:
- Address:
192.168.7.1 - Netmask:
24 - Gateway: (leave empty)
- Address:
- Click Apply
Command Line Setup¶
Create a NetworkManager connection:
# For internet sharing (DHCP)
nmcli connection add type ethernet ifname usb0 \
con-name "PicoCalc USB" \
ipv4.method shared
# For direct connection (static)
nmcli connection add type ethernet ifname usb0 \
con-name "PicoCalc USB" \
ipv4.method manual \
ipv4.addresses 192.168.7.1/24
# Activate the connection
nmcli connection up "PicoCalc USB"
To switch between shared and static:
# Switch to shared (with internet)
nmcli connection modify "PicoCalc USB" ipv4.method shared
nmcli connection up "PicoCalc USB"
# Switch to static (direct only)
nmcli connection modify "PicoCalc USB" \
ipv4.method manual \
ipv4.addresses 192.168.7.1/24
nmcli connection up "PicoCalc USB"
KDE Plasma (NetworkManager)¶
KDE also uses NetworkManager with a different interface:
- Connect your PicoCalc via USB
- Click the network icon in the system tray
- Click Configure Network Connections...
- Find the new USB Ethernet connection (or click + to add a new connection)
-
Select Ethernet as the connection type
-
Option A: With Internet Sharing (DHCP)
-
In the IPv4 tab, set Method to: Shared
-
Click OK then Apply
-
Option B: Direct Connection (Static)
-
In the IPv4 tab, set Method to: Manual
- Click Add next to Addresses:
- Address:
192.168.7.1 - Netmask:
24or255.255.255.0
- Address:
- Click OK then Apply
The command-line approach (using nmcli) also works in KDE since it uses NetworkManager.
systemd-networkd¶
If your system uses systemd-networkd instead of NetworkManager:
For internet sharing (with DHCP):
- Create
/etc/systemd/network/50-usb-picocalc.network:
[Match]
Name=usb0
[Network]
Address=10.42.0.1/24
DHCPServer=yes
IPMasquerade=yes
[DHCPServer]
PoolOffset=100
PoolSize=50
EmitDNS=yes
DNS=1.1.1.1 8.8.8.8
- Enable IP forwarding:
echo "net.ipv4.ip_forward=1" | sudo tee /etc/sysctl.d/50-ip-forward.conf
sudo sysctl -p /etc/sysctl.d/50-ip-forward.conf
- Restart networking:
For direct connection (static):
- Create
/etc/systemd/network/50-usb-picocalc.network:
- Restart networking:
macOS¶
- Connect your PicoCalc via USB
- Open System Settings (or System Preferences on older versions)
- Go to Network
- The USB device should appear (may show as "CDC Composite Gadget" or "USB 10/100 LAN")
-
Select the USB device
-
Option A: Automatic (Internet Sharing)
-
Go back to System Settings → General → Sharing
- Select Internet Sharing in the sidebar
- Set "Share your connection from:" to your active connection (Wi-Fi or Ethernet)
- Check the box next to the USB Ethernet device
- Enable Internet Sharing
macOS will automatically configure DHCP for the PicoCalc!
-
Option B: Manual Configuration
-
Click Details
- Go to the TCP/IP tab
- Set Configure IPv4: Manually
- Enter:
- IP Address:
192.168.7.1 - Subnet Mask:
255.255.255.0
- IP Address:
- Click OK
Windows¶
RNDIS Mode Required
Windows requires the USB gadget to be in RNDIS mode. The default ECM mode will not work on Windows.
See the Configuration section above to switch to RNDIS mode.
Note
Windows requires RNDIS drivers, which are built-in for Windows 10/11.
- Configure PicoCalc for RNDIS mode (see Configuration section)
- Connect your PicoCalc via USB
- Windows should detect it as "RNDIS/Ethernet Gadget"
- If driver installation is needed, Windows should install it automatically
Configure the network:
- Open Settings → Network & Internet → Ethernet
- Click the RNDIS/Ethernet Gadget adapter
-
Click Edit next to IP assignment
-
Option A: For Internet Sharing
-
Use Windows' Internet Connection Sharing (ICS):
- Open Control Panel → Network and Sharing Center
- Click your internet-connected adapter
- Click Properties
- Go to the Sharing tab
- Check "Allow other network users to connect through this computer's Internet connection"
- Select the RNDIS adapter from the dropdown
- Click OK
Windows will automatically configure DHCP (typically 192.168.137.x range).
-
Option B: Manual Configuration
-
Set to Manual
- Enter:
- IP address:
192.168.7.1 - Subnet prefix length:
24 - Gateway: (leave empty)
- IP address:
- Click Save
Connecting to Your PicoCalc¶
Once the network is configured, you can access your PicoCalc:
SSH Access¶
Or if using DHCP/internet sharing, check the assigned IP:
File Transfer¶
Using SCP:
# Copy file to PicoCalc
scp myfile.txt pico@192.168.7.2:/home/pico/
# Copy file from PicoCalc
scp pico@192.168.7.2:/home/pico/myfile.txt ./
Using SFTP:
Package Management¶
With internet sharing enabled, you can install packages on your PicoCalc:
Verifying Connection¶
On Host Computer¶
Check if interface is up:
# Linux/macOS
ip link show usb0 # or the actual interface name
# Should show state UP
# Windows
ipconfig
# Look for the RNDIS/Ethernet Gadget adapter
Test connectivity:
On PicoCalc¶
Via serial console or existing network connection:
# Check if usb0 is configured
ip addr show usb0
# Check if service is running
systemctl status usb-gadget-network
# Test connectivity to host
ping 192.168.7.1 # or your DHCP-assigned gateway
Troubleshooting¶
Device Not Appearing¶
Check Protocol Configuration:
First, verify you're using the correct protocol for your host OS:
# On PicoCalc - check current protocol
grep USB_PROTOCOL /etc/default/usb-gadget-network
# Should be:
# USB_PROTOCOL=ecm # for Linux/macOS
# USB_PROTOCOL=rndis # for Windows
On PicoCalc:
- Check if the USB gadget service is running:
- Restart the service if needed:
- Check kernel modules:
- Check USB gadget configuration:
ls /sys/kernel/config/usb_gadget/g1/UDC
# Check which function is active:
ls /sys/kernel/config/usb_gadget/g1/functions/
# Should show either ecm.usb0 or rndis.usb0 (not both)
On Host:
- Try a different USB cable (must support data, not just charging)
- Try a different USB port
- Check system logs for USB device detection
Cannot Ping PicoCalc¶
- Verify IP configuration on both host and device:
-
Check firewall rules on host computer
-
Verify cable connection - must be a data cable, not power-only
No Internet on PicoCalc (with Sharing Enabled)¶
On PicoCalc:
- Check if you got an IP via DHCP:
- Check default route:
- Check DNS:
- Test connectivity:
On Host (Linux):
- Verify IP forwarding is enabled:
- Check NAT rules (if using manual configuration):
DHCP Not Working¶
If PicoCalc doesn't get an IP via DHCP:
-
Verify host DHCP server is running (automatic with "Shared" mode in NetworkManager)
-
On PicoCalc, check systemd-networkd logs:
- Restart network on PicoCalc:
- Fallback to static IP - PicoCalc will use 192.168.7.2 if DHCP fails
Configuration¶
Switching Between ECM and RNDIS¶
The USB network protocol can be configured by editing /etc/default/usb-gadget-network on the PicoCalc:
To use ECM (default - Linux/macOS):
# Edit the configuration file
sudo nano /etc/default/usb-gadget-network
# Set or verify:
USB_PROTOCOL=ecm
# Restart the USB gadget service
sudo systemctl restart usb-gadget-network
To use RNDIS (Windows):
# Edit the configuration file
sudo nano /etc/default/usb-gadget-network
# Change to:
USB_PROTOCOL=rndis
# Restart the USB gadget service
sudo systemctl restart usb-gadget-network
Reconnection Required
After changing the protocol and restarting the service, you need to unplug and replug the USB cable for the host to detect the new configuration.
Protocol Selection
- Use ECM if you primarily use Linux or macOS - it's native and doesn't require special drivers
- Use RNDIS if you primarily use Windows - it requires the RNDIS driver but provides better Windows compatibility
- You cannot use both simultaneously; the device operates in one mode at a time
Advanced Topics¶
Network Configuration Details¶
The PicoCalc uses dual IP addressing for maximum compatibility:
- Static IP:
192.168.7.2/24- Always available as a fallback - DHCP: Automatically acquires an IP when the host provides DHCP (via internet sharing)
This configuration is handled by systemd-networkd and is defined in /lib/systemd/network/usb0.network:
When internet sharing is enabled on the host:
- The PicoCalc will acquire a second IP via DHCP (e.g.,
10.42.0.247/24on Linux) - The static IP
192.168.7.2remains active - Internet traffic uses the DHCP-assigned gateway
- You can SSH to either IP address
Custom IP Ranges¶
To use a different static IP range:
- Edit
/lib/systemd/network/usb0.network:
- Restart systemd-networkd:
Note
The DHCP-assigned IP is controlled by your host computer's network sharing configuration and cannot be changed on the PicoCalc.
Multiple Simultaneous Connections¶
You can use USB networking alongside WiFi:
- WiFi for internet access
- USB for fast file transfers and SSH access
Both interfaces can be active simultaneously. The PicoCalc will route traffic appropriately based on the default route.
Security Considerations¶
Security Note
When enabling internet sharing, your PicoCalc becomes accessible to anyone who can access your host computer's network (if the host is on a shared network).
Best practices:
- Only join networks that you trust
- Use strong passwords for the
picoandrootaccounts - Keep your system updated
- Disable SSH password authentication and use SSH keys
USB Serial Console¶
The USB gadget also exposes a USB serial console using the ACM (Abstract Control Model) function. This provides an additional login prompt over USB, accessible at 1500000 baud.
Accessing the Console¶
On Linux/macOS:
The device appears as /dev/ttyACM0 (Linux) or /dev/tty.usbmodem* (macOS):
# Linux - using screen
screen /dev/ttyACM0 1500000
# Linux - using miniterm
python3 -m serial.tools.miniterm /dev/ttyACM0 1500000
# macOS - using screen
screen /dev/tty.usbmodem* 1500000
On Windows:
The device appears as a COM port in Device Manager:
- Open Device Manager and note the COM port number (e.g., COM3)
- Use PuTTY or another serial terminal:
- Connection type: Serial
- Serial line: COM3 (or your port)
- Speed: 1500000
Login¶
Once connected, you'll see a login prompt:
Login with:
- Username:
pico - Password:
calc
USB Serial vs Hardware Serial
Both serial console options use 1500000 baud:
- USB Serial (
/dev/ttyACM0on host,/dev/ttyGS0on device): Provided by USB gadget ACM function - Hardware Serial (
/dev/ttyUSB0on host): Physical UART bridge (CH340) on PicoCalc USB-C port
See Serial Console Access for the hardware serial connection.
ADB over USB (Experimental)¶
Currently Disabled by Default
ADB support is included but disabled by default due to initialization complexity. The FunctionFS interface used by ADB requires special setup where the userspace daemon must be running before the gadget function can be bound. For this and other reasons, this interface is not yet fully tested.
Calculinux can expose ADB over the same USB gadget using FunctionFS. This runs a patched adbd that works without Android, mounted via ConfigFS. This was ported from Luckfox's buildroot SDK and the patches were updated to a newer version of adbd to support more modern OpenSSL libraries.
Enabling ADB¶
To enable ADB (advanced users):
- Edit
/etc/default/usb-gadget-networkand setENABLE_ADB=1 - Ensure the adbd service will start before the gadget binds:
- Restart the USB gadget:
Prerequisites¶
- Host has Android Platform Tools (adb) installed
- usb-gadget-network service enabled
- adbd service running before the USB gadget binds
Configure adbd auth and transport¶
- Set a password (preferred): create
/etc/adbd.passwd(plaintext) or/etc/adbd.passwd.md5(md5 hash). Example:
- Runtime defaults:
/etc/default/adbd ADB_SECURE=1(default) enforces password prompt via/usr/bin/adbd-auth.shADB_TCP_PORT=0keeps ADB on USB only; set to5555if you also want TCPADBD_AUTH_COMMANDcan point to a custom helper if needed
Host connection¶
- Plug PicoCalc via USB and wait for usb-gadget-network + adbd
-
On host, restart adb and list devices:
-
Connect (accept password prompt):
If you enabled TCP (
ADB_TCP_PORT=5555), connect withadb connect 192.168.7.2:5555.
ADB Troubleshooting¶
- Check FunctionFS mount:
mount | grep functionfs - Inspect gadget functions:
ls /sys/kernel/config/usb_gadget/g1/functions - View adbd logs:
journalctl -u adbd -f - If host does not see ADB:
adb kill-server, replug USB, verifyENABLE_ADB=1, ensureusb_f_fsmodule is loaded, and verify adbd is running
See Also¶
- Basic Usage - General PicoCalc usage
- WiFi Configuration - Alternative connectivity
- Network Troubleshooting - More troubleshooting tips
- Serial Console Access - Alternative access method