PolariTha: porting AQIRYS's Windows tools to Linux

How I reverse engineered the software for the AQIRYS Polaris Wired mouse and Talitha keyboard, wrote a Rust replacement, found a hidden live-lighting command, and measured why the keyboard's Bluetooth is so unreliable.

  • reverse engineering
  • rust
  • linux
  • hid
  • bluetooth

I use two AQIRYS peripherals: the Polaris Wired mouse and the Talitha keyboard. Both come with a Windows-only configurator, and I run Linux. Without the vendor software you’re stuck with whatever DPI, lighting and button layout the devices shipped with.

So I wrote PolariTha, one Rust app that replaces both tools. This post walks through how the protocols were recovered, what the hardware tests turned up, and a few surprises along the way: a “key response” slider that doesn’t do what its label says, an undocumented live-lighting command, and a Bluetooth link that loses most of what the keyboard sends.

PolariTha’s mouse performance page: DPI stages with colours, polling rate and sensor settings The mouse performance page in PolariTha.

Getting at the software without Windows

Both tools ship as Inno Setup installers. innoextract wasn’t available, so I installed each one silently into a throwaway Wine prefix (/VERYSILENT /DIR=...) and copied the files out. The programs themselves were never run.

The data files were the first goldmine. The mouse ships Data.ini and a binary default profile. The keyboard ships Cfg.ini (UTF-16) and a per-model Dev/0236/KB.ini. Between them they hold the USB IDs, default settings, the keyboard layout, and even raw byte templates the software sends.

For the code, I used Ghidra in headless mode to dump every function to text. That made the binaries greppable: find the HID calls (HidD_SetFeature, HidD_GetFeature, WriteFile, ReadFile), follow their callers up to where each buffer is built, then up again to the UI handler that fills in the values.

Everything from the decompiler was treated as a hypothesis. A field only counted as known once it had been read from, or written to, the real device. The project’s findings tag every fact as Verified, Vendor code or Inferred for exactly that reason.

The mouse: a write-only protocol

The Polaris Wired shows up as 04d9:a2e7. That’s Holtek’s vendor ID, and the data files name the sensor as a PixArt PMW3370.

MouseDriver.exe doesn’t touch the HID API itself. It loads a small helper DLL at runtime and resolves eleven exports with GetProcAddress. Decompiling that DLL showed two write paths: 8-byte feature reports and 65-byte output reports.

The interesting part was what’s missing. The DLL exports read functions, but the application never calls them. The vendor tool is write-only: it keeps the mouse’s state on disk and re-sends everything when you hit Apply. PolariTha does the same.

One checksum rule

All eight places that send a feature report fill the last byte with an expression like 'v' - b2 - b3 - …. Solving them all gives a single rule:

b7 = 0xFF - sum(b0..b6)

For the “start” command 01 88, that’s 0xFF - 0x01 - 0x88 = 0x76, the ASCII 'v' hard-coded in the binary. The mouse accepted every write built this way.

The Apply sequence

The Apply handler sends a fixed sequence: a start command, the active profile, then for each of the five profiles its polling rate, current DPI stage and a 128-byte attribute block. Button mappings and a global block follow, then the start command again. There are 20 ms pauses after feature reports and 30 ms after output reports, and PolariTha keeps them.

The attribute blocks start as templates in Data.ini. Apply copies a template and overwrites specific offsets with profile fields. Mapping offsets to controls took two passes: first which profile field lands at each offset, then which UI control writes that field. The page handlers compare the clicked control against stored pointers, and the init code shows which control name each pointer was looked up by ("key_response_slider", "max_dpi_combo", …).

DPI encoding

DPI turned out to have its own per-sensor branch. For the 3370 the slider runs 1–290 with labels from 50 to 19000: 50 DPI steps up to 10,000, then 100 DPI steps. On the wire, values above 10,000 set a per-stage bit in a “double” mask. Both halves reduce to the same rule, (byte + 1) × 50, doubled when the bit is set, and a unit test pins it down.

Buttons

Button functions go through a long chain of string comparisons ("click" → 1, "dpi_cycle" → 6, …) and then a static table that maps each ID to four wire bytes. Mouse buttons, DPI up/down/cycle, media keys, keyboard shortcuts with modifiers, double/triple click and “disabled” all fit that 4-byte format.

PolariTha’s button page: pick a button, then its function Button mapping: pick a button, then a function.

The “Key response” mystery

The vendor UI has a Key response slider labelled 1–100 “ms” (default 20), stored at offset 0x67 of each profile. The obvious reading is a debounce time. The measurements didn’t agree.

