BlogPart 1 · the remote

Turning a 2003 Palm into a universal remote

A flea-market Tungsten T3 has an infrared port, but it speaks IrDA, not TV. Part one: bit-banging its IR LED from native ARM code, squeezing 8,000 remotes into a PDA, and driving air conditioners with real protocol encoders.

I bought a Palm Tungsten T3 at the Bubanj Potok flea market in Belgrade. It has a slider that turns a 320×320 screen into a 320×480 one, a 400 MHz ARM processor running Palm OS 5, and an infrared port on top.

Before smartphones, a PDA, a “personal digital assistant”, was the pocket computer that held your calendar, contacts, notes and to-do list. You wrote on it with a stylus, in a simplified alphabet called Graffiti. Once a day you dropped it into its cradle and pressed HotSync, which synced everything with your desktop. Palm made the most popular ones, and Palms could beam contacts and apps to each other through that infrared port. The Tungsten T3 came out in 2003, near the end of that era.

The Tungsten T3 standing in its HotSync cradle, green charge light on

The T3 in its cradle, where it spent this whole project.

Its battery was swollen, so I took it out and ran the T3 straight from the cradle.

The back of the Tungsten T3 in my hand, with its Palm Powered logo and label

Twenty-odd years old and still in one piece.

Palms with an IR port were popular universal remotes in their day, so the plan seemed obvious: a remote for the TV and, more importantly, for the air conditioners. It took about two days, and most of it went into one problem. The T3’s infrared port was never meant for remote controls.

Talking to it at all

Before anything could run on the T3, I had to get files onto it from a 2026 Linux machine. That meant pilot-link, the old Palm sync suite, and it needed a few fixes to build with a current compiler.

Its USB path hung the sync every time. The kernel’s visor driver works, but the serial device it creates only exists for a few seconds after the HotSync button is pressed, so starting the sync first fails and starting it late misses the window. I ended up with a small wrapper script that waits for /dev/ttyUSB1 to appear and runs the transfer the moment it does. Every install in this post went through it: run the command, press HotSync, wait.

IrDA is not a remote control

Remote controls flash an LED in bursts of a carrier, usually 38 kHz, and the receiver in the TV only listens for that carrier. The T3’s port is IrDA, which was made for beaming contacts between Palms. It sends short pulses through the serial hardware, and the Palm OS serial API offers nothing closer to a carrier than that.

I tried anyway. Sending carefully chosen bytes at 38,400 baud through IrDA mode produced something a Sony TV accepted, which was encouraging for about ten minutes. The Gree air conditioner ignored it completely. Plain serial output at 76,800 and 115,200 baud, which in theory makes a usable carrier, did nothing at all.

Other Palm remote apps exist, so someone had solved this. NoviiRemote ships its hardware drivers as native ARM resources, and opening them in Ghidra showed its trick: it does not use the serial port. It takes the transmit pin of the UART away from the serial hardware, turns it into a plain output, and toggles it by hand, timed against the processor’s own timer.

Bit-banging the LED

The T3 is built around an Intel XScale from the PXA25x family. Its IR transceiver hangs off the processor’s “standard” UART, whose transmit line is GPIO47. So the plan became:

  • Open the IR port through Palm OS, so the system powers the transceiver.
  • Jump into native ARM code with PceNativeCall, Palm OS 5’s way of leaving the 68k emulator.
  • Switch GPIO47 to a plain output, mask every interrupt, and draw the carrier by hand, timed by the PXA’s 3.6864 MHz OS timer.
  • Put everything back exactly as it was.

The core of it is a busy loop:

/* Mark: square wave until the deadline. */
edge = OSCR;
while (BEFORE(edge, deadline)) {
    GPSR1 = PIN_BIT;                /* LED on  */
    edge += on;
    while (BEFORE(OSCR, edge)) ;
    GPCR1 = PIN_BIT;                /* LED off */
    edge += off;
    while (BEFORE(OSCR, edge)) ;
}

Getting there took a few crashes, and each one taught me something about Palm OS 5:

  • Physical addresses fault. The PXA’s registers live at 0x40000000, and touching that address from ARM code crashed the T3. NoviiRemote’s drivers use 0x90000000 instead, where Palm OS 5 maps the same block, and so does mine.
  • Alignment. The parameter block and the timing array are read as 32-bit words, and the 68k stack is only 2-byte aligned. Passing them from the stack gave Fatal Exceptions; allocating them with MemPtrNew fixed it.
  • Fresh code. ARM code copied into memory and run right away crashed, because the processor’s caches still held the old contents. Running it straight from the app’s own resource avoids that.
  • Overflow. Converting microseconds to timer ticks is a multiplication by 3.6864. The obvious us * 36864 / 10000 overflows 32 bits past about 116 ms, and Samsung remotes have a 145 ms gap. us * 2304 / 625 is the same ratio with smaller numbers.

With that, the Sony TV responded again, and this time the air conditioners did too.

8,000 remotes on a PDA

A remote app is only as good as its codes. Flipper-IRDB is a community collection of about 8,000 remotes in the Flipper Zero’s .ir format. Most buttons are stored as a protocol plus an address and a command (NEC, RC5, Samsung and so on); the rest are raw captures, lists of on and off times.

A Python packer turns that into two Palm databases: a curated one of 1.2 MB with the remotes most people will want, and an extended one of 8.3 MB with everything else. Protocol buttons are stored as protocol, address and command, nine bytes each, and the T3 renders them into timings when a button is pressed. Raw captures are dictionary-compressed. Every button also gets a role (power, volume up, digit 5…) so the app can place it on a screen without parsing names.

