Skip to content
tmon.ch
Go back

My fake AirPods Max had an annoying chime, so I hacked them

I own a pair of picun F8 Pro headphones, which are a Chinese AirPods Max clone. Two things bugged me: the status LED, and the sounds they make when you turn them on and off.

So I set three goals:

  1. Kill the LED.
  2. Replace the sounds.
  3. Get to a point where I can read and write the flash whenever I want.

All three happened. One of them involved a soldering iron instead of software, and on the way I bricked the headphones once.

The headphone board with wires soldered to the SoC

The patient, with thin single-core wire soldered on. Yes, it’s out of focus.

Step 1: what chip is this?

Opening the ear cup comes with its own troubles: expect glue and hidden screws, and prod at things until something gives. I was lucky that none of those snap-fit clips were in there, the kind where you have to shim all of them at once and pull off some impossible maneuver. Inside is a round PCB with a QFN40 that has the JieLi “JL” logo on it. The marking sent me to the JL7018F8 datasheet. From there it gets confusing, because JieLi uses a bunch of names for what is basically one family:

WhereName
DatasheetJL7018F8
SDKJL701N
Tools and communityAC701N
The chip’s own bootloaderBR28

Finding any of this took some prowling. JieLi isn’t exactly handing out docs, so I spent a while digging through Chinese websites and weird GitHub repos for PDFs: the datasheet, a reference schematic and the SDK docs, some of them only in Chinese.

Lesson one: similar names are usually enough. The suffix at the end of a JieLi part number is mostly a variant. If you search only for the exact marking you find nothing. Search for the family and you find a surprisingly deep rabbit hole.

The board also has nicely labeled DP and DM pads right next to the chip, which are USB D+ and D-. That is the way in, and it’s a deliberate one. JieLi’s reference schematic reserves VBAT, DP, DM and GND as test points for flashing and updates, so I was using the factory’s own door. The same schematic warns you not to put the USB tool’s 5 V on VBAT, and to keep VBAT under 4.5 V while flashing.

Closeup of the JieLi chip with wires on DP and DM

Step 2: getting into UBOOT mode (the hard part)

JieLi chips have a ROM download mode called UBOOT. It has nothing to do with Das U-Boot, the Linux bootloader. In this mode the chip shows up on USB as a fake mass storage device, and tools talk to it with custom SCSI commands.

To enter it, you have to send a magic 16-bit key, 0x16EF, over the USB data lines right as the chip starts up. D+ acts as clock and D- as data, at least going by the waveform in the docs, because the sentence right below it says the opposite. When the ROM sees the key, it acknowledges and comes up as a USB device.

You can buy a dongle for this. They’re sold as “USB activation tools” and they sit inline between PC and target. Inside there’s basically another JieLi chip, a power switch and a USB switch: it sends the key, then passes the bus through to the PC. But I’d seen people do it with a plain microcontroller, so I wasn’t paying for one. I had an ESP32-S3.

A JieLi USB activation dongle between a PC cable and a target board

The dongle I didn’t buy. Image from an AliExpress listing.

This is where most of my time went. The final answer is about 50 lines. Getting there took:

What actually cracked it was reading GitHub issues on christian-kramer’s JieLi repo, mainly #12 and #15, plus kagaimiq’s how to enter UBOOT doc. The working approach is a simple loop: keep sending the key, and stop when both lines get pulled low. That low state is the acknowledge. The catch is that the chip has pulldowns on those lines (15k in the datasheet), and a microcontroller’s weak builtin pullup loses to them, so the lines read low even with no ack. That false positive is why the sketch needs a strong external pullup, around 4.7k.

Here’s the core of the sketch from issue #12, with my pins:

#define POWER_CTL  6  // the power button pin on the board
#define EXT_PULLUP 7  // pullup on the USB lines, needed to see the ack
#define JL_CLK     4  // goes to USBDP
#define JL_DAT     5  // goes to USBDM

bool send_usbkey() {
  pinMode(JL_CLK, OUTPUT);
  pinMode(JL_DAT, OUTPUT);

  for (uint16_t mask = 0x8000; mask; mask >>= 1) {
    digitalWrite(JL_DAT, (mask & 0x16EF) ? HIGH : LOW);
    digitalWrite(JL_CLK, LOW);
    delayMicroseconds(10);
    digitalWrite(JL_CLK, HIGH);
    delayMicroseconds(10);
  }

  pinMode(JL_CLK, INPUT);
  pinMode(JL_DAT, INPUT);
  delayMicroseconds(100);

  // the chip acks by holding both lines low
  return digitalRead(JL_DAT) == LOW && digitalRead(JL_CLK) == LOW;
}