First, recording raw kernel events during fast clicking showed a floor of about 15 ms for every press and every release. That isn’t USB polling: the endpoint polls at 1000 Hz. Setting Key response to 1 didn’t move the floor.

Then, with Key response at 100, rapid single-finger clicking still reached 11.6 presses per second in raw kernel events, with presses and gaps as short as 22 ms. A 100 ms debounce would cap that at about 5 per second. So it’s not a debounce time in milliseconds.

To find out whether it does anything at all, I ran an A-B-A latency test. A keyboard key and the left mouse button were pressed together 20–40 times per run, and both devices’ raw events were recorded. The keyboard’s own latency is the same in every run, so it cancels out:

Key response Median mouse − key offset
100 +2.3 ms
1 −16.2 ms
100 (again) −3.1 ms

The two runs at 100 agree with each other (permutation test p = 0.34), and both differ from the run at 1 by about 16 ms (p ≈ 0.001). So 0x67 does delay button reports, by roughly 15–20 ms at 100 compared with 1. That fits a debounce that waits until a button has been stable for a while, just at a far smaller scale than the “ms” label claims. The docs keep the vendor’s neutral name.

The keyboard: one protocol, three transports

The Talitha is a tri-mode keyboard with 67 keys, and it has three identities:

Connection USB ID Reported name
USB cable 258a:0236 BY Tech USB Keyboard
2.4 GHz receiver 3554:fa09 CX 2.4G Wireless Receiver
Bluetooth (classic) 3554:fa08 Talitha BT3.0

258a is the vendor ID used by Sinowealth-based boards, and the vendor software is a re-skin of a widely used OEM configurator. That’s good news for other AQIRYS keyboards: they likely share this protocol with different KB.ini data.

The software has separate classes for the keyboard logic, the wireless transport and an older wired family. For wireless, all the settings code is shared and only the byte transport differs. That made the port much simpler.

Wireless packets

Over the receiver and Bluetooth, everything is a 20-byte report:

13 cmd npk idx (hi<<4 | len) data[14] sum

sum is the byte sum of the first 19 bytes. Writes are acknowledged per packet, and reads send cmd | 0x40 and get npk packets back.

Settings live in a 128-byte config block that ends in 5A A5. The vendor reads it, patches the fields that changed and writes it back. Effects are stored as index + 1, with a brightness and speed<<4 | colour pair per effect. Colours go over the wire as G, R, B, because KB.ini says RGBIndex=1,0,2.

The USB cable

Over the cable, the same data travels in 520-byte feature reports with report ID 6. A full read of the product signature and the config took about 130 ms, compared with seconds over the air. The config matched the wireless copy except for one byte that differs between cable and receiver.

PolariTha’s keyboard lighting page: effects, parameters, palette and sleep timer Keyboard lighting: effects, brightness, speed, a seven-colour palette per effect, and the sleep timer.

PolariTha’s per-key colour page: paint keys on the layout Per-key colours, painted on the layout and stored on the keyboard as its “Self-define” effect.

Finding live lighting

I wanted the keyboard to spell KODA in aqua, with the rest of the keys running a rainbow that skips aqua. The keyboard can only store one static per-key layout, so anything animated has to come from the PC, one frame at a time. Rewriting the stored layout over and over could wear out the keyboard’s flash, so I went looking for whatever the vendor’s music and screen-sync modes use.

Listing every caller of the wired transport function turned up one command the port didn’t know yet: command 8, reached only through a virtual call from the music thread. That thread fills a 126 × 3 byte buffer, one colour per key at the key’s LED index, and sends all 378 bytes. Nothing in that path saves to the keyboard.

The first test knocked the keyboard off USB

My first test sent solid red frames in a tight loop with no pause. About three seconds in, the keyboard disconnected from USB and then failed to enumerate: the kernel log filled with can't read configurations, error -22 until I unplugged it and plugged it back in. Nothing was damaged, but the lesson stuck: frames must be paced.

With a 33 ms pause the keyboard ran at about 22 frames per second for 20 seconds without a single error. Solid green turned every key green, and the keyboard went back to its own effect the moment the frames stopped.

Black isn’t black

Drawing letters on a keyboard is mostly about the keys you don’t light. My first attempts looked like nonsense. Eventually it became clear why: a key sent as 00 00 00 doesn’t turn off. It shows whatever effect the keyboard is running underneath. My “dark” keys had been showing a rotating windmill the whole time.

The fix is to set the keyboard’s own effect to Off. Then black is black, and when streaming stops the keyboard is dark.

