Repository files navigation
FujiKit
Safe, open-source Swift SDK, macOS CLI (fuji), and wire protocol reference for Fujifilm X-series cameras.
Back up and write custom film simulation slots (C1–C7) over USB, tweak live camera looks without touching your saved banks, pull full-size photos over camera Wi-Fi without Fujifilm's XApp, inspect .dat settings backups, and drive your camera's own X-Processor for authentic in-camera RAW conversion.
- Zero third-party dependencies — pure Swift 6 (ImageCaptureCore, CoreBluetooth, Network, Foundation)
- iOS 18+ & macOS 15+ — clean Swift Package (no .unsafeFlags) ready for Xcode or SwiftPM
- Hardware-safe by architecture — read-only PTP opcode allowlist for photo imports, mandatory fresh backups before every write, byte-diff RestoreGuard, and strict readback verification
- Canonical wire spec included — FUJIFILM-PROTOCOL.md documents USB PTP, Bluetooth LE (basic & 1.30+ secure pairing), the FUJIFILMX-BACKUP binary format, checksums, and Wi-Fi PTP/IP with strict evidence labels
Quickstart (macOS CLI)
Install
# From source (embeds macOS Info.plist for USB, Bluetooth, and Local Network permissions)
git clone https://github.com/maam00/fujikit.git
cd fujikit
make install
(A Homebrew formula is included in Formula/fuji.rb for tap distribution.)
Use it
Plug in your camera over USB with MENU → NETWORK/USB SETTING → CONNECTION MODE → USB RAW CONV./BACKUP RESTORE:
# Inspect connected body, firmware, and all C1–C7 slots (read-only)
fuji info
fuji show
# Take a timestamped backup of all 7 custom slots
fuji backup
# Load recipes into C1–C7 (backs up first, writes, reads back every property)
fuji load examples/recipes/classic-chrome-day.json
# Try a look on the live camera state without touching C1–C7
fuji look-live examples/recipes/classic-chrome-day.json --snapshot live-before.json
fuji look-restore live-before.json
# Pull recent full-size photos wirelessly over BLE wake + camera Wi-Fi
fuji import-wifi --last 10
# Render a RAF file using your camera's real film-simulation engine (never touches C1–C7)
fuji rawconv DSCF0001.RAF --recipe examples/recipes/classic-chrome-day.json
# Inspect a FUJIFILMX-BACKUP .dat file offline (read-only)
fuji settings-probe backup.dat
Run fuji --help for all subcommands.
Use FujiKit in Your Swift / iOS / macOS App
Add FujiKit via Swift Package Manager:
dependencies: [
.package(url: "https://github.com/maam00/fujikit.git", from: "0.1.0")
]
Connect over USB (ImageCaptureCore) and load custom slots with per-slot readback verification:
import FujiKit
let link = CameraLink.usb()
let recipes: [Recipe] = [
Recipe(
name: "Street Chrome",
filmSim: .classicChrome,
grain: .weakSmall,
colorChrome: .weak,
colorChromeFxBlue: .off,
whiteBalance: .daylight,
kelvin: 0,
wbShiftR: 2,
wbShiftB: -3,
dynamicRange: .dr200,
highlight: -0.5,
shadow: 1.0,
color: 1,
sharpness: -1,
noiseReduction: -4,
clarity: 0
)
]
let report = try await link.load(looks: recipes) { slot in
print("C\(slot.slot): \(slot.verdict)")
}
await link.disconnect()
In Xcode Previews, simulators, and unit tests, swap CameraLink.usb() for MockCameraLink() — identical API, zero hardware required.
Core Modules
| Module | What it provides |
|---|---|
| USB PTP | FujiCamera , CameraLink , ImageCaptureTransport , SlotEncoder , LiveControl |
| Bluetooth LE | FujiBluetoothLink , FujiBLEFlows , basic & 1.30+ secure pairing, settings backup & Wi-Fi wake |
| Settings File ( .dat ) | FujiSettingsFile , SettingsLookPatch , RestoreGuard — parse, probe, and narrow-patch FUJIFILMX-BACKUP files with incremental checksum updates |
| Wi-Fi & USB Import | PhotoImporter , FujiPTPIPTransport , FujiWifiWake , ReadOnlyPTP , ExifReader |
| In-Camera RAW Conv | FujiRawConverter , D185Profile — drive Fujifilm's hardware X-Processor over USB |
| Safety & Qualification | CameraCompatibility , USBQualification , SlotBackup , CameraCheck |
The Fujifilm Wire Protocol Reference
If you are building Fujifilm tooling in any language (Swift, Rust, Python, Go, C++), start with:
👉 docs/FUJIFILM-PROTOCOL.md
Every fact in the spec is tagged with its exact evidence level (VERIFIED-HW, CODE, CITED, or HYPOTHESIS):
- USB PTP D18C–D1A4 slot registers, gating rules, monochrome skip sets, and the Grain-Off 1 → 6/7 readback quirk
- macOS ptpcamerad exclusive-claim behavior
- Bluetooth LE GATT tables, basic (4-byte key) vs. secure (1.30+ LE bonding + f557d96b status echo), and chunked zlib backup/restore framing
- FUJIFILMX-BACKUP binary layout (0xF800–0x11000), volatile regions, and checksum model at 0x108
- Wi-Fi PTP/IP gallery session handshake, handle priming (GetObjectInfo before GetPartialObject), and EXIF date probing
Camera Compatibility & Adding Your Body
Read-only operations (info, show, backup, settings-probe, props --read) work safely without modifying camera state.
Verified slot writes are strictly allowlisted by exact model + firmware so FujiKit never guesses wire encodings on an untested body:
| Body | Firmware | USB Read / Backup | USB Slot Writes ( C1 – C7 ) | BLE Backup / Wi-Fi Import | BLE Modified Writes |
|---|---|---|---|---|---|
| X100VI | 1.10 | Verified | Verified (write, readback, exact restore, restart) | Verified (basic BLE + Wi-Fi JPEG pull) | Experimental lab only |
| X100VI | 1.30+ | Supported | Ready to qualify ( fuji qualify-usb ) | Secure BLE + hidden-SSID Wi-Fi implemented (untested on HW) | Blocked |
| X-T5, X-T50, X-E5, X-M5, GFX | Any | Read-only probe | Community PRs welcome | — | Blocked |
Own an X100VI on 1.30+, X-T5, X-T50, X-E5, or GFX?
Help qualify your camera in 2 minutes (safely tests C7 only, backs up first, verifies readback, and restores your original slot):
fuji qualify-usb --qualify-unverified-firmware --out my-camera-record.json
See docs/COMPATIBILITY.md and open an Add Camera issue with the redacted output.
Safety Guarantees
Writing to camera firmware/settings carries real risk if done carelessly. FujiKit enforces four non-negotiable invariants in code (not just docs) — see docs/SAFETY.md:
- Photos can never be modified or deleted: All import transports are wrapped in ReadOnlyPTP, which throws before transmitting any destructive opcode (DeleteObject, FormatStore, SendObject, etc.).
- Fresh backup before every write: load and qualify-usb always snapshot all seven slots first and refuse to proceed if any slot fails to read.
- Byte-level RestoreGuard: Any settings-file restore verifies that only the chosen slot bytes and 16-bit checksum changed relative to a fresh backup from the same serial number.
- Strict readback verification: A 0x2001 OK response from the camera is never trusted alone — every written property is read back and verified (accounting for documented hardware quirks like Grain Off returning 6/7).
Using fuji with Claude Code / Codex (Optional)
Want your coding agent to plan film-simulation palettes for a shoot and load them safely into your camera? Drop docs/CLAUDE-SKILL.md into your agent's skills directory.
Development
# Run the full offline test suite (360+ tests, no camera required)
make test
# Build the CLI with embedded Info.plist
make build
make verify-plist
Credits & License
MIT Licensed — see LICENSE.
Protocol discoveries build on and credit the open-source Fujifilm community: FilmKit, fuji-bridge, libfuji, furble, fffw, and helios (full upstream licenses in THIRD_PARTY_NOTICES.md and third_party/licenses/).
FujiKit is an independent open-source project and is not affiliated with or endorsed by FUJIFILM Corporation. FUJIFILM, X100VI, and film simulation names are trademarks of FUJIFILM Corporation.