Rendering protocols on the device means two implementations of every protocol, one in Python and one in C, and they have to agree. The C renderer produces exactly the same timings as the Python one for all 148,932 protocol buttons in the database. The Python one, in turn, was checked against IrpTransmogrifier, an independent decoder. The packer is tested the same way: all of the roughly 246,000 buttons round-trip through the database format.

From a Flipper .ir file to the T3's infrared LED Flipper-IRDB files are packed on the PC into a Palm database. On the T3, a renderer turns a button into on and off times. Instead of the serial port, a small piece of native ARM code drives the IR LED's pin directly with a 38 kHz carrier. Flipper-IRDB · about 8,000 remotes .ir files: protocol, address, command, or raw timings Packer on the PC (Python) button roles, compressed raw captures Code database on the T3 1.2 MB curated, 8.3 MB extended Renderer (68k C) button → on/off times in microseconds IrDA transceiver, GPIO47 built for beaming contacts, not for TVs ARM transmitter takes the pin from the UART, draws a 38 kHz carrier, timed by the 3.6864 MHz timer

Everything above the transceiver is ordinary software. The last step skips the serial port entirely.

The screens

The app sorts remotes by category, then brand, then model, and typing in the Find field searches all of them. Each category has its own layout template: a TV gets a power row, volume and channel rockers around a d-pad, and its digits on a Numbers tab; an air conditioner gets temperature and fan rockers next to its modes. Buttons that fit no template end up on an “All” tab, so nothing in the database is unreachable.

The screenshots here come from PumpkinOS, an open-source reimplementation of Palm OS that runs ordinary 68k Palm apps on Linux. It draws in its own purple instead of the T3’s blue, but every pixel inside the window is IR Knife’s.

IR Knife’s category list Searching for “airwell” finds two remotes

Categories, and a search across every remote in the database.

The Airwell air conditioner remote, main tab The same remote’s All tab with every button

A remote’s main tab, built from button roles, and its All tab.

PumpkinOS is not a T3, and the app knows it. The transmitter only runs on a device that reports itself as a Tungsten T3, because poking GPIO47 at 0x90000000 on any other Palm would be poking something else entirely.

An alert reading “IR Knife drives the T3’s IR hardware directly and can only transmit on a Tungsten T3. You can still browse the codes.”

What IR Knife says on anything that is not a T3, including an emulator.

Air conditioners are different

A TV remote sends a command: volume up. An air conditioner remote sends its entire state every time: power, mode, 24 degrees, fan speed, swing, all in one frame. The unit just applies whatever it receives. A database of captured buttons can only replay the exact states someone happened to capture, which is no way to set 23 degrees.

So ACs needed real protocol encoders. IRremoteESP8266, the Arduino library, already implements over 70 AC protocols and is well tested. It is C++ written for microcontrollers, though, and the T3 runs 68k C. Rather than trust a port by eye, I built the library natively on my PC as a reference. Every module I port to C has to produce byte-identical frames to the library for thousands of random states before it ships. The current ones match on 5,000 out of 5,000.

The screen is built from each module’s capabilities rather than designed per brand: the modes, fan speeds and extras it supports become the buttons.

The Gree YAW1F full-control screen: power, temperature, mode, fan, swing and extras The list of AC modules: Gree YAW1F, Gree YBOFB, Coolix / Midea, Haier YR-W02

Full control for a Gree, generated from the module’s capabilities.

Two of my own mistakes are worth telling:

  • The Gree that did not match. My first comparison against real Gree captures failed on all 27 of them, and I briefly believed other Gree models used a different checksum. The decoder was wrong: it read the long gap after the frame’s three footer bits as a 36th bit. Fixed, the Gree module matches 2,575 of 2,578 frames from SmartIR’s Gree tables and all 21 Flipper captures.
  • The kitchen AC. The unit in my kitchen is sold here as a Bergen, a local brand. Brands like that usually rebadge Midea, so I wrote the Coolix/Midea module first. The AC did not react to anything. Codes from Haier’s remotes worked, so it got a Haier module, and now it is a Haier as far as I am concerned.

The slider

The T3’s slider grows the screen from 160×160 to 160×224 standard coordinates by hiding the writing area. Newer Palms have a standard API for this, PINS. The T3 predates it: it has palmOne’s own PinLib instead, and its system only resizes apps it knows are tall-screen aware, flagged with an undocumented resource. So the app drives the input area itself through PinLib, listens for the slider’s launch codes, and lays every screen out again when the size changes. Remote screens collapse the writing area, since there is nothing to write there.

A safety net

A Palm keeps everything in RAM, and mine had no battery. Any power cut would wipe the app, its databases and the T3’s own settings. So the last thing I added was a copy of everything on the SD card: the app and the databases in /PALM/Launcher, and the app imports its databases from there when they are missing from RAM.

It was a sensible precaution, and it set up the strangest bug of the project. That is part two.

Credits

  • Flipper-IRDB for the remote codes (CC0), and the Flipper Zero firmware for protocol timings.
  • IRremoteESP8266 (LGPL-2.1): the AC modules are C ports of its protocol code, and it is the reference they are tested against.
  • SmartIR for its Gree code tables, and IrpTransmogrifier for checking the renderer.
  • NoviiRemote, whose PXA drivers showed how to drive the IR pin directly, and Vishay’s application note on remote control with IrDA transceivers.
  • prc-tools-remix, palm-os-sdk, pilrc and pilot-link, which still build Palm apps in 2026.
  • PumpkinOS for the screenshots.

← All posts