/f90x-tool

A tool for communicating with the Nikon F90x/N90s camera over the serial interface.

Primary LanguageRustGNU General Public License v3.0GPL-3.0

Intro

This tool is intended to communicate with the Nikon F90x/N90s camera over the serial interface. I started this project in order to help me with learning rust.

The tool currently supports the following functions:

  • Triggering autofocus
  • Triggering shutter release
  • Reading from memory
  • Writing to memory
  • Reading a finished roll

There is a separate repository for the documentation of the serial interface here.

Example Usage

For hardware requirements for the serial connection and the memory values of the camera, refer here.

Enabling debug logs

I recommend using the setting "RUST_LOG=debug" in the environment to get more logs. All the bytes sent between the camera and PC would be printed. This can help with troubleshooting.

$ RUST_LOG=debug f90x-tool read /dev/ttyACM0 0xFD28 

[2024-06-07T11:16:01Z DEBUG f90x_tool::camera_interface] Will send camera command: Wakeup
[2024-06-07T11:16:01Z DEBUG f90x_tool::camera_interface] Sending bytes: [00]
[2024-06-07T11:16:01Z DEBUG f90x_tool::camera_interface] Clearing input buffer
[2024-06-07T11:16:01Z DEBUG f90x_tool::camera_interface] Will send camera command: UnitInquiry
[2024-06-07T11:16:01Z DEBUG f90x_tool::camera_interface] Sending bytes: [53, 31, 30, 30, 30, 05]
[2024-06-07T11:16:01Z DEBUG f90x_tool::camera_interface] Received bytes: [31, 30, 32, 30, 46, 39, 30, 58, 2F, 4E, 39, 30, 53, 00, 03, 06]
[2024-06-07T11:16:01Z DEBUG f90x_tool::camera_interface] Will send camera command: ReadMemory { memory_space: 0, address: 64808, length: 1 }
[2024-06-07T11:16:01Z DEBUG f90x_tool::camera_interface] Sending bytes: [01, 20, 80, 00, FD, 28, 00, 01, 03]
[2024-06-07T11:16:01Z DEBUG f90x_tool::camera_interface] Received bytes: [02, 00, 00, 03]
Memory value: [00]

Triggering shutter release

$ f90x-tool shoot /dev/ttyACM0

Checking metering mode

$ f90x-tool read /dev/ttyACM0 0xFD28
Memory value: [01]

Setting metering mode to matrix

$ f90x-tool write /dev/ttyACM0 0xFD28 0x00
Successfully written.

Reading a finished roll

$ f90x-tool read-finished-roll /dev/ttyACM0
Roll Number;ISO
8;25

Frame Number;Shutter Speed;Aperture;Exposure Mode;Metering System;Flash Sync;Focal Length;Exposure Compensation;Flash Compensation
1;1/160;f/5.6;Aperture-Priority Auto;Matrix;Disconnected;50;0.0;0.0
2;1/250;f/5.6;Aperture-Priority Auto;Matrix;Disconnected;50;-1.0;0.0
...

Backlog

Following are some improvements that can be done over time:

  • Check and verify some values in value_constants.rs. They are marked with TODOs.
  • Refactoring the decoder to use the MemoHolderSetting enum.
  • Refactoring the value_constants.rs; maybe some derive macro can be used?
  • Change the module structure to separate the application logic. Then it can be possible to have a module that can be used as a library so that one can implement different user interfaces in addition to the current minimal CLI.
  • Implement deleting of finished rolls
  • Implement reading unfinished rolls