- Nix 77.9%
- Shell 22.1%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| tools | ||
| .gitignore | ||
| flake.lock | ||
| flake.nix | ||
| LICENSE | ||
| README.md | ||
sony-crsdk-nix
Sony's Camera Remote SDK, packaged for Nix.
The SDK is not redistributed here. requireFile asks you to supply the zip, which
Sony hands out through a regional application form rather than a download link. What
this repo adds is the packaging and the three things that stop it working, none of
which are documented and one of which lies to you in the backtrace.
What it reaches
libgphoto2 sees 405 PTP device properties on this body and knows the names of 42. The SDK names 848, including everything needed to keep a camera in a declared state:
HighIsoNR LongExposureNR DRO ZebraDisplay ZebraLevel
LensCompensationShading LensCompensationChromaticAberration
LensCompensationDistortion PictureProfile CreativeLook
None of those are reachable through gphoto2, so if you want to assert a body's settings from a script rather than set them in a menu and hope, this is the way.
tools/codebook.sh prints all 848 with their numeric values and whether they are
settable. The enum is mostly implicit, so the values have to be walked rather than read.
Build notes
libxml2 must be 2.13.x. Upstream bumped the soname at 2.14, so current nixpkgs ships
libxml2.so.16 while libCr_Core.so wants libxml2.so.2 and references versioned symbols
(xmlNewText@LIBXML2_2.4.30) that 2.15 no longer emits. A soname symlink gets past the
loader and then segfaults — the ABI gap is real. The flake pulls 2.13.8 from nixos-24.11
for that one library and nothing else.
Missing libudev crashes rather than degrades, and this is the one that costs time. The
bundled libusb-1.0.so links against libudev.so.1; without it the dlopen inside
PTPCameraBrowser's constructor fails, and the cleanup path then dlcloses a handle that
was never validly opened. The backtrace lands in _dl_close inside ld.so and looks
convincingly like a glibc bug.
The adaptors are found relative to your executable. libCr_Core.so calls
readlink("/proc/self/exe") and looks for CrAdapter/ in that directory — not the
library's directory, not $CWD, and there is no environment variable or API override.
Init(logtype) is the only initialiser.
That last one shapes any language binding. Every entry point is exported unmangled, so
ctypes can drive the whole API without a compiler, but a store-path python3 will never
find the adaptors because CrAdapter/ cannot be placed beside it. The interpreter, or a
shim, has to live in a directory that also holds them.
Two smaller things: it writes ~/Camera Remote SDK/Preference.xml on first run without
asking, which on an ephemeral home wants persisting or redirecting. And it was built
against glibc 2.34 and GCC 12 — an Ubuntu 22.04 base — so nothing here is stale; it runs
fine on 2.42. The libxml2 break is upstream moving ahead of the LTS, not Sony lagging.
Usage
nix build .#crsdk # libraries and headers, RPATHs patched
nix develop # shell with CRSDK_LIB and CRSDK_INCLUDE
nix build explains how to supply the zip if you have not already.
Status
Loads, Init() succeeds, enumerates cleanly and correctly reports no cameras on an
empty bus. Not yet tested against a connected camera, so property get and set are
unverified.
Licence
MIT, covering the packaging in this repository. Sony's SDK is proprietary, is not included, and is not covered by it.