diff --git a/configs/sterni/packages.nix b/configs/sterni/packages.nix index e5b9d7d..23c0742 100644 --- a/configs/sterni/packages.nix +++ b/configs/sterni/packages.nix @@ -15,6 +15,9 @@ in { # rust development environment rustup jetbrains.clion + + # foto + fuji-cam-wifi-tool ]; environment.variables.RECIPE_HOME = "$HOME/mahlzeit"; diff --git a/pkgs/default.nix b/pkgs/default.nix index cb6f3ec..b497c68 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -26,6 +26,8 @@ in { gitlog2json = callPackage ./gitlog2json { }; + fuji-cam-wifi-tool = callPackage ./fuji-cam {}; + bitwig-studio3 = callPackage ./bitwig-studio/bitwig-studio3.nix { }; bitwig-studio = callPackage ./bitwig-studio/bitwig-studio-environment.nix { }; diff --git a/pkgs/fuji-cam/default.nix b/pkgs/fuji-cam/default.nix new file mode 100644 index 0000000..f271937 --- /dev/null +++ b/pkgs/fuji-cam/default.nix @@ -0,0 +1,28 @@ +{ stdenv, fetchgit, fetchpatch, cmake, linenoise, opencv, ... }: + +stdenv.mkDerivation rec { + version = "master"; + name = "fuji-cam-wifi-tool-${version}"; + + src = fetchgit { + url = "https://github.com/hkr/fuji-cam-wifi-tool.git"; + rev = "d66aad105f8533f62cf308647850c04f3436af26"; + sha256 = "0bnqdqs7g1p5qz3jnlazydznym516bwwxsyzybqxqxy01jjpc5kw"; + }; + + patches = [ ./my.patch ]; + + buildInputs = [ linenoise opencv ]; + nativeBuildInputs = [ cmake ]; + + cmakeFlags = [ "-DWITH_OPENCV=ON" ]; + + meta = with stdenv.lib; { + description = + "Trying to reverse-engineer the wifi remote control protocol used by Fuji X series cameras"; + homepage = "https://github.com/hkr/fuji-cam-wifi-tool"; + license = licenses.unknown; + platforms = platforms.linux; + maintainers = with maintainers; [ mrVanDalo ]; + }; +} diff --git a/pkgs/fuji-cam/my.patch b/pkgs/fuji-cam/my.patch new file mode 100644 index 0000000..2466a65 --- /dev/null +++ b/pkgs/fuji-cam/my.patch @@ -0,0 +1,66 @@ +diff --git a/lib/include/capabilities.hpp b/lib/include/capabilities.hpp +index d8d05dc..46f3660 100644 +--- a/lib/include/capabilities.hpp ++++ b/lib/include/capabilities.hpp +@@ -37,7 +37,7 @@ enum property_codes: uint16_t { + bool is_known_property(uint16_t value); + std::string to_string(property_codes property); + +-enum data_type : uint16_t { ++enum data_types : uint16_t { + data_type_unknown = 0, + data_type_int8 = 1, + data_type_uint8 = 2, +@@ -47,7 +47,7 @@ enum data_type : uint16_t { + data_type_uint32 = 6 + }; + +-inline bool is_signed(data_type dt) ++inline bool is_signed(data_types dt) + { + switch (dt) { + default: +@@ -59,7 +59,7 @@ inline bool is_signed(data_type dt) + } + } + +-inline size_t data_type_size(data_type dt) ++inline size_t data_type_size(data_types dt) + { + switch (dt) { + case data_type_int8: +@@ -79,7 +79,7 @@ inline size_t data_type_size(data_type dt) + + struct capability { + property_codes property_code = property_unknown; +- data_type data_type = data_type_unknown; ++ data_types data_type = data_type_unknown; + uint8_t get_set = 0; + uint32_t default_value = 0; + uint32_t current_value = 0; +diff --git a/lib/src/capabilities.cpp b/lib/src/capabilities.cpp +index 9f5b175..141d8fc 100644 +--- a/lib/src/capabilities.cpp ++++ b/lib/src/capabilities.cpp +@@ -63,7 +63,7 @@ std::string to_string(property_codes property) + flag = "(current)"; \ + printf("\t\t%s %s\n", value_string, flag.c_str()) + +-static int cap_value_to_int(data_type dt, uint32_t value) ++static int cap_value_to_int(data_types dt, uint32_t value) + { + switch (dt) + { +diff --git a/tool/CMakeLists.txt b/tool/CMakeLists.txt +index 74c15d6..3d221c9 100644 +--- a/tool/CMakeLists.txt ++++ b/tool/CMakeLists.txt +@@ -30,3 +30,8 @@ endif() + if(WIN32) + target_link_libraries(fuji_cam_wifi_tool wsock32 ws2_32) + endif() ++ ++ ++# install ++install(TARGETS fuji_cam_wifi_tool DESTINATION bin) ++