Skip to content

Tips, tricks, and hacks

D3VL Jack edited this page Sep 28, 2022 · 24 revisions

This page will have instructions for cool things to do with your DJI gear.

Flashing firmware on rooted devices via adb

Obtain the appropriate Android firmware package file (extracted from DDD packages via dji-firmware-tools). Make sure you are able to connect to your device via adb.

On the host PC:

adb push path/to/fw/file.bin /cache/ota.zip
adb shell

If on Air Side or V1 Goggles, skip on V2 Goggles:

while mount | grep -q '/proc/cmdline' -q; do
    echo "removing cmdline bindmount"
    umount /proc/cmdline
    sleep 1
done

Now run this to flash the first slot and reboot:

update_engine --update_package=/cache/ota.zip
reboot

Wait for the Goggles to reboot. You may need to re-root regain adb access. Now repeat, to flash the second slot and reboot:

update_engine --update_package=/cache/ota.zip
reboot

Your device should now be on the intended version.

Resizing the adb text window

busybox resize

Binding without using the button

If you've got an Air unit or goggles with a busted bind button, you can use this command to enter bind mode

modem_info.sh auto

Editing files on the device

Once connected to goggles or airunit via adb, you have busybox to your disposal. Unfortunately most of the functions are not symlinked, but it is easy to do so yourself:

ln -s /sbin/busybox /system/bin/vi

Instead of running:

busybox vi /path/to/file

You can now run:

vi /path/to/file

The same can be done for other busybox functions you are interested in like ping, unzip, wget or less. A full set of functions will be shown if you simply run busybox without any parameters.

Those symlinks will persist between reboots and powercycles.

Internet connectivity

For different use-cases it might be important for you to have internet access on your goggles or air-unit when connected to the PC. In order to do so, you have to share your internet connection from your PC to your goggles or airunit.

Linux

On Linux you should see a new USB Ethernet network device popping up when attaching the goggles or air unit, you can verify this by running ifconfig with no hardware connected and then again with the hardware connected, it might look something like this:

enp3s0f0u4: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        ether fe:c4:22:af:83:d8  txqueuelen 1000  (Ethernet)
        RX packets 9  bytes 592 (592.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

For the sake of example my device with Internet connection is enp34s0.

On the Linux computer we now:

  1. Create a bridge
  2. Add devices to the bridge
  3. Bring the bridge up
sudo ip addr flush dev enp34s0
sudo ip addr flush dev enp3s0f0u4
sudo brctl addbr br0
sudo brctl addif br0 enp34s0 enp3s0f0u4
sudo ip link set dev br0 up

On the goggle or airunit we only need to run dhcptool:

adb shell
dhcptool rndis0

We can now check with ifconfig that we received an IP from our local router:

rndis0    Link encap:Ethernet  HWaddr 8A:4C:79:BE:5B:DF
          inet addr:192.168.1.21  Bcast:192.168.1.255  Mask:255.255.255.0 
          inet6 addr: fe80::884c:79ff:febe:5bdf/64 Scope: Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:358 errors:0 dropped:0 overruns:0 frame:0 
          TX packets:67 errors:0 dropped:0 overruns:0 carrier:0 
          collisions:0 txqueuelen:1000 
          RX bytes:60017 TX bytes:15260 

use ping to test that we can in fact connect to the outer world:

ping 1.1.1.1

DNS

Unfortunately DNS resolution is broken with the busybox tools like ping, wget and nslookup and this seems to be a known issue:

There are known issues with DNS functionality in statically-linked glibc programs (like busybox in this case), because libnss must be dynamically loaded. Building a uClibc toolchain and linking busybox against that would resolve this.

You can get an official busybox build, push that to your goggles/airunit and use that instead:

wget https://busybox.net/downloads/binaries/1.31.0-defconfig-multiarch-musl/busybox-armv7l
adb push busybox-armv7l /blackbox
adb shell
chmod a+x /blackbox/busybox-armv7l

Now you can link the applets that require DNS resolution to this version of busybox:

ln -s /blackbox/busybox-armv7l /system/bin/ping
ln -s /blackbox/busybox-armv7l /system/bin/wget
ln -s /blackbox/busybox-armv7l /system/bin/nslookup

You will also have to set a nameserver of your choice in /etc/resolv.conf:

nameserver 1.1.1.1

Windows

TODO...

Package manager

To setup Entware package manager follow these steps:

mkdir /blackbox/entware

The following steps have to be repeated after each reboot:

mount -o rw,remount /
mkdir /bin
ln -s /system/bin/sh /bin/sh
ln -s /blackbox/entware /opt
mount -o ro,remount /

You can obviously put this in a bash script and run after connecting, or add to the general startup script.

Install Entware and update your path variable:

wget -O - http://bin.entware.net/armv7sf-k3.2/installer/alternative.sh | sh
export PATH="/opt/bin:/opt/sbin:$PATH"

Optionally install and run dropbear SSH server:

/opt/bin/opkg install dropbear
/opt/sbin/dropbear -p 22 -a

Now you can connect via ssh - the default password for the root user is 12345:

At this point you should be set and can use entware to its full capabilities and change your password:

opkg update
opkg install mc
mc
passwd

AV-IN hacks

There's a hacky way to write to the registers of the integrated analog chip(adv7280m) in the goggles. Makes it possible to write to any register from the datasheet and test various settings. The limitation is we can only modifiy one register at a time prior launching the AVIN function in the goggles. It's not permament and after a reboot or just by writing the default starting values to the memory addresses it restores the default behaviour.

The three memory addresses that control the registers write are the following:

  • 0x1020f428 - register select. Default set to 0x21('!') to write to the main register. Other options are 'D'(csi_write) and 'B'(vpp_write)
  • 0x1020f42c - register address
  • 0x1020f430 - register value

If case you're doing it the first time it's good the check the default values are at that addresses before doing any modification.

  • busybox devmem 0x1020f428 8 - default 0x21 - main_write
  • busybox devmem 0x1020f42c 8 - dafault 0x0F - power managament
  • busybox devmem 0x1020f430 8 - dafault 0x00 - system functional

To make a change you just write to the addresses and launch AVIN from the menu.

Examples

Color bars

Shows the color bars in place of the blue screen
busybox devmem 0x1020f42c 8 0x14 && busybox devmem 0x1020f430 8 0x11

Luma ramp

Shows a luma ramp in place of the blue screen
busybox devmem 0x1020f42c 8 0x14 && busybox devmem 0x1020f430 8 0x12

Free-run mode

This will disable free-run mode and show only noise in place of the blue screen
busybox devmem 0x1020f42c 8 0x0c && busybox devmem 0x1020f430 8 0x34

Video system autodetection

Disables all video systems autodetection(NTSC/PAL/SECAM). Could solve the problem some people are having when goggles display the DJI logo when signal is lost.

busybox devmem 0x1020f42c 8 0x07 && busybox devmem 0x1020f430 8 0x00

Datasheet

The datasheet contains all the registers information. From page 70 on registers are listed with a short description. Convert the bits to HEX: eg 00110100 -> 0x34

ADV7280_7281_7282_7283_UG-637.pdf

Adjusting the Goggle Displays brightness

Each display is on it's own i2c bus at address 0x34, the left being on bus 2, the right on bus 1 You can adjust the brightness by writing a value between 0x00 (0) and 0xFF (255) to the register 0x01

# Turn off displays (0 brightness)
test_i2c 1 w 0x34 0x01 0x00
test_i2c 2 w 0x34 0x01 0x00

# Set displays to 100% brightness
test_i2c 1 w 0x34 0x01 0xFF
test_i2c 2 w 0x34 0x01 0xFF

Clone this wiki locally