Skip to content

Tips, tricks, and hacks

Joonas Trussmann edited this page Jun 20, 2023 · 24 revisions

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

Dumping blackbox to sdcard

cd /blackbox/
test_hal_storage -c "0 volume detach_pc"
cp upgrade/signimgs/*.cfg.sig ./
tar --exclude='upgrade' --exclude='wtfos/system.img' -zcvf /storage/sdcard0/debugdump.tgz .
reboot

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

moved -> Known-Memory-Addresses/av-in-adv7280-i2c-table

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

Disconnect the SD card from the computer

When you connect the device to your pc, the SD card is unmounted from the filesystem and forwarded to the computer. You can stop this from happening and allow the Airunit/Goggles to access the SD card while plugged into the PC.

# Temporary method, until next plug into pc
test_hal_storage -c "0 volume detach_pc"

# Permanent method, until re enabled (change 0 to 1 to re enable)
setprop persist.dji.storage.exportable 0

Testing and debbuging fan behavior

Here's a few things you can poke at for troubleshooting if your V2 Goggles fan is misbehaving (eg. overheat reboots):

  • show the dji glasses process operations as it adjusts pwm: logcat | grep gs_fan_adjust
  • stop the dji glasses process: setprop dji.glasses_wm150_service 0
  • restart the dji glasses process: setprop dji.glasses_wm150_service 1
  • manually adjust the pwm (stop the glasses process before): test_pwm 2 1000 $yourPercentHere 1 1 replace $yourPercentHere with a number from 0-100

So far we haven't identified any SW issues related to the fan, so most likely if you're having problems it's bad HW.