Four letters on a tiny screen

As a display, the keyboard has about 15 keys across and only 4 usable rows (the bottom row is mostly spacebar), and the rows are staggered. Four 3-key-wide letters fill the whole width with barely any gaps. After a few rounds, rounding off the O freed one key on each side of the K so its diagonal could breathe:

The final KODA layout: the lit keys spell K, O, D, A across the four upper rows The final KODA layout. The lit keys spell K, O, D and A; everything else is off.

Light bleed

Even with the right keys lit, it looked like everything was on. A test with only Esc lit showed why: light bleeds through the plate into the keys next to it. With about 31 of the 67 keys lit, the bleed fills almost every gap. Dimming helps more than you’d expect, because faint bleed drops below what you notice: 20% and 8% still bled a little, and 5% was clean.

The Talitha with every key lit: the keycaps are opaque and the light glows out of the gaps between them The keycaps are opaque, so the light escapes through the gaps between them and washes over the neighbouring keys. That’s the glow that blurs a pattern like KODA.

Sharing the keyboard

Running the KODA stream as a background service caused a new problem. The configurator suddenly reported the keyboard as asleep, and the keyboard dropped off USB three times in half an hour. Frames were landing in the middle of the app’s read/write exchanges, so its replies came back as frame echoes.

The fix is a shared lock file. The app holds it while it talks to the keyboard, and the stream skips frames until it’s free, then waits another half second. Ten reads in a row and a config write then worked with KODA running.

In the end I turned KODA off. Live lighting covers every key, so anything I changed in the app stayed hidden underneath. The feature is in PolariTha as polaritha kb-live: a scene file describes a rainbow wave that can skip a hue range, plus fixed colours for chosen keys.

Bluetooth: where the packets go

Over Bluetooth the keyboard speaks the same 20-byte protocol, but reads are painful. The keyboard answers a config request with a burst of 10 packets, and most of them never arrive. PolariTha copes by re-requesting and merging packets by index, and by filling gaps from the last complete read cached on disk. Writes are acknowledged per packet and stay reliable.

I first assumed the laptop’s Realtek combo card was the culprit. To check, I tested the same keyboard against a ThinkPad X1 Carbon Gen 5 with an Intel Wireless 8265, driving it over SSH. Both machines run Ubuntu 26.04 with BlueZ 5.85. Each round was five cold config reads (cache deleted first, 20 s limit), with the keyboard either next to the computer or on my chair: 90 cm from the Realtek machine and 1 m from the Intel one.

Realtek, close Intel, close Realtek, 90 cm Intel, 1 m
Keyboard answered 5/5 5/5* 1/5 5/5
Packets per request 1.9–2.6 2.2–2.5 2.6 2.2–2.5
Complete reads 4/5 0/4 0/5 0/5
Packets never received none always 1, usually 2 3 and 8 always 1, usually 2

* In run 1 of the close Intel round the keyboard hadn’t connected over Bluetooth yet, so that run produced no data; the other four all answered. The “Complete reads” figure counts those four.

A few things stand out:

  • Neither adapter receives the whole burst. About two of the ten packets arrive per request either way. A btmon capture on the Intel machine showed exactly as many reply packets reaching the host as the app received, 48 and 48. Nothing is lost in the Linux stack; the packets never reach it.
  • The Realtek card has poor range. Up close it receives every packet position and usually completes a read. From 90 cm the keyboard mostly stopped answering at all.
  • The Intel card holds the link but misses packets 1 and 2. Its results were the same up close and at 1 m, but in nine of nine runs packet 1 never arrived, and packet 2 almost never did. Those are the packets sent right after packet 0, so the controller seems to miss packets that follow too closely.

If your computer has a Realtek Bluetooth adapter, configure the Talitha over the USB cable or the 2.4 GHz receiver instead. On an Intel adapter, do one read over the cable or receiver first; after that the cache fills the two missing packets and Bluetooth reads work. Typing over Bluetooth is fine on both, because key presses are single packets.

Where it stands

PolariTha configures both devices over every connection they support: DPI stages, polling rate, lighting, button mapping and profiles on the mouse; effects, palettes, per-key colours, key remapping, the sleep timer and live lighting on the keyboard. There’s also a CLI for scripting.

Still missing: macros on both devices, Fn-layer editing, the mouse’s recoil feature, and the music and screen-sync modes themselves.

The protocol reference and the full findings, including dead ends and open questions, are in the repository. If you own another AQIRYS device, the repo also has a guide for pointing an AI agent (or yourself) at the vendor software to add support.