Robbie Ardiansyah
← All work

Gametap: a phone that pairs as a gamepad

A personal project, open source. Gametap turns an Android or iOS phone into a Bluetooth gamepad. The host needs no companion app and no driver. From an Android phone, Windows, Linux and Steam see an Xbox Wireless Controller. All the code is on GitHub, so this is the one story on this site you can check line by line.

Code
github.com/robbieadi/gametap
When
November 2026
Built with
Kotlin Multiplatform, Compose Multiplatform, Bluetooth Low Energy (HID over GATT)
License
GPL-3.0

01One codebase, two radios

The HID descriptor, report encoding, touch and gyro input, layout profiles and the whole UI live in shared Kotlin. Platform code only moves bytes over the radio: an Android GATT server on one side, CoreBluetooth on the other. Profiles are stored in a JSON DataStore, and each stick has its own deadzone, response curve and floating mode, set in an on-screen layout editor.

iOS has no public API for acting as a HID device, so the iOS transport builds the HID GATT service by hand with the same layout as Android. On an iPhone, iOS published it, and Linux read it and created a gamepad device.

02Why it moved to Low Energy

The first version used classic Bluetooth HID. Classic puts an idle link into sniff mode, where the radio only wakes at intervals, and Samsung phones let it sleep for up to 750 ms even while reports were flowing. Presses stalled and occasionally got lost. Apps can't turn sniff off or choose which side runs the radio schedule. Low Energy has no sniff mode: the host polls at a fixed interval and a report goes out at the next poll.

I measured it against a Linux PC with injected presses, comparing when the phone received the touch with when the event arrived in evdev:

391 – 709 ms
Spread between fastest and slowest press per run, Galaxy A54 over classic Bluetooth with the phone connected to the PC.
12 – 42 ms
Same phone over Low Energy with its Wi-Fi off, 60 presses. On a Redmi Pad SE over Low Energy, 17 – 64 ms over 75 presses.

Android gives a GATT server no way to ask for a short connection interval, so Gametap also opens a GATT client back to the host on the same link and requests high priority from there.

03Looking like an Xbox controller

Windows only binds its XInput driver to a fixed list of Microsoft device IDs. Gametap reports the Xbox Wireless Controller's IDs, Report Map and report layout, as commercial third-party controllers do. Hosts' Xbox drivers read fields at fixed byte offsets, so unit tests pin the descriptor and the encoder byte for byte.

On Windows 11 every control arrives through XInput, DirectInput and Steam, which recognises it without any setup. On Linux, once BlueZ has the Xbox IDs (it doesn't on the first connection after pairing, which falls back to a generic driver that still works), the kernel binds its Microsoft driver, and every button, axis and trigger was checked in evdev one at a time.

04Bugs that only real hosts show

  • Windows doesn't re-enable notifications on reconnect. The Bluetooth spec allows that for a bonded device, so Windows reconnected but Gametap waited and sent nothing. It now saves the setting for each bonded host and restores it a second after that host connects.
  • Sending during pairing broke Linux. An HCI capture showed BlueZ starting its GATT client unencrypted when input reports arrived mid-pairing. Its reads were refused and it never created the gamepad. Gametap now sends nothing until pairing is done.
  • A congested link went silent for good. Android held back send confirmations while the link was congested, and three times the clear never came. Gametap now stops waiting after three confirmations are missing for 100 ms each. In 30 rounds of leaving and reopening the app, 28 got every press through.
  • 2.4 GHz Wi-Fi drops the link. Phones share one radio between Wi-Fi and Bluetooth. On a 2.4 GHz network a tablet left alone for 10 minutes had 6, 9 and 4 link drops. With Wi-Fi off, or on 5 GHz, there were none. An app can't change how the radio is shared, so Gametap tells the user instead.

05What isn't done

The README says what is and isn't verified, and I'd rather say it here too. Tilt control is unit-tested but hasn't been tried on a device. The Xbox identity works from Android only: hosts never see an iPhone as an Xbox controller, so the iPhone's report also carries the triggers on standard axes that a generic gamepad driver passes on. On an iPhone it pairs with Linux and macOS, but the buttons haven't been checked one at a time. Windows doesn't reconnect by itself after Gametap's process ends or the phone's Bluetooth restarts.

06Result

An Android phone pairs with Windows or Linux as an Xbox controller and works in Steam with no setup, from one Kotlin codebase that also runs on iOS.