Here’s how it all connects. The USB data lines go to the ESP and the PC at the same time, based on the diagram in issue #12:

Wiring between the ESP32-S3, the JieLi chip and the PC

setup() presses the power line, enables the pullup, spins on while (!send_usbkey());, then lets go of everything.

The things that mattered, none of which are obvious:

My dirty trick for that last one: briefly shorting VDD to GND. Sparks fly, but it does force a reset. I’m telling you what I did here, not recommending it. It’s a great way to kill a board, and with a lithium cell attached it’s a bit of a fire hazard too. Unplugging the battery is the grown-up solution. There’s a cleaner one too: the SDK’s default config resets the chip if PB1 is held low for 8 seconds, and PB1 was already wired to my ESP.

And then, finally:

dmesg showing BR28UBOOT1.00

BR28UBOOT1.00. Best line of kernel log I’ve ever seen.

Step 3: reading the flash

Once the chip is in UBOOT, it gets easy fast. The ROM’s UBOOT mode is barebones: it can read and write memory and run code, and that’s about it. So kagaimiq’s jl-uboot-tool uploads a loader into RAM, and that gives you a shell with real flash access:

jl-uboot-tool's shell connected to the chip

From there it’s just a read command. I pulled 1 MB, then tried 8 MB to see how far it went. The 8 MB dump turned out to be the same 1 MB repeated 8 times, because the address wraps around. The flash ID says the same thing, since the 0x14 at the end of 0xb36014 means 2^20 bytes. 1 MB of flash, total. Anything you write goes in the first 1 MB and nowhere else.

Step 4: the “encryption”

The dump looks like noise, because the flash contents are scrambled and the chip’s flash controller unscrambles them on the fly. The chip reports a 16-bit chip key, burned into its efuses (0x077A on mine, right there in the shell screenshot), and it turns out the whole thing is a fancy XOR:

def jl_enc_cipher(buff, off, size, key=0xFFFF):
    for i in range(size):
        buff[off+i] ^= key & 0xFF
        key = ((key << 1) ^ (0x1021 if key & 0x8000 else 0)) & 0xFFFF

That’s a keystream from a 16-bit LFSR, restarted every 32 bytes with chipkey ^ (offset >> 2). Because it’s XOR, encrypting and decrypting are the same function. Sixteen bits of key is not exactly a vault either. That’s the code from kagaimiq’s jl-misctools, whose unpacker did all the heavy lifting here. Run the dump through it and out comes a real filesystem:

uboot.boot   app.bin (626 KB)   config.dat   eq_*.bin   p11_code.bin
tone/
  index.idx
  power_on.mp3  power_off.mp3  bt_conn.mp3  low_power.mp3  anc_on.mp3 ...
  zpower_on.mp3 zpower_off.mp3 zbt_conn.mp3 ...

46 MP3 files. Actual MP3s, with filenames, in a directory, sitting in my headphones.

Specifically, that’s 23 sounds, mostly voice prompts, plus a second set of 23 with a z prefix, which is the Chinese language bank. All MPEG-2 Layer III, 24 kHz, mono, 24 kbps. That’s why they sound the way they do.

I can’t get over this. Look at that chip in the photo again: a black square 5 mm on a side that you wouldn’t look at twice, and you’d never guess it has storage. But it’s a full SoC, with a dual-core 160 MHz DSP, Bluetooth 5.3, ANC, a battery charger and MP3 and FLAC decoding all in one package. The firmware even has support for a gyro (mpu6887) for head-tracked spatial audio, which is a lot of magic for headphones like these.

It has its own RAM and its own storage in there too: 640 KB of SRAM for working memory, and the 1 MB of flash I just dumped. And on that flash sits power_on.mp3, the same format you’d have dragged onto an MP3 player in 2005.

Step 5: the actual problem, putting it back

Unpacking was solved. Packing wasn’t: jl-misctools has no packer for this format, and my first attempts were just carving a new file into the old slot and filling the leftovers with 0xFF. That works, because the MP3 decoder doesn’t choke on FF padding (FF FF FF FF looks like a sync word but fails on its reserved fields). So the first build was a shorter tone that fit in the old slot, and it only touched 3 sectors.

