Skip to content

stiad/dji-rc-linux

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dji-rc-linux

DJI RC (RM330)

Linux joystick driver for DJI RC smart controllers. Connects to the controller over WiFi and exposes it as a standard virtual joystick via uinput.

Supported Hardware

Confirmed working:

  • DJI RC (RM330)

Likely compatible (same Android/DUML platform — untested):

  • DJI RC 2
  • DJI RC Pro (RM510)
  • DJI Smart Controller (RM500)
  • DJI RC Pro Enterprise

If you test with a different model, please open an issue to let us know!

Features

  • Auto-discovers the RC on your local network (no IP needed)
  • 4 stick axes, 2 back wheel axes, 6 buttons, flight mode switch
  • Persistent TCP connection with DUML keepalive (~9 Hz update rate)
  • Works with any game, simulator, or application that supports joysticks
  • Single C file, minimal dependencies

Input Mapping

Input Joystick Axis/Button
Left stick horizontal ABS_X
Left stick vertical ABS_Y
Right stick horizontal ABS_RX
Right stick vertical ABS_RY
Left back wheel ABS_Z
Right back wheel ABS_RZ
Flight mode (S/N/C) ABS_MISC (0/1/2)
RTH / Flight Pause Button 0
Record Button 1
Camera (half-press) Button 2
Camera (full-press) Button 3
C1 (left back) Button 4
C2 (right back) Button 5

Dependencies

  • libncurses-dev — for the --visual mode
# Debian/Ubuntu
sudo apt install libncurses-dev

# Fedora/RHEL
sudo dnf install ncurses-devel

# Arch
sudo pacman -S ncurses

Building

mkdir build && cd build
cmake ..
cmake --build .

Usage

Make sure the RC is powered on and connected to the same WiFi network as your computer.

# Auto-detect the RC and create a virtual joystick
sudo ./dji-rc-joystick

# Specify the IP manually
sudo ./dji-rc-joystick 192.168.7.251

# Visual mode — ncurses controller display
sudo ./dji-rc-joystick -V

# Debug mode — print live values
sudo ./dji-rc-joystick -d

# Test mode — print values without creating a joystick
sudo ./dji-rc-joystick -t

# Raw mode — show all channel values (for debugging)
sudo ./dji-rc-joystick -R

Root (or uinput permissions) is required to create the virtual joystick device.

Options

-p, --port PORT    TCP port [default: 40007]
-d, --debug        Print live axis values
-t, --test         Test mode: print values without creating joystick
-R, --raw          Raw mode: show ALL channel values
-V, --visual       Visual mode: ncurses controller display
-h, --help         Show this help

How It Works

The DJI RC smart controllers run Android internally and expose an undocumented TCP service on port 40007. When a client connects, the controller streams DJI DUML protocol packets containing real-time RC channel data (stick positions, wheel positions, and button states).

This driver:

  1. Discovers the RC by scanning the local network for port 40007 + DUML protocol magic bytes
  2. Maintains a persistent TCP connection, sending periodic DUML keepalive commands to sustain data flow
  3. Parses DUML packets (cmd_set=0x06, cmd_id=0xAE) to extract signed 16-bit channel values
  4. Decodes the byte-interleaved axis encoding into proper stick/wheel positions
  5. Maps everything to a virtual joystick created via Linux uinput

Contributing

If you test this with a different DJI RC model, please open an issue with your results — even if it doesn't work. Bug reports and pull requests are welcome.

If you find this useful, a star helps others discover the project.

License

MIT — see LICENSE.

About

Linux joystick driver for DJI RC smart controllers. Connects to the controller over WiFi and exposes it as a standard virtual joystick via uinput.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors