GithubHelp home page GithubHelp logo

hkr / fuji-cam-wifi-tool Goto Github PK

View Code? Open in Web Editor NEW
228.0 36.0 37.0 165 KB

Trying to reverse-engineer the wifi remote control protocol used by Fuji X series cameras

License: The Unlicense

CMake 2.02% C++ 97.98%

fuji-cam-wifi-tool's Introduction

fuji-cam-wifi-tool

Trying to reverse-engineer the wifi remote control protocol used by Fuji X series cameras

Build instructions

Mac OS X, Linux, Windows

mkdir fuji-tool
cd fuji-tool
git clone https://github.com/hkr/fuji-cam-wifi-tool
git -C fuji-cam-wifi-tool submodule update --init --recursive
mkdir build
cd build
cmake ../fuji-cam-wifi-tool
cmake --build .

To build with OpenCV:

cmake ../fuji-cam-wifi-tool -DWITH_OPENCV=yes
cmake --build .

Run the tool

The tool fuji_cam_wifi_tool is an interactive shell (based on linenoise) that can be used to send commands to the camera. At this time it is very limited and mostly undocumented. Supported commands are connect, shutter, stream, info, set_iso, aperture, white_balance, shutter_speed. I suggest to look at the code.

Mac OS X:

./tool/fuji_cam_wifi_tool

Steps to connect the tool to the camera:

  • Press the "Wireless Communication" button on the X-T10
  • Connect your computer to the camera's Wifi Access Point (in ad-hoc mode)
  • Send the connect command.
  • Press the OK (Change) button (only needed the first time, fuji_cam_wifi_tool connects as "HackedClient", see main.cpp)
  • On success the tool should print a lot of debug data and the current camera settings
  • Try taking a picture by sending "shutter"

Using live preview as a linux webcam

modprobe v4l2loopback

See what device this created eg /dev/video2

Then running the command (having built with opencv):

./tool/fuji_cam_wifi_tool
fcwt> connect
fcwt> stream_cv /dev/video2

Opening up the v4l device in chrome or vlc should now show the same output, but without any focus overlays:

vlc v4l2:///dev/video2

Wireshark debugging

To dump control messages (excluding info) set the following wireshark filter:

ip.dst == 192.168.0.1 && len(data.data) > 0 && !(data.data[6:2] == 15:10)

To capture the jpeg start of all streamed images use:

ip.src == 192.168.0.1 && tcp.port == 55742 && data.data[18:2] == ff:d8

protocol is to look under data section of wireshark, first 4 bytes are the size, next 2 bytes are 01 00, then comes 2 byte command (reversed, network format ) eg 15 10 = 0x1015 = single_part message.

fuji-cam-wifi-tool's People

Contributors

fidi avatar grw1983 avatar hi-a avatar hkr avatar lupino3 avatar mzealey avatar nilssei avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fuji-cam-wifi-tool's Issues

Use PTP codes in includes where possible

It seems Fuji's protocol is close to, but not the same as PTP/IP. The port numbers are even close (55740 instead of 15740 like canon and nikon use). Event codes are clearly PTP/IP-similiar, ie 0x100E is fire shutter in Fuji and in PTP/IP too.

So im just saying for the future you could grab libptp's includes and see what else maps 1:1.

build error on Linux

building on Ubuntu 18.04 I get following error:

Scanning dependencies of target fuji_cam_wifi_tool
[ 92%] Building CXX object tool/CMakeFiles/fuji_cam_wifi_tool.dir/src/main.cpp.o
/mnt/sviluppo/fuji-tool/fuji-cam-wifi-tool/tool/src/main.cpp:38:6: error: ‘timed_mutex’ in namespace ‘std’ does not name a type
std::timed_mutex g_comm_lock;
^~~~~~~~~~~
/mnt/sviluppo/fuji-tool/fuji-cam-wifi-tool/tool/src/main.cpp: In function ‘void fcwt::onMouse(int, int, int, int, void*)’:
/mnt/sviluppo/fuji-tool/fuji-cam-wifi-tool/tool/src/main.cpp:80:21: error: ‘getWindowImageRect’ was not declared in this scope
Rect win_size = getWindowImageRect(WIN_NAME);
^~~~~~~~~~~~~~~~~~
/mnt/sviluppo/fuji-tool/fuji-cam-wifi-tool/tool/src/main.cpp:85:8: error: ‘g_comm_lock’ was not declared in this scope
if(g_comm_lock.try_lock_for(std::chrono::milliseconds(10))) {
^~~~~~~~~~~
/mnt/sviluppo/fuji-tool/fuji-cam-wifi-tool/tool/src/main.cpp: In function ‘void fcwt::draw_focus_point(cv::Mat&, fcwt::auto_focus_point, cv::Scalar)’:
/mnt/sviluppo/fuji-tool/fuji-cam-wifi-tool/tool/src/main.cpp:128:25: error: ‘getWindowImageRect’ was not declared in this scope
Rect win_size = getWindowImageRect(WIN_NAME);
^~~~~~~~~~~~~~~~~~
/mnt/sviluppo/fuji-tool/fuji-cam-wifi-tool/tool/src/main.cpp: In function ‘int fcwt::main(int, const char**)’:
/mnt/sviluppo/fuji-tool/fuji-cam-wifi-tool/tool/src/main.cpp:347:16: error: ‘lock_guard’ in namespace ‘std’ does not name a template type
const std::lock_guardstd::timed_mutex lock(g_comm_lock);
^~~~~~~~~~
tool/CMakeFiles/fuji_cam_wifi_tool.dir/build.make:62: recipe for target 'tool/CMakeFiles/fuji_cam_wifi_tool.dir/src/main.cpp.o' failed
make[2]: *** [tool/CMakeFiles/fuji_cam_wifi_tool.dir/src/main.cpp.o] Error 1
CMakeFiles/Makefile2:148: recipe for target 'tool/CMakeFiles/fuji_cam_wifi_tool.dir/all' failed
make[1]: *** [tool/CMakeFiles/fuji_cam_wifi_tool.dir/all] Error 2
Makefile:129: recipe for target 'all' failed
make: *** [all] Error 2

Zooming support?

As far as I can tell, there is no zooming support in this. It'd be nice to see - in the Android app, I can zoom in/out with either a slower zoom or a faster zoom. (There's also some zoom button that seems to open a blank panel that I have no idea what it's meant to do...)

error when building

I'm able to install just fine until I get to cmake --build .. I get the following error:

Scanning dependencies of target fuji_cam_wifi                                                                                                                      
[  7%] Building CXX object lib/CMakeFiles/fuji_cam_wifi.dir/src/capabilities.cpp.o                                                                                 
In file included from /mnt/c/Users/dgmma/Documents/fuji-tool/fuji-cam-wifi-tool/lib/src/capabilities.cpp:1:0:                                                      
/mnt/c/Users/dgmma/Documents/fuji-tool/fuji-cam-wifi-tool/lib/include/capabilities.hpp:82:25: error: declaration of ‘fcwt::data_type fcwt::capability::data_type’ [
-fpermissive]                                                                                                                                                      
   data_type data_type = data_type_unknown;                                                                                                                        
                         ^                                                                                                                                         
/mnt/c/Users/dgmma/Documents/fuji-tool/fuji-cam-wifi-tool/lib/include/capabilities.hpp:40:6: error: changes meaning of ‘data_type’ from ‘enum fcwt::data_type’ [-fp
ermissive]                                                                                                                                                         
 enum data_type : uint16_t {                                                                                                                                       
      ^                                                                                                                                                            
lib/CMakeFiles/fuji_cam_wifi.dir/build.make:62: recipe for target 'lib/CMakeFiles/fuji_cam_wifi.dir/src/capabilities.cpp.o' failed                                 
make[2]: *** [lib/CMakeFiles/fuji_cam_wifi.dir/src/capabilities.cpp.o] Error 1                                                                                     
CMakeFiles/Makefile2:85: recipe for target 'lib/CMakeFiles/fuji_cam_wifi.dir/all' failed                                                                           
make[1]: *** [lib/CMakeFiles/fuji_cam_wifi.dir/all] Error 2                                                                                                        
Makefile:127: recipe for target 'all' failed                                                                                                                       
make: *** [all] Error 2       

Any ideas as to why?

(I'm using an ubuntu bash emulator on windows)

X-T2 requires newer version

Hi there, I just discovered this and wanted to try it out. Using an X-T2, I get an error when connecting:

I get the prompt whether I want to connect to "HackedClient" so the initial handshake seems to work, but afterwards I get a message saying
"The app is previous version
Upgrade app to latest version"

I understand you've been busy with other stuff, so this is just FYI (and for others interested in trying this on an X-T2).

Bounty: control shutter speed

Bounty amount: 100 euro, payable in paypal or bitcoin
Bounty deadline: 1st of July 2017 (can be optionally extended if you're almost finished)
Context: I will photograph the USA eclipse this summer, and if the Fuji XT-1 is not remote controllable, I'll have to buy myself a second hand canon/nikon. I'd rather spend the money on getting remote control for all fuji users!
Concretely, I will take automatic sequences of all shutter speeds between 1/32000s and 2sec over and over in the 2 minutes of the eclipse. This will be used to do kind of HDR processing afterwards.

Specs:

  • fuji-cam-wifi-tool control of all possible shutter speeds (1/32000 to 30 sec)
  • minimal delay between 2 pictures, so no downloading of the image. Ideally the X-t1 should buffer the images, but that's outside of your control so not part of bounty.

PS: maybe money does not motivate you or it's not enough, in that case just do it for the project ;)
PPS: feel free to ask me questions if the scope is not clear

Is it possibe to increase the stream resolution?

I tried to read the code to understand this but I was not able to. Is it possible to increase the resolution when using stream_cv with a videodevice under linux? It is by default 640x480. I tried to build v4l2loopback with changed source code for increasing the width and the height of the device then reisnerting the module, but It doesn't seem to change the final resolution. I am using @mzealey 's fork at the moment. Thank you both for this amazing tool!

Project news?

I'm interested in your work, have you leaved the project?

Thanks for your answer :)

Protocol information

Hi,

I am working on making this software connect with my X-T2 in receive mode. So far, my code, while working, is to ugly to commit. However, I have found new information on the protocol used to request a picture. In commands.cpp, you provide the following :

// get actual image in full size
//    18:00:00:00: 01:00:1b:10: 30:00:00:00: 01:00:00:00: 00:00:00:00:
//    68:81:08:00 // last one is image id?

I would like to correct this. In fact, the request is :

// get actual image in full size
//    18:00:00:00: 01:00:1b:10: 30:00:00:00: 01:00:00:00:
//    00:00:00:00: // offset from the begining of the picture
//    68:81:08:00 // size of the picture chunk asked

Changing the offset and the size, you can choose to download the picture in multiple parts. The camera will know when the whole picture is sent.

Connecting to camera for the first time

I have attempted to follow the second instruction Connect your computer to the camera's Wifi Access Point (in ad-hoc mode) to no avail with both my X-T1 and X100T. I am not sure if these cameras are not supported by the software, but I open up "Wireless Communication" and attempt to connect to the Wi-Fi network through the gnome system utility, to no avail. I successfully downloaded and built this tool, but I have a suspicion that this prerequisite step isn't met regardless of the state of the software.

Any help is appreciated.

video recording function

The project is very interesting! I connected my Fuji X-T30 using this program. But Fuji Camera Remote allows you to shoot video, not just photos. Is it possible to add such a command here?
I want to connect my Fuji X-T30 to a DJI Ronin-SC for video recording. Unfortunately, Fuji does not provide such support :( In the older model, this is done via USB tethering, but there is no video recording in the SDK! I would like to use the USB (from the DJI side) - WiFi (from the Fuji side) bridge. Fuji does not yet support SDK

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.