But the slot is only 3.5 KB, and I wanted something longer. To grow one file, everything after it needs to slide down, with the headers and CRCs redone and the whole span re-encrypted. So I built a packer, jl_fwpack.py, with AI, which made this a lot faster: it’s very good at testing lots of arrangements quickly, calculating offsets and smoke testing. What made it trustworthy was the checks: a no-op rebuild has to reproduce the input bit for bit, and the output has to unpack cleanly with the independent jl-misctools unpacker.

The nice surprise was the layout. Every block stores offsets relative to itself, and nothing encodes an absolute address, so moving a block is just a memcpy. The bad surprise was the end of the chain.

Map of the flash and the end of the resource chain

Going by the firmware layout, I had space up to 0xcde00, where the VM area starts. But flash doesn’t erase bytes, it erases 4 KB sectors, and VM doesn’t start on a sector edge. It starts 3584 bytes into sector 205, so that sector is shared. To stay out of it, I treated 0xcd000 as a hard wall, which leaves 2458 bytes of growth across the entire firmware.

Even that space isn’t truly empty. Going back through the dump later, I found about 2 KB of data sitting just past the end of the chain, running from 0xcc6e0 to 0xcd021. My packer doesn’t know what it is, and neither do I.

I found that wall the fun way. Here’s the build history, recovered by decrypting every image I kept:

Buildpower_on.mp3Other changesChain endsHighest sectorResult
Stock3582 B0xcc666Original
flash_1MB1656 B, 0.55 ssame171First in-place test
final (lol)9144 B, 3.05 sLED pin set to PGND0xcdc26205Bricked
toneonly5904 B, 1.97 s0xccf76204Boots!
toneonly25904 B, 1.97 snew power_off.mp30xccf76204Final version

The build named final was not final. And I still don’t know why it bricked, because it changed two things at once. For a while I blamed sector 205, on the theory that erasing it wiped live VM data. The dump doesn’t back that up: those 512 bytes of VM are blank in my stock dump, and final doesn’t change a single byte from 0xcde00 onward. So the suspects are the PGND value, which the firmware really does parse at boot, or the fact that final overwrote all of that mystery data, while toneonly left its tail alone. Change one variable at a time, kids.

The reason this story has a happy ending: UBOOT mode lives in ROM. No matter how badly I wrecked the flash, the ROM was still there, and I could write my pristine dump back. The chip even drops into download mode on its own if it can’t boot from flash at all. Keep your pristine dump. It’s your only way home.

The packer now refuses to produce any image that reaches sector 205, and prints the exact number of bytes you’re over. That limit might be stricter than it needs to be, but it’s the known-good side of the line.

The result

The funny part is that the official way to do all this is drag and drop: JieLi’s config tool lets vendors swap a tone by dragging a file onto it. I did it with an ESP32, some soldered wire and my own packer.

Making a tone that fits means matching the stock format and skipping any headers that waste bytes:

ffmpeg -i mytone.wav -ar 24000 -ac 1 -c:a libmp3lame -b:a 24k \
  -write_xing 0 -id3v2_version 0 -f mp3 power_on.mp3

Before, the stock power_on. The stacked harmonics are what a voice prompt looks like:

Spectrogram of the stock power-on tone

After, three clean notes, which you can pretty much read off the spectrogram:

Spectrogram of the new three-note chime

Hear them side by side. Do listen to the stock power off: she sounds so sad, like she’s guilt-tripping me for turning off my own headphones.

Stock

Mine

No player showing? Grab them directly: stock on, new on, stock off, new off.

I think the new sounds are a lot more neutral and calming.

And the LED?

config.dat has a neat pilot_lamp_io value of PB03, and I hoped to point it somewhere harmless. That was the PGND experiment in the bricked build, so it might even be what killed it. The firmware parses that string at runtime, and changing how it reacts would mean reversing code for pi32v2, JieLi’s custom ISA. That’s a much bigger project than a sound swap.

So I solved it with the most reliable tool available. I desoldered the LED.

What’s next

Thanks to kagaimiq, christian-kramer, bonayonpatrick and everyone in those GitHub issues. Almost everything that worked here started with someone else’s notes. So here are mine.


Share this post:

Previous Post
I rooted my Swisscom Internet-Box by asking it nicely
Next Post
I hit 120 WPM on Colemak, then discovered QWERTY US