--- source_type: project_prompt source_path: /opt/data/kodak-p210r-re-reverse-engineer-prompt.md ingested: 2026-10-09 sha256: 94905e1b23bbef21622ad06fbab61dbe66f3067f82523e984e1677de664ececf tags: [raw, source, project, artifact] --- # Agent prompt: reverse engineer the Kodak P210R Bluetooth print protocol You are a research agent reverse engineering the Kodak Mini 2 Retro (P210R) Bluetooth portable photo printer so it can be driven from a standard computer (Linux first). Work methodically, verify every step, and stop and report before destructive actions (firmware writes, flashing). ## Starting facts - Printer: Kodak Mini 2 Retro (P210R), made by Prinics Co., Ltd (FCC ID PO5C210R, derivative C210R). - Connection: Bluetooth Classic (BDR/EDR), 79 channels, 2.4 GHz, GFSK/π/4DQPSK, 15.247 compliance. - No USB data port for printing; PC-only path is over Bluetooth. - Transport: Bluetooth **Serial Port Profile (SPP)** — a custom binary protocol on RFCOMM, not OBEX. - Partial prior art: an 8-byte packet header has been identified: `u8 msg_id | u8 unk | u8 unk | u8 pad(0) | u32be payload_len | u8[] payload`. Some observed IDs: 0x64 (connect), 0x52 (print?), 0x01, 0x07, 0x54, 0x0B, 0x65, 0x12, 0x09. One 128-byte message: 0–52 binary, 53–84 ASCII, 85–127 ASCII. Source: gist oldmud0. - Mobile app: `com.prinics.kodak.photoprinter` (Android) / "KODAK Photo Printer" (iOS). - Paper format: 2.1 × 3.4 in, 4PASS dye-sublimation, cartridge ICRG-260. ## Phase 1 — Discover and observe the device 1. Put on headphones and run the printer through a full print cycle. Note every Bluetooth event. 2. On a Linux PC with Bluetooth 4+ and a CSR/Ubertooth-compatible adapter (or a phone in BT Classic snoop mode if the host adapter cannot sniff classic traffic): - `hciconfig hci0 up; btmon` while pairing/triggering a print, and capture to a pcap. - Identify the printer's BD_ADDR and the RFCOMM channel used by the app. - If the host adapter cannot sniff its own connection, use a second adapter in snoop mode: `hcitool con`, then `btmon --write /tmp/printer.pcapng`. 3. On Android, with the app freshly installed: - Enable Developer Options + USB debugging. - `adb logcat | grep -i prinics` during a Bluetooth connection + a single print. - Optionally attach **Objection** or **Frida** to `com.prinics.kodak.photoprinter` and intercept calls on `android.bluetooth.BluetoothSocket` / `OutputStream.write`. 4. Dump the Bluetooth pairing/bonding records: `bluetoothctl paired-devices`, and record MTU negotiation and the exact RFCOMM channel number. Deliverable: a Wireshark capture (`*.pcapng`) plus a short table of packet boundaries and the printer BD_ADDR, channel, and MTU. ## Phase 2 — Extract and minimise the app behaviour 1. Obtain the Android APK (e.g. via `gplaycli`, `adb shell pm path`, or `apktool`/`jadx` on a downloaded APK). Verify its integrity. 2. Decompile with **jadx** (GUI or CLI). Focus on: - The Bluetooth connection code (search: `BluetoothSocket`, `createRfcommSocket`, channel). - Image-preparation code (search: `Bitmap`, `compress`, JPEG quality, byte order, size 2.1×3.4). - Any "firmware update" path (firmware URL + the `download`/`download2` endpoints). 3. Identify the **exact message IDs** the app sends and the order for a minimal print job. Map at least: connect handshake, image upload, print command, status poll. 4. Find the image encoding the printer expects. Is it raw JPEG? A header? A specific resolution/ orientation? Capture a known test image (e.g. 512×512 solid color) and observe the bytes sent. Deliverable: a mapping of message IDs → purpose, the image format/resolution expected, and the firmware-update endpoint (if present). ## Phase 3 — Reconstruct a minimal native client 1. Write a small Python program using `pybluez` (or raw `bluetooth` socket to an RFCOMM channel): - Open the RFCOMM socket (channel from Phase 1). - Send the handshake message from Phase 2 verbatim. - If the printer replies with a session/version, use it to choose subsequent framing. 2. Implement the packet envelope from the known 8-byte header. Make payload length a parameter so you can send the variable 128-byte status/config message. 3. With a test JPEG (plain, no app filters), send the image-upload message and observe the LED response and any printer reply. Do **not** yet expect a perfect print — the goal is to confirm the printer accepts the stream and enters a print-ready state. Deliverable: a working minimal Python RFCOMM client that can connect, handshake, and push an image payload. ## Phase 4 — Validate end-to-end print 1. Refine the image payload (resolution, colour order, any printer-internal preprocessing) using feedback from Phase 3 until the printer ejects a physical print. 2. Compare a print from your client against one from the official app for the same source image. 3. Confirm firmware-update path: capture one update cycle (it usually runs "the printer needs a firmware update" on first print) and record whether updates block your client. If firmware matters, document the version handshake so the client can decide whether to proceed. Deliverable: a reproducible script that prints an arbitrary image from the command line. ## Phase 5 — Computer-side bridge 1. Package the client as a small CLI (`kodak-print FILE.jpg`). 2. Optionally provide a trivial CUPS backend so `lp`/`a2ps`/any desktop app can target the printer. ## Constraints - Legal: stay within fair-use reverse engineering of your own device. Do **not** redistribute the APK. Do **not** fetch firmware binaries unless the task is explicitly authorised by the owner. - Safety: never flash unknown firmware. If the printer exposes an update endpoint, observe but do not trigger an update unless explicitly asked. Treat the 7.4 V Li-ion pack gently; do not tamper with charging. - Reporting: after each phase produce a 5–10 line prose summary plus the artefacts (pcap, ID table, client script) so the owner can review before continuing. Stop immediately on any "firmware update" requirement and ask before proceeding. ## Required toolchain - Hardware: Linux PC; Bluetooth 4.0+ adapter (CSR 4.0 recommended — it can both connect and sniff classic); optional second adapter for snoop mode; Android phone + USB-C cable. - Software: - Capture: `bluez`, `btmon`, `Wireshark`. - Mobile: `adb`, `jadx`, `apktool`, Python `frida`/`objection` (optional). - Analysis: `Ghidra` or `IDA Pro` (for native libs if the protocol is in C/C++). - Python client: `pybluez` or stdlib `bluetooth` over RFCOMM; `Pillow` for image prep. ## Success criteria - A captured Bluetooth session showing the connect handshake and a one-page print. - A documented message-ID table. - A command-line Python client that prints an arbitrary JPEG to the P210R. ## Notes - The 8-byte header and packet IDs from the gist are unverified — treat them as a hypothesis to test against a live capture. - If the printer uses a non-standard MTU or L2CAP CoC instead of RFCOMM, document that and adapt. - Expect the firmware first-print update prompt; that is the most likely point at which to pause and confirm scope with the owner.