libpktriggercord-0.85.1/0000755000175100017510000000000014162305227014374 5ustar debiandebianlibpktriggercord-0.85.1/libpktriggercord.spec0000644000175100017510000000460214152245133020605 0ustar debiandebian%define __cmake_in_source_build %{_vpath_builddir} Name: libpktriggercord Version:1.9.4.git Release: %(date -u +%%Y%%m%%d%%H%%M%%S)%{?dist} Summary: Instrument Neutral Distributed Interface 3rd party drivers License: LGPLv2 # See COPYRIGHT file for a description of the licenses and files covered URL: https://indilib.org Source0: https://github.com/indilib/indi-3rdparty/archive/master.tar.gz %global debug_package %{nil} %define __find_requires %{nil} BuildRequires: cmake BuildRequires: libfli-devel BuildRequires: libnova-devel BuildRequires: qt5-qtbase-devel BuildRequires: systemd BuildRequires: gphoto2-devel BuildRequires: LibRaw-devel BuildRequires: indi-libs BuildRequires: indi-devel BuildRequires: libtiff-devel BuildRequires: cfitsio-devel BuildRequires: zlib-devel BuildRequires: gsl-devel BuildRequires: libcurl-devel BuildRequires: libjpeg-turbo-devel BuildRequires: fftw-devel BuildRequires: libftdi-devel BuildRequires: gpsd-devel BuildRequires: libdc1394-devel BuildRequires: boost-devel BuildRequires: boost-regex BuildRequires: gmock BuildRequires: pkgconfig(fftw3) BuildRequires: pkgconfig(cfitsio) BuildRequires: pkgconfig(libcurl) BuildRequires: pkgconfig(gsl) BuildRequires: pkgconfig(libjpeg) BuildRequires: pkgconfig(libusb-1.0) BuildRequires: pkgconfig(zlib) Provides: libpktriggercord.so.0()(64bit) Provides: libpktriggercord.so %description INDI is a distributed control protocol designed to operate astronomical instrumentation. INDI is small, flexible, easy to parse, and scalable. It supports common DCS functions such as remote control, data acquisition, monitoring, and a lot more. This is a 3rd party driver. %prep -v %setup -n %{name}-%{version} %build # This package tries to mix and match PIE and PIC which is wrong and will # trigger link errors when LTO is enabled. # Disable LTO %define _lto_cflags %{nil} cd libpktriggercord %cmake . make VERBOSE=1 %{?_smp_mflags} -j4 %install cd libpktriggercord find %buildroot -type f \( -name '*.so' -o -name '*.so.*' \) -exec chmod 755 {} + make DESTDIR=%{buildroot} install %files %{_libdir}/* %{_includedir}/libpktriggercord /lib/udev/rules.d/95-pentax.rules /lib/udev/rules.d/95-samsung.rules /usr/share/pktriggercord/pentax_settings.json %changelog * Sun Jul 19 2020 Jim Howard 1.8.7.git-1 - update to build from git for copr, credit to Sergio Pascual and Christian Dersch for prior work on spec files libpktriggercord-0.85.1/indi-3rdparty-infos/0000755000175100017510000000000014162305227020201 5ustar debiandebianlibpktriggercord-0.85.1/indi-3rdparty-infos/changelog0000644000175100017510000000020714136175546022064 0ustar debiandebianlibpktriggercord (0.85.01) bionic; urgency=low * New release -- Karl Rees Mon, 15 Mar 2020 17:45:00 +0300 libpktriggercord-0.85.1/cmake_modules/0000755000175100017510000000000014136175546017216 5ustar debiandebianlibpktriggercord-0.85.1/cmake_modules/FindGPSD.cmake0000644000175100017510000000103614136175546021556 0ustar debiandebian# - Find GPSD # Find the native GPSD includes and library FIND_PATH(GPSD_INCLUDE_DIR libgpsmm.h gps.h) SET(GPSD_NAMES ${GPSD_NAMES} gps) FIND_LIBRARY(GPSD_LIBRARY NAMES ${GPSD_NAMES} ) # handle the QUIETLY and REQUIRED arguments and set JPEG_FOUND to TRUE if # all listed variables are TRUE INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(GPSD DEFAULT_MSG GPSD_LIBRARY GPSD_INCLUDE_DIR) IF(GPSD_FOUND) SET(GPSD_LIBRARIES ${GPSD_LIBRARY}) message(STATUS "Found libgps: ${GPSD_LIBRARIES}") ENDIF(GPSD_FOUND) libpktriggercord-0.85.1/cmake_modules/FindFTDI1.cmake0000644000175100017510000000267214136175546021637 0ustar debiandebian# - Try to find FTDI1 # Once done this will define # # FTDI1_FOUND - system has FTDI # FTDI1_INCLUDE_DIR - the FTDI include directory # FTDI1_LIBRARIES - Link these to use FTDI # # N.B. You must include the file as following: # #include # # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. if (FTDI1_INCLUDE_DIR AND FTDI1_LIBRARIES) # in cache already set(FTDI1_FOUND TRUE) message(STATUS "Found libftdi1: ${FTDI1_LIBRARIES}") else (FTDI1_INCLUDE_DIR AND FTDI1_LIBRARIES) find_path(FTDI1_INCLUDE_DIR ftdi.h PATH_SUFFIXES libftdi1 ${_obIncDir} ${GNUWIN32_DIR}/include /usr/local/include ) find_library(FTDI1_LIBRARIES NAMES ftdi1 PATHS ${_obLinkDir} ${GNUWIN32_DIR}/lib /usr/local/lib ) if(FTDI1_INCLUDE_DIR AND FTDI1_LIBRARIES) set(FTDI1_FOUND TRUE) else (FTDI1_INCLUDE_DIR AND FTDI1_LIBRARIES) set(FTDI1_FOUND FALSE) endif(FTDI1_INCLUDE_DIR AND FTDI1_LIBRARIES) if (FTDI1_FOUND) if (NOT FTDI1_FIND_QUIETLY) message(STATUS "Found FTDI1: ${FTDI1_LIBRARIES}") endif (NOT FTDI1_FIND_QUIETLY) else (FTDI1_FOUND) if (FTDI1_FIND_REQUIRED) message(FATAL_ERROR "FTDI not found. Please install libftdi1-dev") endif (FTDI1_FIND_REQUIRED) endif (FTDI1_FOUND) mark_as_advanced(FTDI1_INCLUDE_DIR FTDI1_LIBRARIES) endif (FTDI1_INCLUDE_DIR AND FTDI1_LIBRARIES) libpktriggercord-0.85.1/cmake_modules/FindOpenAL.cmake0000644000175100017510000000660414136175546022145 0ustar debiandebian# Locate OpenAL # This module defines # OPENAL_LIBRARY # OPENAL_FOUND, if false, do not try to link to OpenAL # OPENAL_INCLUDE_DIR, where to find the headers # # $OPENALDIR is an environment variable that would # correspond to the ./configure --prefix=$OPENALDIR # used in building OpenAL. # # Created by Eric Wing. This was influenced by the FindSDL.cmake module. # This makes the presumption that you are include al.h like # #include "al.h" # and not # #include # The reason for this is that the latter is not entirely portable. # Windows/Creative Labs does not by default put their headers in AL/ and # OS X uses the convention . # # For Windows, Creative Labs seems to have added a registry key for their # OpenAL 1.1 installer. I have added that key to the list of search paths, # however, the key looks like it could be a little fragile depending on # if they decide to change the 1.00.0000 number for bug fix releases. # Also, they seem to have laid down groundwork for multiple library platforms # which puts the library in an extra subdirectory. Currently there is only # Win32 and I have hardcoded that here. This may need to be adjusted as # platforms are introduced. # The OpenAL 1.0 installer doesn't seem to have a useful key I can use. # I do not know if the Nvidia OpenAL SDK has a registry key. # # For OS X, remember that OpenAL was added by Apple in 10.4 (Tiger). # To support the framework, I originally wrote special framework detection # code in this module which I have now removed with CMake's introduction # of native support for frameworks. # In addition, OpenAL is open source, and it is possible to compile on Panther. # Furthermore, due to bugs in the initial OpenAL release, and the # transition to OpenAL 1.1, it is common to need to override the built-in # framework. # Per my request, CMake should search for frameworks first in # the following order: # ~/Library/Frameworks/OpenAL.framework/Headers # /Library/Frameworks/OpenAL.framework/Headers # /System/Library/Frameworks/OpenAL.framework/Headers # # On OS X, this will prefer the Framework version (if found) over others. # People will have to manually change the cache values of # OPENAL_LIBRARY to override this selection or set the CMake environment # CMAKE_INCLUDE_PATH to modify the search paths. FIND_PATH(OPENAL_INCLUDE_DIR al.h PATHS $ENV{OPENALDIR} NO_DEFAULT_PATH PATH_SUFFIXES include/AL include/OpenAL include ) FIND_PATH(OPENAL_INCLUDE_DIR al.h PATHS ~/Library/Frameworks /Library/Frameworks /usr/local /usr /sw # Fink /opt/local # DarwinPorts /opt/csw # Blastwave /opt [HKEY_LOCAL_MACHINE\\SOFTWARE\\Creative\ Labs\\OpenAL\ 1.1\ Software\ Development\ Kit\\1.00.0000;InstallDir] PATH_SUFFIXES include/AL include/OpenAL include ) FIND_LIBRARY(OPENAL_LIBRARY NAMES OpenAL al openal OpenAL32 PATHS $ENV{OPENALDIR} NO_DEFAULT_PATH PATH_SUFFIXES lib64 lib libs64 libs libs/Win32 libs/Win64 ) FIND_LIBRARY(OPENAL_LIBRARY NAMES OpenAL al openal OpenAL32 PATHS ~/Library/Frameworks /Library/Frameworks /usr/local /usr /sw /opt/local /opt/csw /opt [HKEY_LOCAL_MACHINE\\SOFTWARE\\Creative\ Labs\\OpenAL\ 1.1\ Software\ Development\ Kit\\1.00.0000;InstallDir] PATH_SUFFIXES lib64 lib libs64 libs libs/Win32 libs/Win64 ) SET(OPENAL_FOUND "NO") IF(OPENAL_LIBRARY AND OPENAL_INCLUDE_DIR) SET(OPENAL_FOUND "YES") ENDIF(OPENAL_LIBRARY AND OPENAL_INCLUDE_DIR) libpktriggercord-0.85.1/cmake_modules/FindFFTW3.cmake0000644000175100017510000000257314136175546021661 0ustar debiandebian# - Try to find FFTW3 # Once done this will define # # FFTW3_FOUND - system has FFTW3 # FFTW3_INCLUDE_DIR - the FFTW3 include directory # FFTW3_LIBRARIES - Link these to use FFTW3 # FFTW3_VERSION_STRING - Human readable version number of fftw3 # FFTW3_VERSION_MAJOR - Major version number of fftw3 # FFTW3_VERSION_MINOR - Minor version number of fftw3 # Copyright (c) 2017, Ilia Platone, # Based on FindLibfacile by Carsten Niehaus, # # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. if (FFTW3_LIBRARIES) # in cache already set(FFTW3_FOUND TRUE) message(STATUS "Found FFTW3: ${FFTW3_LIBRARIES}") else (FFTW3_LIBRARIES) find_library(FFTW3_LIBRARIES NAMES fftw3 PATHS ${_obLinkDir} ${GNUWIN32_DIR}/lib /usr/local/lib ) if(FFTW3_LIBRARIES) set(FFTW3_FOUND TRUE) else (FFTW3_LIBRARIES) set(FFTW3_FOUND FALSE) endif(FFTW3_LIBRARIES) if (FFTW3_FOUND) if (NOT FFTW3_FIND_QUIETLY) message(STATUS "Found FFTW3: ${FFTW3_LIBRARIES}") endif (NOT FFTW3_FIND_QUIETLY) else (FFTW3_FOUND) if (FFTW3_FIND_REQUIRED) message(FATAL_ERROR "FFTW3 not found. Please install libfftw3-dev") endif (FFTW3_FIND_REQUIRED) endif (FFTW3_FOUND) mark_as_advanced(FFTW3_LIBRARIES) endif (FFTW3_LIBRARIES) libpktriggercord-0.85.1/cmake_modules/FindMALLINCAM.cmake0000644000175100017510000000301314136175546022313 0ustar debiandebian# - Try to find MALLINCAM Camera Library # Once done this will define # # MALLINCAM_FOUND - system has Levenhuk # MALLINCAM_INCLUDE_DIR - the Levenhuk include directory # MALLINCAM_LIBRARIES - Link these to use Levenhuk # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. if (MALLINCAM_INCLUDE_DIR AND MALLINCAM_LIBRARIES) # in cache already set(MALLINCAM_FOUND TRUE) message(STATUS "Found libnncam: ${MALLINCAM_LIBRARIES}") else (MALLINCAM_INCLUDE_DIR AND MALLINCAM_LIBRARIES) find_path(MALLINCAM_INCLUDE_DIR mallincam.h PATH_SUFFIXES libmallincam ${_obIncDir} ${GNUWIN32_DIR}/include ) find_library(MALLINCAM_LIBRARIES NAMES mallincam PATHS ${_obLinkDir} ${GNUWIN32_DIR}/lib ) if(MALLINCAM_INCLUDE_DIR AND MALLINCAM_LIBRARIES) set(MALLINCAM_FOUND TRUE) else (MALLINCAM_INCLUDE_DIR AND MALLINCAM_LIBRARIES) set(MALLINCAM_FOUND FALSE) endif(MALLINCAM_INCLUDE_DIR AND MALLINCAM_LIBRARIES) if (MALLINCAM_FOUND) if (NOT MALLINCAM_FIND_QUIETLY) message(STATUS "Found MALLINCAM: ${MALLINCAM_LIBRARIES}") endif (NOT MALLINCAM_FIND_QUIETLY) else (MALLINCAM_FOUND) if (MALLINCAM_FIND_REQUIRED) message(FATAL_ERROR "MALLINCAM not found. Please install MALLINCAM Library http://www.indilib.org") endif (MALLINCAM_FIND_REQUIRED) endif (MALLINCAM_FOUND) mark_as_advanced(MALLINCAM_INCLUDE_DIR MALLINCAM_LIBRARIES) endif (MALLINCAM_INCLUDE_DIR AND MALLINCAM_LIBRARIES) libpktriggercord-0.85.1/cmake_modules/FindNova.cmake0000644000175100017510000000304614136175546021727 0ustar debiandebian# - Try to find NOVA # Once done this will define # # NOVA_FOUND - system has NOVA # NOVA_INCLUDE_DIR - the NOVA include directory # NOVA_LIBRARIES - Link these to use NOVA # Copyright (c) 2006, Jasem Mutlaq # Based on FindLibfacile by Carsten Niehaus, # # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. if (NOVA_INCLUDE_DIR AND NOVA_LIBRARIES) # in cache already set(NOVA_FOUND TRUE) message(STATUS "Found libnova: ${NOVA_LIBRARIES}") else (NOVA_INCLUDE_DIR AND NOVA_LIBRARIES) find_path(NOVA_INCLUDE_DIR libnova.h PATH_SUFFIXES libnova ${_obIncDir} ${GNUWIN32_DIR}/include ) find_library(NOVA_LIBRARIES NAMES nova libnova libnovad PATHS ${_obLinkDir} ${GNUWIN32_DIR}/lib ) set(CMAKE_REQUIRED_INCLUDES ${NOVA_INCLUDE_DIR}) set(CMAKE_REQUIRED_LIBRARIES ${NOVA_LIBRARIES}) if(NOVA_INCLUDE_DIR AND NOVA_LIBRARIES) set(NOVA_FOUND TRUE) else (NOVA_INCLUDE_DIR AND NOVA_LIBRARIES) set(NOVA_FOUND FALSE) endif(NOVA_INCLUDE_DIR AND NOVA_LIBRARIES) if (NOVA_FOUND) if (NOT Nova_FIND_QUIETLY) message(STATUS "Found NOVA: ${NOVA_LIBRARIES}") endif (NOT Nova_FIND_QUIETLY) else (NOVA_FOUND) if (Nova_FIND_REQUIRED) message(FATAL_ERROR "libnova not found. Please install libnova development package.") endif (Nova_FIND_REQUIRED) endif (NOVA_FOUND) mark_as_advanced(NOVA_INCLUDE_DIR NOVA_LIBRARIES) endif (NOVA_INCLUDE_DIR AND NOVA_LIBRARIES) libpktriggercord-0.85.1/cmake_modules/FindVorbis.cmake0000644000175100017510000000204414136175546022265 0ustar debiandebian# - Find vorbis # Find the native vorbis includes and libraries # # VORBIS_INCLUDE_DIR - where to find vorbis.h, etc. # VORBIS_LIBRARIES - List of libraries when using vorbis(file). # VORBIS_FOUND - True if vorbis found. if(VORBIS_INCLUDE_DIR) # Already in cache, be silent set(VORBIS_FIND_QUIETLY TRUE) endif(VORBIS_INCLUDE_DIR) find_path(VORBIS_INCLUDE_DIR vorbis/vorbisfile.h) find_library(OGG_LIBRARY NAMES ogg) find_library(VORBIS_LIBRARY NAMES vorbis) find_library(VORBISFILE_LIBRARY NAMES vorbisfile) # Handle the QUIETLY and REQUIRED arguments and set VORBIS_FOUND to TRUE if # all listed variables are TRUE. include(FindPackageHandleStandardArgs) find_package_handle_standard_args(VORBIS DEFAULT_MSG VORBIS_INCLUDE_DIR OGG_LIBRARY VORBIS_LIBRARY VORBIS_LIBRARY) if(VORBIS_FOUND) set(VORBIS_LIBRARIES ${VORBISFILE_LIBRARY} ${VORBIS_LIBRARY} ${OGG_LIBRARY}) else(VORBIS_FOUND) set(VORBIS_LIBRARIES) endif(VORBIS_FOUND) mark_as_advanced(VORBIS_INCLUDE_DIR) mark_as_advanced(OGG_LIBRARY VORBIS_LIBRARY VORBISFILE_LIBRARY) libpktriggercord-0.85.1/cmake_modules/FindJPEG.cmake0000644000175100017510000000166314136175546021554 0ustar debiandebian# - Find JPEG # Find the native JPEG includes and library # This module defines # JPEG_INCLUDE_DIR, where to find jpeglib.h, etc. # JPEG_LIBRARIES, the libraries needed to use JPEG. # JPEG_FOUND, If false, do not try to use JPEG. # also defined, but not for general use are # JPEG_LIBRARY, where to find the JPEG library. FIND_PATH(JPEG_INCLUDE_DIR jpeglib.h) SET(JPEG_NAMES ${JPEG_NAMES} jpeg) FIND_LIBRARY(JPEG_LIBRARY NAMES ${JPEG_NAMES} ) # handle the QUIETLY and REQUIRED arguments and set JPEG_FOUND to TRUE if # all listed variables are TRUE INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(JPEG DEFAULT_MSG JPEG_LIBRARY JPEG_INCLUDE_DIR) IF(JPEG_FOUND) SET(JPEG_LIBRARIES ${JPEG_LIBRARY}) ENDIF(JPEG_FOUND) # Deprecated declarations. SET (NATIVE_JPEG_INCLUDE_PATH ${JPEG_INCLUDE_DIR} ) GET_FILENAME_COMPONENT (NATIVE_JPEG_LIB_PATH ${JPEG_LIBRARY} PATH) MARK_AS_ADVANCED(JPEG_LIBRARY JPEG_INCLUDE_DIR ) libpktriggercord-0.85.1/cmake_modules/FindCFITSIO.cmake0000644000175100017510000000434614136175546022130 0ustar debiandebian# - Try to find CFITSIO # Once done this will define # # CFITSIO_FOUND - system has CFITSIO # CFITSIO_INCLUDE_DIR - the CFITSIO include directory # CFITSIO_LIBRARIES - Link these to use CFITSIO # CFITSIO_VERSION_STRING - Human readable version number of cfitsio # CFITSIO_VERSION_MAJOR - Major version number of cfitsio # CFITSIO_VERSION_MINOR - Minor version number of cfitsio # Copyright (c) 2006, Jasem Mutlaq # Based on FindLibfacile by Carsten Niehaus, # # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. if (CFITSIO_INCLUDE_DIR AND CFITSIO_LIBRARIES) # in cache already set(CFITSIO_FOUND TRUE) message(STATUS "Found CFITSIO: ${CFITSIO_LIBRARIES}") else (CFITSIO_INCLUDE_DIR AND CFITSIO_LIBRARIES) # JM: Packages from different distributions have different suffixes find_path(CFITSIO_INCLUDE_DIR fitsio.h PATH_SUFFIXES libcfitsio3 libcfitsio0 cfitsio ${_obIncDir} ${GNUWIN32_DIR}/include ) find_library(CFITSIO_LIBRARIES NAMES cfitsio PATHS ${_obLinkDir} ${GNUWIN32_DIR}/lib ) if(CFITSIO_INCLUDE_DIR AND CFITSIO_LIBRARIES) set(CFITSIO_FOUND TRUE) else (CFITSIO_INCLUDE_DIR AND CFITSIO_LIBRARIES) set(CFITSIO_FOUND FALSE) endif(CFITSIO_INCLUDE_DIR AND CFITSIO_LIBRARIES) if (CFITSIO_FOUND) # Find the version of the cfitsio header file(STRINGS ${CFITSIO_INCLUDE_DIR}/fitsio.h CFITSIO_VERSION_STRING LIMIT_COUNT 1 REGEX "CFITSIO_VERSION") STRING(REGEX REPLACE "[^0-9.]" "" CFITSIO_VERSION_STRING ${CFITSIO_VERSION_STRING}) STRING(REGEX REPLACE "^([0-9]+)[.]([0-9]+)" "\\1" CFITSIO_VERSION_MAJOR ${CFITSIO_VERSION_STRING}) STRING(REGEX REPLACE "^([0-9]+)[.]([0-9]+)" "\\2" CFITSIO_VERSION_MINOR ${CFITSIO_VERSION_STRING}) if (NOT CFITSIO_FIND_QUIETLY) message(STATUS "Found CFITSIO ${CFITSIO_VERSION_STRING}: ${CFITSIO_LIBRARIES}") endif (NOT CFITSIO_FIND_QUIETLY) else (CFITSIO_FOUND) if (CFITSIO_FIND_REQUIRED) message(STATUS "CFITSIO not found.") endif (CFITSIO_FIND_REQUIRED) endif (CFITSIO_FOUND) mark_as_advanced(CFITSIO_INCLUDE_DIR CFITSIO_LIBRARIES) endif (CFITSIO_INCLUDE_DIR AND CFITSIO_LIBRARIES) libpktriggercord-0.85.1/cmake_modules/FindUSB1.cmake0000644000175100017510000000562314136175546021541 0ustar debiandebian# - Try to find libusb-1.0 # Once done this will define # # USB1_FOUND - system has libusb-1.0 # USB1_INCLUDE_DIRS - the libusb-1.0 include directories # USB1_LIBRARIES - Link these to use libusb-1.0 # USB1_DEFINITIONS - Compiler switches required for using libusb-1.0 # # USB1_HAS_LIBUSB_ERROR_NAME - defined when libusb-1.0 has libusb_error_name() #============================================================================= # Copyright (c) 2017 Pino Toscano # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # 1. Redistributions of source code must retain the copyright # notice, this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # 3. The name of the author may not be used to endorse or promote products # derived from this software without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #============================================================================= find_package(PkgConfig) pkg_check_modules(PC_LIBUSB1 QUIET libusb-1.0) find_path(USB1_INCLUDE_DIR NAMES libusb.h HINTS ${PC_LIBUSB1_INCLUDE_DIRS} PATH_SUFFIXES libusb-1.0 ) find_library(USB1_LIBRARY NAMES ${PC_LIBUSB1_LIBRARIES} usb-1.0 HINTS ${PC_LIBUSB1_LIBRARY_DIRS} ) set(USB1_INCLUDE_DIRS ${USB1_INCLUDE_DIR}) set(USB1_LIBRARIES ${USB1_LIBRARY}) include(FindPackageHandleStandardArgs) find_package_handle_standard_args(USB1 FOUND_VAR USB1_FOUND REQUIRED_VARS USB1_LIBRARY USB1_INCLUDE_DIR VERSION_VAR PC_LIBUSB1_VERSION ) mark_as_advanced(USB1_INCLUDE_DIRS USB1_LIBRARIES) if(USB1_FOUND) include(CheckCXXSourceCompiles) include(CMakePushCheckState) cmake_push_check_state(RESET) set(CMAKE_REQUIRED_INCLUDES ${USB1_INCLUDE_DIRS}) set(CMAKE_REQUIRED_LIBRARIES ${USB1_LIBRARIES}) check_cxx_source_compiles("#include int main() { libusb_error_name(0); return 0; }" USB1_HAS_LIBUSB_ERROR_NAME) cmake_pop_check_state() endif() libpktriggercord-0.85.1/cmake_modules/FindGMock.cmake0000644000175100017510000001162314136175546022024 0ustar debiandebian#.rst: # FindGMock # --------- # # Locate the Google C++ Mocking Framework. # # Defines the following variables: # # :: # # GMOCK_FOUND - Found the Google Mocking framework # GMOCK_INCLUDE_DIRS - Include directories # # # # Also defines the library variables below as normal variables. These # contain debug/optimized keywords when a debugging library is found. # # :: # # GMOCK_LIBRARIES - libgmock # # # # Accepts the following variables as input: # # :: # # GMOCK_ROOT - (as a CMake or environment variable) # The root directory of the gmock install prefix # # # # :: # # GMOCK_MSVC_SEARCH - If compiling with MSVC, this variable can be set to # "MD" or "MT" to enable searching a GMock build tree # (defaults: "MD") # # # # Example Usage: # # :: # # find_package(GMock REQUIRED) # include_directories(${GMOCK_INCLUDE_DIRS}) # # # # :: # # add_executable(foo foo.cc) # target_link_libraries(foo ${GMOCK_LIBRARIES}) # # # # :: # # add_test(AllMocksInFoo foo) # # # # # # If you would like each Google test to show up in CMock as a test you # may use the following macro. NOTE: It will slow down your tests by # running an executable for each test and test fixture. You will also # have to rerun CMake after adding or removing tests or test fixtures. # # GMOCK_ADD_MOCKS(executable extra_args ARGN) # # :: # # executable = The path to the test executable # extra_args = Pass a list of extra arguments to be passed to # executable enclosed in quotes (or "" for none) # ARGN = A list of source files to search for tests & test # fixtures. # # # # :: # # Example: # set(FooMockArgs --foo 1 --bar 2) # add_executable(FooMock FooUnitMock.cc) # GMOCK_ADD_MOCKS(FooMock "${FooMockArgs}" FooUnitMock.cc) #============================================================================= # Copyright 2009 Kitware, Inc. # Copyright 2009 Philip Lowman # Copyright 2009 Daniel Blezek # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. # # This software is distributed WITHOUT ANY WARRANTY; without even the # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # # Thanks to Daniel Blezek for the GMOCK_ADD_MOCKS code function(GMOCK_ADD_MOCKS executable extra_args) if(NOT ARGN) message(FATAL_ERROR "Missing ARGN: Read the documentation for GMOCK_ADD_MOCKS") endif() foreach(source ${ARGN}) file(READ "${source}" contents) string(REGEX MATCHALL "MOCK_?F?\\(([A-Za-z_0-9 ,]+)\\)" found_tests ${contents}) foreach(hit ${found_tests}) string(REGEX REPLACE ".*\\( *([A-Za-z_0-9]+), *([A-Za-z_0-9]+) *\\).*" "\\1.\\2" test_name ${hit}) add_test(${test_name} ${executable} --gmock_filter=${test_name} ${extra_args}) endforeach() endforeach() endfunction() function(_gmock_append_debugs _endvar _library) if(${_library} AND ${_library}_DEBUG) set(_output optimized ${${_library}} debug ${${_library}_DEBUG}) else() set(_output ${${_library}}) endif() set(${_endvar} ${_output} PARENT_SCOPE) endfunction() function(_gmock_find_library _name) find_library(${_name} NAMES ${ARGN} HINTS ENV GMOCK_ROOT ${GMOCK_ROOT} PATH_SUFFIXES ${_gmock_libpath_suffixes} ) mark_as_advanced(${_name}) endfunction() # if(NOT DEFINED GMOCK_MSVC_SEARCH) set(GMOCK_MSVC_SEARCH MD) endif() set(_gmock_libpath_suffixes lib) if(MSVC) if(GMOCK_MSVC_SEARCH STREQUAL "MD") list(APPEND _gmock_libpath_suffixes msvc/gmock-md/Debug msvc/gmock-md/Release) elseif(GMOCK_MSVC_SEARCH STREQUAL "MT") list(APPEND _gmock_libpath_suffixes msvc/gmock/Debug msvc/gmock/Release) endif() endif() find_path(GMOCK_INCLUDE_DIR gmock/gmock.h HINTS $ENV{GMOCK_ROOT}/include ${GMOCK_ROOT}/include ) mark_as_advanced(GMOCK_INCLUDE_DIR) if(MSVC AND GMOCK_MSVC_SEARCH STREQUAL "MD") # The provided /MD project files for Google Mock add -md suffixes to the # library names. _gmock_find_library(GMOCK_LIBRARY gmock-md gmock) _gmock_find_library(GMOCK_LIBRARY_DEBUG gmock-mdd gmockd) else() _gmock_find_library(GMOCK_LIBRARY gmock) _gmock_find_library(GMOCK_LIBRARY_DEBUG gmockd) endif() FIND_PACKAGE_HANDLE_STANDARD_ARGS(GMock DEFAULT_MSG GMOCK_LIBRARY GMOCK_INCLUDE_DIR) if(GMOCK_FOUND) set(GMOCK_INCLUDE_DIRS ${GMOCK_INCLUDE_DIR}) _gmock_append_debugs(GMOCK_LIBRARIES GMOCK_LIBRARY) endif() libpktriggercord-0.85.1/cmake_modules/FindPackageMessage.cmake0000644000175100017510000000375514136175546023673 0ustar debiandebian#.rst: # FindPackageMessage # ------------------ # # # # FIND_PACKAGE_MESSAGE( "message for user" "find result details") # # This macro is intended to be used in FindXXX.cmake modules files. It # will print a message once for each unique find result. This is useful # for telling the user where a package was found. The first argument # specifies the name (XXX) of the package. The second argument # specifies the message to display. The third argument lists details # about the find result so that if they change the message will be # displayed again. The macro also obeys the QUIET argument to the # find_package command. # # Example: # # :: # # if(X11_FOUND) # FIND_PACKAGE_MESSAGE(X11 "Found X11: ${X11_X11_LIB}" # "[${X11_X11_LIB}][${X11_INCLUDE_DIR}]") # else() # ... # endif() #============================================================================= # Copyright 2008-2009 Kitware, Inc. # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. # # This software is distributed WITHOUT ANY WARRANTY; without even the # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) function(FIND_PACKAGE_MESSAGE pkg msg details) # Avoid printing a message repeatedly for the same find result. if(NOT ${pkg}_FIND_QUIETLY) string(REPLACE "\n" "" details "${details}") set(DETAILS_VAR FIND_PACKAGE_MESSAGE_DETAILS_${pkg}) if(NOT "${details}" STREQUAL "${${DETAILS_VAR}}") # The message has not yet been printed. message(STATUS "${msg}") # Save the find details in the cache to avoid printing the same # message again. set("${DETAILS_VAR}" "${details}" CACHE INTERNAL "Details about finding ${pkg}") endif() endif() endfunction() libpktriggercord-0.85.1/cmake_modules/FindFTDI.cmake0000644000175100017510000000267114136175546021555 0ustar debiandebian# - Try to find FTDI # This finds libFTDI that is compatible with old libusb v 0.1 # For newer libusb > 1.0, use FindFTDI1.cmake # Once done this will define # # FTDI_FOUND - system has FTDI # FTDI_INCLUDE_DIR - the FTDI include directory # FTDI_LIBRARIES - Link these to use FTDI # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. if (FTDI_INCLUDE_DIR AND FTDI_LIBRARIES) # in cache already set(FTDI_FOUND TRUE) message(STATUS "Found libftdi: ${FTDI_LIBRARIES}") else (FTDI_INCLUDE_DIR AND FTDI_LIBRARIES) find_path(FTDI_INCLUDE_DIR ftdi.h PATH_SUFFIXES libftdi1 ${_obIncDir} ${GNUWIN32_DIR}/include /usr/local/include ) find_library(FTDI_LIBRARIES NAMES ftdi ftdi1 PATHS ${_obLinkDir} ${GNUWIN32_DIR}/lib /usr/local/lib ) if(FTDI_INCLUDE_DIR AND FTDI_LIBRARIES) set(FTDI_FOUND TRUE) else (FTDI_INCLUDE_DIR AND FTDI_LIBRARIES) set(FTDI_FOUND FALSE) endif(FTDI_INCLUDE_DIR AND FTDI_LIBRARIES) if (FTDI_FOUND) if (NOT FTDI_FIND_QUIETLY) message(STATUS "Found FTDI: ${FTDI_LIBRARIES}") endif (NOT FTDI_FIND_QUIETLY) else (FTDI_FOUND) if (FTDI_FIND_REQUIRED) message(FATAL_ERROR "FTDI not found. Please install libftdi-dev") endif (FTDI_FIND_REQUIRED) endif (FTDI_FOUND) mark_as_advanced(FTDI_INCLUDE_DIR FTDI_LIBRARIES) endif (FTDI_INCLUDE_DIR AND FTDI_LIBRARIES) libpktriggercord-0.85.1/cmake_modules/FindMODBUS.cmake0000644000175100017510000000320114136175546022006 0ustar debiandebian# - Try to find libmodbus # Once done this will define # # MODBUS_FOUND - system has MODBUS # MODBUS_INCLUDE_DIR - the MODBUS include directory # MODBUS_LIBRARIES - Link these to use MODBUS # Copyright (c) 2006, Jasem Mutlaq # Based on FindLibfacile by Carsten Niehaus, # # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. if (MODBUS_INCLUDE_DIR AND MODBUS_LIBRARIES) # in cache already set(MODBUS_FOUND TRUE) message(STATUS "Found libmodbus: ${MODBUS_LIBRARIES}") else (MODBUS_INCLUDE_DIR AND MODBUS_LIBRARIES) find_path(MODBUS_INCLUDE_DIR modbus.h PATH_SUFFIXES modbus ${_obIncDir} ${GNUWIN32_DIR}/include ) find_library(MODBUS_LIBRARIES NAMES modbus PATHS ${_obLinkDir} ${GNUWIN32_DIR}/lib ) set(CMAKE_REQUIRED_INCLUDES ${MODBUS_INCLUDE_DIR}) set(CMAKE_REQUIRED_LIBRARIES ${MODBUS_LIBRARIES}) if(MODBUS_INCLUDE_DIR AND MODBUS_LIBRARIES) set(MODBUS_FOUND TRUE) else (MODBUS_INCLUDE_DIR AND MODBUS_LIBRARIES) set(MODBUS_FOUND FALSE) endif(MODBUS_INCLUDE_DIR AND MODBUS_LIBRARIES) if (MODBUS_FOUND) if (NOT MODBUS_FIND_QUIETLY) message(STATUS "Found libmodbus: ${MODBUS_LIBRARIES}") endif (NOT MODBUS_FIND_QUIETLY) else (MODBUS_FOUND) if (MODBUS_FIND_REQUIRED) message(FATAL_ERROR "libmodbus not found. Please install libmodbus-devel. https://launchpad.net/libmodbus/") endif (MODBUS_FIND_REQUIRED) endif (MODBUS_FOUND) mark_as_advanced(MODBUS_INCLUDE_DIR MODBUS_LIBRARIES) endif (MODBUS_INCLUDE_DIR AND MODBUS_LIBRARIES) libpktriggercord-0.85.1/cmake_modules/FindSTARSHOOTG.cmake0000644000175100017510000000307014136175546022516 0ustar debiandebian# - Try to find Starshoot Camera Library # Once done this will define # # STARSHOOTG_FOUND - system has Starshoot # STARSHOOTG_INCLUDE_DIR - the Starshoot include directory # STARSHOOTG_LIBRARIES - Link these to use Starshoot # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. if (STARSHOOTG_INCLUDE_DIR AND STARSHOOTG_LIBRARIES) # in cache already set(STARSHOOTG_FOUND TRUE) message(STATUS "Found libstarshootg: ${STARSHOOTG_LIBRARIES}") else (STARSHOOTG_INCLUDE_DIR AND STARSHOOTG_LIBRARIES) find_path(STARSHOOTG_INCLUDE_DIR starshootg.h PATH_SUFFIXES libstarshootg ${_obIncDir} ${GNUWIN32_DIR}/include ) find_library(STARSHOOTG_LIBRARIES NAMES starshootg PATHS ${_obLinkDir} ${GNUWIN32_DIR}/lib ) if(STARSHOOTG_INCLUDE_DIR AND STARSHOOTG_LIBRARIES) set(STARSHOOTG_FOUND TRUE) else (STARSHOOTG_INCLUDE_DIR AND STARSHOOTG_LIBRARIES) set(STARSHOOTG_FOUND FALSE) endif(STARSHOOTG_INCLUDE_DIR AND STARSHOOTG_LIBRARIES) if (STARSHOOTG_FOUND) if (NOT STARSHOOTG_FIND_QUIETLY) message(STATUS "Found StarshootG: ${STARSHOOTG_LIBRARIES}") endif (NOT STARSHOOTG_FIND_QUIETLY) else (STARSHOOTG_FOUND) if (STARSHOOTG_FIND_REQUIRED) message(FATAL_ERROR "StarshootG not found. Please install StarshootG Library http://www.indilib.org") endif (STARSHOOTG_FIND_REQUIRED) endif (STARSHOOTG_FOUND) mark_as_advanced(STARSHOOTG_INCLUDE_DIR STARSHOOTG_LIBRARIES) endif (STARSHOOTG_INCLUDE_DIR AND STARSHOOTG_LIBRARIES) libpktriggercord-0.85.1/cmake_modules/InstallImported.cmake0000644000175100017510000000661114136175546023336 0ustar debiandebian function (install_imported) cmake_parse_arguments (ARG "" "DESTINATION" "TARGETS" ${ARGN}) if (NOT DEFINED ARG_DESTINATION) message (FATAL_ERROR "DESTINATION not defined") endif () foreach (target ${ARG_TARGETS}) get_target_property (location ${target} LOCATION) get_target_property (version ${target} VERSION) get_target_property (soversion ${target} SOVERSION) get_target_property (output_name ${target} OUTPUT_NAME) get_target_property (suffix ${target} SUFFIX) get_target_property (type ${target} TYPE) if (NOT ${type} STREQUAL "SHARED_LIBRARY") message (FATAL_ERROR "install_imported: ${type} not supported") endif () if (${location} STREQUAL "${target}-NOTFOUND") return () endif () if (NOT ${version} STREQUAL "version-NOTFOUND") set (version ".${version}") else () set (version "") endif () if (NOT ${soversion} STREQUAL "soversion-NOTFOUND") set (soversion ".${soversion}") else () set (soversion "") endif () if (${output_name} STREQUAL "output_name-NOTFOUND") set (output_name ${target}) endif () set (name_noversion "${CMAKE_SHARED_LIBRARY_PREFIX}${output_name}${CMAKE_SHARED_LIBRARY_SUFFIX}") if (APPLE) set (name_version "${CMAKE_SHARED_LIBRARY_PREFIX}${output_name}${version}${CMAKE_SHARED_LIBRARY_SUFFIX}") set (name_soversion "${CMAKE_SHARED_LIBRARY_PREFIX}${output_name}${soversion}${CMAKE_SHARED_LIBRARY_SUFFIX}") else () set (name_version "${CMAKE_SHARED_LIBRARY_PREFIX}${output_name}${CMAKE_SHARED_LIBRARY_SUFFIX}${version}") set (name_soversion "${CMAKE_SHARED_LIBRARY_PREFIX}${output_name}${CMAKE_SHARED_LIBRARY_SUFFIX}${soversion}") endif () if (NOT IS_ABSOLUTE ${location}) set (location ${CMAKE_CURRENT_SOURCE_DIR}/${location}) endif () if (NOT ${name_noversion} STREQUAL ${name_soversion}) add_custom_command ( OUTPUT ${name_noversion} COMMAND ${CMAKE_COMMAND} -E create_symlink ${name_soversion} ${name_noversion} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} MAIN_DEPENDENCY ${name_soversion} ) install (FILES ${CMAKE_CURRENT_BINARY_DIR}/${name_noversion} DESTINATION ${ARG_DESTINATION}) endif () if (NOT ${name_soversion} STREQUAL ${name_version}) add_custom_command ( OUTPUT ${name_soversion} COMMAND ${CMAKE_COMMAND} -E create_symlink ${name_version} ${name_soversion} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} MAIN_DEPENDENCY ${name_version} ) install (FILES ${CMAKE_CURRENT_BINARY_DIR}/${name_soversion} DESTINATION ${ARG_DESTINATION}) endif () add_custom_command ( OUTPUT ${name_version} COMMAND ${CMAKE_COMMAND} -E copy "${location}" "${CMAKE_CURRENT_BINARY_DIR}/${name_version}" MAIN_DEPENDENCY ${location} ) install (FILES ${CMAKE_CURRENT_BINARY_DIR}/${name_version} DESTINATION ${ARG_DESTINATION}) add_custom_target( imported_${output_name} ALL DEPENDS ${name_version} ${name_noversion} ${name_soversion} ) endforeach () endfunction () libpktriggercord-0.85.1/cmake_modules/FindAHPXC.cmake0000644000175100017510000000273214136175546021670 0ustar debiandebian# - Try to find AHPXC Universal Library # Once done this will define # # AHPXC_FOUND - system has AHPXC # AHPXC_INCLUDE_DIR - the AHPXC include directory # AHPXC_LIBRARIES - Link these to use AHPXC # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. if (AHPXC_INCLUDE_DIR AND AHPXC_LIBRARIES) # in cache already set(AHPXC_FOUND TRUE) message(STATUS "Found libahp_xc: ${AHPXC_LIBRARIES}") else (AHPXC_INCLUDE_DIR AND AHPXC_LIBRARIES) find_path(AHPXC_INCLUDE_DIR ahp_xc.h PATH_SUFFIXES ahp ${_obIncDir} ${GNUWIN32_DIR}/include ) find_library(AHPXC_LIBRARIES NAMES ahp_xc PATHS ${_obLinkDir} ${GNUWIN32_DIR}/lib ) if(AHPXC_INCLUDE_DIR AND AHPXC_LIBRARIES) set(AHPXC_FOUND TRUE) else (AHPXC_INCLUDE_DIR AND AHPXC_LIBRARIES) set(AHPXC_FOUND FALSE) endif(AHPXC_INCLUDE_DIR AND AHPXC_LIBRARIES) if (AHPXC_FOUND) if (NOT AHPXC_FIND_QUIETLY) message(STATUS "Found AHP XC: ${AHPXC_LIBRARIES}") endif (NOT AHPXC_FIND_QUIETLY) else (AHPXC_FOUND) if (AHPXC_FIND_REQUIRED) message(FATAL_ERROR "AHP XC not found. Please install libahp_xc http://www.indilib.org") endif (AHPXC_FIND_REQUIRED) endif (AHPXC_FOUND) mark_as_advanced(AHPXC_INCLUDE_DIR AHPXC_LIBRARIES) endif (AHPXC_INCLUDE_DIR AND AHPXC_LIBRARIES) libpktriggercord-0.85.1/cmake_modules/FindFLI.cmake0000644000175100017510000000264514136175546021442 0ustar debiandebian# - Try to find Finger Lakes Instruments Library # Once done this will define # # FLI_FOUND - system has FLI # FLI_INCLUDE_DIR - the FLI include directory # FLI_LIBRARIES - Link these to use FLI # Copyright (c) 2008, Jasem Mutlaq # Based on FindLibfacile by Carsten Niehaus, # # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. if (FLI_INCLUDE_DIR AND FLI_LIBRARIES) # in cache already set(FLI_FOUND TRUE) message(STATUS "Found libfli: ${FLI_LIBRARIES}") else (FLI_INCLUDE_DIR AND FLI_LIBRARIES) find_path(FLI_INCLUDE_DIR libfli.h PATH_SUFFIXES fli ${_obIncDir} ${GNUWIN32_DIR}/include ) find_library(FLI_LIBRARIES NAMES fli PATHS ${_obLinkDir} ${GNUWIN32_DIR}/lib ) if(FLI_INCLUDE_DIR AND FLI_LIBRARIES) set(FLI_FOUND TRUE) else (FLI_INCLUDE_DIR AND FLI_LIBRARIES) set(FLI_FOUND FALSE) endif(FLI_INCLUDE_DIR AND FLI_LIBRARIES) if (FLI_FOUND) if (NOT FLI_FIND_QUIETLY) message(STATUS "Found FLI: ${FLI_LIBRARIES}") endif (NOT FLI_FIND_QUIETLY) else (FLI_FOUND) if (FLI_FIND_REQUIRED) message(FATAL_ERROR "FLI not found. Please install libfli-dev. http://www.indilib.org") endif (FLI_FIND_REQUIRED) endif (FLI_FOUND) mark_as_advanced(FLI_INCLUDE_DIR FLI_LIBRARIES) endif (FLI_INCLUDE_DIR AND FLI_LIBRARIES) libpktriggercord-0.85.1/cmake_modules/FindASI.cmake0000644000175100017510000000356514136175546021446 0ustar debiandebian# - Try to find ASI Library # Once done this will define # # ASI_FOUND - system has ASI # ASI_INCLUDE_DIR - the ASI include directory # ASI_LIBRARIES - Link these to use ASI # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. if (ASI_INCLUDE_DIR AND ASI_LIBRARIES) # in cache already set(ASI_FOUND TRUE) message(STATUS "Found libasi: ${ASI_LIBRARIES}") else (ASI_INCLUDE_DIR AND ASI_LIBRARIES) find_path(ASI_INCLUDE_DIR ASICamera2.h PATH_SUFFIXES libasi ${_obIncDir} ${GNUWIN32_DIR}/include ) find_library(ASICAM_LIBRARIES NAMES ASICamera2 PATHS ${_obLinkDir} ${GNUWIN32_DIR}/lib ) find_library(ASIEFW_LIBRARIES NAMES EFWFilter PATHS ${_obLinkDir} ${GNUWIN32_DIR}/lib ) find_library(ASIST4_LIBRARIES NAMES USB2ST4Conv PATHS ${_obLinkDir} ${GNUWIN32_DIR}/lib ) find_library(ASIEAF_LIBRARIES NAMES EAFFocuser PATHS ${_obLinkDir} ${GNUWIN32_DIR}/lib ) if (ASICAM_LIBRARIES AND ASIEFW_LIBRARIES AND ASIST4_LIBRARIES AND ASIEAF_LIBRARIES) set(ASI_LIBRARIES ${ASICAM_LIBRARIES} ${ASIEFW_LIBRARIES} ${ASIST4_LIBRARIES} ${ASIEAF_LIBRARIES}) endif (ASICAM_LIBRARIES AND ASIEFW_LIBRARIES AND ASIST4_LIBRARIES AND ASIEAF_LIBRARIES) if(ASI_INCLUDE_DIR AND ASI_LIBRARIES) set(ASI_FOUND TRUE) else (ASI_INCLUDE_DIR AND ASI_LIBRARIES) set(ASI_FOUND FALSE) endif(ASI_INCLUDE_DIR AND ASI_LIBRARIES) if (ASI_FOUND) if (NOT ASI_FIND_QUIETLY) message(STATUS "Found ASI: ${ASI_LIBRARIES}") endif (NOT ASI_FIND_QUIETLY) else (ASI_FOUND) if (ASI_FIND_REQUIRED) message(FATAL_ERROR "ASI not found. Please install libasi http://www.indilib.org") endif (ASI_FIND_REQUIRED) endif (ASI_FOUND) mark_as_advanced(ASI_INCLUDE_DIR ASI_LIBRARIES) endif (ASI_INCLUDE_DIR AND ASI_LIBRARIES) libpktriggercord-0.85.1/cmake_modules/FindINDI.cmake0000644000175100017510000003457414136175546021561 0ustar debiandebian# Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # http://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # # This module can find INDI Library # # Requirements: # - CMake >= 2.8.3 (for new version of find_package_handle_standard_args) # # The following variables will be defined for your use: # - INDI_FOUND : were all of your specified components found (include dependencies)? # - INDI_WEBSOCKET : was INDI compiled with websocket support? # - INDI_INCLUDE_DIR : INDI include directory # - INDI_DATA_DIR : INDI include directory # - INDI_LIBRARIES : INDI libraries # - INDI_DRIVER_LIBRARIES : Same as above maintained for backward compatibility # - INDI_VERSION : complete version of INDI (x.y.z) # - INDI_MAJOR_VERSION : major version of INDI # - INDI_MINOR_VERSION : minor version of INDI # - INDI_RELEASE_VERSION : release version of INDI # - INDI__FOUND : were found? (FALSE for non specified component if it is not a dependency) # # For windows or non standard installation, define INDI_ROOT variable to point to the root installation of INDI. Two ways: # - run cmake with -DINDI_ROOT= # - define an environment variable with the same name before running cmake # With cmake-gui, before pressing "Configure": # 1) Press "Add Entry" button # 2) Add a new entry defined as: # - Name: INDI_ROOT # - Type: choose PATH in the selection list # - Press "..." button and select the root installation of INDI # # Example Usage: # # 1. Copy this file in the root of your project source directory # 2. Then, tell CMake to search this non-standard module in your project directory by adding to your CMakeLists.txt: # set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}) # 3. Finally call find_package() once, here are some examples to pick from # # Require INDI 1.4 or later # find_package(INDI 1.4 REQUIRED) # # if(INDI_FOUND) # include_directories(${INDI_INCLUDE_DIR}) # add_executable(myapp myapp.cpp) # target_link_libraries(myapp ${INDI_LIBRARIES}) # endif(INDI_FOUND) # # # Using Components: # # You can search for specific components. Currently, the following components are available # * driver: to build INDI hardware drivers. # * align: to build drivers that use INDI Alignment Subsystem. # * client: to build pure C++ INDI clients. # * clientqt5: to build Qt5-based INDI clients. # * lx200: To build LX200-based 3rd party drivers (you must link with driver above as well). # # By default, if you do not specify any components, driver and align components are searched. # # Example: # # To use INDI Qt5 Client library only in your application: # # find_package(INDI COMPONENTS clientqt5 REQUIRED) # # if(INDI_FOUND) # include_directories(${INDI_INCLUDE_DIR}) # add_executable(myapp myapp.cpp) # target_link_libraries(myapp ${INDI_LIBRARIES}) # endif(INDI_FOUND) # # To use INDI driver + lx200 component in your application: # # find_package(INDI COMPONENTS driver lx200 REQUIRED) # # if(INDI_FOUND) # include_directories(${INDI_INCLUDE_DIR}) # add_executable(myapp myapp.cpp) # target_link_libraries(myapp ${INDI_LIBRARIES}) # endif(INDI_FOUND) # # Notice we still use ${INDI_LIBRARIES} which now should contain both driver & lx200 libraries. #============================================================================================== # Copyright (c) 2011-2013, julp # Copyright (c) 2017-2019 Jasem Mutlaq # # Distributed under the OSI-approved BSD License # # This software is distributed WITHOUT ANY WARRANTY; without even the # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTINDILAR PURPOSE. #============================================================================= find_package(PkgConfig QUIET) ########## Private ########## if(NOT DEFINED INDI_PUBLIC_VAR_NS) set(INDI_PUBLIC_VAR_NS "INDI") # Prefix for all INDI relative public variables endif(NOT DEFINED INDI_PUBLIC_VAR_NS) if(NOT DEFINED INDI_PRIVATE_VAR_NS) set(INDI_PRIVATE_VAR_NS "_${INDI_PUBLIC_VAR_NS}") # Prefix for all INDI relative internal variables endif(NOT DEFINED INDI_PRIVATE_VAR_NS) if(NOT DEFINED PC_INDI_PRIVATE_VAR_NS) set(PC_INDI_PRIVATE_VAR_NS "_PC${INDI_PRIVATE_VAR_NS}") # Prefix for all pkg-config relative internal variables endif(NOT DEFINED PC_INDI_PRIVATE_VAR_NS) function(indidebug _VARNAME) if(${INDI_PUBLIC_VAR_NS}_DEBUG) if(DEFINED ${INDI_PUBLIC_VAR_NS}_${_VARNAME}) message("${INDI_PUBLIC_VAR_NS}_${_VARNAME} = ${${INDI_PUBLIC_VAR_NS}_${_VARNAME}}") else(DEFINED ${INDI_PUBLIC_VAR_NS}_${_VARNAME}) message("${INDI_PUBLIC_VAR_NS}_${_VARNAME} = ") endif(DEFINED ${INDI_PUBLIC_VAR_NS}_${_VARNAME}) endif(${INDI_PUBLIC_VAR_NS}_DEBUG) endfunction(indidebug) set(${INDI_PRIVATE_VAR_NS}_ROOT "") if(DEFINED ENV{INDI_ROOT}) set(${INDI_PRIVATE_VAR_NS}_ROOT "$ENV{INDI_ROOT}") endif(DEFINED ENV{INDI_ROOT}) if (DEFINED INDI_ROOT) set(${INDI_PRIVATE_VAR_NS}_ROOT "${INDI_ROOT}") endif(DEFINED INDI_ROOT) set(${INDI_PRIVATE_VAR_NS}_BIN_SUFFIXES ) set(${INDI_PRIVATE_VAR_NS}_LIB_SUFFIXES ) if(CMAKE_SIZEOF_VOID_P EQUAL 8) list(APPEND ${INDI_PRIVATE_VAR_NS}_BIN_SUFFIXES "bin64") list(APPEND ${INDI_PRIVATE_VAR_NS}_LIB_SUFFIXES "lib64") endif(CMAKE_SIZEOF_VOID_P EQUAL 8) list(APPEND ${INDI_PRIVATE_VAR_NS}_BIN_SUFFIXES "bin") list(APPEND ${INDI_PRIVATE_VAR_NS}_LIB_SUFFIXES "lib") set(${INDI_PRIVATE_VAR_NS}_COMPONENTS ) # ... macro(INDI_declare_component _NAME) list(APPEND ${INDI_PRIVATE_VAR_NS}_COMPONENTS ${_NAME}) set("${INDI_PRIVATE_VAR_NS}_COMPONENTS_${_NAME}" ${ARGN}) endmacro(INDI_declare_component) INDI_declare_component(driver indidriver) INDI_declare_component(align indiAlignmentDriver) INDI_declare_component(client indiclient) INDI_declare_component(clientqt5 indiclientqt5) INDI_declare_component(lx200 indilx200) ########## Public ########## set(${INDI_PUBLIC_VAR_NS}_FOUND TRUE) set(${INDI_PUBLIC_VAR_NS}_LIBRARIES ) set(${INDI_PUBLIC_VAR_NS}_INCLUDE_DIR ) foreach(${INDI_PRIVATE_VAR_NS}_COMPONENT ${${INDI_PRIVATE_VAR_NS}_COMPONENTS}) string(TOUPPER "${${INDI_PRIVATE_VAR_NS}_COMPONENT}" ${INDI_PRIVATE_VAR_NS}_UPPER_COMPONENT) set("${INDI_PUBLIC_VAR_NS}_${${INDI_PRIVATE_VAR_NS}_UPPER_COMPONENT}_FOUND" FALSE) # may be done in the INDI_declare_component macro endforeach(${INDI_PRIVATE_VAR_NS}_COMPONENT) # Check components if(NOT ${INDI_PUBLIC_VAR_NS}_FIND_COMPONENTS) # driver and posix client by default set(${INDI_PUBLIC_VAR_NS}_FIND_COMPONENTS driver align) else(NOT ${INDI_PUBLIC_VAR_NS}_FIND_COMPONENTS) #list(APPEND ${INDI_PUBLIC_VAR_NS}_FIND_COMPONENTS uc) list(REMOVE_DUPLICATES ${INDI_PUBLIC_VAR_NS}_FIND_COMPONENTS) foreach(${INDI_PRIVATE_VAR_NS}_COMPONENT ${${INDI_PUBLIC_VAR_NS}_FIND_COMPONENTS}) if(NOT DEFINED ${INDI_PRIVATE_VAR_NS}_COMPONENTS_${${INDI_PRIVATE_VAR_NS}_COMPONENT}) message(FATAL_ERROR "Unknown INDI component: ${${INDI_PRIVATE_VAR_NS}_COMPONENT}") endif(NOT DEFINED ${INDI_PRIVATE_VAR_NS}_COMPONENTS_${${INDI_PRIVATE_VAR_NS}_COMPONENT}) endforeach(${INDI_PRIVATE_VAR_NS}_COMPONENT) endif(NOT ${INDI_PUBLIC_VAR_NS}_FIND_COMPONENTS) # Includes find_path( ${INDI_PUBLIC_VAR_NS}_INCLUDE_DIR indidevapi.h PATH_SUFFIXES libindi include/libindi ${PC_INDI_INCLUDE_DIR} ${_obIncDir} ${GNUWIN32_DIR}/include HINTS ${${INDI_PRIVATE_VAR_NS}_ROOT} DOC "Include directory for INDI" ) find_path( WEBSOCKET_HEADER indiwsserver.h PATH_SUFFIXES libindi ${PC_INDI_INCLUDE_DIR} ${_obIncDir} ${GNUWIN32_DIR}/include ) if (WEBSOCKET_HEADER) SET(INDI_WEBSOCKET TRUE) else() SET(INDI_WEBSOCKET FALSE) endif() find_path(${INDI_PUBLIC_VAR_NS}_DATA_DIR drivers.xml PATH_SUFFIXES share/indi DOC "Data directory for INDI" ) if(${INDI_PUBLIC_VAR_NS}_INCLUDE_DIR) if(EXISTS "${${INDI_PUBLIC_VAR_NS}_INCLUDE_DIR}/indiversion.h") # INDI >= 1.4 file(READ "${${INDI_PUBLIC_VAR_NS}_INCLUDE_DIR}/indiversion.h" ${INDI_PRIVATE_VAR_NS}_VERSION_HEADER_CONTENTS) else() message(FATAL_ERROR "INDI version header not found") endif() if(${INDI_PRIVATE_VAR_NS}_VERSION_HEADER_CONTENTS MATCHES ".*INDI_VERSION ([0-9]+).([0-9]+).([0-9]+)") set(${INDI_PUBLIC_VAR_NS}_MAJOR_VERSION "${CMAKE_MATCH_1}") set(${INDI_PUBLIC_VAR_NS}_MINOR_VERSION "${CMAKE_MATCH_2}") set(${INDI_PUBLIC_VAR_NS}_RELEASE_VERSION "${CMAKE_MATCH_3}") else() message(FATAL_ERROR "failed to detect INDI version") endif() set(${INDI_PUBLIC_VAR_NS}_VERSION "${${INDI_PUBLIC_VAR_NS}_MAJOR_VERSION}.${${INDI_PUBLIC_VAR_NS}_MINOR_VERSION}.${${INDI_PUBLIC_VAR_NS}_RELEASE_VERSION}") # Check libraries foreach(${INDI_PRIVATE_VAR_NS}_COMPONENT ${${INDI_PUBLIC_VAR_NS}_FIND_COMPONENTS}) set(${INDI_PRIVATE_VAR_NS}_POSSIBLE_RELEASE_NAMES ) set(${INDI_PRIVATE_VAR_NS}_POSSIBLE_DEBUG_NAMES ) foreach(${INDI_PRIVATE_VAR_NS}_BASE_NAME ${${INDI_PRIVATE_VAR_NS}_COMPONENTS_${${INDI_PRIVATE_VAR_NS}_COMPONENT}}) list(APPEND ${INDI_PRIVATE_VAR_NS}_POSSIBLE_RELEASE_NAMES "${${INDI_PRIVATE_VAR_NS}_BASE_NAME}") list(APPEND ${INDI_PRIVATE_VAR_NS}_POSSIBLE_DEBUG_NAMES "${${INDI_PRIVATE_VAR_NS}_BASE_NAME}d") list(APPEND ${INDI_PRIVATE_VAR_NS}_POSSIBLE_RELEASE_NAMES "${${INDI_PRIVATE_VAR_NS}_BASE_NAME}${INDI_MAJOR_VERSION}${INDI_MINOR_VERSION}") list(APPEND ${INDI_PRIVATE_VAR_NS}_POSSIBLE_DEBUG_NAMES "${${INDI_PRIVATE_VAR_NS}_BASE_NAME}${INDI_MAJOR_VERSION}${INDI_MINOR_VERSION}d") endforeach(${INDI_PRIVATE_VAR_NS}_BASE_NAME) find_library( ${INDI_PRIVATE_VAR_NS}_LIB_RELEASE_${${INDI_PRIVATE_VAR_NS}_COMPONENT} NAMES ${${INDI_PRIVATE_VAR_NS}_POSSIBLE_RELEASE_NAMES} HINTS ${${INDI_PRIVATE_VAR_NS}_ROOT} PATH_SUFFIXES ${_INDI_LIB_SUFFIXES} DOC "Release libraries for INDI" ) find_library( ${INDI_PRIVATE_VAR_NS}_LIB_DEBUG_${${INDI_PRIVATE_VAR_NS}_COMPONENT} NAMES ${${INDI_PRIVATE_VAR_NS}_POSSIBLE_DEBUG_NAMES} HINTS ${${INDI_PRIVATE_VAR_NS}_ROOT} PATH_SUFFIXES ${_INDI_LIB_SUFFIXES} DOC "Debug libraries for INDI" ) string(TOUPPER "${${INDI_PRIVATE_VAR_NS}_COMPONENT}" ${INDI_PRIVATE_VAR_NS}_UPPER_COMPONENT) if(NOT ${INDI_PRIVATE_VAR_NS}_LIB_RELEASE_${${INDI_PRIVATE_VAR_NS}_COMPONENT} AND NOT ${INDI_PRIVATE_VAR_NS}_LIB_DEBUG_${${INDI_PRIVATE_VAR_NS}_COMPONENT}) # both not found set("${INDI_PUBLIC_VAR_NS}_${${INDI_PRIVATE_VAR_NS}_UPPER_COMPONENT}_FOUND" FALSE) set("${INDI_PUBLIC_VAR_NS}_FOUND" FALSE) else(NOT ${INDI_PRIVATE_VAR_NS}_LIB_RELEASE_${${INDI_PRIVATE_VAR_NS}_COMPONENT} AND NOT ${INDI_PRIVATE_VAR_NS}_LIB_DEBUG_${${INDI_PRIVATE_VAR_NS}_COMPONENT}) # one or both found set("${INDI_PUBLIC_VAR_NS}_${${INDI_PRIVATE_VAR_NS}_UPPER_COMPONENT}_FOUND" TRUE) if(NOT ${INDI_PRIVATE_VAR_NS}_LIB_RELEASE_${${INDI_PRIVATE_VAR_NS}_COMPONENT}) # release not found => we are in debug set(${INDI_PRIVATE_VAR_NS}_LIB_${${INDI_PRIVATE_VAR_NS}_COMPONENT} "${${INDI_PRIVATE_VAR_NS}_LIB_DEBUG_${${INDI_PRIVATE_VAR_NS}_COMPONENT}}") elseif(NOT ${INDI_PRIVATE_VAR_NS}_LIB_DEBUG_${${INDI_PRIVATE_VAR_NS}_COMPONENT}) # debug not found => we are in release set(${INDI_PRIVATE_VAR_NS}_LIB_${${INDI_PRIVATE_VAR_NS}_COMPONENT} "${${INDI_PRIVATE_VAR_NS}_LIB_RELEASE_${${INDI_PRIVATE_VAR_NS}_COMPONENT}}") else() # both found set( ${INDI_PRIVATE_VAR_NS}_LIB_${${INDI_PRIVATE_VAR_NS}_COMPONENT} optimized ${${INDI_PRIVATE_VAR_NS}_LIB_RELEASE_${${INDI_PRIVATE_VAR_NS}_COMPONENT}} debug ${${INDI_PRIVATE_VAR_NS}_LIB_DEBUG_${${INDI_PRIVATE_VAR_NS}_COMPONENT}} ) endif() list(APPEND ${INDI_PUBLIC_VAR_NS}_LIBRARIES ${${INDI_PRIVATE_VAR_NS}_LIB_${${INDI_PRIVATE_VAR_NS}_COMPONENT}}) endif(NOT ${INDI_PRIVATE_VAR_NS}_LIB_RELEASE_${${INDI_PRIVATE_VAR_NS}_COMPONENT} AND NOT ${INDI_PRIVATE_VAR_NS}_LIB_DEBUG_${${INDI_PRIVATE_VAR_NS}_COMPONENT}) endforeach(${INDI_PRIVATE_VAR_NS}_COMPONENT) # Check find_package arguments include(FindPackageHandleStandardArgs) if(${INDI_PUBLIC_VAR_NS}_FIND_REQUIRED AND NOT ${INDI_PUBLIC_VAR_NS}_FIND_QUIETLY) find_package_handle_standard_args( ${INDI_PUBLIC_VAR_NS} REQUIRED_VARS ${INDI_PUBLIC_VAR_NS}_LIBRARIES ${INDI_PUBLIC_VAR_NS}_INCLUDE_DIR VERSION_VAR ${INDI_PUBLIC_VAR_NS}_VERSION ) else(${INDI_PUBLIC_VAR_NS}_FIND_REQUIRED AND NOT ${INDI_PUBLIC_VAR_NS}_FIND_QUIETLY) find_package_handle_standard_args(${INDI_PUBLIC_VAR_NS} "INDI not found" ${INDI_PUBLIC_VAR_NS}_LIBRARIES ${INDI_PUBLIC_VAR_NS}_INCLUDE_DIR) endif(${INDI_PUBLIC_VAR_NS}_FIND_REQUIRED AND NOT ${INDI_PUBLIC_VAR_NS}_FIND_QUIETLY) else(${INDI_PUBLIC_VAR_NS}_INCLUDE_DIR) set("${INDI_PUBLIC_VAR_NS}_FOUND" FALSE) if(${INDI_PUBLIC_VAR_NS}_FIND_REQUIRED AND NOT ${INDI_PUBLIC_VAR_NS}_FIND_QUIETLY) message(FATAL_ERROR "Could not find INDI include directory") endif(${INDI_PUBLIC_VAR_NS}_FIND_REQUIRED AND NOT ${INDI_PUBLIC_VAR_NS}_FIND_QUIETLY) endif(${INDI_PUBLIC_VAR_NS}_INCLUDE_DIR) mark_as_advanced( ${INDI_PUBLIC_VAR_NS}_INCLUDE_DIR ${INDI_PUBLIC_VAR_NS}_LIBRARIES INDI_WEBSOCKET ) # IN (args) indidebug("FIND_COMPONENTS") indidebug("FIND_REQUIRED") indidebug("FIND_QUIETLY") indidebug("FIND_VERSION") # OUT # Found indidebug("FOUND") indidebug("SERVER_FOUND") indidebug("DRIVERS_FOUND") indidebug("CLIENT_FOUND") indidebug("QT5CLIENT_FOUND") indidebug("LX200_FOUND") # Linking indidebug("INCLUDE_DIR") indidebug("DATA_DIR") indidebug("LIBRARIES") # Backward compatibility set(${INDI_PUBLIC_VAR_NS}_DRIVER_LIBRARIES ${${INDI_PUBLIC_VAR_NS}_LIBRARIES}) indidebug("DRIVER_LIBRARIES") # Version indidebug("MAJOR_VERSION") indidebug("MINOR_VERSION") indidebug("RELEASE_VERSION") indidebug("VERSION") libpktriggercord-0.85.1/cmake_modules/CMakeCommon.cmake0000644000175100017510000001366714136175546022366 0ustar debiandebian include(CheckCCompilerFlag) #IF (NOT ${CMAKE_CXX_COMPILER_ID} STREQUAL "MSVC") #SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99") #SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") #ENDIF () # C++14 Support if (NOT ANDROID) set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD_REQUIRED ON) endif(NOT ANDROID) # Position Independent Code set(CMAKE_POSITION_INDEPENDENT_CODE ON) # Ccache support IF (ANDROID OR UNIX OR APPLE) FIND_PROGRAM(CCACHE_FOUND ccache) SET(CCACHE_SUPPORT OFF CACHE BOOL "Enable ccache support") IF ((CCACHE_FOUND OR ANDROID) AND CCACHE_SUPPORT MATCHES ON) SET_PROPERTY(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache) SET_PROPERTY(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache) ENDIF () ENDIF () # Add security (hardening flags) IF (UNIX OR APPLE OR ANDROID) # Older compilers are predefining _FORTIFY_SOURCE, so defining it causes a # warning, which is then considered an error. Second issue is that for # these compilers, _FORTIFY_SOURCE must be used while optimizing, else # causes a warning, which also results in an error. And finally, CMake is # not using optimization when testing for libraries, hence breaking the build. CHECK_C_COMPILER_FLAG("-Werror -D_FORTIFY_SOURCE=2" COMPATIBLE_FORTIFY_SOURCE) IF (${COMPATIBLE_FORTIFY_SOURCE}) SET(SEC_COMP_FLAGS "-D_FORTIFY_SOURCE=2") ENDIF () SET(SEC_COMP_FLAGS "${SEC_COMP_FLAGS} -fstack-protector-all -fPIE") # Make sure to add optimization flag. Some systems require this for _FORTIFY_SOURCE. IF (NOT CMAKE_BUILD_TYPE MATCHES "MinSizeRel" AND NOT CMAKE_BUILD_TYPE MATCHES "Release" AND NOT CMAKE_BUILD_TYPE MATCHES "Debug") SET(SEC_COMP_FLAGS "${SEC_COMP_FLAGS} -O1") ENDIF () IF (NOT ANDROID AND NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" AND NOT APPLE AND NOT CYGWIN) SET(SEC_COMP_FLAGS "${SEC_COMP_FLAGS} -Wa,--noexecstack") ENDIF () SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${SEC_COMP_FLAGS}") SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${SEC_COMP_FLAGS}") SET(SEC_LINK_FLAGS "") IF (NOT APPLE AND NOT CYGWIN) SET(SEC_LINK_FLAGS "${SEC_LINK_FLAGS} -Wl,-z,nodump -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now") ENDIF () IF (NOT ANDROID AND NOT APPLE) SET(SEC_LINK_FLAGS "${SEC_LINK_FLAGS} -pie") ENDIF () SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${SEC_LINK_FLAGS}") SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${SEC_LINK_FLAGS}") ENDIF () # Warning, debug and linker flags SET(FIX_WARNINGS OFF CACHE BOOL "Enable strict compilation mode to turn compiler warnings to errors") IF (UNIX OR APPLE) SET(COMP_FLAGS "") SET(LINKER_FLAGS "") # Verbose warnings and turns all to errors SET(COMP_FLAGS "${COMP_FLAGS} -Wall -Wextra") IF (FIX_WARNINGS) SET(COMP_FLAGS "${COMP_FLAGS} -Werror") ENDIF () # Omit problematic warnings IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") SET(COMP_FLAGS "${COMP_FLAGS} -Wno-unused-but-set-variable") ENDIF () IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 6.9.9) SET(COMP_FLAGS "${COMP_FLAGS} -Wno-format-truncation") ENDIF () IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang") SET(COMP_FLAGS "${COMP_FLAGS} -Wno-nonnull -Wno-deprecated-declarations") ENDIF () # Minimal debug info with Clang IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") SET(COMP_FLAGS "${COMP_FLAGS} -gline-tables-only") ELSE () SET(COMP_FLAGS "${COMP_FLAGS} -g") ENDIF () # Note: The following flags are problematic on older systems with gcc 4.8 IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 4.9.9)) IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang") SET(COMP_FLAGS "${COMP_FLAGS} -Wno-unused-command-line-argument") ENDIF () FIND_PROGRAM(LDGOLD_FOUND ld.gold) SET(LDGOLD_SUPPORT OFF CACHE BOOL "Enable ld.gold support") # Optional ld.gold is 2x faster than normal ld IF (LDGOLD_FOUND AND LDGOLD_SUPPORT MATCHES ON AND NOT APPLE AND NOT CMAKE_SYSTEM_PROCESSOR MATCHES arm) SET(LINKER_FLAGS "${LINKER_FLAGS} -fuse-ld=gold") # Use Identical Code Folding SET(COMP_FLAGS "${COMP_FLAGS} -ffunction-sections") SET(LINKER_FLAGS "${LINKER_FLAGS} -Wl,--icf=safe") # Compress the debug sections # Note: Before valgrind 3.12.0, patch should be applied for valgrind (https://bugs.kde.org/show_bug.cgi?id=303877) IF (NOT APPLE AND NOT ANDROID AND NOT CMAKE_SYSTEM_PROCESSOR MATCHES arm AND NOT CMAKE_CXX_CLANG_TIDY) SET(COMP_FLAGS "${COMP_FLAGS} -Wa,--compress-debug-sections") SET(LINKER_FLAGS "${LINKER_FLAGS} -Wl,--compress-debug-sections=zlib") ENDIF () ENDIF () ENDIF () # Apply the flags SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${COMP_FLAGS}") SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${COMP_FLAGS}") SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${LINKER_FLAGS}") SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${LINKER_FLAGS}") ENDIF () # Sanitizer support SET(CLANG_SANITIZERS OFF CACHE BOOL "Clang's sanitizer support") IF (CLANG_SANITIZERS AND ((UNIX AND "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") OR (APPLE AND "${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang"))) SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address,undefined -fno-omit-frame-pointer") SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address,undefined -fno-omit-frame-pointer") SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address,undefined -fno-omit-frame-pointer") SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fsanitize=address,undefined -fno-omit-frame-pointer") ENDIF () # Unity Build support include(UnityBuild) libpktriggercord-0.85.1/cmake_modules/FindINOVASDK.cmake0000644000175100017510000000275314136175546022246 0ustar debiandebian# - Try to find INOVASDK Universal Library # Once done this will define # # INOVASDK_FOUND - system has INOVASDK # INOVASDK_INCLUDE_DIR - the INOVASDK include directory # INOVASDK_LIBRARIES - Link these to use INOVASDK # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. if (INOVASDK_INCLUDE_DIR AND INOVASDK_LIBRARIES) # in cache already set(INOVASDK_FOUND TRUE) message(STATUS "Found libinovasdk: ${INOVASDK_LIBRARIES}") else (INOVASDK_INCLUDE_DIR AND INOVASDK_LIBRARIES) find_path(INOVASDK_INCLUDE_DIR inovasdk.h PATH_SUFFIXES inovasdk ${_obIncDir} ${GNUWIN32_DIR}/include ) find_library(INOVASDK_LIBRARIES NAMES inovasdk PATHS ${_obLinkDir} ${GNUWIN32_DIR}/lib ) if(INOVASDK_INCLUDE_DIR AND INOVASDK_LIBRARIES) set(INOVASDK_FOUND TRUE) else (INOVASDK_INCLUDE_DIR AND INOVASDK_LIBRARIES) set(INOVASDK_FOUND FALSE) endif(INOVASDK_INCLUDE_DIR AND INOVASDK_LIBRARIES) if (INOVASDK_FOUND) if (NOT INOVASDK_FIND_QUIETLY) message(STATUS "Found INOVASDK: ${INOVASDK_LIBRARIES}") endif (NOT INOVASDK_FIND_QUIETLY) else (INOVASDK_FOUND) if (INOVASDK_FIND_REQUIRED) message(FATAL_ERROR "INOVASDK not found. Please install INOVASDK Library http://www.indilib.org") endif (INOVASDK_FIND_REQUIRED) endif (INOVASDK_FOUND) mark_as_advanced(INOVASDK_INCLUDE_DIR INOVASDK_LIBRARIES) endif (INOVASDK_INCLUDE_DIR AND INOVASDK_LIBRARIES) libpktriggercord-0.85.1/cmake_modules/FindQHY.cmake0000644000175100017510000000242614136175546021466 0ustar debiandebian# - Try to find QHY Library # Once done this will define # # QHY_FOUND - system has QHY # QHY_INCLUDE_DIR - the QHY include directory # QHY_LIBRARIES - Link these to use QHY # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. if (QHY_INCLUDE_DIR AND QHY_LIBRARIES) # in cache already set(QHY_FOUND TRUE) message(STATUS "Found libqhyccd: ${QHY_LIBRARIES}") else (QHY_INCLUDE_DIR AND QHY_LIBRARIES) find_path(QHY_INCLUDE_DIR qhyccd.h PATH_SUFFIXES libqhy ${_obIncDir} ${GNUWIN32_DIR}/include ) find_library(QHY_LIBRARIES NAMES qhyccd PATHS ${_obLinkDir} ${GNUWIN32_DIR}/lib ) if(QHY_INCLUDE_DIR AND QHY_LIBRARIES) set(QHY_FOUND TRUE) else (QHY_INCLUDE_DIR AND QHY_LIBRARIES) set(QHY_FOUND FALSE) endif(QHY_INCLUDE_DIR AND QHY_LIBRARIES) if (QHY_FOUND) if (NOT QHY_FIND_QUIETLY) message(STATUS "Found QHY: ${QHY_LIBRARIES}") endif (NOT QHY_FIND_QUIETLY) else (QHY_FOUND) if (QHY_FIND_REQUIRED) message(FATAL_ERROR "QHY not found. Please install libqhy http://www.indilib.org") endif (QHY_FIND_REQUIRED) endif (QHY_FOUND) mark_as_advanced(QHY_INCLUDE_DIR QHY_LIBRARIES) endif (QHY_INCLUDE_DIR AND QHY_LIBRARIES) libpktriggercord-0.85.1/cmake_modules/FindPENTAX.cmake0000644000175100017510000000553014136175546022023 0ustar debiandebian# - Try to find PENTAX Universal Libraries # Once done this will define # # PENTAX_FOUND - system has PENTAX # PENTAX_INCLUDE_DIR - the PENTAX include directory # PENTAX_LIBRARIES - Link these to use PENTAX # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. if (PENTAX_INCLUDE_DIR AND PENTAX_LIBRARIES) # in cache already set(PENTAX_FOUND TRUE) message(STATUS "Found PENTAX libraries: ${PENTAX_LIBRARIES}") else (PENTAX_INCLUDE_DIR AND PENTAX_LIBRARIES) find_path(PKTRIGGERCORD_INCLUDE_DIR libpktriggercord.h PATH_SUFFIXES libpktriggercord ${_obIncDir} ${GNUWIN32_DIR}/include ) find_library(PKTRIGGERCORD_LIBRARIES NAMES pktriggercord PATHS ${_obLinkDir} ${GNUWIN32_DIR}/lib PATH_SUFFIXES indipentax ) #if not armv8, then look for ricoh library; otherwise only use pktriggercord library if(NOT (${CMAKE_SYSTEM_PROCESSOR} MATCHES "^aarch64")) find_path(RICOH_INCLUDE_DIR ricoh_camera_sdk.hpp PATH_SUFFIXES libpentax libricohcamerasdk ${_obIncDir} ${GNUWIN32_DIR}/include ) find_library(RICOH_LIBRARIES NAMES RicohCameraSDKCpp PATHS ${_obLinkDir} ${GNUWIN32_DIR}/lib ) find_library(RICOHMTP_LIBRARIES NAMES libmtpricoh.so.9.3.0 PATHS ${_obLinkDir} ${GNUWIN32_DIR}/lib ) if (RICOH_INCLUDE_DIR AND PKTRIGGERCORD_INCLUDE_DIR) set(PENTAX_INCLUDE_DIR ${RICOH_INCLUDE_DIR} ${PKTRIGGERCORD_INCLUDE_DIR}) endif (RICOH_INCLUDE_DIR AND PKTRIGGERCORD_INCLUDE_DIR) if (RICOH_LIBRARIES AND RICOHMTP_LIBRARIES AND PKTRIGGERCORD_LIBRARIES) set(PENTAX_LIBRARIES ${RICOH_LIBRARIES} ${RICOHMTP_LIBRARIES} ${PKTRIGGERCORD_LIBRARIES}) endif (RICOH_LIBRARIES AND RICOHMTP_LIBRARIES AND PKTRIGGERCORD_LIBRARIES) else() if (PKTRIGGERCORD_INCLUDE_DIR) set(PENTAX_INCLUDE_DIR ${PKTRIGGERCORD_INCLUDE_DIR}) endif (PKTRIGGERCORD_INCLUDE_DIR) if (PKTRIGGERCORD_LIBRARIES) set(PENTAX_LIBRARIES ${PKTRIGGERCORD_LIBRARIES}) endif (PKTRIGGERCORD_LIBRARIES) endif() if(PENTAX_INCLUDE_DIR AND PENTAX_LIBRARIES) set(PENTAX_FOUND TRUE) else (PENTAX_INCLUDE_DIR AND PENTAX_LIBRARIES) set(PENTAX_FOUND FALSE) endif(PENTAX_INCLUDE_DIR AND PENTAX_LIBRARIES) if (PENTAX_FOUND) if (NOT PENTAX_FIND_QUIETLY) message(STATUS "Found PENTAX libraries: ${PENTAX_LIBRARIES}") endif (NOT PENTAX_FIND_QUIETLY) else (PENTAX_FOUND) if (PENTAX_FIND_REQUIRED) message(FATAL_ERROR "One or both of libricohcamersdk and libpktriggercord are not found. Please install them. See http://www.indilib.org.") endif (PENTAX_FIND_REQUIRED) endif (PENTAX_FOUND) mark_as_advanced(PENTAX_INCLUDE_DIR PENTAX_LIBRARIES) endif (PENTAX_INCLUDE_DIR AND PENTAX_LIBRARIES) libpktriggercord-0.85.1/cmake_modules/FindGLIB2.cmake0000644000175100017510000001327114136175546021624 0ustar debiandebian# - Try to find GLib2 # Once done this will define # # GLIB2_FOUND - system has GLib2 # GLIB2_INCLUDE_DIRS - the GLib2 include directory # GLIB2_LIBRARIES - Link these to use GLib2 # # HAVE_GLIB_GREGEX_H glib has gregex.h header and # supports g_regex_match_simple # # Copyright (c) 2006 Andreas Schneider # Copyright (c) 2006 Philippe Bernery # Copyright (c) 2007 Daniel Gollub # Copyright (c) 2007 Alban Browaeys # Copyright (c) 2008 Michael Bell # Copyright (c) 2008 Bjoern Ricks # # Redistribution and use is allowed according to the terms of the New # BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. # IF (GLIB2_LIBRARIES AND GLIB2_INCLUDE_DIRS ) # in cache already SET(GLIB2_FOUND TRUE) ELSE (GLIB2_LIBRARIES AND GLIB2_INCLUDE_DIRS ) INCLUDE(FindPkgConfig) ## Glib IF ( GLIB2_FIND_REQUIRED ) SET( _pkgconfig_REQUIRED "REQUIRED" ) ELSE ( GLIB2_FIND_REQUIRED ) SET( _pkgconfig_REQUIRED "" ) ENDIF ( GLIB2_FIND_REQUIRED ) IF ( GLIB2_MIN_VERSION ) PKG_SEARCH_MODULE( GLIB2 ${_pkgconfig_REQUIRED} glib-2.0>=${GLIB2_MIN_VERSION} ) ELSE ( GLIB2_MIN_VERSION ) PKG_SEARCH_MODULE( GLIB2 ${_pkgconfig_REQUIRED} glib-2.0 ) ENDIF ( GLIB2_MIN_VERSION ) IF ( PKG_CONFIG_FOUND ) IF ( GLIB2_FOUND ) SET ( GLIB2_CORE_FOUND TRUE ) ELSE ( GLIB2_FOUND ) SET ( GLIB2_CORE_FOUND FALSE ) ENDIF ( GLIB2_FOUND ) ENDIF ( PKG_CONFIG_FOUND ) # Look for glib2 include dir and libraries w/o pkgconfig IF ( NOT GLIB2_FOUND AND NOT PKG_CONFIG_FOUND ) FIND_PATH( _glibconfig_include_DIR NAMES glibconfig.h PATHS /opt/gnome/lib64 /opt/gnome/lib /opt/lib/ /opt/local/lib /sw/lib/ /usr/lib64 /usr/lib /usr/local/include ${CMAKE_LIBRARY_PATH} PATH_SUFFIXES glib-2.0/include ) FIND_PATH( _glib2_include_DIR NAMES glib.h PATHS /opt/gnome/include /opt/local/include /sw/include /usr/include /usr/local/include PATH_SUFFIXES glib-2.0 ) #MESSAGE(STATUS "Glib headers: ${_glib2_include_DIR}") FIND_LIBRARY( _glib2_link_DIR NAMES glib-2.0 glib PATHS /opt/gnome/lib /opt/local/lib /sw/lib /usr/lib /usr/local/lib ) IF ( _glib2_include_DIR AND _glib2_link_DIR ) SET ( _glib2_FOUND TRUE ) ENDIF ( _glib2_include_DIR AND _glib2_link_DIR ) IF ( _glib2_FOUND ) SET ( GLIB2_INCLUDE_DIRS ${_glib2_include_DIR} ${_glibconfig_include_DIR} ) SET ( GLIB2_LIBRARIES ${_glib2_link_DIR} ) SET ( GLIB2_CORE_FOUND TRUE ) ELSE ( _glib2_FOUND ) SET ( GLIB2_CORE_FOUND FALSE ) ENDIF ( _glib2_FOUND ) # Handle dependencies # libintl IF ( NOT LIBINTL_FOUND ) FIND_PATH(LIBINTL_INCLUDE_DIR NAMES libintl.h PATHS /opt/gnome/include /opt/local/include /sw/include /usr/include /usr/local/include ) FIND_LIBRARY(LIBINTL_LIBRARY NAMES intl PATHS /opt/gnome/lib /opt/local/lib /sw/lib /usr/local/lib /usr/lib ) IF (LIBINTL_LIBRARY AND LIBINTL_INCLUDE_DIR) SET (LIBINTL_FOUND TRUE) ENDIF (LIBINTL_LIBRARY AND LIBINTL_INCLUDE_DIR) ENDIF ( NOT LIBINTL_FOUND ) # libiconv IF ( NOT LIBICONV_FOUND ) FIND_PATH(LIBICONV_INCLUDE_DIR NAMES iconv.h PATHS /opt/gnome/include /opt/local/include /opt/local/include /sw/include /sw/include /usr/local/include /usr/include PATH_SUFFIXES glib-2.0 ) FIND_LIBRARY(LIBICONV_LIBRARY NAMES iconv PATHS /opt/gnome/lib /opt/local/lib /sw/lib /usr/lib /usr/local/lib ) IF (LIBICONV_LIBRARY AND LIBICONV_INCLUDE_DIR) SET (LIBICONV_FOUND TRUE) ENDIF (LIBICONV_LIBRARY AND LIBICONV_INCLUDE_DIR) ENDIF ( NOT LIBICONV_FOUND ) IF (LIBINTL_FOUND) SET (GLIB2_LIBRARIES ${GLIB2_LIBRARIES} ${LIBINTL_LIBRARY}) SET (GLIB2_INCLUDE_DIRS ${GLIB2_INCLUDE_DIRS} ${LIBINTL_INCLUDE_DIR}) ENDIF (LIBINTL_FOUND) IF (LIBICONV_FOUND) SET (GLIB2_LIBRARIES ${GLIB2_LIBRARIES} ${LIBICONV_LIBRARY}) SET (GLIB2_INCLUDE_DIRS ${GLIB2_INCLUDE_DIRS} ${LIBICONV_INCLUDE_DIR}) ENDIF (LIBICONV_FOUND) ENDIF ( NOT GLIB2_FOUND AND NOT PKG_CONFIG_FOUND ) ## IF (GLIB2_CORE_FOUND AND GLIB2_INCLUDE_DIRS AND GLIB2_LIBRARIES) SET (GLIB2_FOUND TRUE) ENDIF (GLIB2_CORE_FOUND AND GLIB2_INCLUDE_DIRS AND GLIB2_LIBRARIES) IF (GLIB2_FOUND) IF (NOT GLIB2_FIND_QUIETLY) MESSAGE (STATUS "Found GLib2: ${GLIB2_LIBRARIES} ${GLIB2_INCLUDE_DIRS}") ENDIF (NOT GLIB2_FIND_QUIETLY) ELSE (GLIB2_FOUND) IF (GLIB2_FIND_REQUIRED) MESSAGE (SEND_ERROR "Could not find GLib2") ENDIF (GLIB2_FIND_REQUIRED) ENDIF (GLIB2_FOUND) # show the GLIB2_INCLUDE_DIRS and GLIB2_LIBRARIES variables only in the advanced view MARK_AS_ADVANCED(GLIB2_INCLUDE_DIRS GLIB2_LIBRARIES) MARK_AS_ADVANCED(LIBICONV_INCLUDE_DIR LIBICONV_LIBRARY) MARK_AS_ADVANCED(LIBINTL_INCLUDE_DIR LIBINTL_LIBRARY) ENDIF (GLIB2_LIBRARIES AND GLIB2_INCLUDE_DIRS) IF ( GLIB2_FOUND ) # Check if system has a newer version of glib # which supports g_regex_match_simple INCLUDE( CheckIncludeFiles ) SET( CMAKE_REQUIRED_INCLUDES ${GLIB2_INCLUDE_DIRS} ) CHECK_INCLUDE_FILES ( glib/gregex.h HAVE_GLIB_GREGEX_H ) # Reset CMAKE_REQUIRED_INCLUDES SET( CMAKE_REQUIRED_INCLUDES "" ) ENDIF( GLIB2_FOUND ) libpktriggercord-0.85.1/cmake_modules/FindATIK.cmake0000644000175100017510000000254014136175546021552 0ustar debiandebian# - Try to find Atik Camera Library # Once done this will define # # ATIK_FOUND - system has ATIK # ATIK_INCLUDE_DIR - the ATIK include directory # ATIK_LIBRARIES - Link these to use ATIK # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. if (ATIK_INCLUDE_DIR AND ATIK_LIBRARIES) # in cache already set(ATIK_FOUND TRUE) message(STATUS "Found libatik: ${ATIK_LIBRARIES}") else (ATIK_INCLUDE_DIR AND ATIK_LIBRARIES) find_path(ATIK_INCLUDE_DIR AtikCameras.h PATH_SUFFIXES libatik ${_obIncDir} ${GNUWIN32_DIR}/include ) find_library(ATIK_LIBRARIES NAMES atikcameras PATHS ${_obLinkDir} ${GNUWIN32_DIR}/lib ) if(ATIK_INCLUDE_DIR AND ATIK_LIBRARIES) set(ATIK_FOUND TRUE) else (ATIK_INCLUDE_DIR AND ATIK_LIBRARIES) set(ATIK_FOUND FALSE) endif(ATIK_INCLUDE_DIR AND ATIK_LIBRARIES) if (ATIK_FOUND) if (NOT ATIK_FIND_QUIETLY) message(STATUS "Found Atik Library: ${ATIK_LIBRARIES}") endif (NOT ATIK_FIND_QUIETLY) else (ATIK_FOUND) if (ATIK_FIND_REQUIRED) message(FATAL_ERROR "Atik Library not found. Please install Atik Library http://www.indilib.org") endif (ATIK_FIND_REQUIRED) endif (ATIK_FOUND) mark_as_advanced(ATIK_INCLUDE_DIR ATIK_LIBRARIES) endif (ATIK_INCLUDE_DIR AND ATIK_LIBRARIES) libpktriggercord-0.85.1/cmake_modules/FindALUT.cmake0000644000175100017510000000504214136175546021567 0ustar debiandebian# - Locate ALUT # This module defines # ALUT_LIBRARY # ALUT_FOUND, if false, do not try to link to OpenAL # ALUT_INCLUDE_DIR, where to find the headers # # $OPENALDIR is an environment variable that would # correspond to the ./configure --prefix=$OPENALDIR # used in building OpenAL. # # Created by Bryan Donlan, based on the FindOpenAL.cmake module by Eric Wang. FIND_PATH(ALUT_INCLUDE_DIR alut.h $ENV{OPENALDIR}/include ~/Library/Frameworks/OpenAL.framework/Headers /Library/Frameworks/OpenAL.framework/Headers /System/Library/Frameworks/OpenAL.framework/Headers # Tiger /usr/local/include/AL /usr/local/include/OpenAL /usr/local/include /usr/include/AL /usr/include/OpenAL /usr/include /sw/include/AL # Fink /sw/include/OpenAL /sw/include /opt/local/include/AL # DarwinPorts /opt/local/include/OpenAL /opt/local/include /opt/csw/include/AL # Blastwave /opt/csw/include/OpenAL /opt/csw/include /opt/include/AL /opt/include/OpenAL /opt/include ) # I'm not sure if I should do a special casing for Apple. It is # unlikely that other Unix systems will find the framework path. # But if they do ([Next|Open|GNU]Step?), # do they want the -framework option also? IF(${ALUT_INCLUDE_DIR} MATCHES ".framework") STRING(REGEX REPLACE "(.*)/.*\\.framework/.*" "\\1" ALUT_FRAMEWORK_PATH_TMP ${ALUT_INCLUDE_DIR}) IF("${ALUT_FRAMEWORK_PATH_TMP}" STREQUAL "/Library/Frameworks" OR "${ALUT_FRAMEWORK_PATH_TMP}" STREQUAL "/System/Library/Frameworks" ) # String is in default search path, don't need to use -F SET (ALUT_LIBRARY "-framework OpenAL" CACHE STRING "OpenAL framework for OSX") ELSE("${ALUT_FRAMEWORK_PATH_TMP}" STREQUAL "/Library/Frameworks" OR "${ALUT_FRAMEWORK_PATH_TMP}" STREQUAL "/System/Library/Frameworks" ) # String is not /Library/Frameworks, need to use -F SET(ALUT_LIBRARY "-F${ALUT_FRAMEWORK_PATH_TMP} -framework OpenAL" CACHE STRING "OpenAL framework for OSX") ENDIF("${ALUT_FRAMEWORK_PATH_TMP}" STREQUAL "/Library/Frameworks" OR "${ALUT_FRAMEWORK_PATH_TMP}" STREQUAL "/System/Library/Frameworks" ) # Clear the temp variable so nobody can see it SET(ALUT_FRAMEWORK_PATH_TMP "" CACHE INTERNAL "") ELSE(${ALUT_INCLUDE_DIR} MATCHES ".framework") FIND_LIBRARY(ALUT_LIBRARY NAMES alut PATHS $ENV{OPENALDIR}/lib $ENV{OPENALDIR}/libs /usr/local/lib /usr/lib /sw/lib /opt/local/lib /opt/csw/lib /opt/lib ) ENDIF(${ALUT_INCLUDE_DIR} MATCHES ".framework") SET(ALUT_FOUND "NO") IF(ALUT_LIBRARY) SET(ALUT_FOUND "YES") ENDIF(ALUT_LIBRARY) libpktriggercord-0.85.1/cmake_modules/FindD2XX.cmake0000644000175100017510000000262014136175546021546 0ustar debiandebian# - Try to find D2XX # Once done this will define # # D2XX_FOUND - system has FTDI # D2XX_INCLUDE_DIR - the FTDI include directory # D2XX_LIBRARIES - Link these to use FTDI # # N.B. You must include the file as following: # #include # # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. if (D2XX_INCLUDE_DIR AND D2XX_LIBRARIES) # in cache already set(D2XX_FOUND TRUE) message(STATUS "Found libfd2xx: ${D2XX_LIBRARIES}") else (D2XX_INCLUDE_DIR AND D2XX_LIBRARIES) find_path(D2XX_INCLUDE_DIR ftd2xx.h #PATH_SUFFIXES libD2XX ${_obIncDir} ${GNUWIN32_DIR}/include /usr/local/include ) find_library(D2XX_LIBRARIES NAMES ftd2xx PATHS ${_obLinkDir} ${GNUWIN32_DIR}/lib /usr/local/lib ) if(D2XX_INCLUDE_DIR AND D2XX_LIBRARIES) set(D2XX_FOUND TRUE) else (D2XX_INCLUDE_DIR AND D2XX_LIBRARIES) set(D2XX_FOUND FALSE) endif(D2XX_INCLUDE_DIR AND D2XX_LIBRARIES) if (D2XX_FOUND) if (NOT D2XX_FIND_QUIETLY) message(STATUS "Found D2XX: ${D2XX_LIBRARIES}") endif (NOT D2XX_FIND_QUIETLY) else (D2XX_FOUND) if (D2XX_FIND_REQUIRED) message(FATAL_ERROR "D2XX not found. Please install libd2xx") endif (D2XX_FIND_REQUIRED) endif (D2XX_FOUND) mark_as_advanced(D2XX_INCLUDE_DIR D2XX_LIBRARIES) endif (D2XX_INCLUDE_DIR AND D2XX_LIBRARIES) libpktriggercord-0.85.1/cmake_modules/FindARAVIS.cmake0000644000175100017510000000272314136175546022012 0ustar debiandebian# - Find the native sqlite3 includes and library # # This module defines # ARV_INCLUDE_DIR, where to find libgphoto2 header files # ARV_LIBRARIES, the libraries to link against to use libgphoto2 # ARV_FOUND, If false, do not try to use libgphoto2. # ARV_VERSION_STRING, e.g. 2.4.14 # ARV_VERSION_MAJOR, e.g. 2 # ARV_VERSION_MINOR, e.g. 4 # ARV_VERSION_PATCH, e.g. 14 # # also defined, but not for general use are # ARV_LIBRARY, where to find the sqlite3 library. #============================================================================= # Copyright 2010 henrik andersson #============================================================================= SET(ARV_FIND_REQUIRED ${Arv_FIND_REQUIRED}) find_path(ARV_INCLUDE_DIR aravis-0.8/arv.h) mark_as_advanced(ARV_INCLUDE_DIR) set(ARV_NAMES ${ARV_NAMES} aravis-0.8) find_library(ARV_LIBRARY NAMES ${ARV_NAMES} ) mark_as_advanced(ARV_LIBRARY) set(ARV_VERSION_MAJOR "0") set(ARV_VERSION_MINOR "8") set(ARV_VERSION_STRING "${ARV_VERSION_MAJOR}.${ARV_VERSION_MINOR}") # handle the QUIETLY and REQUIRED arguments and set ARV_FOUND to TRUE if # all listed variables are TRUE include(FindPackageHandleStandardArgs) find_package_handle_standard_args(ARV DEFAULT_MSG ARV_LIBRARY ARV_INCLUDE_DIR) IF(ARV_FOUND) #SET(Arv_LIBRARIES ${ARV_LIBRARY}) SET(Arv_LIBRARIES "aravis-0.8") SET(Arv_INCLUDE_DIRS "${ARV_INCLUDE_DIR}/aravis-0.8") MESSAGE (STATUS "Found aravis: ${Arv_LIBRARIES} ${Arv_INCLUDE_DIRS}") ENDIF(ARV_FOUND) libpktriggercord-0.85.1/cmake_modules/FindFISHCAMP.cmake0000644000175100017510000000322514136175546022215 0ustar debiandebian# - Try to find FISHCAMP CCD # Once done this will define # # FISHCAMP_FOUND - system has FISHCAMP # FISHCAMP_LIBRARIES - Link these to use FISHCAMP # FISHCAMP_INCLUDE_DIR - Fishcamp include directory # Copyright (c) 2006, Jasem Mutlaq # Based on FindLibfacile by Carsten Niehaus, # # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. if (FISHCAMP_LIBRARIES AND FISHCAMP_INCLUDE_DIR) # in cache already set(FISHCAMP_FOUND TRUE) message(STATUS "Found FISHCAMP: ${FISHCAMP_LIBRARIES}") else (FISHCAMP_LIBRARIES AND FISHCAMP_INCLUDE_DIR) find_library(FISHCAMP_LIBRARIES NAMES fishcamp PATHS ${_obLinkDir} ${GNUWIN32_DIR}/lib ) find_path(FISHCAMP_INCLUDE_DIR fishcamp.h PATH_SUFFIXES libfishcamp ${_obIncDir} ${GNUWIN32_DIR}/include ) set(CMAKE_REQUIRED_LIBRARIES ${FISHCAMP_LIBRARIES}) if(FISHCAMP_LIBRARIES AND FISHCAMP_INCLUDE_DIR) set(FISHCAMP_FOUND TRUE) else (FISHCAMP_LIBRARIES AND FISHCAMP_INCLUDE_DIR) set(FISHCAMP_FOUND FALSE) endif(FISHCAMP_LIBRARIES AND FISHCAMP_INCLUDE_DIR) if (FISHCAMP_FOUND) if (NOT FISHCAMP_FIND_QUIETLY) message(STATUS "Found FISHCAMP: ${FISHCAMP_LIBRARIES}") endif (NOT FISHCAMP_FIND_QUIETLY) else (FISHCAMP_FOUND) if (FISHCAMP_FIND_REQUIRED) message(FATAL_ERROR "FISHCAMP not found. Please install FISHCAMP library. http://www.indilib.org") endif (FISHCAMP_FIND_REQUIRED) endif (FISHCAMP_FOUND) mark_as_advanced(FISHCAMP_LIBRARIES FISHCAMP_INCLUDE_DIR) endif (FISHCAMP_LIBRARIES AND FISHCAMP_INCLUDE_DIR) libpktriggercord-0.85.1/cmake_modules/FindDC1394.cmake0000644000175100017510000000264314136175546021635 0ustar debiandebian# - Try to find dc1394 library (version 2) and include files # Once done this will define # # DC1394_FOUND - system has DC1394 # DC1394_INCLUDE_DIR - the DC1394 include directory # DC1394_LIBRARIES - Link these to use DC1394 # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. if (DC1394_INCLUDE_DIR AND DC1394_LIBRARIES) # in cache already set(DC1394_FOUND TRUE) message(STATUS "Found libdc1394: ${DC1394_LIBRARIES}") else (DC1394_INCLUDE_DIR AND DC1394_LIBRARIES) find_path(DC1394_INCLUDE_DIR control.h PATH_SUFFIXES dc1394 ${_obIncDir} ${GNUWIN32_DIR}/include ) find_library(DC1394_LIBRARIES NAMES dc1394 PATHS ${_obLinkDir} ${GNUWIN32_DIR}/lib ) if(DC1394_INCLUDE_DIR AND DC1394_LIBRARIES) set(DC1394_FOUND TRUE) else (DC1394_INCLUDE_DIR AND DC1394_LIBRARIES) set(DC1394_FOUND FALSE) endif(DC1394_INCLUDE_DIR AND DC1394_LIBRARIES) if (DC1394_FOUND) if (NOT DC1394_FIND_QUIETLY) message(STATUS "Found DC1394: ${DC1394_LIBRARIES}") endif (NOT DC1394_FIND_QUIETLY) else (DC1394_FOUND) if (DC1394_FIND_REQUIRED) message(FATAL_ERROR "DC1394 not found. Please install libdc1394 development package.") endif (DC1394_FIND_REQUIRED) endif (DC1394_FOUND) mark_as_advanced(DC1394_INCLUDE_DIR DC1394_LIBRARIES) endif (DC1394_INCLUDE_DIR AND DC1394_LIBRARIES) libpktriggercord-0.85.1/cmake_modules/FindTIFFXX.cmake0000644000175100017510000000176314136175546022040 0ustar debiandebian# - Try to find TIFFXX Library # Once done this will define # # TIFXX_LIBRARY - Link these to use TIFFXX # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. if (TIFFXX_LIBRARY) # in cache already set(TIFFXX_FOUND TRUE) message(STATUS "Found libtiffxx: ${TIFFXX_LIBRARY}") else (TIFFXX_LIBRARY) find_library(TIFFXX_LIBRARY NAMES tiffxx PATHS ${_obLinkDir} ${GNUWIN32_DIR}/lib ) if(TIFFXX_LIBRARY) set(TIFFXX_FOUND TRUE) else (TIFFXX_LIBRARY) set(TIFFXX_FOUND FALSE) endif(TIFFXX_LIBRARY) if (TIFFXX_FOUND) if (NOT TIFFXX_FIND_QUIETLY) message(STATUS "Found tiffxx: ${TIFFXX_LIBRARY}") endif (NOT TIFFXX_FIND_QUIETLY) else (TIFFXX_FOUND) if (TIFFXX_FIND_REQUIRED) message(FATAL_ERROR "tiffxx is not found. Please install it first.") endif (TIFFXX_FIND_REQUIRED) endif (TIFFXX_FOUND) mark_as_advanced(TIFFXX_LIBRARY) endif (TIFFXX_LIBRARY) libpktriggercord-0.85.1/cmake_modules/FindGSL.cmake0000644000175100017510000002224114136175546021447 0ustar debiandebian#.rst: # FindGSL # -------- # # Find the native GSL includes and libraries. # # The GNU Scientific Library (GSL) is a numerical library for C and C++ # programmers. It is free software under the GNU General Public # License. # # Imported Targets # ^^^^^^^^^^^^^^^^ # # If GSL is found, this module defines the following :prop_tgt:`IMPORTED` # targets:: # # GSL::gsl - The main GSL library. # GSL::gslcblas - The CBLAS support library used by GSL. # # Result Variables # ^^^^^^^^^^^^^^^^ # # This module will set the following variables in your project:: # # GSL_FOUND - True if GSL found on the local system # GSL_INCLUDE_DIRS - Location of GSL header files. # GSL_LIBRARIES - The GSL libraries. # GSL_VERSION - The version of the discovered GSL install. # # Hints # ^^^^^ # # Set ``GSL_ROOT_DIR`` to a directory that contains a GSL installation. # # This script expects to find libraries at ``$GSL_ROOT_DIR/lib`` and the GSL # headers at ``$GSL_ROOT_DIR/include/gsl``. The library directory may # optionally provide Release and Debug folders. For Unix-like systems, this # script will use ``$GSL_ROOT_DIR/bin/gsl-config`` (if found) to aid in the # discovery GSL. # # Cache Variables # ^^^^^^^^^^^^^^^ # # This module may set the following variables depending on platform and type # of GSL installation discovered. These variables may optionally be set to # help this module find the correct files:: # # GSL_CLBAS_LIBRARY - Location of the GSL CBLAS library. # GSL_CBLAS_LIBRARY_DEBUG - Location of the debug GSL CBLAS library (if any). # GSL_CONFIG_EXECUTABLE - Location of the ``gsl-config`` script (if any). # GSL_LIBRARY - Location of the GSL library. # GSL_LIBRARY_DEBUG - Location of the debug GSL library (if any). # #============================================================================= # Copyright 2014 Kelly Thompson # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. # # This software is distributed WITHOUT ANY WARRANTY; without even the # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # Include these modules to handle the QUIETLY and REQUIRED arguments. include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) #============================================================================= # If the user has provided ``GSL_ROOT_DIR``, use it! Choose items found # at this location over system locations. if( EXISTS "$ENV{GSL_ROOT_DIR}" ) file( TO_CMAKE_PATH "$ENV{GSL_ROOT_DIR}" GSL_ROOT_DIR ) set( GSL_ROOT_DIR "${GSL_ROOT_DIR}" CACHE PATH "Prefix for GSL installation." ) endif() if( NOT EXISTS "${GSL_ROOT_DIR}" ) set( GSL_USE_PKGCONFIG ON ) endif() #============================================================================= # As a first try, use the PkgConfig module. This will work on many # *NIX systems. See :module:`findpkgconfig` # This will return ``GSL_INCLUDEDIR`` and ``GSL_LIBDIR`` used below. if( GSL_USE_PKGCONFIG ) find_package(PkgConfig) pkg_check_modules( GSL QUIET gsl ) if( EXISTS "${GSL_INCLUDEDIR}" ) get_filename_component( GSL_ROOT_DIR "${GSL_INCLUDEDIR}" DIRECTORY CACHE) endif() endif() #============================================================================= # Set GSL_INCLUDE_DIRS and GSL_LIBRARIES. If we skipped the PkgConfig step, try # to find the libraries at $GSL_ROOT_DIR (if provided) or in standard system # locations. These find_library and find_path calls will prefer custom # locations over standard locations (HINTS). If the requested file is not found # at the HINTS location, standard system locations will be still be searched # (/usr/lib64 (Redhat), lib/i386-linux-gnu (Debian)). find_path( GSL_INCLUDE_DIR NAMES gsl/gsl_sf.h HINTS ${GSL_ROOT_DIR}/include ${GSL_INCLUDEDIR} ) find_library( GSL_LIBRARY NAMES gsl HINTS ${GSL_ROOT_DIR}/lib ${GSL_LIBDIR} PATH_SUFFIXES Release Debug ) find_library( GSL_CBLAS_LIBRARY NAMES gslcblas cblas HINTS ${GSL_ROOT_DIR}/lib ${GSL_LIBDIR} PATH_SUFFIXES Release Debug ) # Do we also have debug versions? find_library( GSL_LIBRARY_DEBUG NAMES gsl HINTS ${GSL_ROOT_DIR}/lib ${GSL_LIBDIR} PATH_SUFFIXES Debug ) find_library( GSL_CBLAS_LIBRARY_DEBUG NAMES gslcblas cblas HINTS ${GSL_ROOT_DIR}/lib ${GSL_LIBDIR} PATH_SUFFIXES Debug ) set( GSL_INCLUDE_DIRS ${GSL_INCLUDE_DIR} ) set( GSL_LIBRARIES ${GSL_LIBRARY} ${GSL_CBLAS_LIBRARY} ) # If we didn't use PkgConfig, try to find the version via gsl-config or by # reading gsl_version.h. if( NOT GSL_VERSION ) # 1. If gsl-config exists, query for the version. find_program( GSL_CONFIG_EXECUTABLE NAMES gsl-config HINTS "${GSL_ROOT_DIR}/bin" ) if( EXISTS "${GSL_CONFIG_EXECUTABLE}" ) execute_process( COMMAND "${GSL_CONFIG_EXECUTABLE}" --version OUTPUT_VARIABLE GSL_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE ) endif() # 2. If gsl-config is not available, try looking in gsl/gsl_version.h if( NOT GSL_VERSION AND EXISTS "${GSL_INCLUDE_DIRS}/gsl/gsl_version.h" ) file( STRINGS "${GSL_INCLUDE_DIRS}/gsl/gsl_version.h" gsl_version_h_contents REGEX "define GSL_VERSION" ) string( REGEX REPLACE ".*([0-9].[0-9][0-9]).*" "\\1" GSL_VERSION ${gsl_version_h_contents} ) endif() # might also try scraping the directory name for a regex match "gsl-X.X" endif() #============================================================================= # handle the QUIETLY and REQUIRED arguments and set GSL_FOUND to TRUE if all # listed variables are TRUE find_package_handle_standard_args( GSL FOUND_VAR GSL_FOUND REQUIRED_VARS GSL_INCLUDE_DIR GSL_LIBRARY GSL_CBLAS_LIBRARY VERSION_VAR GSL_VERSION ) mark_as_advanced( GSL_ROOT_DIR GSL_VERSION GSL_LIBRARY GSL_INCLUDE_DIR GSL_CBLAS_LIBRARY GSL_LIBRARY_DEBUG GSL_CBLAS_LIBRARY_DEBUG GSL_USE_PKGCONFIG GSL_CONFIG ) #============================================================================= # Register imported libraries: # 1. If we can find a Windows .dll file (or if we can find both Debug and # Release libraries), we will set appropriate target properties for these. # 2. However, for most systems, we will only register the import location and # include directory. # Look for dlls, or Release and Debug libraries. if(WIN32) string( REPLACE ".lib" ".dll" GSL_LIBRARY_DLL "${GSL_LIBRARY}" ) string( REPLACE ".lib" ".dll" GSL_CBLAS_LIBRARY_DLL "${GSL_CBLAS_LIBRARY}" ) string( REPLACE ".lib" ".dll" GSL_LIBRARY_DEBUG_DLL "${GSL_LIBRARY_DEBUG}" ) string( REPLACE ".lib" ".dll" GSL_CBLAS_LIBRARY_DEBUG_DLL "${GSL_CBLAS_LIBRARY_DEBUG}" ) endif() if( GSL_FOUND AND NOT TARGET GSL::gsl ) if( EXISTS "${GSL_LIBRARY_DLL}" AND EXISTS "${GSL_CBLAS_LIBRARY_DLL}") # Windows systems with dll libraries. add_library( GSL::gsl SHARED IMPORTED ) add_library( GSL::gslcblas SHARED IMPORTED ) # Windows with dlls, but only Release libraries. set_target_properties( GSL::gslcblas PROPERTIES IMPORTED_LOCATION_RELEASE "${GSL_CBLAS_LIBRARY_DLL}" IMPORTED_IMPLIB "${GSL_CBLAS_LIBRARY}" INTERFACE_INCLUDE_DIRECTORIES "${GSL_INCLUDE_DIRS}" IMPORTED_CONFIGURATIONS Release IMPORTED_LINK_INTERFACE_LANGUAGES "C" ) set_target_properties( GSL::gsl PROPERTIES IMPORTED_LOCATION_RELEASE "${GSL_LIBRARY_DLL}" IMPORTED_IMPLIB "${GSL_LIBRARY}" INTERFACE_INCLUDE_DIRECTORIES "${GSL_INCLUDE_DIRS}" IMPORTED_CONFIGURATIONS Release IMPORTED_LINK_INTERFACE_LANGUAGES "C" INTERFACE_LINK_LIBRARIES GSL::gslcblas ) # If we have both Debug and Release libraries if( EXISTS "${GSL_LIBRARY_DEBUG_DLL}" AND EXISTS "${GSL_CBLAS_LIBRARY_DEBUG_DLL}") set_property( TARGET GSL::gslcblas APPEND PROPERTY IMPORTED_CONFIGURATIONS Debug ) set_target_properties( GSL::gslcblas PROPERTIES IMPORTED_LOCATION_DEBUG "${GSL_CBLAS_LIBRARY_DEBUG_DLL}" IMPORTED_IMPLIB_DEBUG "${GSL_CBLAS_LIBRARY_DEBUG}" ) set_property( TARGET GSL::gsl APPEND PROPERTY IMPORTED_CONFIGURATIONS Debug ) set_target_properties( GSL::gsl PROPERTIES IMPORTED_LOCATION_DEBUG "${GSL_LIBRARY_DEBUG_DLL}" IMPORTED_IMPLIB_DEBUG "${GSL_LIBRARY_DEBUG}" ) endif() else() # For all other environments (ones without dll libraries), create # the imported library targets. add_library( GSL::gsl UNKNOWN IMPORTED ) add_library( GSL::gslcblas UNKNOWN IMPORTED ) set_target_properties( GSL::gslcblas PROPERTIES IMPORTED_LOCATION "${GSL_CBLAS_LIBRARY}" INTERFACE_INCLUDE_DIRECTORIES "${GSL_INCLUDE_DIRS}" IMPORTED_LINK_INTERFACE_LANGUAGES "C" ) set_target_properties( GSL::gsl PROPERTIES IMPORTED_LOCATION "${GSL_LIBRARY}" INTERFACE_INCLUDE_DIRECTORIES "${GSL_INCLUDE_DIRS}" IMPORTED_LINK_INTERFACE_LANGUAGES "C" INTERFACE_LINK_LIBRARIES GSL::gslcblas ) endif() endif() libpktriggercord-0.85.1/cmake_modules/FindMICAM.cmake0000644000175100017510000000256714136175546021661 0ustar debiandebian# - Try to find Moravian Instruments Camera Library # Once done this will define # # MICAM_FOUND - system has MI # MICAM_INCLUDE_DIR - the MI include directory # MICAM_LIBRARIES - Link these to use MI # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. if (MICAM_INCLUDE_DIR AND MICAM_LIBRARIES) # in cache already set(MICAM_FOUND TRUE) message(STATUS "Found libmicam: ${MICAM_LIBRARIES}") else (MICAM_INCLUDE_DIR AND MICAM_LIBRARIES) find_path(MICAM_INCLUDE_DIR gxccd.h PATH_SUFFIXES libmicam ${_obIncDir} ${GNUWIN32_DIR}/include ) find_library(MICAM_LIBRARIES NAMES gxccd PATHS ${_obLinkDir} ${GNUWIN32_DIR}/lib ) if(MICAM_INCLUDE_DIR AND MICAM_LIBRARIES) set(MICAM_FOUND TRUE) else (MICAM_INCLUDE_DIR AND MICAM_LIBRARIES) set(MICAM_FOUND FALSE) endif(MICAM_INCLUDE_DIR AND MICAM_LIBRARIES) if (MICAM_FOUND) if (NOT MICAM_FIND_QUIETLY) message(STATUS "Found MI Library: ${MICAM_LIBRARIES}") endif (NOT MICAM_FIND_QUIETLY) else (MICAM_FOUND) if (MICAM_FIND_REQUIRED) message(FATAL_ERROR "MI Library not found. Please install MI Library http://www.indilib.org") endif (MICAM_FIND_REQUIRED) endif (MICAM_FOUND) mark_as_advanced(MICAM_INCLUDE_DIR MICAM_LIBRARIES) endif (MICAM_INCLUDE_DIR AND MICAM_LIBRARIES) libpktriggercord-0.85.1/cmake_modules/FindPackageHandleStandardArgs.cmake0000644000175100017510000003565714136175546026006 0ustar debiandebian#[=======================================================================[.rst: FindPackageHandleStandardArgs ----------------------------- This module provides a function intended to be used in :ref:`Find Modules` implementing :command:`find_package()` calls. It handles the ``REQUIRED``, ``QUIET`` and version-related arguments of ``find_package``. It also sets the ``_FOUND`` variable. The package is considered found if all variables listed contain valid results, e.g. valid filepaths. .. command:: find_package_handle_standard_args There are two signatures:: find_package_handle_standard_args( (DEFAULT_MSG|) ... ) find_package_handle_standard_args( [FOUND_VAR ] [REQUIRED_VARS ...] [VERSION_VAR ] [HANDLE_COMPONENTS] [CONFIG_MODE] [FAIL_MESSAGE ] ) The ``_FOUND`` variable will be set to ``TRUE`` if all the variables ``...`` are valid and any optional constraints are satisfied, and ``FALSE`` otherwise. A success or failure message may be displayed based on the results and on whether the ``REQUIRED`` and/or ``QUIET`` option was given to the :command:`find_package` call. The options are: ``(DEFAULT_MSG|)`` In the simple signature this specifies the failure message. Use ``DEFAULT_MSG`` to ask for a default message to be computed (recommended). Not valid in the full signature. ``FOUND_VAR `` Obsolete. Specifies either ``_FOUND`` or ``_FOUND`` as the result variable. This exists only for compatibility with older versions of CMake and is now ignored. Result variables of both names are always set for compatibility. ``REQUIRED_VARS ...`` Specify the variables which are required for this package. These may be named in the generated failure message asking the user to set the missing variable values. Therefore these should typically be cache entries such as ``FOO_LIBRARY`` and not output variables like ``FOO_LIBRARIES``. ``VERSION_VAR `` Specify the name of a variable that holds the version of the package that has been found. This version will be checked against the (potentially) specified required version given to the :command:`find_package` call, including its ``EXACT`` option. The default messages include information about the required version and the version which has been actually found, both if the version is ok or not. ``HANDLE_COMPONENTS`` Enable handling of package components. In this case, the command will report which components have been found and which are missing, and the ``_FOUND`` variable will be set to ``FALSE`` if any of the required components (i.e. not the ones listed after the ``OPTIONAL_COMPONENTS`` option of :command:`find_package`) are missing. ``CONFIG_MODE`` Specify that the calling find module is a wrapper around a call to ``find_package( NO_MODULE)``. This implies a ``VERSION_VAR`` value of ``_VERSION``. The command will automatically check whether the package configuration file was found. ``FAIL_MESSAGE `` Specify a custom failure message instead of using the default generated message. Not recommended. Example for the simple signature: .. code-block:: cmake find_package_handle_standard_args(LibXml2 DEFAULT_MSG LIBXML2_LIBRARY LIBXML2_INCLUDE_DIR) The ``LibXml2`` package is considered to be found if both ``LIBXML2_LIBRARY`` and ``LIBXML2_INCLUDE_DIR`` are valid. Then also ``LibXml2_FOUND`` is set to ``TRUE``. If it is not found and ``REQUIRED`` was used, it fails with a :command:`message(FATAL_ERROR)`, independent whether ``QUIET`` was used or not. If it is found, success will be reported, including the content of the first ````. On repeated CMake runs, the same message will not be printed again. Example for the full signature: .. code-block:: cmake find_package_handle_standard_args(LibArchive REQUIRED_VARS LibArchive_LIBRARY LibArchive_INCLUDE_DIR VERSION_VAR LibArchive_VERSION) In this case, the ``LibArchive`` package is considered to be found if both ``LibArchive_LIBRARY`` and ``LibArchive_INCLUDE_DIR`` are valid. Also the version of ``LibArchive`` will be checked by using the version contained in ``LibArchive_VERSION``. Since no ``FAIL_MESSAGE`` is given, the default messages will be printed. Another example for the full signature: .. code-block:: cmake find_package(Automoc4 QUIET NO_MODULE HINTS /opt/automoc4) find_package_handle_standard_args(Automoc4 CONFIG_MODE) In this case, a ``FindAutmoc4.cmake`` module wraps a call to ``find_package(Automoc4 NO_MODULE)`` and adds an additional search directory for ``automoc4``. Then the call to ``find_package_handle_standard_args`` produces a proper success/failure message. #]=======================================================================] #============================================================================= # Copyright 2007-2009 Kitware, Inc. # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. # # This software is distributed WITHOUT ANY WARRANTY; without even the # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) include(${CMAKE_CURRENT_LIST_DIR}/FindPackageMessage.cmake) include(${CMAKE_CURRENT_LIST_DIR}/CMakeParseArguments.cmake) # internal helper macro macro(_FPHSA_FAILURE_MESSAGE _msg) if (${_NAME}_FIND_REQUIRED) message(FATAL_ERROR "${_msg}") else () if (NOT ${_NAME}_FIND_QUIETLY) message(STATUS "${_msg}") endif () endif () endmacro() # internal helper macro to generate the failure message when used in CONFIG_MODE: macro(_FPHSA_HANDLE_FAILURE_CONFIG_MODE) # _CONFIG is set, but FOUND is false, this means that some other of the REQUIRED_VARS was not found: if(${_NAME}_CONFIG) _FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE}: missing: ${MISSING_VARS} (found ${${_NAME}_CONFIG} ${VERSION_MSG})") else() # If _CONSIDERED_CONFIGS is set, the config-file has been found, but no suitable version. # List them all in the error message: if(${_NAME}_CONSIDERED_CONFIGS) set(configsText "") list(LENGTH ${_NAME}_CONSIDERED_CONFIGS configsCount) math(EXPR configsCount "${configsCount} - 1") foreach(currentConfigIndex RANGE ${configsCount}) list(GET ${_NAME}_CONSIDERED_CONFIGS ${currentConfigIndex} filename) list(GET ${_NAME}_CONSIDERED_VERSIONS ${currentConfigIndex} version) set(configsText "${configsText} ${filename} (version ${version})\n") endforeach() if (${_NAME}_NOT_FOUND_MESSAGE) set(configsText "${configsText} Reason given by package: ${${_NAME}_NOT_FOUND_MESSAGE}\n") endif() _FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE} ${VERSION_MSG}, checked the following files:\n${configsText}") else() # Simple case: No Config-file was found at all: _FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE}: found neither ${_NAME}Config.cmake nor ${_NAME_LOWER}-config.cmake ${VERSION_MSG}") endif() endif() endmacro() function(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG) # set up the arguments for CMAKE_PARSE_ARGUMENTS and check whether we are in # new extended or in the "old" mode: set(options CONFIG_MODE HANDLE_COMPONENTS) set(oneValueArgs FAIL_MESSAGE VERSION_VAR FOUND_VAR) set(multiValueArgs REQUIRED_VARS) set(_KEYWORDS_FOR_EXTENDED_MODE ${options} ${oneValueArgs} ${multiValueArgs} ) list(FIND _KEYWORDS_FOR_EXTENDED_MODE "${_FIRST_ARG}" INDEX) if(${INDEX} EQUAL -1) set(FPHSA_FAIL_MESSAGE ${_FIRST_ARG}) set(FPHSA_REQUIRED_VARS ${ARGN}) set(FPHSA_VERSION_VAR) else() CMAKE_PARSE_ARGUMENTS(FPHSA "${options}" "${oneValueArgs}" "${multiValueArgs}" ${_FIRST_ARG} ${ARGN}) if(FPHSA_UNPARSED_ARGUMENTS) message(FATAL_ERROR "Unknown keywords given to FIND_PACKAGE_HANDLE_STANDARD_ARGS(): \"${FPHSA_UNPARSED_ARGUMENTS}\"") endif() if(NOT FPHSA_FAIL_MESSAGE) set(FPHSA_FAIL_MESSAGE "DEFAULT_MSG") endif() endif() # now that we collected all arguments, process them if("x${FPHSA_FAIL_MESSAGE}" STREQUAL "xDEFAULT_MSG") set(FPHSA_FAIL_MESSAGE "Could NOT find ${_NAME}") endif() # In config-mode, we rely on the variable _CONFIG, which is set by find_package() # when it successfully found the config-file, including version checking: if(FPHSA_CONFIG_MODE) list(INSERT FPHSA_REQUIRED_VARS 0 ${_NAME}_CONFIG) list(REMOVE_DUPLICATES FPHSA_REQUIRED_VARS) set(FPHSA_VERSION_VAR ${_NAME}_VERSION) endif() if(NOT FPHSA_REQUIRED_VARS) message(FATAL_ERROR "No REQUIRED_VARS specified for FIND_PACKAGE_HANDLE_STANDARD_ARGS()") endif() list(GET FPHSA_REQUIRED_VARS 0 _FIRST_REQUIRED_VAR) string(TOUPPER ${_NAME} _NAME_UPPER) string(TOLOWER ${_NAME} _NAME_LOWER) if(FPHSA_FOUND_VAR) if(FPHSA_FOUND_VAR MATCHES "^${_NAME}_FOUND$" OR FPHSA_FOUND_VAR MATCHES "^${_NAME_UPPER}_FOUND$") set(_FOUND_VAR ${FPHSA_FOUND_VAR}) else() message(FATAL_ERROR "The argument for FOUND_VAR is \"${FPHSA_FOUND_VAR}\", but only \"${_NAME}_FOUND\" and \"${_NAME_UPPER}_FOUND\" are valid names.") endif() else() set(_FOUND_VAR ${_NAME_UPPER}_FOUND) endif() # collect all variables which were not found, so they can be printed, so the # user knows better what went wrong (#6375) set(MISSING_VARS "") set(DETAILS "") # check if all passed variables are valid set(FPHSA_FOUND_${_NAME} TRUE) foreach(_CURRENT_VAR ${FPHSA_REQUIRED_VARS}) if(NOT ${_CURRENT_VAR}) set(FPHSA_FOUND_${_NAME} FALSE) set(MISSING_VARS "${MISSING_VARS} ${_CURRENT_VAR}") else() set(DETAILS "${DETAILS}[${${_CURRENT_VAR}}]") endif() endforeach() if(FPHSA_FOUND_${_NAME}) set(${_NAME}_FOUND TRUE) set(${_NAME_UPPER}_FOUND TRUE) else() set(${_NAME}_FOUND FALSE) set(${_NAME_UPPER}_FOUND FALSE) endif() # component handling unset(FOUND_COMPONENTS_MSG) unset(MISSING_COMPONENTS_MSG) if(FPHSA_HANDLE_COMPONENTS) foreach(comp ${${_NAME}_FIND_COMPONENTS}) if(${_NAME}_${comp}_FOUND) if(NOT DEFINED FOUND_COMPONENTS_MSG) set(FOUND_COMPONENTS_MSG "found components: ") endif() set(FOUND_COMPONENTS_MSG "${FOUND_COMPONENTS_MSG} ${comp}") else() if(NOT DEFINED MISSING_COMPONENTS_MSG) set(MISSING_COMPONENTS_MSG "missing components: ") endif() set(MISSING_COMPONENTS_MSG "${MISSING_COMPONENTS_MSG} ${comp}") if(${_NAME}_FIND_REQUIRED_${comp}) set(${_NAME}_FOUND FALSE) set(MISSING_VARS "${MISSING_VARS} ${comp}") endif() endif() endforeach() set(COMPONENT_MSG "${FOUND_COMPONENTS_MSG} ${MISSING_COMPONENTS_MSG}") set(DETAILS "${DETAILS}[c${COMPONENT_MSG}]") endif() # version handling: set(VERSION_MSG "") set(VERSION_OK TRUE) set(VERSION ${${FPHSA_VERSION_VAR}}) # check with DEFINED here as the requested or found version may be "0" if (DEFINED ${_NAME}_FIND_VERSION) if(DEFINED ${FPHSA_VERSION_VAR}) if(${_NAME}_FIND_VERSION_EXACT) # exact version required # count the dots in the version string string(REGEX REPLACE "[^.]" "" _VERSION_DOTS "${VERSION}") # add one dot because there is one dot more than there are components string(LENGTH "${_VERSION_DOTS}." _VERSION_DOTS) if (_VERSION_DOTS GREATER ${_NAME}_FIND_VERSION_COUNT) # Because of the C++ implementation of find_package() ${_NAME}_FIND_VERSION_COUNT # is at most 4 here. Therefore a simple lookup table is used. if (${_NAME}_FIND_VERSION_COUNT EQUAL 1) set(_VERSION_REGEX "[^.]*") elseif (${_NAME}_FIND_VERSION_COUNT EQUAL 2) set(_VERSION_REGEX "[^.]*\\.[^.]*") elseif (${_NAME}_FIND_VERSION_COUNT EQUAL 3) set(_VERSION_REGEX "[^.]*\\.[^.]*\\.[^.]*") else () set(_VERSION_REGEX "[^.]*\\.[^.]*\\.[^.]*\\.[^.]*") endif () string(REGEX REPLACE "^(${_VERSION_REGEX})\\..*" "\\1" _VERSION_HEAD "${VERSION}") unset(_VERSION_REGEX) if (NOT ${_NAME}_FIND_VERSION VERSION_EQUAL _VERSION_HEAD) set(VERSION_MSG "Found unsuitable version \"${VERSION}\", but required is exact version \"${${_NAME}_FIND_VERSION}\"") set(VERSION_OK FALSE) else () set(VERSION_MSG "(found suitable exact version \"${VERSION}\")") endif () unset(_VERSION_HEAD) else () if (NOT ${_NAME}_FIND_VERSION VERSION_EQUAL VERSION) set(VERSION_MSG "Found unsuitable version \"${VERSION}\", but required is exact version \"${${_NAME}_FIND_VERSION}\"") set(VERSION_OK FALSE) else () set(VERSION_MSG "(found suitable exact version \"${VERSION}\")") endif () endif () unset(_VERSION_DOTS) else() # minimum version specified: if (${_NAME}_FIND_VERSION VERSION_GREATER VERSION) set(VERSION_MSG "Found unsuitable version \"${VERSION}\", but required is at least \"${${_NAME}_FIND_VERSION}\"") set(VERSION_OK FALSE) else () set(VERSION_MSG "(found suitable version \"${VERSION}\", minimum required is \"${${_NAME}_FIND_VERSION}\")") endif () endif() else() # if the package was not found, but a version was given, add that to the output: if(${_NAME}_FIND_VERSION_EXACT) set(VERSION_MSG "(Required is exact version \"${${_NAME}_FIND_VERSION}\")") else() set(VERSION_MSG "(Required is at least version \"${${_NAME}_FIND_VERSION}\")") endif() endif() else () if(VERSION) set(VERSION_MSG "(found version \"${VERSION}\")") endif() endif () if(VERSION_OK) set(DETAILS "${DETAILS}[v${VERSION}(${${_NAME}_FIND_VERSION})]") else() set(${_NAME}_FOUND FALSE) endif() # print the result: if (${_NAME}_FOUND) FIND_PACKAGE_MESSAGE(${_NAME} "Found ${_NAME}: ${${_FIRST_REQUIRED_VAR}} ${VERSION_MSG} ${COMPONENT_MSG}" "${DETAILS}") else () if(FPHSA_CONFIG_MODE) _FPHSA_HANDLE_FAILURE_CONFIG_MODE() else() if(NOT VERSION_OK) _FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE}: ${VERSION_MSG} (found ${${_FIRST_REQUIRED_VAR}})") else() _FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE} (missing: ${MISSING_VARS}) ${VERSION_MSG}") endif() endif() endif () set(${_NAME}_FOUND ${${_NAME}_FOUND} PARENT_SCOPE) set(${_NAME_UPPER}_FOUND ${${_NAME}_FOUND} PARENT_SCOPE) endfunction() libpktriggercord-0.85.1/cmake_modules/FindOggTheora.cmake0000644000175100017510000000247214136175546022705 0ustar debiandebian# # Find the native Ogg/Theora includes and libraries # # This module defines # OGGTHEORA_INCLUDE_DIR, where to find ogg/ogg.h and theora/theora.h # OGGTHEORA_LIBRARIES, the libraries to link against to use Ogg/Theora. # OGGTHEORA_FOUND, If false, do not try to use Ogg/Theora. FIND_PATH(OGGTHEORA_ogg_INCLUDE_DIR ogg/ogg.h) FIND_PATH(OGGTHEORA_theora_INCLUDE_DIR theora/theora.h) FIND_LIBRARY(OGGTHEORA_ogg_LIBRARY ogg) FIND_LIBRARY(OGGTHEORA_theoraenc_LIBRARY theoraenc) FIND_LIBRARY(OGGTHEORA_theoradec_LIBRARY theoradec) SET(OGGTHEORA_INCLUDE_DIRS ${OGGTHEORA_ogg_INCLUDE_DIR} ${OGGTHEORA_theora_INCLUDE_DIR} ) #HACK multiple directories SET(OGGTHEORA_INCLUDE_DIR ${OGGTHEORA_INCLUDE_DIRS}) SET(OGGTHEORA_LIBRARIES ${OGGTHEORA_theoraenc_LIBRARY} ${OGGTHEORA_theoradec_LIBRARY} ${OGGTHEORA_ogg_LIBRARY} ) #HACK multiple libraries SET(OGGTHEORA_LIBRARY ${OGGTHEORA_LIBRARIES}) INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(OGGTHEORA "Could NOT find the ogg and theora libraries" OGGTHEORA_ogg_LIBRARY OGGTHEORA_theoraenc_LIBRARY OGGTHEORA_theoradec_LIBRARY OGGTHEORA_ogg_INCLUDE_DIR OGGTHEORA_theora_INCLUDE_DIR ) MARK_AS_ADVANCED(OGGTHEORA_ogg_INCLUDE_DIR OGGTHEORA_theora_INCLUDE_DIR OGGTHEORA_ogg_LIBRARY OGGTHEORA_theoraenc_LIBRARY OGGTHEORA_theoradec_LIBRARY ) libpktriggercord-0.85.1/cmake_modules/FindMEADE.cmake0000644000175100017510000000247714136175546021646 0ustar debiandebian# - Try to find Meade DSI Library. # Once done this will define # # MEADEDSI_FOUND - system has Meade DSI # MEADEDSI_LIBRARIES - Link these to use Meade DSI # Copyright (c) 2006, Jasem Mutlaq # Based on FindLibfacile by Carsten Niehaus, # # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. if (MEADEDSI_LIBRARIES) # in cache already set(MEADEDSI_FOUND TRUE) message(STATUS "Found MEADEDSI: ${MEADEDSI_LIBRARIES}") else (MEADEDSI_LIBRARIES) find_library(MEADEDSI_LIBRARIES NAMES dsi PATHS ${_obLinkDir} ${GNUWIN32_DIR}/lib ) set(CMAKE_REQUIRED_LIBRARIES ${MEADEDSI_LIBRARIES}) if(MEADEDSI_LIBRARIES) set(MEADEDSI_FOUND TRUE) else (MEADEDSI_LIBRARIES) set(MEADEDSI_FOUND FALSE) endif(MEADEDSI_LIBRARIES) if (MEADEDSI_FOUND) if (NOT MEADEDSI_FIND_QUIETLY) message(STATUS "Found Meade DSI: ${MEADEDSI_LIBRARIES}") endif (NOT MEADEDSI_FIND_QUIETLY) else (MEADEDSI_FOUND) if (MEADEDSI_FIND_REQUIRED) message(FATAL_ERROR "Meade DSI not found. Please install Meade DSI library. http://linuxdsi.sourceforge.net") endif (MEADEDSI_FIND_REQUIRED) endif (MEADEDSI_FOUND) mark_as_advanced(MEADEDSI_LIBRARIES) endif (MEADEDSI_LIBRARIES) libpktriggercord-0.85.1/cmake_modules/FindTOUPCAM.cmake0000644000175100017510000000267614136175546022144 0ustar debiandebian# - Try to find Toupcam Camera Library # Once done this will define # # TOUPCAM_FOUND - system has Toupcam # TOUPCAM_INCLUDE_DIR - the Toupcam include directory # TOUPCAM_LIBRARIES - Link these to use Toupcam # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. if (TOUPCAM_INCLUDE_DIR AND TOUPCAM_LIBRARIES) # in cache already set(TOUPCAM_FOUND TRUE) message(STATUS "Found libsbig: ${TOUPCAM_LIBRARIES}") else (TOUPCAM_INCLUDE_DIR AND TOUPCAM_LIBRARIES) find_path(TOUPCAM_INCLUDE_DIR toupcam.h PATH_SUFFIXES libtoupcam ${_obIncDir} ${GNUWIN32_DIR}/include ) find_library(TOUPCAM_LIBRARIES NAMES toupcam PATHS ${_obLinkDir} ${GNUWIN32_DIR}/lib ) if(TOUPCAM_INCLUDE_DIR AND TOUPCAM_LIBRARIES) set(TOUPCAM_FOUND TRUE) else (TOUPCAM_INCLUDE_DIR AND TOUPCAM_LIBRARIES) set(TOUPCAM_FOUND FALSE) endif(TOUPCAM_INCLUDE_DIR AND TOUPCAM_LIBRARIES) if (TOUPCAM_FOUND) if (NOT TOUPCAM_FIND_QUIETLY) message(STATUS "Found Toupcam: ${TOUPCAM_LIBRARIES}") endif (NOT TOUPCAM_FIND_QUIETLY) else (TOUPCAM_FOUND) if (TOUPCAM_FIND_REQUIRED) message(FATAL_ERROR "Toupcam not found. Please install Toupcam Library http://www.indilib.org") endif (TOUPCAM_FIND_REQUIRED) endif (TOUPCAM_FOUND) mark_as_advanced(TOUPCAM_INCLUDE_DIR TOUPCAM_LIBRARIES) endif (TOUPCAM_INCLUDE_DIR AND TOUPCAM_LIBRARIES) libpktriggercord-0.85.1/cmake_modules/FindSV305.cmake0000644000175100017510000000264614136175546021611 0ustar debiandebian# - Try to find SV305 Library # Once done this will define # # SV305_FOUND - system has QHY # SV305_INCLUDE_DIR - the QHY include directory # SV305_LIBRARIES - Link these to use QHY # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. if (SV305_INCLUDE_DIR AND SV305_LIBRARIES) # in cache already set(SV305_FOUND TRUE) message(STATUS "Found libsv305: ${SV305_LIBRARIES}") else (SV305_INCLUDE_DIR AND SV305_LIBRARIES) # find headers find_path(SV305_INCLUDE_DIR NAMES SVBCameraSDK.h PATH_SUFFIXES libsv305 ${_obIncDir} ${GNUWIN32_DIR}/include ) # find libraries find_library(SV305_LIBRARIES NAMES SVBCameraSDK PATHS ${_obLinkDir} ${GNUWIN32_DIR}/lib ) if(SV305_INCLUDE_DIR AND SV305_LIBRARIES) set(SV305_FOUND TRUE) else (SV305_INCLUDE_DIR AND SV305_LIBRARIES) set(SV305_FOUND FALSE) endif(SV305_INCLUDE_DIR AND SV305_LIBRARIES) if (SV305_FOUND) if (NOT SV305_FIND_QUIETLY) message(STATUS "Found SV305 libraries : ${SV305_LIBRARIES}") endif (NOT SV305_FIND_QUIETLY) else (SV305_FOUND) if (SV305_FIND_REQUIRED) message(FATAL_ERROR "SV305 libraries not found. Please install libsv305 http://www.indilib.org") endif (SV305_FIND_REQUIRED) endif (SV305_FOUND) mark_as_advanced(SV305_INCLUDE_DIR SV305_LIBRARIES) endif (SV305_INCLUDE_DIR AND SV305_LIBRARIES) libpktriggercord-0.85.1/cmake_modules/FindQSI.cmake0000644000175100017510000000245514136175546021463 0ustar debiandebian# - Try to find Quantum Scientific Imaging Library # Once done this will define # # QSI_FOUND - system has QSI # QSI_INCLUDE_DIR - the QSI include directory # QSI_LIBRARIES - Link these to use QSI # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. if (QSI_INCLUDE_DIR AND QSI_LIBRARIES) # in cache already set(QSI_FOUND TRUE) message(STATUS "Found libqsiapi: ${QSI_LIBRARIES}") else (QSI_INCLUDE_DIR AND QSI_LIBRARIES) find_path(QSI_INCLUDE_DIR qsiapi.h PATH_SUFFIXES qsiapi ${_obIncDir} ${GNUWIN32_DIR}/include ) find_library(QSI_LIBRARIES NAMES qsiapi PATHS ${_obLinkDir} ${GNUWIN32_DIR}/lib ) if(QSI_INCLUDE_DIR AND QSI_LIBRARIES) set(QSI_FOUND TRUE) else (QSI_INCLUDE_DIR AND QSI_LIBRARIES) set(QSI_FOUND FALSE) endif(QSI_INCLUDE_DIR AND QSI_LIBRARIES) if (QSI_FOUND) if (NOT QSI_FIND_QUIETLY) message(STATUS "Found QSI: ${QSI_LIBRARIES}") endif (NOT QSI_FIND_QUIETLY) else (QSI_FOUND) if (QSI_FIND_REQUIRED) message(FATAL_ERROR "QSI not found. Please install libqsi http://www.indilib.org") endif (QSI_FIND_REQUIRED) endif (QSI_FOUND) mark_as_advanced(QSI_INCLUDE_DIR QSI_LIBRARIES) endif (QSI_INCLUDE_DIR AND QSI_LIBRARIES) libpktriggercord-0.85.1/cmake_modules/UnityBuild.cmake0000644000175100017510000001627714136175546022325 0ustar debiandebian# # Copyright (c) 2009-2012 Christoph Heindl # Copyright (c) 2015 Csaba Kertész (csaba.kertesz@gmail.com) # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # * Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # * Neither the name of the nor the # names of its contributors may be used to endorse or promote products # derived from this software without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE # DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # MACRO (COMMIT_UNITY_FILE UNITY_FILE FILE_CONTENT) SET(DIRTY FALSE) # Check if the build file exists SET(OLD_FILE_CONTENT "") IF (NOT EXISTS ${${UNITY_FILE}} AND NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/${${UNITY_FILE}}) SET(DIRTY TRUE) ELSE () # Check the file content FILE(STRINGS ${${UNITY_FILE}} OLD_FILE_CONTENT) STRING(REPLACE ";" "" OLD_FILE_CONTENT "${OLD_FILE_CONTENT}") STRING(REPLACE "\n" "" NEW_CONTENT "${${FILE_CONTENT}}") STRING(COMPARE EQUAL "${OLD_FILE_CONTENT}" "${NEW_CONTENT}" EQUAL_CHECK) IF (NOT EQUAL_CHECK EQUAL 1) SET(DIRTY TRUE) ENDIF () ENDIF () IF (DIRTY MATCHES TRUE) MESSAGE(STATUS "Write Unity Build file: " ${${UNITY_FILE}}) FILE(WRITE ${${UNITY_FILE}} "${${FILE_CONTENT}}") ENDIF () # Create a dummy copy of the unity file to trigger CMake reconfigure if it is deleted. SET(UNITY_FILE_PATH "") SET(UNITY_FILE_NAME "") GET_FILENAME_COMPONENT(UNITY_FILE_PATH ${${UNITY_FILE}} PATH) GET_FILENAME_COMPONENT(UNITY_FILE_NAME ${${UNITY_FILE}} NAME) CONFIGURE_FILE(${${UNITY_FILE}} ${UNITY_FILE_PATH}/CMakeFiles/${UNITY_FILE_NAME}.dummy) ENDMACRO () MACRO (ENABLE_UNITY_BUILD TARGET_NAME SOURCE_VARIABLE_NAME UNIT_SIZE EXTENSION) # Limit is zero based conversion of unit_size MATH(EXPR LIMIT ${UNIT_SIZE}-1) SET(FILES ${SOURCE_VARIABLE_NAME}) # Effectivly ignore the source files from the build, but keep track them for changes. SET_SOURCE_FILES_PROPERTIES(${${FILES}} PROPERTIES HEADER_FILE_ONLY true) # Counts the number of source files up to the threshold SET(COUNTER ${LIMIT}) # Have one or more unity build files SET(FILE_NUMBER 0) SET(BUILD_FILE "") SET(BUILD_FILE_CONTENT "") SET(UNITY_BUILD_FILES "") SET(_DEPS "") FOREACH (SOURCE_FILE ${${FILES}}) IF (COUNTER EQUAL LIMIT) SET(_DEPS "") # Write the actual Unity Build file IF (NOT ${BUILD_FILE} STREQUAL "" AND NOT ${BUILD_FILE_CONTENT} STREQUAL "") COMMIT_UNITY_FILE(BUILD_FILE BUILD_FILE_CONTENT) ENDIF () SET(UNITY_BUILD_FILES ${UNITY_BUILD_FILES} ${BUILD_FILE}) # Set the variables for the current Unity Build file SET(BUILD_FILE ${CMAKE_CURRENT_BINARY_DIR}/unitybuild_${FILE_NUMBER}_${TARGET_NAME}.${EXTENSION}) SET(BUILD_FILE_CONTENT "// Unity Build file generated by CMake\n") MATH(EXPR FILE_NUMBER ${FILE_NUMBER}+1) SET(COUNTER 0) ENDIF () # Add source path to the file name if it is not there yet. SET(FINAL_SOURCE_FILE "") SET(SOURCE_PATH "") GET_FILENAME_COMPONENT(SOURCE_PATH ${SOURCE_FILE} PATH) IF (SOURCE_PATH STREQUAL "" OR NOT EXISTS ${SOURCE_FILE}) SET(FINAL_SOURCE_FILE ${CMAKE_CURRENT_SOURCE_DIR}/${SOURCE_FILE}) ELSE () SET(FINAL_SOURCE_FILE ${SOURCE_FILE}) ENDIF () # Treat only the existing files or moc_*.cpp files STRING(FIND ${SOURCE_FILE} "moc_" MOC_POS) IF (EXISTS ${FINAL_SOURCE_FILE} OR MOC_POS GREATER -1) # Add md5 hash of the source file (except moc files) to the build file content IF (MOC_POS LESS 0) SET(MD5_HASH "") FILE(MD5 ${FINAL_SOURCE_FILE} MD5_HASH) SET(BUILD_FILE_CONTENT "${BUILD_FILE_CONTENT}// md5: ${MD5_HASH}\n") ENDIF () # Add the source file to the build file content IF (MOC_POS GREATER -1) SET(BUILD_FILE_CONTENT "${BUILD_FILE_CONTENT}#include <${SOURCE_FILE}>\n") ELSE () SET(BUILD_FILE_CONTENT "${BUILD_FILE_CONTENT}#include <${FINAL_SOURCE_FILE}>\n") ENDIF () # Add the source dependencies to the Unity Build file GET_SOURCE_FILE_PROPERTY(_FILE_DEPS ${SOURCE_FILE} OBJECT_DEPENDS) IF (_FILE_DEPS) SET(_DEPS ${_DEPS} ${_FILE_DEPS}) SET_SOURCE_FILES_PROPERTIES(${BUILD_FILE} PROPERTIES OBJECT_DEPENDS "${_DEPS}") ENDIF() # Keep counting up to the threshold. Increment counter. MATH(EXPR COUNTER ${COUNTER}+1) ENDIF () ENDFOREACH () # Write out the last Unity Build file IF (NOT ${BUILD_FILE} STREQUAL "" AND NOT ${BUILD_FILE_CONTENT} STREQUAL "") COMMIT_UNITY_FILE(BUILD_FILE BUILD_FILE_CONTENT) ENDIF () SET(UNITY_BUILD_FILES ${UNITY_BUILD_FILES} ${BUILD_FILE}) SET(${SOURCE_VARIABLE_NAME} ${${SOURCE_VARIABLE_NAME}} ${UNITY_BUILD_FILES}) ENDMACRO () MACRO (UNITY_GENERATE_MOC TARGET_NAME SOURCES HEADERS) SET(NEW_SOURCES "") FOREACH (HEADER_FILE ${${HEADERS}}) IF (NOT EXISTS ${HEADER_FILE}) MESSAGE(FATAL_ERROR "Header file does not exist (mocing): ${HEADER_FILE}") ENDIF () FILE(READ ${HEADER_FILE} FILE_CONTENT) STRING(FIND "${FILE_CONTENT}" "Q_OBJECT" QOBJECT_POS) STRING(FIND "${FILE_CONTENT}" "Q_SLOTS" QSLOTS_POS) STRING(FIND "${FILE_CONTENT}" "Q_SIGNALS" QSIGNALS_POS) STRING(FIND "${FILE_CONTENT}" "QObject" OBJECT_POS) STRING(FIND "${FILE_CONTENT}" "slots" SLOTS_POS) STRING(FIND "${FILE_CONTENT}" "signals" SIGNALS_POS) IF (QOBJECT_POS GREATER 0 OR OBJECT_POS GREATER 0 OR QSLOTS_POS GREATER 0 OR Q_SIGNALS GREATER 0 OR SLOTS_POS GREATER 0 OR SIGNALS GREATER 0) # Generate the moc filename GET_FILENAME_COMPONENT(HEADER_BASENAME ${HEADER_FILE} NAME_WE) SET(MOC_FILENAME "moc_${HEADER_BASENAME}.cpp") SET(NEW_SOURCES ${NEW_SOURCES} ; "${CMAKE_CURRENT_BINARY_DIR}/${MOC_FILENAME}") ADD_CUSTOM_COMMAND(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${MOC_FILENAME}" DEPENDS ${HEADER_FILE} COMMAND ${QT_MOC_EXECUTABLE} ${HEADER_FILE} -o "${CMAKE_CURRENT_BINARY_DIR}/${MOC_FILENAME}") ENDIF () ENDFOREACH () IF (NEW_SOURCES) SET_SOURCE_FILES_PROPERTIES(${NEW_SOURCES} PROPERTIES GENERATED TRUE) SET(${SOURCES} ${${SOURCES}} ; ${NEW_SOURCES}) ENDIF () ENDMACRO () libpktriggercord-0.85.1/cmake_modules/FindLibRaw.cmake0000644000175100017510000000562514136175546022211 0ustar debiandebian# - Find LibRaw # Find the LibRaw library # This module defines # LibRaw_VERSION_STRING, the version string of LibRaw # LibRaw_INCLUDE_DIR, where to find libraw.h # LibRaw_LIBRARIES, the libraries needed to use LibRaw (non-thread-safe) # LibRaw_r_LIBRARIES, the libraries needed to use LibRaw (thread-safe) # LibRaw_DEFINITIONS, the definitions needed to use LibRaw (non-thread-safe) # LibRaw_r_DEFINITIONS, the definitions needed to use LibRaw (thread-safe) # # Copyright (c) 2013, Pino Toscano # Copyright (c) 2013, Gilles Caulier # # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. FIND_PACKAGE(PkgConfig) IF(PKG_CONFIG_FOUND) PKG_CHECK_MODULES(PC_LIBRAW libraw) SET(LibRaw_DEFINITIONS ${PC_LIBRAW_CFLAGS_OTHER}) PKG_CHECK_MODULES(PC_LIBRAW_R libraw_r) SET(LibRaw_r_DEFINITIONS ${PC_LIBRAW_R_CFLAGS_OTHER}) ENDIF() FIND_PATH(LibRaw_INCLUDE_DIR libraw.h HINTS ${PC_LIBRAW_INCLUDEDIR} ${PC_LibRaw_INCLUDE_DIRS} PATH_SUFFIXES libraw ) FIND_LIBRARY(LibRaw_LIBRARIES NAMES raw HINTS ${PC_LIBRAW_LIBDIR} ${PC_LIBRAW_LIBRARY_DIRS} ) FIND_LIBRARY(LibRaw_r_LIBRARIES NAMES raw_r HINTS ${PC_LIBRAW_R_LIBDIR} ${PC_LIBRAW_R_LIBRARY_DIRS} ) IF(LibRaw_INCLUDE_DIR) FILE(READ ${LibRaw_INCLUDE_DIR}/libraw_version.h _libraw_version_content) STRING(REGEX MATCH "#define LIBRAW_MAJOR_VERSION[ \t]*([0-9]*)\n" _version_major_match ${_libraw_version_content}) SET(_libraw_version_major "${CMAKE_MATCH_1}") STRING(REGEX MATCH "#define LIBRAW_MINOR_VERSION[ \t]*([0-9]*)\n" _version_minor_match ${_libraw_version_content}) SET(_libraw_version_minor "${CMAKE_MATCH_1}") STRING(REGEX MATCH "#define LIBRAW_PATCH_VERSION[ \t]*([0-9]*)\n" _version_patch_match ${_libraw_version_content}) SET(_libraw_version_patch "${CMAKE_MATCH_1}") IF(_version_major_match AND _version_minor_match AND _version_patch_match) SET(LibRaw_VERSION_STRING "${_libraw_version_major}.${_libraw_version_minor}.${_libraw_version_patch}") ELSE() IF(NOT LibRaw_FIND_QUIETLY) MESSAGE(STATUS "Failed to get version information from ${LibRaw_INCLUDE_DIR}/libraw_version.h") ENDIF() ENDIF() ENDIF() INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibRaw REQUIRED_VARS LibRaw_LIBRARIES LibRaw_INCLUDE_DIR VERSION_VAR LibRaw_VERSION_STRING ) MARK_AS_ADVANCED(LibRaw_VERSION_STRING LibRaw_INCLUDE_DIR LibRaw_LIBRARIES LibRaw_r_LIBRARIES LibRaw_DEFINITIONS LibRaw_r_DEFINITIONS ) libpktriggercord-0.85.1/cmake_modules/FindALTAIRCAM.cmake0000644000175100017510000000301014136175546022310 0ustar debiandebian# - Try to find Altair Camera Library # Once done this will define # # ALTAIRCAM_FOUND - system has Altair # ALTAIRCAM_INCLUDE_DIR - the Altair include directory # ALTAIRCAM_LIBRARIES - Link these to use Altair # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. if (ALTAIRCAM_INCLUDE_DIR AND ALTAIRCAM_LIBRARIES) # in cache already set(ALTAIRCAM_FOUND TRUE) message(STATUS "Found libaltaircam: ${ALTAIRCAM_LIBRARIES}") else (ALTAIRCAM_INCLUDE_DIR AND ALTAIRCAM_LIBRARIES) find_path(ALTAIRCAM_INCLUDE_DIR altaircam.h PATH_SUFFIXES libaltaircam ${_obIncDir} ${GNUWIN32_DIR}/include ) find_library(ALTAIRCAM_LIBRARIES NAMES altaircam PATHS ${_obLinkDir} ${GNUWIN32_DIR}/lib ) if(ALTAIRCAM_INCLUDE_DIR AND ALTAIRCAM_LIBRARIES) set(ALTAIRCAM_FOUND TRUE) else (ALTAIRCAM_INCLUDE_DIR AND ALTAIRCAM_LIBRARIES) set(ALTAIRCAM_FOUND FALSE) endif(ALTAIRCAM_INCLUDE_DIR AND ALTAIRCAM_LIBRARIES) if (ALTAIRCAM_FOUND) if (NOT ALTAIRCAM_FIND_QUIETLY) message(STATUS "Found Altaircam: ${ALTAIRCAM_LIBRARIES}") endif (NOT ALTAIRCAM_FIND_QUIETLY) else (ALTAIRCAM_FOUND) if (ALTAIRCAM_FIND_REQUIRED) message(FATAL_ERROR "Altaircam not found. Please install Altaircam Library http://www.indilib.org") endif (ALTAIRCAM_FIND_REQUIRED) endif (ALTAIRCAM_FOUND) mark_as_advanced(ALTAIRCAM_INCLUDE_DIR ALTAIRCAM_LIBRARIES) endif (ALTAIRCAM_INCLUDE_DIR AND ALTAIRCAM_LIBRARIES) libpktriggercord-0.85.1/cmake_modules/FindSBIG.cmake0000644000175100017510000000251214136175546021545 0ustar debiandebian# - Try to find SBIG Universal Library # Once done this will define # # SBIG_FOUND - system has SBIG # SBIG_INCLUDE_DIR - the SBIG include directory # SBIG_LIBRARIES - Link these to use SBIG # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. if (SBIG_INCLUDE_DIR AND SBIG_LIBRARIES) # in cache already set(SBIG_FOUND TRUE) message(STATUS "Found libsbig: ${SBIG_LIBRARIES}") else (SBIG_INCLUDE_DIR AND SBIG_LIBRARIES) find_path(SBIG_INCLUDE_DIR sbigudrv.h PATH_SUFFIXES libsbig ${_obIncDir} ${GNUWIN32_DIR}/include ) find_library(SBIG_LIBRARIES NAMES sbig PATHS ${_obLinkDir} ${GNUWIN32_DIR}/lib ) if(SBIG_INCLUDE_DIR AND SBIG_LIBRARIES) set(SBIG_FOUND TRUE) else (SBIG_INCLUDE_DIR AND SBIG_LIBRARIES) set(SBIG_FOUND FALSE) endif(SBIG_INCLUDE_DIR AND SBIG_LIBRARIES) if (SBIG_FOUND) if (NOT SBIG_FIND_QUIETLY) message(STATUS "Found SBIG: ${SBIG_LIBRARIES}") endif (NOT SBIG_FIND_QUIETLY) else (SBIG_FOUND) if (SBIG_FIND_REQUIRED) message(FATAL_ERROR "SBIG not found. Please install SBIG Library http://www.indilib.org") endif (SBIG_FIND_REQUIRED) endif (SBIG_FOUND) mark_as_advanced(SBIG_INCLUDE_DIR SBIG_LIBRARIES) endif (SBIG_INCLUDE_DIR AND SBIG_LIBRARIES) libpktriggercord-0.85.1/cmake_modules/CMakeParseArguments.cmake0000644000175100017510000000164214136175546024064 0ustar debiandebian#.rst: # CMakeParseArguments # ------------------- # # This module once implemented the :command:`cmake_parse_arguments` command # that is now implemented natively by CMake. It is now an empty placeholder # for compatibility with projects that include it to get the command from # CMake 3.4 and lower. #============================================================================= # Copyright 2010 Alexander Neundorf # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. # # This software is distributed WITHOUT ANY WARRANTY; without even the # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) libpktriggercord-0.85.1/cmake_modules/FindGPHOTO2.cmake0000644000175100017510000000562614136175546022114 0ustar debiandebian# - Find the native sqlite3 includes and library # # This module defines # GPHOTO2_INCLUDE_DIR, where to find libgphoto2 header files # GPHOTO2_LIBRARIES, the libraries to link against to use libgphoto2 # GPHOTO2_FOUND, If false, do not try to use libgphoto2. # GPHOTO2_VERSION_STRING, e.g. 2.4.14 # GPHOTO2_VERSION_MAJOR, e.g. 2 # GPHOTO2_VERSION_MINOR, e.g. 4 # GPHOTO2_VERSION_PATCH, e.g. 14 # # also defined, but not for general use are # GPHOTO2_LIBRARY, where to find the sqlite3 library. #============================================================================= # Copyright 2010 henrik andersson #============================================================================= SET(GPHOTO2_FIND_REQUIRED ${Gphoto2_FIND_REQUIRED}) find_path(GPHOTO2_INCLUDE_DIR gphoto2/gphoto2.h) mark_as_advanced(GPHOTO2_INCLUDE_DIR) set(GPHOTO2_NAMES ${GPHOTO2_NAMES} gphoto2 libgphoto2) set(GPHOTO2_PORT_NAMES ${GPHOTO2_PORT_NAMES} gphoto2_port libgphoto2_port) find_library(GPHOTO2_LIBRARY NAMES ${GPHOTO2_NAMES} ) find_library(GPHOTO2_PORT_LIBRARY NAMES ${GPHOTO2_PORT_NAMES} ) mark_as_advanced(GPHOTO2_LIBRARY) mark_as_advanced(GPHOTO2_PORT_LIBRARY) # Detect libgphoto2 version FIND_PROGRAM(GPHOTO2CONFIG_EXECUTABLE NAMES gphoto2-config) IF(GPHOTO2CONFIG_EXECUTABLE) EXEC_PROGRAM(${GPHOTO2CONFIG_EXECUTABLE} ARGS --version RETURN_VALUE _return_VALUE OUTPUT_VARIABLE GPHOTO2_VERSION) string(REGEX REPLACE "^.*libgphoto2 ([0-9]+).*$" "\\1" GPHOTO2_VERSION_MAJOR "${GPHOTO2_VERSION}") string(REGEX REPLACE "^.*libgphoto2 [0-9]+\\.([0-9]+).*$" "\\1" GPHOTO2_VERSION_MINOR "${GPHOTO2_VERSION}") string(REGEX REPLACE "^.*libgphoto2 [0-9]+\\.[0-9]+\\.([0-9]+).*$" "\\1" GPHOTO2_VERSION_PATCH "${GPHOTO2_VERSION}") set(GPHOTO2_VERSION_STRING "${GPHOTO2_VERSION_MAJOR}.${GPHOTO2_VERSION_MINOR}.${GPHOTO2_VERSION_PATCH}") ENDIF(GPHOTO2CONFIG_EXECUTABLE) # handle the QUIETLY and REQUIRED arguments and set GPHOTO2_FOUND to TRUE if # all listed variables are TRUE include(FindPackageHandleStandardArgs) find_package_handle_standard_args(GPHOTO2 DEFAULT_MSG GPHOTO2_LIBRARY GPHOTO2_INCLUDE_DIR) IF(GPHOTO2_FOUND) SET(Gphoto2_LIBRARIES ${GPHOTO2_LIBRARY} ${GPHOTO2_PORT_LIBRARY}) SET(Gphoto2_INCLUDE_DIRS ${GPHOTO2_INCLUDE_DIR}) # libgphoto2 dynamically loads and unloads usb library # without calling any cleanup functions (since they are absent from libusb-0.1). # This leaves usb event handling threads running with invalid callback and return addresses, # which causes a crash after any usb event is generated, at least in Mac OS X. # libusb1 backend does correctly call exit function, but ATM it crashes anyway. # Workaround is to link against libusb so that it wouldn't get unloaded. IF(APPLE) find_library(USB_LIBRARY NAMES usb-1.0 libusb-1.0) mark_as_advanced(USB_LIBRARY) IF(USB_LIBRARY) SET(Gphoto2_LIBRARIES ${Gphoto2_LIBRARIES} ${USB_LIBRARY}) ENDIF(USB_LIBRARY) ENDIF(APPLE) ENDIF(GPHOTO2_FOUND) libpktriggercord-0.85.1/cmake_modules/FindMMAL.cmake0000644000175100017510000000303214136175546021545 0ustar debiandebian# Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # http://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # # This module can find the MMAL camera libraries. # cmake_minimum_required(VERSION 3.0.0) set (MMAL_LIBS mmal_core mmal_util mmal_vc_client) set (EGL_LIBS brcmGLESv2 brcmEGL) foreach(lib ${MMAL_LIBS} ${EGL_LIBS} vcos bcm_host m dl) find_library(${lib}_LIBRARY NAMES ${lib} HINTS ${MMAL_DIR}/lib /opt/vc/lib ) if (DEFINED ${lib}_LIBRARY) set(MMAL_LIBRARIES ${MMAL_LIBRARIES} ${${lib}_LIBRARY}) else() message(FATAL_ERROR "Failed to find ${${lib}_LIBRARY} library") endif() endforeach(lib) find_path(BCM_INCLUDE_DIR NAMES bcm_host.h HINTS "/opt/vc/include" ) find_path(MMAL_BASE_INCLUDE_DIR NAMES mmal.h HINTS "/opt/vc/include/interface/mmal" ) find_path(MMAL_UTIL_INCLUDE_DIR NAMES mmal_util.h HINTS "/opt/vc/include/interface/mmal/util" ) if (MMAL_BASE_INCLUDE_DIR AND BCM_INCLUDE_DIR AND MMAL_UTIL_INCLUDE_DIR) set(MMAL_INCLUDE_DIR ${MMAL_BASE_INCLUDE_DIR} ${BCM_INCLUDE_DIR} ${MMAL_UTIL_INCLUDE_DIR}) set(MMAL_FOUND TRUE) endif() libpktriggercord-0.85.1/cmake_modules/FindAIOUSB.cmake0000644000175100017510000000371314136175546022007 0ustar debiandebian# - Try to find libaiousb # Once done this will define # # AIOUSB_FOUND - system has AIOUSB # AIOUSB_INCLUDE_DIR - the AIOUSB include directory # AIOUSB_LIBRARIES - Link these to use AIOUSB (C) # AIOUSB_CPP_LIBRARIES - Link these to use AIOUSB (C++) # Copyright (c) 2006, Jasem Mutlaq # Based on FindLibfacile by Carsten Niehaus, # # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. if (AIOUSB_INCLUDE_DIR AND AIOUSB_LIBRARIES AND AIOUSB_CPP_LIBRARIES) # in cache already set(AIOUSB_FOUND TRUE) message(STATUS "Found libaiusb: ${AIOUSB_LIBRARIES}") message(STATUS "Found libaiusbcpp: ${AIOUSB_CPP_LIBRARIES}") else (AIOUSB_INCLUDE_DIR AND AIOUSB_LIBRARIES AND AIOUSB_CPP_LIBRARIES) find_path(AIOUSB_INCLUDE_DIR aiousb.h ${_obIncDir} ${GNUWIN32_DIR}/include ) find_library(AIOUSB_LIBRARIES NAMES aiousb PATHS ${_obLinkDir} ${GNUWIN32_DIR}/lib ) find_library(AIOUSB_CPP_LIBRARIES NAMES aiousbcpp PATHS ${_obLinkDir} ${GNUWIN32_DIR}/lib ) if(AIOUSB_INCLUDE_DIR AND AIOUSB_LIBRARIES AND AIOUSB_CPP_LIBRARIES) set(AIOUSB_FOUND TRUE) else (AIOUSB_INCLUDE_DIR AND AIOUSB_LIBRARIES AND AIOUSB_CPP_LIBRARIES) set(AIOUSB_FOUND FALSE) endif(AIOUSB_INCLUDE_DIR AND AIOUSB_LIBRARIES AND AIOUSB_CPP_LIBRARIES) if (AIOUSB_FOUND) if (NOT AIOUSB_FIND_QUIETLY) message(STATUS "Found libaiousb: ${AIOUSB_LIBRARIES}") message(STATUS "Found libaiusbcpp: ${AIOUSB_CPP_LIBRARIES}") endif (NOT AIOUSB_FIND_QUIETLY) else (AIOUSB_FOUND) if (AIOUSB_FIND_REQUIRED) message(FATAL_ERROR "libaiousb not found. Please install libaiousb. https://www.accesio.com") endif (AIOUSB_FIND_REQUIRED) endif (AIOUSB_FOUND) mark_as_advanced(AIOUSB_INCLUDE_DIR AIOUSB_LIBRARIES AIOUSB_CPP_LIBRARIES) endif (AIOUSB_INCLUDE_DIR AND AIOUSB_LIBRARIES AND AIOUSB_CPP_LIBRARIES) libpktriggercord-0.85.1/cmake_modules/FindAPOGEE.cmake0000644000175100017510000000311514136175546021761 0ustar debiandebian# - Try to find Apogee Instruments Library # Once done this will define # # APOGEE_FOUND - system has APOGEE # APOGEE_INCLUDE_DIR - the APOGEE include directory # APOGEE_LIBRARY - Link these to use APOGEE # Copyright (c) 2008, Jasem Mutlaq # Based on FindLibfacile by Carsten Niehaus, # # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. if (APOGEE_INCLUDE_DIR AND APOGEE_LIBRARY) # in cache already set(APOGEE_FOUND TRUE) message(STATUS "Found libapogee: ${APOGEE_LIBRARY}") else (APOGEE_INCLUDE_DIR AND APOGEE_LIBRARY) find_path(APOGEE_INCLUDE_DIR ApogeeCam.h PATH_SUFFIXES libapogee ${_obIncDir} ${GNUWIN32_DIR}/include ) # Find Apogee Library find_library(APOGEE_LIBRARY NAMES apogee PATHS ${_obLinkDir} ${GNUWIN32_DIR}/lib ) if(APOGEE_INCLUDE_DIR AND APOGEE_LIBRARY) set(APOGEE_FOUND TRUE) else (APOGEE_INCLUDE_DIR AND APOGEE_LIBRARY) set(APOGEE_FOUND FALSE) endif(APOGEE_INCLUDE_DIR AND APOGEE_LIBRARY) if (APOGEE_FOUND) if (NOT APOGEE_FIND_QUIETLY) message(STATUS "Found APOGEE: ${APOGEE_LIBRARY}") endif (NOT APOGEE_FIND_QUIETLY) else (APOGEE_FOUND) if (APOGEE_FIND_REQUIRED) message(FATAL_ERROR "libapogee not found. Cannot compile Apogee CCD Driver. Please install libapogee and try again. http://www.indilib.org") endif (APOGEE_FIND_REQUIRED) endif (APOGEE_FOUND) mark_as_advanced(APOGEE_INCLUDE_DIR APOGEE_LIBRARY) endif (APOGEE_INCLUDE_DIR AND APOGEE_LIBRARY) libpktriggercord-0.85.1/cmake_modules/FindFFmpeg.cmake0000644000175100017510000001573514136175546022200 0ustar debiandebian# - Try to find ffmpeg libraries (libavcodec, libavdevice, libavformat, libavutil, and libswscale) # Once done this will define # # FFMPEG_FOUND - system has ffmpeg or libav # FFMPEG_INCLUDE_DIR - the ffmpeg include directory # FFMPEG_LIBRARIES - Link these to use ffmpeg # FFMPEG_LIBAVCODEC # FFMPEG_LIBAVDEVICE # FFMPEG_LIBAVFORMAT # FFMPEG_LIBAVUTIL # FFMPEG_LIBSWSCALE # # Copyright (c) 2008 Andreas Schneider # Modified for other libraries by Lasse Kärkkäinen # Modified for Hedgewars by Stepik777 # Modified for INDILIB by rlancaste # # Redistribution and use is allowed according to the terms of the New # BSD license. # macro(_FFMPEG_PACKAGE_check_version) if(EXISTS "${PACKAGE_INCLUDE_DIR}/version.h") file(READ "${PACKAGE_INCLUDE_DIR}/version.h" _FFMPEG_PACKAGE_version_header) string(REGEX MATCH "#define ${PACKAGE_NAME}_VERSION_MAJOR[ \t]+([0-9]+)" _VERSION_MAJOR_match "${_FFMPEG_PACKAGE_version_header}") set(FFMPEG_PACKAGE_VERSION_MAJOR "${CMAKE_MATCH_1}") string(REGEX MATCH "#define ${PACKAGE_NAME}_VERSION_MINOR[ \t]+([0-9]+)" _VERSION_MINOR_match "${_FFMPEG_PACKAGE_version_header}") set(FFMPEG_PACKAGE_VERSION_MINOR "${CMAKE_MATCH_1}") string(REGEX MATCH "#define ${PACKAGE_NAME}_VERSION_MICRO[ \t]+([0-9]+)" _VERSION_MICRO_match "${_FFMPEG_PACKAGE_version_header}") set(FFMPEG_PACKAGE_VERSION_MICRO "${CMAKE_MATCH_1}") set(FFMPEG_PACKAGE_VERSION ${FFMPEG_PACKAGE_VERSION_MAJOR}.${FFMPEG_PACKAGE_VERSION_MINOR}.${FFMPEG_PACKAGE_VERSION_MICRO}) if(${FFMPEG_PACKAGE_VERSION} VERSION_LESS ${FFMPEG_PACKAGE_FIND_VERSION}) set(FFMPEG_PACKAGE_VERSION_OK FALSE) else(${FFMPEG_PACKAGE_VERSION} VERSION_LESS ${FFMPEG_PACKAGE_FIND_VERSION}) set(FFMPEG_PACKAGE_VERSION_OK TRUE) endif(${FFMPEG_PACKAGE_VERSION} VERSION_LESS ${FFMPEG_PACKAGE_FIND_VERSION}) if(NOT FFMPEG_PACKAGE_VERSION_OK) message(STATUS "${PACKAGE_NAME} version ${FFMPEG_PACKAGE_VERSION} found in ${PACKAGE_INCLUDE_DIR}, " "but at least version ${FFMPEG_PACKAGE_FIND_VERSION} is required") else(NOT FFMPEG_PACKAGE_VERSION_OK) mark_as_advanced(FFMPEG_PACKAGE_VERSION_MAJOR FFMPEG_PACKAGE_VERSION_MINOR FFMPEG_PACKAGE_VERSION_MICRO) endif(NOT FFMPEG_PACKAGE_VERSION_OK) else(EXISTS "${PACKAGE_INCLUDE_DIR}/version.h") set(FFMPEG_PACKAGE_VERSION_OK FALSE) message(STATUS "${PACKAGE_NAME}'s version.h file was not found in the include directory: ${PACKAGE_INCLUDE_DIR}, please install this program.") endif(EXISTS "${PACKAGE_INCLUDE_DIR}/version.h") endmacro(_FFMPEG_PACKAGE_check_version) # required ffmpeg library versions, Requiring at least FFMPEG 3.2.11, Hypatia set(_avcodec_ver ">=57.64.101") set(_avdevice_ver ">=57.1.100") set(_avformat_ver ">=57.56.100") set(_avutil_ver ">=55.34.100") set(_swscale_ver ">=4.2.100") if (FFMPEG_LIBRARIES AND FFMPEG_INCLUDE_DIR) # in cache already set(FFMPEG_FOUND TRUE) else (FFMPEG_LIBRARIES AND FFMPEG_INCLUDE_DIR) # use pkg-config to get the directories and then use these values # in the FIND_PATH() and FIND_LIBRARY() calls find_path(FFMPEG_INCLUDE_DIR NAMES libavcodec/avcodec.h PATHS ${FFMPEG_INCLUDE_DIRS} ${CMAKE_INSTALL_PREFIX}/include /usr/include /usr/local/include /opt/local/include /sw/include PATH_SUFFIXES ffmpeg libav ) find_package(PkgConfig) if (PKG_CONFIG_FOUND) pkg_check_modules(AVCODEC libavcodec${_avcodec_ver}) pkg_check_modules(AVDEVICE libavdevice${_avdevice_ver}) pkg_check_modules(AVFORMAT libavformat${_avformat_ver}) pkg_check_modules(AVUTIL libavutil${_avutil_ver}) pkg_check_modules(SWSCALE libswscale${_swscale_ver}) else (PKG_CONFIG_FOUND) # LIBAVCODEC set(PACKAGE_NAME "LIBAVCODEC") set(PACKAGE_INCLUDE_DIR "${FFMPEG_INCLUDE_DIR}/libavcodec") set(FFMPEG_PACKAGE_FIND_VERSION _avcodec_ver) _FFMPEG_PACKAGE_check_version() if(FFMPEG_PACKAGE_VERSION_OK) set(AVCODEC_VERSION FFMPEG_PACKAGE_VERSION) endif(FFMPEG_PACKAGE_VERSION_OK) # LIBAVDEVICE set(PACKAGE_NAME "LIBAVDEVICE") set(PACKAGE_INCLUDE_DIR "${FFMPEG_INCLUDE_DIR}/libavdevice") set(FFMPEG_PACKAGE_FIND_VERSION _avdevice_ver) _FFMPEG_PACKAGE_check_version() if(FFMPEG_PACKAGE_VERSION_OK) set(AVDEVICE_VERSION FFMPEG_PACKAGE_VERSION) endif(FFMPEG_PACKAGE_VERSION_OK) # LIBAVFORMAT set(PACKAGE_NAME "LIBAVFORMAT") set(PACKAGE_INCLUDE_DIR "${FFMPEG_INCLUDE_DIR}/libavformat") set(FFMPEG_PACKAGE_FIND_VERSION _avformat_ver) _FFMPEG_PACKAGE_check_version() if(FFMPEG_PACKAGE_VERSION_OK) set(AVFORMAT_VERSION FFMPEG_PACKAGE_VERSION) endif(FFMPEG_PACKAGE_VERSION_OK) # LIBAVUTIL set(PACKAGE_NAME "LIBAVUTIL") set(PACKAGE_INCLUDE_DIR "${FFMPEG_INCLUDE_DIR}/libavutil") set(FFMPEG_PACKAGE_FIND_VERSION _avutil_ver) _FFMPEG_PACKAGE_check_version() if(FFMPEG_PACKAGE_VERSION_OK) set(AVUTIL_VERSION FFMPEG_PACKAGE_VERSION) endif(FFMPEG_PACKAGE_VERSION_OK) # LIBSWSCALE set(PACKAGE_NAME "LIBSWSCALE") set(PACKAGE_INCLUDE_DIR "${FFMPEG_INCLUDE_DIR}/libswscale") set(FFMPEG_PACKAGE_FIND_VERSION _swscale_ver) _FFMPEG_PACKAGE_check_version() if(FFMPEG_PACKAGE_VERSION_OK) set(SWSCALE_VERSION FFMPEG_PACKAGE_VERSION) endif(FFMPEG_PACKAGE_VERSION_OK) endif (PKG_CONFIG_FOUND) find_library(FFMPEG_LIBAVCODEC NAMES avcodec libavcodec PATHS ${AVCODEC_LIBRARY_DIRS} ${CMAKE_INSTALL_PREFIX}/lib /usr/lib /usr/local/lib /opt/local/lib /sw/lib ) find_library(FFMPEG_LIBAVDEVICE NAMES avdevice libavdevice PATHS ${AVDEVICE_LIBRARY_DIRS} ${CMAKE_INSTALL_PREFIX}/lib /usr/lib /usr/local/lib /opt/local/lib /sw/lib ) find_library(FFMPEG_LIBAVFORMAT NAMES avformat libavformat PATHS ${AVFORMAT_LIBRARY_DIRS} ${CMAKE_INSTALL_PREFIX}/lib /usr/lib /usr/local/lib /opt/local/lib /sw/lib ) find_library(FFMPEG_LIBAVUTIL NAMES avutil libavutil PATHS ${AVUTIL_LIBRARY_DIRS} ${CMAKE_INSTALL_PREFIX}/lib /usr/lib /usr/local/lib /opt/local/lib /sw/lib ) find_library(FFMPEG_LIBSWSCALE NAMES swscale libswscale PATHS ${SWSCALE_LIBRARY_DIRS} ${CMAKE_INSTALL_PREFIX}/lib /usr/lib /usr/local/lib /opt/local/lib /sw/lib ) #Only set FFMPEG to found if all the libraries are found in the right versions. if(AVCODEC_VERSION AND AVDEVICE_VERSION AND AVFORMAT_VERSION AND AVUTIL_VERSION AND SWSCALE_VERSION AND FFMPEG_LIBAVCODEC AND FFMPEG_LIBAVDEVICE AND FFMPEG_LIBAVFORMAT AND FFMPEG_LIBAVUTIL AND FFMPEG_LIBSWSCALE) set(FFMPEG_FOUND TRUE) endif() if (FFMPEG_FOUND) set(FFMPEG_LIBRARIES ${FFMPEG_LIBAVCODEC} ${FFMPEG_LIBAVDEVICE} ${FFMPEG_LIBAVFORMAT} ${FFMPEG_LIBAVUTIL} ${FFMPEG_LIBSWSCALE} ) endif (FFMPEG_FOUND) if (FFMPEG_FOUND) if (NOT FFMPEG_FIND_QUIETLY) message(STATUS "Found FFMPEG: ${FFMPEG_LIBRARIES}, ${FFMPEG_INCLUDE_DIR}") endif (NOT FFMPEG_FIND_QUIETLY) else (FFMPEG_FOUND) message(STATUS "Could not find up to date FFMPEG for INDI Webcam. Up to date versions of these packages are required: libavcodec, libavdevice, libavformat, libavutil, and libswscale") if (FFMPEG_FIND_REQUIRED) message(FATAL_ERROR "Error: FFMPEG is required by this package!") endif (FFMPEG_FIND_REQUIRED) endif (FFMPEG_FOUND) endif (FFMPEG_LIBRARIES AND FFMPEG_INCLUDE_DIR) libpktriggercord-0.85.1/cmake_modules/FindIconv.cmake0000644000175100017510000000426114136175546022102 0ustar debiandebian# # Copyright (C) 2010 Michael Bell # 2015-2016 MariaDB Corporation AB # # Redistribution and use is allowed according to the terms of the New # BSD license. # For details see the COPYING-CMAKE-SCRIPTS file. # # ICONV_EXTERNAL - Iconv is an external library (not libc) # ICONV_FOUND - system has Iconv # ICONV_INCLUDE_DIR - the Iconv include directory # ICONV_LIBRARIES - Link these to use Iconv # ICONV_SECOND_ARGUMENT_IS_CONST - the second argument for iconv() is const # ICONV_VERSION - Iconv version string if (ICONV_INCLUDE_DIR AND ICONV_LIBRARIES) # Already in cache, be silent set(ICONV_FIND_QUIETLY TRUE) endif (ICONV_INCLUDE_DIR AND ICONV_LIBRARIES) find_path(ICONV_INCLUDE_DIR iconv.h) IF(CMAKE_SYSTEM_NAME MATCHES "SunOS") # There is some libiconv.so in /usr/local that must # be avoided, iconv routines are in libc ELSEIF(APPLE) find_library(ICONV_LIBRARIES NAMES iconv libiconv PATHS /usr/lib/ NO_CMAKE_SYSTEM_PATH) SET(ICONV_EXTERNAL TRUE) ELSE() find_library(ICONV_LIBRARIES NAMES iconv libiconv libiconv-2) IF(ICONV_LIBRARIES) SET(ICONV_EXTERNAL TRUE) ENDIF() ENDIF() if (ICONV_INCLUDE_DIR AND ICONV_LIBRARIES) set (ICONV_FOUND TRUE) endif (ICONV_INCLUDE_DIR AND ICONV_LIBRARIES) set(CMAKE_REQUIRED_INCLUDES ${ICONV_INCLUDE_DIR}) IF(ICONV_EXTERNAL) set(CMAKE_REQUIRED_LIBRARIES ${ICONV_LIBRARIES}) ENDIF() if (ICONV_FOUND) include(CheckCSourceCompiles) CHECK_C_SOURCE_COMPILES(" #include int main(){ iconv_t conv = 0; const char* in = 0; size_t ilen = 0; char* out = 0; size_t olen = 0; iconv(conv, &in, &ilen, &out, &olen); return 0; } " ICONV_SECOND_ARGUMENT_IS_CONST ) endif (ICONV_FOUND) set (CMAKE_REQUIRED_INCLUDES) set (CMAKE_REQUIRED_LIBRARIES) if (ICONV_FOUND) if (NOT ICONV_FIND_QUIETLY) message (STATUS "Found Iconv: ${ICONV_LIBRARIES}") endif (NOT ICONV_FIND_QUIETLY) else (ICONV_FOUND) if (Iconv_FIND_REQUIRED) message (FATAL_ERROR "Could not find Iconv") endif (Iconv_FIND_REQUIRED) endif (ICONV_FOUND) MARK_AS_ADVANCED( ICONV_INCLUDE_DIR ICONV_LIBRARIES ICONV_EXTERNAL ICONV_SECOND_ARGUMENT_IS_CONST ) libpktriggercord-0.85.1/cmake_modules/FindLIMESUITE.cmake0000644000175100017510000000301214136175546022355 0ustar debiandebian# - Try to find LIMESUITE # Once done this will define # # LIMESUITE_FOUND - system has LIMESUITE # LIMESUITE_INCLUDE_DIR - the LIMESUITE include directory # LIMESUITE_LIBRARIES - Link these to use LIMESUITE # LIMESUITE_VERSION_STRING - Human readable version number of rtlsdr # LIMESUITE_VERSION_MAJOR - Major version number of rtlsdr # LIMESUITE_VERSION_MINOR - Minor version number of rtlsdr # Copyright (c) 2017, Ilia Platone, # Based on FindLibfacile by Carsten Niehaus, # # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. if (LIMESUITE_LIBRARIES) # in cache already set(LIMESUITE_FOUND TRUE) message(STATUS "Found LIMESUITE: ${LIMESUITE_LIBRARIES}") else (LIMESUITE_LIBRARIES) find_library(LIMESUITE_LIBRARIES NAMES LimeSuite PATHS ${_obLinkDir} ${GNUWIN32_DIR}/lib /usr/local/lib ) if(LIMESUITE_LIBRARIES) set(LIMESUITE_FOUND TRUE) else (LIMESUITE_LIBRARIES) set(LIMESUITE_FOUND FALSE) endif(LIMESUITE_LIBRARIES) if (LIMESUITE_FOUND) if (NOT LIMESUITE_FIND_QUIETLY) message(STATUS "Found LIMESUITE: ${LIMESUITE_LIBRARIES}") endif (NOT LIMESUITE_FIND_QUIETLY) else (LIMESUITE_FOUND) if (LIMESUITE_FIND_REQUIRED) message(FATAL_ERROR "LIMESUITE not found. Please install libLimeSuite-dev") endif (LIMESUITE_FIND_REQUIRED) endif (LIMESUITE_FOUND) mark_as_advanced(LIMESUITE_LIBRARIES) endif (LIMESUITE_LIBRARIES) libpktriggercord-0.85.1/cmake_modules/FindPLAYERONE.cmake0000644000175100017510000000322114136175546022355 0ustar debiandebian# - Try to find PlayerOne Library # Once done this will define # # PLAYERONE_FOUND - system has PLAYERONE # PLAYERONE_INCLUDE_DIR - the PLAYERONE include directory # PLAYERONE_LIBRARIES - Link these to use ASI # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. if (PLAYERONE_INCLUDE_DIR AND PLAYERONE_LIBRARIES) # in cache already set(PLAYERONE_FOUND TRUE) message(STATUS "Found libplayerone: ${PLAYERONE_LIBRARIES}") else (PLAYERONE_INCLUDE_DIR AND PLAYERONE_LIBRARIES) find_path(PLAYERONE_INCLUDE_DIR PlayerOneCamera.h PATH_SUFFIXES libplayerone ${_obIncDir} ${GNUWIN32_DIR}/include ) find_library(PLAYERONECAM_LIBRARIES NAMES PlayerOneCamera PATHS ${_obLinkDir} ${GNUWIN32_DIR}/lib ) if (PLAYERONECAM_LIBRARIES) set(PLAYERONE_LIBRARIES ${PLAYERONECAM_LIBRARIES}) endif (PLAYERONECAM_LIBRARIES) if(PLAYERONE_INCLUDE_DIR AND PLAYERONE_LIBRARIES) set(PLAYERONE_FOUND TRUE) else (PLAYERONE_INCLUDE_DIR AND PLAYERONE_LIBRARIES) set(PLAYERONE_FOUND FALSE) endif(PLAYERONE_INCLUDE_DIR AND PLAYERONE_LIBRARIES) if (PLAYERONE_FOUND) if (NOT PLAYERONE_FIND_QUIETLY) message(STATUS "Found PLAYERONE: ${PLAYERONE_LIBRARIES}") endif (NOT PLAYERONE_FIND_QUIETLY) else (PLAYERONE_FOUND) if (PLAYERONE_FIND_REQUIRED) message(FATAL_ERROR "PLAYERONE not found. Please install libPlayerOneCamera.2 http://www.indilib.org") endif (PLAYERONE_FIND_REQUIRED) endif (PLAYERONE_FOUND) mark_as_advanced(PLAYERONE_INCLUDE_DIR PLAYERONE_LIBRARIES) endif (PLAYERONE_INCLUDE_DIR AND PLAYERONE_LIBRARIES) libpktriggercord-0.85.1/cmake_modules/FindNNCAM.cmake0000644000175100017510000000256314136175546021663 0ustar debiandebian# - Try to find NNCAM Camera Library # Once done this will define # # NNCAM_FOUND - system has Levenhuk # NNCAM_INCLUDE_DIR - the Levenhuk include directory # NNCAM_LIBRARIES - Link these to use Levenhuk # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. if (NNCAM_INCLUDE_DIR AND NNCAM_LIBRARIES) # in cache already set(NNCAM_FOUND TRUE) message(STATUS "Found libnncam: ${NNCAM_LIBRARIES}") else (NNCAM_INCLUDE_DIR AND NNCAM_LIBRARIES) find_path(NNCAM_INCLUDE_DIR nncam.h PATH_SUFFIXES libnncam ${_obIncDir} ${GNUWIN32_DIR}/include ) find_library(NNCAM_LIBRARIES NAMES nncam PATHS ${_obLinkDir} ${GNUWIN32_DIR}/lib ) if(NNCAM_INCLUDE_DIR AND NNCAM_LIBRARIES) set(NNCAM_FOUND TRUE) else (NNCAM_INCLUDE_DIR AND NNCAM_LIBRARIES) set(NNCAM_FOUND FALSE) endif(NNCAM_INCLUDE_DIR AND NNCAM_LIBRARIES) if (NNCAM_FOUND) if (NOT NNCAM_FIND_QUIETLY) message(STATUS "Found NNCAM: ${NNCAM_LIBRARIES}") endif (NOT NNCAM_FIND_QUIETLY) else (NNCAM_FOUND) if (NNCAM_FIND_REQUIRED) message(FATAL_ERROR "NNCAM not found. Please install NNCAM Library http://www.indilib.org") endif (NNCAM_FIND_REQUIRED) endif (NNCAM_FOUND) mark_as_advanced(NNCAM_INCLUDE_DIR NNCAM_LIBRARIES) endif (NNCAM_INCLUDE_DIR AND NNCAM_LIBRARIES) libpktriggercord-0.85.1/cmake_modules/FindRT.cmake0000644000175100017510000000152514136175546021351 0ustar debiandebian# FindRT.cmake - Try to find the RT library # Once done this will define # # RT_FOUND - System has rt # RT_INCLUDE_DIR - The rt include directory # RT_LIBRARIES - The libraries needed to use rt # RT_DEFINITIONS - Compiler switches required for using rt # # Also creates an import target called RT::RT find_path (RT_INCLUDE_DIR NAMES time.h PATHS /usr /usr/local /opt PATH_SUFFIXES ) find_library(RT_LIBRARIES NAMES rt PATHS /usr /usr/local /opt ) include(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(rt DEFAULT_MSG RT_LIBRARIES RT_INCLUDE_DIR) mark_as_advanced(RT_INCLUDE_DIR RT_LIBRARIES) if (NOT TARGET RT::RT) add_library(RT::RT INTERFACE IMPORTED) set_target_properties(RT::RT PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${RT_INCLUDE_DIR} INTERFACE_LINK_LIBRARIES ${RT_LIBRARIES} ) endif()libpktriggercord-0.85.1/CMakeLists.txt0000644000175100017510000000552414136175550017147 0ustar debiandebiancmake_minimum_required (VERSION 3.0.2) project (libpktriggercord C) set (PK_VERSION 0.85.02) set (PK_SOVERSION 0) set (PK_DATADIR /usr/share/pktriggercord) set (PK_DEBUG true) set (PK_WARNINGS true) list (APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules/") list (APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../cmake_modules/") include (GNUInstallDirs) find_package(INDI REQUIRED) set (UDEVRULES_INSTALL_DIR "/lib/udev/rules.d" CACHE STRING "Base directory for udev rules") # Build library add_definitions (-DPKTDATADIR="${PK_DATADIR}") add_definitions (-DVERSION="${PK_VERSION}") include_directories (${CMAKE_CURRENT_BINARY_DIR}) include_directories (${CMAKE_CURRENT_SOURCE_DIR}/include) include_directories (${CMAKE_CURRENT_SOURCE_DIR}/src) include_directories (${CMAKE_CURRENT_SOURCE_DIR}/src/src/external/js0n) include_directories (${INDI_INCLUDE_DIR}) # strip main function from pktriggercord file (READ ${CMAKE_CURRENT_SOURCE_DIR}/src/pktriggercord-cli.c PK_CLI) string (REGEX REPLACE "int main.*$" "" PK_CLI "${PK_CLI}") file (WRITE ${CMAKE_CURRENT_BINARY_DIR}/libpktriggercord.c "${PK_CLI}") set (libpktriggercord_SRCS ${CMAKE_CURRENT_BINARY_DIR}/libpktriggercord.c # stripped ${CMAKE_CURRENT_SOURCE_DIR}/src/pslr.c ${CMAKE_CURRENT_SOURCE_DIR}/src/pslr_model.c ${CMAKE_CURRENT_SOURCE_DIR}/src/pslr_lens.c ${CMAKE_CURRENT_SOURCE_DIR}/src/pslr_enum.c ${CMAKE_CURRENT_SOURCE_DIR}/src/pslr_utils.c ${CMAKE_CURRENT_SOURCE_DIR}/src/pslr_log.c ${CMAKE_CURRENT_SOURCE_DIR}/src/pslr_scsi.c ${CMAKE_CURRENT_SOURCE_DIR}/src/src/external/js0n/js0n.c ${CMAKE_CURRENT_SOURCE_DIR}/src/pktriggercord-servermode.c ) add_library (pktriggercord SHARED ${libpktriggercord_SRCS}) set_target_properties (pktriggercord PROPERTIES VERSION ${PK_VERSION} SOVERSION ${PK_SOVERSION}) # Build udev rules add_custom_command ( OUTPUT 95-pentax.rules COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/src/pentax.rules ${CMAKE_CURRENT_BINARY_DIR}/95-pentax.rules ) add_custom_command ( OUTPUT 95-samsung.rules COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/src/samsung.rules ${CMAKE_CURRENT_BINARY_DIR}/95-samsung.rules ) add_custom_target (udev_rules ALL DEPENDS 95-pentax.rules 95-samsung.rules) # Install udev rules if (${CMAKE_SYSTEM_NAME} MATCHES "Linux") install (FILES ${CMAKE_CURRENT_BINARY_DIR}/95-pentax.rules ${CMAKE_CURRENT_BINARY_DIR}/95-samsung.rules DESTINATION ${UDEVRULES_INSTALL_DIR}) install (FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/pentax_settings.json DESTINATION ${PK_DATADIR}) endif() # Install header files install (DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/src/ DESTINATION include/libpktriggercord FILES_MATCHING PATTERN "*.h") install (DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/ DESTINATION include/libpktriggercord) # Install library install (TARGETS pktriggercord DESTINATION ${CMAKE_INSTALL_LIBDIR}) libpktriggercord-0.85.1/src/0000755000175100017510000000000014136175550015170 5ustar debiandebianlibpktriggercord-0.85.1/src/pentax.rules0000644000175100017510000000103214136175550017537 0ustar debiandebianACTION!="add", GOTO="pentax_rules_end" SUBSYSTEM=="scsi_generic", GOTO="pentax_rules_start" SUBSYSTEM!="scsi_generic", GOTO="pentax_rules_end" LABEL="pentax_rules_start" # WAIT_FOR_SYSFS="device/vendor" ATTRS{vendor}=="PENTAX", ATTRS{model}=="DIGITAL_CAMERA", MODE="0666", GROUP="users" ATTRS{vendor}=="PENTAX", ATTRS{model}=="DSC*", MODE="0666", GROUP="users" ATTRS{vendor}=="RICOHIMG", ATTRS{model}=="DSC*", MODE="0666", GROUP="users" ATTRS{vendor}=="PENTAX", ATTRS{model}=="K*", MODE="0666", GROUP="users" LABEL="pentax_rules_end" libpktriggercord-0.85.1/src/.travis.yml0000644000175100017510000000257114136175550017306 0ustar debiandebianlanguage: android android: components: - tools - platform-tools - build-tools-28.0.3 - android-28 licenses: - 'android-sdk-license-.+' addons: apt: packages: - binutils-mingw-w64-i686 - g++-mingw-w64-i686 - gcc-mingw-w64-i686 - wine - groff - gtk2.0 - libgtk2.0 - libgtk2.0-dev before_install: - git clone https://github.com/urho3d/android-ndk.git $HOME/android-ndk-root - pushd $HOME/android-ndk-root - git checkout 9afc86eae45a544562bc7052ca6f529772754f16 . - popd - export ANDROID_NDK_HOME=$HOME/android-ndk-root - mkdir -p "/usr/local/android-sdk/licenses" - echo -e "\n8933bad161af4178b1185d1a37fbf41ea5269c55" > /usr/local/android-sdk/licenses/android-sdk-license before_script: - wget -O astyle_3.1_linux.tar.gz http://sourceforge.net/projects/astyle/files/astyle/astyle%203.1/astyle_3.1_linux.tar.gz/download - tar -xf astyle_3.1_linux.tar.gz -C $HOME - make -C $HOME/astyle/build/gcc - make -C $HOME/astyle/build/gcc prefix=$HOME install script: - if [[ -n $(make astyle | grep Formatted) ]]; then echo "Code formatting error. Please check astyle"; exit -1; fi - make android - make localwin - make srczip - make clean - make - ./pktriggercord-cli --version - mkdir -p windows_test - cd windows_test - unzip ../pktriggercord-*-win.zip - wine ./pktriggercord-cli.exe --version - cd .. libpktriggercord-0.85.1/src/pslr_log.c0000644000175100017510000000341314136175550017156 0ustar debiandebian/* pkTriggerCord Remote control of Pentax DSLR cameras. Copyright (C) 2011-2020 Andras Salamon which is based on: pslr-shoot Command line remote control of Pentax DSLR cameras. Copyright (C) 2009 Ramiro Barreiro With fragments of code from PK-Remote by Pontus Lidman. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU General Public License and GNU Lesser General Public License along with this program. If not, see . */ #include #include #include "pslr_log.h" pslr_verbosity_t verbosity_level = PSLR_ERROR; void pslr_set_verbosity(pslr_verbosity_t verbosity) { verbosity_level = verbosity; } pslr_verbosity_t pslr_get_verbosity() { return verbosity_level; } bool pslr_verbosity_enabled(pslr_verbosity_t level) { return level >= verbosity_level; } void pslr_write_log(pslr_verbosity_t level, const char* message, ...) { // immediatly returns for disabled log levels if (!pslr_verbosity_enabled(level)) { return; } // Write to stderr va_list argp; va_start(argp, message); vfprintf( stderr, message, argp ); va_end(argp); }libpktriggercord-0.85.1/src/pktriggercord-cli.c0000644000175100017510000012224514136175550020755 0ustar debiandebian/* pkTriggerCord Remote control of Pentax DSLR cameras. Copyright (C) 2011-2019 Andras Salamon based on: pslr-shoot Command line remote control of Pentax DSLR cameras. Copyright (C) 2009 Ramiro Barreiro With fragments of code from PK-Remote by Pontus Lidman. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU General Public License and GNU Lesser General Public License along with this program. If not, see . */ #include #include #include #include #include #ifdef RAD10 #include #include #include "tdbtimes.h" #include "getopt.h" #else #include #include #endif #include #include #include #include "pslr.h" #include "pktriggercord-servermode.h" #include "pslr_log.h" #include "pslr_utils.h" #ifdef WIN32 #define FILE_ACCESS O_WRONLY | O_CREAT | O_TRUNC | O_BINARY #else #define FILE_ACCESS O_WRONLY | O_CREAT | O_TRUNC #endif const char *shortopts = "m:q:a:r:d:t:o:i:F:fghvsSw"; pslr_settings settings; bool bulb_timer_before=false; bool astrotracer_before=false; bool need_bulb_new_cleanup=false; bool need_one_push_bracketing_cleanup=false; #if 0 // UNUSED - INDI modification, reapply for next update #ifdef RAD10 static option const longopts[] = { #else static struct option const longopts[] = { #endif {"exposure_mode", required_argument, NULL, 'm'}, {"resolution", required_argument, NULL, 'r'}, {"quality", required_argument, NULL, 'q'}, {"aperture", required_argument, NULL, 'a'}, {"shutter_speed", required_argument, NULL, 't'}, {"iso", required_argument, NULL, 'i'}, {"file_format", required_argument, NULL, 1}, {"output_file", required_argument, NULL, 'o'}, {"help", no_argument, NULL, 'h'}, {"version", no_argument, NULL, 'v'}, {"status", no_argument, NULL, 's'}, {"status_hex", no_argument, NULL, 2}, {"frames", required_argument, NULL, 'F'}, {"delay", required_argument, NULL, 'd'}, {"auto_focus", no_argument, NULL, 'f'}, {"green", no_argument, NULL, 'g'}, {"warnings", no_argument, NULL, 'w'}, {"exposure_compensation", required_argument, NULL, 3}, {"flash_exposure_compensation", required_argument, NULL, 5}, {"debug", no_argument, NULL, 4}, {"dust_removal", no_argument, NULL, 6}, {"color_space", required_argument, NULL, 7}, {"af_mode", required_argument, NULL, 8}, {"ae_metering", required_argument, NULL, 9}, {"flash_mode", required_argument, NULL, 10}, {"drive_mode", required_argument, NULL, 11}, {"select_af_point", required_argument, NULL, 12}, {"jpeg_image_tone", required_argument, NULL, 13}, {"white_balance_mode", required_argument, NULL, 14}, {"white_balance_adjustment", required_argument, NULL, 15}, {"model", required_argument, NULL, 16}, {"nowarnings", no_argument, NULL, 17}, {"device", required_argument, NULL, 18}, {"reconnect", no_argument, NULL, 19}, {"timeout", required_argument, NULL, 20}, {"noshutter", no_argument, NULL, 21}, {"servermode", no_argument, NULL, 22}, {"servermode_timeout", required_argument, NULL, 23}, {"pentax_debug_mode", required_argument, NULL,24}, {"dangerous", no_argument, NULL, 25}, {"read_datetime", no_argument, NULL, 26}, {"read_firmware_version", no_argument, NULL, 27}, {"settings_hex", no_argument, NULL, 28}, {"dump_memory", required_argument, NULL, 29}, {"file_num_start", required_argument, NULL, 30}, {"settings", no_argument, NULL, 'S'}, { NULL, 0, NULL, 0} }; #endif // INDI modification, reapply for next update int save_buffer(pslr_handle_t camhandle, int bufno, int fd, pslr_status *status, user_file_format filefmt, int jpeg_stars) { pslr_buffer_type imagetype; uint8_t buf[65536]; uint32_t length; uint32_t current; if (filefmt == USER_FILE_FORMAT_PEF) { imagetype = PSLR_BUF_PEF; } else if (filefmt == USER_FILE_FORMAT_DNG) { imagetype = PSLR_BUF_DNG; } else { imagetype = pslr_get_jpeg_buffer_type( camhandle, jpeg_stars ); } DPRINT("get buffer %d type %d res %d\n", bufno, imagetype, status->jpeg_resolution); if (pslr_buffer_open(camhandle, bufno, imagetype, status->jpeg_resolution) != PSLR_OK) { return 1; } length = pslr_buffer_get_size(camhandle); DPRINT("Buffer length: %d\n", length); current = 0; while (true) { uint32_t bytes; bytes = pslr_buffer_read(camhandle, buf, sizeof (buf)); if (bytes == 0) { break; } ssize_t r = write(fd, buf, bytes); if (r == 0) { DPRINT("write(buf): Nothing has been written to buf.\n"); } else if (r < 0) { // r<0 - INDI modification, reapply for next update perror("write(buf)"); } else if ((uint32_t)r < bytes) { DPRINT("write(buf): only write %zu bytes, should be %d bytes.\n", r, bytes); } current += bytes; } pslr_buffer_close(camhandle); return 0; } void save_memory(pslr_handle_t camhandle, int fd, uint32_t length) { uint8_t buf[65536]; uint32_t current; DPRINT("save memory %d\n", length); current = 0; while (current65536 ? 65536 : length-current; bytes = pslr_fullmemory_read(camhandle, buf, current, readsize); if (bytes == 0) { break; } ssize_t r = write(fd, buf, bytes); if (r == 0) { DPRINT("write(buf): Nothing has been written to buf.\n"); } else if (r < 0) { // r<0 - INDI modification, reapply for next update perror("write(buf)"); } else if ((uint32_t)r < bytes) { DPRINT("write(buf): only write %zu bytes, should be %d bytes.\n", r, bytes); } current += bytes; } } void print_status_info( pslr_handle_t h, pslr_status status ) { printf("\n"); printf( "%s", pslr_get_status_info( h, status ) ); } void print_settings_info( pslr_handle_t h, pslr_settings settings ) { printf("\n"); printf( "%s", pslr_get_settings_info( h, settings ) ); } void usage(char *name) { printf("\nUsage: %s [OPTIONS]\n\n\ \n\ --model=CAMERA_MODEL valid values are: K20d, K10d, GX10, GX20, K-x, K200D, K-7, K-r, K-5, K-2000, K-m, K-30, K100D, K110D, K-01, K-3, K-3II, K-500\n\ --device=DEVICE valid values for Linux: sg0, sg1, ..., for Windows: C, D, E, ...\n\ --timeout=SECONDS timeout for camera connection ( 0 means forever )\n\ -w, --warnings warning mode on\n\ --nowarnings warning mode off\n\ -m, --exposure_mode=MODE valid values are GREEN, P, SV, TV, AV, TAV, M and X\n\ --exposure_compensation=VALUE exposure compensation value\n\ --drive_mode=DRIVE_MODE valid values are: Single, Continuous-HI, SelfTimer-12, SelfTimer-2, Remote, Remote-3, Continuous-LO\n\ -i, --iso=ISO single value (400) or interval (200-800)\n\ --color_space=COLOR_SPACE valid values are: sRGB, AdobeRGB\n\ --af_mode=AF_MODE valid values are: AF.S, AF.C, AF.A\n\ --select_af_point=AF_SELECT_MODE valid values are: Auto-5, Auto-11, Spot, Select, or numerical value\n\ --ae_metering=AE_METERING valid values are: Multi, Center, Spot\n\ --flash_mode=FLASH_MODE valid values are: Manual, Manual-RedEye, Slow, Slow-RedEye, TrailingCurtain, Auto, Auto-RedEye, Wireless\n\ --flash_exposure_compensation=VAL flash exposure compensation value\n\ -a, --aperture=APERTURE\n\ -t, --shutter_speed=SHUTTER SPEED values can be given in rational form (eg. 1/90) or decimal form (eg. 0.8)\n\ -r, --resolution=RESOLUTION resolution in megapixels\n\ -q, --quality=QUALITY valid values are 1, 2, 3 and 4\n\ --jpeg_image_tone=IMAGE_TONE valid values are: Auto, Natural, Bright, Portrait, Landscape, Vibrant, Monochrome, Muted, ReversalFilm, BleachBypass, Radiant, CrossProcessing, Flat\n\ --white_balance_mode=WB_MODE valid values are: Auto, Daylight, Shade, Cloudy, Fluorescent_D, Fluorescent_N, Fluorescent_W, Fluorescent_L, Tungsten, Flash, Manual, Manual2, Manual3, Kelvin1, Kelvin2, Kelvin3, CTE, MultiAuto\n\ --white_balance_adjustment=WB_ADJ valid values like: G5B2, G3A5, B5, A3, G5, M4...\n\ -f, --auto_focus autofocus\n\ --reconnect reconnect between shots\n\ --servermode start in server mode and wait for commands\n\ --servermode_timeout=SECONDS servermode timeout\n\ -g, --green green button\n\ -s, --status print status info\n\ --status_hex print status hex info\n\ -S, --settings print settings info\n\ --settings_hex print settings hex info\n\ --read_datetime print the camera date and time\n\ --read_firmware_version print the firmware version of the camera\n\ --dump_memory SIZE dumps the internal memory of the camera to pentax_dump.dat file. Size is in bytes, but can be specified using K, M, and G modifiers.\n\ --dust_removal dust removal\n\ -F, --frames=NUMBER number of frames\n\ -d, --delay=SECONDS delay between the frames (seconds)\n\ --file_format=FORMAT valid values: PEF, DNG, JPEG\n\ -o, --output_file=FILE send output to FILE\n\ --file_num_start=NUMBER number to start the filename frame counter at\n\ --debug turn on debug messages\n\ --noshutter do not send shutter command, just wait for new photo, download and delete from camera\n\ -v, --version display version information and exit\n\ -h, --help display this help and exit\n\ --pentax_debug_mode={0|1} enable or disable camera debug mode and exit (DANGEROUS). Valid values are: 0, 1\n\ \n", name); } int open_file(char* output_file, int frameNo, user_file_format_t ufft) { int ofd; char fileName[256]; if (!output_file) { ofd = 1; } else { char *dot = strrchr(output_file, '.'); int prefix_length; if (dot && !strcmp(dot+1, ufft.extension)) { prefix_length = dot - output_file; } else { prefix_length = strlen(output_file); } snprintf(fileName, 256, "%.*s-%04d.%s", prefix_length, output_file, frameNo, ufft.extension); ofd = open(fileName, FILE_ACCESS, 0664); if (ofd == -1) { pslr_write_log(PSLR_ERROR, "Could not open %s\n", output_file); return -1; } } return ofd; } void process_wbadj( const char* argv0, const char chr, uint32_t adj, uint32_t *wbadj_mg, uint32_t *wbadj_ba ) { if ( chr == 'M' ) { *wbadj_mg = 7 - adj; } else if ( chr == 'G' ) { *wbadj_mg = 7 + adj; } else if ( chr == 'B' ) { *wbadj_ba = 7 - adj; } else if ( chr == 'A' ) { *wbadj_ba = 7 + adj; } else { pslr_write_log(PSLR_WARNING, "%s: Invalid white_balance_adjustment\n", argv0); } } char *copyright_version(char *name, char *version) { char *ret = malloc(sizeof(char)*1024); sprintf(ret, "%s %s\n\n\%s\ License LGPLv3: GNU LGPL version 3 \n\ This is free software: you are free to change and redistribute it.\n\ There is NO WARRANTY, to the extent permitted by law.\n", name, version, pslr_copyright() ); return ret; } char *command_line(int argc, char **argv) { int len = 0; int i; for (i=0; i 9999) { pslr_write_log(PSLR_WARNING, "%s: Invalid frame number.\n", argv[0]); frames = 9999; } break; case 'd': delay = atoi(optarg); if (!delay) { pslr_write_log(PSLR_WARNING, "%s: Invalid delay value\n", argv[0]); } break; case 'i': if (sscanf(optarg, "%d-%d%c", &auto_iso_min, &auto_iso_max, &C) != 2) { auto_iso_min = 0; auto_iso_max = 0; iso = atoi(optarg); } if (iso==0 && auto_iso_min==0) { pslr_write_log(PSLR_WARNING, "%s: Invalid iso value\n", argv[0]); exit(-1); } break; case 3: if ( sscanf(optarg, "%f%c", &F, &C) == 1 ) { ec.nom=10*F; ec.denom=10; } break; case 5: if ( sscanf(optarg, "%f%c", &F, &C) == 1 ) { fec.nom=10*F; fec.denom=10; } break; case 21: noshutter = true; break; case 22: servermode = true; break; case 23: servermode_timeout = atoi(optarg); break; case 24: modify_debug_mode=1; debug_mode=atoi(optarg); break; case 25: dangerous = true; break; case 26: read_datetime=true; break; case 27: read_firmware_version=true; break; case 28: settings_hex=true; break; case 29: if ( sscanf(optarg, "%d%c", &dump_memory_size, &multc) == 2 ) { switch (multc) { case 'G': case 'g': mult = 1024*1024*1024; break; case 'M': case 'm': mult = 1024*1024; break; case 'K': case 'k': mult = 1024; break; default: pslr_write_log(PSLR_WARNING, "%s: Invalid dump memory size: %s\n", argv[0], optarg); } dump_memory_size *= mult; } else { dump_memory_size=atoi(optarg); } DPRINT("DUMP_MEMORY_SIZE: %u\n",dump_memory_size); break; case 30: counter = atoi(optarg); if (counter > 9999) { pslr_write_log(PSLR_WARNING, "%s: file_num_start is too high.\n", argv[0]); counter = 0; } else if (counter + frames > 9999) { pslr_write_log(PSLR_WARNING, "%s: Taking too many frames, file_num_start is too high.\n", argv[0]); frames = 10000 - counter; } break; } } if ( servermode ) { #ifndef WIN32 // ignore all the other argument and go to server mode servermode_socket(servermode_timeout); exit(0); #else pslr_write_log(PSLR_ERROR, "Servermode is not supported in Windows\n"); exit(-1); #endif } if (!output_file && !output_file_stdout && frames > 0) { pslr_write_log(PSLR_ERROR, "Should specify output filename (use '-o -' if you really want to output to stdout)\n"); exit(-1); } if (frames == 0 && (output_file || output_file_stdout)) { frames = 1; } DPRINT("%s %s \n", argv[0], VERSION); DPRINT("model %s\n", model ); DPRINT("device %s\n", device ); char buf[2100]; if ( !(camhandle = pslr_camera_connect( model, device, timeout, buf)) ) { printf("%s", buf); exit(-1); } camera_name = pslr_get_camera_name(camhandle); printf("%s: %s Connected...\n", argv[0], camera_name); if ( dump_memory_size > 0 ) { int dfd = open(DUMP_FILE_NAME, FILE_ACCESS, 0664); if (dfd == -1) { pslr_write_log(PSLR_ERROR, "Could not open %s\n", DUMP_FILE_NAME); return -1; } else { printf("Dumping system memory to %s\n", DUMP_FILE_NAME); save_memory(camhandle, dfd, dump_memory_size); close(dfd); pslr_camera_close(camhandle); exit(0); } } /* if debug mode switch is on, there is a possibility someone just want to alter debug mode */ if ( modify_debug_mode == 1) { pslr_set_debugmode(camhandle,debug_mode); pslr_camera_close(camhandle); exit(0); } pslr_get_status(camhandle, &status); if ( color_space != (pslr_color_space_t)(-1) ) { pslr_set_color_space( camhandle, color_space ); } if ( af_mode != (pslr_af_mode_t)(-1) ) { pslr_set_af_mode( camhandle, af_mode ); } if ( af_point_sel != (pslr_af_point_sel_t)(-1) ) { pslr_set_af_point_sel( camhandle, af_point_sel ); if (af_point_selected != 0) { pslr_set_selected_af_point(camhandle, af_point_selected); } } if ( ae_metering != (pslr_ae_metering_t)(-1) ) { pslr_set_ae_metering_mode( camhandle, ae_metering ); } if ( flash_mode != (pslr_flash_mode_t)(-1) ) { pslr_set_flash_mode( camhandle, flash_mode ); } if ( jpeg_image_tone != -1 ) { if ( jpeg_image_tone > pslr_get_model_max_supported_image_tone(camhandle) ) { pslr_write_log(PSLR_WARNING, "%s: Invalid jpeg image tone setting.\n", argv[0]); } pslr_set_jpeg_image_tone( camhandle, jpeg_image_tone ); } if ( white_balance_mode != (pslr_white_balance_mode_t)(-1) ) { pslr_set_white_balance( camhandle, white_balance_mode ); if ( wbadj_ss > 0 ) { pslr_set_white_balance_adjustment( camhandle, white_balance_mode, white_balance_adjustment_mg, white_balance_adjustment_ba ); } } else if ( white_balance_mode == (pslr_white_balance_mode_t)(-1) && wbadj_ss > 0 ) { pslr_set_white_balance_adjustment( camhandle, status.white_balance_mode, white_balance_adjustment_mg, white_balance_adjustment_ba); } if ( drive_mode != (pslr_drive_mode_t)(-1) ) { pslr_set_drive_mode( camhandle, drive_mode ); } if ( uff == USER_FILE_FORMAT_MAX ) { // not specified if ( !pslr_get_model_only_limited( camhandle ) ) { // use the default of the camera uff = pslr_get_user_file_format( &status ); } else { // use PEF, since all the camera supports this uff = USER_FILE_FORMAT_PEF; } } else { // set the requested format pslr_set_user_file_format(camhandle, uff); } if (resolution) { pslr_set_jpeg_resolution(camhandle, resolution); } if (quality>-1) { if ( quality > pslr_get_model_max_jpeg_stars(camhandle) ) { pslr_write_log(PSLR_WARNING, "%s: Invalid jpeg quality setting.\n", argv[0]); } pslr_set_jpeg_stars(camhandle, quality); } // We do not check iso settings // The camera can handle invalid iso settings (it will use ISO 800 instead of ISO 795) if (EM != PSLR_EXPOSURE_MODE_MAX) { pslr_set_exposure_mode(camhandle, EM); } if ( ec.denom ) { pslr_set_expose_compensation( camhandle, ec ); } if ( fec.denom ) { pslr_set_flash_exposure_compensation( camhandle, fec ); } if (iso >0 || auto_iso_min >0) { pslr_set_iso(camhandle, iso, auto_iso_min, auto_iso_max); } /* For some reason, resolution is not set until we read the status: */ pslr_get_status(camhandle, &status); if ( quality == -1 ) { // quality is not set we read it from the camera quality = status.jpeg_quality; } if (EM != PSLR_EXPOSURE_MODE_MAX && status.exposure_mode != EM) { pslr_write_log(PSLR_WARNING, "%s: Cannot set %s mode; set the mode dial to %s or USER\n", argv[0], MODESTRING, MODESTRING); } if (shutter_speed.nom) { DPRINT("shutter_speed.nom=%d\n", shutter_speed.nom); DPRINT("shutter_speed.denom=%d\n", shutter_speed.denom); if (shutter_speed.nom <= 0 || (shutter_speed.nom > 30 && status.exposure_mode != PSLR_GUI_EXPOSURE_MODE_B ) || shutter_speed.denom <= 0 || shutter_speed.denom > pslr_get_model_fastest_shutter_speed(camhandle)) { pslr_write_log(PSLR_WARNING, "%s: Invalid shutter speed value.\n", argv[0]); } pslr_set_shutter(camhandle, shutter_speed); } else if ( status.exposure_mode == PSLR_GUI_EXPOSURE_MODE_B ) { pslr_write_log(PSLR_WARNING, "%s: Shutter speed not specified in Bulb mode. Using 30s.\n", argv[0]); shutter_speed.nom = 30; shutter_speed.denom = 1; } if (aperture.nom) { if ((aperture.nom * status.lens_max_aperture.denom) > (aperture.denom * status.lens_max_aperture.nom)) { pslr_write_log(PSLR_WARNING, "%s: Warning, selected aperture is smaller than this lens minimum aperture.\n", argv[0]); pslr_write_log(PSLR_WARNING, "%s: Setting aperture to f:%d\n", argv[0], status.lens_max_aperture.nom / status.lens_max_aperture.denom); } if ((aperture.nom * status.lens_min_aperture.denom) < (aperture.denom * status.lens_min_aperture.nom)) { pslr_write_log(PSLR_WARNING, "%s: Warning, selected aperture is wider than this lens maximum aperture.\n", argv[0]); pslr_write_log(PSLR_WARNING, "%s: Setting aperture to f:%.1f\n", argv[0], (float) status.lens_min_aperture.nom / (float) status.lens_min_aperture.denom); } pslr_set_aperture(camhandle, aperture); } int frameNo; if (auto_focus) { pslr_focus(camhandle); } if (green) { pslr_green_button( camhandle ); } // pslr_test( camhandle, true, 0x1e, 4, 1, 2, 3, 4); // pslr_button_test( camhandle, 0x0c, 1 ); if (read_datetime) { int year=0, month=0, day=0, hour=0, min=0, sec=0; pslr_get_datetime(camhandle, &year, &month, &day, &hour, &min, &sec); printf("%04d/%02d/%02d %02d:%02d:%02d\n", year, month, day, hour, min, sec); pslr_camera_close(camhandle); exit(0); } if (read_firmware_version || PSLR_DEBUG_ENABLED) { char firmware[16]; pslr_get_dspinfo( camhandle, firmware ); if (!read_firmware_version) { DPRINT("Firmware version: %s\n", firmware); } else { printf("Firmware version: %s\n", firmware); pslr_camera_close(camhandle); exit(0); } } // read the status and settings after setting the values if (settings_hex || settings_info || pslr_get_model_has_settings_parser(camhandle)) { pslr_get_settings_json(camhandle, &settings); } pslr_get_status(camhandle, &status); if ( status_hex_info || status_info || settings_info || settings_hex ) { if ( status_hex_info || status_info ) { if ( status_hex_info ) { int status_bufsize = pslr_get_model_status_buffer_size( camhandle ); uint8_t status_buffer[MAX_STATUS_BUF_SIZE]; pslr_get_status_buffer(camhandle, status_buffer); hexdump( status_buffer, status_bufsize > 0 ? status_bufsize : MAX_STATUS_BUF_SIZE); } print_status_info( camhandle, status ); } if ( settings_info || settings_hex ) { if (settings_hex) { uint8_t settings_buf[SETTINGS_BUFFER_SIZE]; pslr_get_settings_buffer(camhandle, settings_buf); hexdump(settings_buf, SETTINGS_BUFFER_SIZE); } if (pslr_get_model_has_settings_parser(camhandle)) { print_settings_info(camhandle, settings); } else { printf("--settings is not supported for this camera model\n"); } } pslr_camera_close(camhandle); exit(0); } if ( dust ) { pslr_dust_removal(camhandle); pslr_camera_close(camhandle); exit(0); } if (frames == 0) { // no action specified print_status_info( camhandle, status ); pslr_camera_close(camhandle); exit(-1); } if (pslr_has_setting_by_name(camhandle, "bulb_timer")) { bulb_timer_before = settings.bulb_timer.value; } else if (pslr_has_setting_by_name(camhandle, "astrotracer")) { astrotracer_before = settings.astrotracer.value; } double waitsec=0; user_file_format_t ufft = *pslr_get_user_file_format_t(uff); int bracket_count = status.auto_bracket_picture_count; if ( bracket_count < 1 || status.auto_bracket_mode == 0 ) { bracket_count = 1; } gettimeofday(&prev_time, NULL); int bracket_index=0; bool continuous = status.drive_mode == PSLR_DRIVE_MODE_CONTINUOUS_HI || status.drive_mode == PSLR_DRIVE_MODE_CONTINUOUS_LO; DPRINT("cont: %d\n", continuous); if (pslr_get_model_bufmask_single(camhandle) && bracket_count >1 && settings.one_push_bracketing.pslr_setting_status == PSLR_SETTING_STATUS_READ && settings.one_push_bracketing.value) { pslr_set_setting_by_name(camhandle, "one_push_bracketing", 0); settings.one_push_bracketing.value=false; need_one_push_bracketing_cleanup = true; } for (frameNo = 0; frameNo < frames; ++frameNo) { gettimeofday(¤t_time, NULL); if ( bracket_count <= bracket_index ) { if ( reconnect ) { pslr_camera_close( camhandle ); while (!(camhandle = pslr_init( model, device ))) { sleep_sec(1); } pslr_connect(camhandle); } waitsec = 1.0 * delay - timeval_diff_sec(¤t_time, &prev_time); if ( waitsec > 0 ) { printf("Waiting for %.2f sec\n", waitsec); sleep_sec( waitsec ); } bracket_index = 0; gettimeofday(&prev_time, NULL); } if ( noshutter ) { while (1) { if ( PSLR_OK != pslr_get_status (camhandle, &status) ) { break; } if ( status.bufmask != 0 ) { break; //new image ? } gettimeofday (¤t_time, NULL); if ( timeout != 0 && ( timeval_diff_sec(¤t_time, &prev_time) >= timeout) ) { printf("Timeout %d sec passed!\n", timeout); break; } usleep(100000); /* 100 ms */ } } else { if ( frames > 1 ) { printf("Taking picture %d/%d\n", frameNo+1, frames); fflush(stdout); } if ( status.exposure_mode == PSLR_GUI_EXPOSURE_MODE_B ) { if (pslr_get_model_old_bulb_mode(camhandle)) { bulb_old(camhandle, shutter_speed, prev_time); } else { need_bulb_new_cleanup = true; bulb_new(camhandle, shutter_speed); } } else { DPRINT("not bulb\n"); if (!settings.one_push_bracketing.value || bracket_index == 0) { pslr_shutter(camhandle); } else { // TODO: fix waiting time sleep_sec(1); } } pslr_get_status(camhandle, &status); } if ( bracket_index+1 >= bracket_count || frameNo+1>=frames || pslr_get_model_bufmask_single(camhandle) ) { int bracket_download = pslr_get_model_bufmask_single(camhandle) ? 1 : (bracket_index+1 < bracket_count ? bracket_index+1 : bracket_count); int buffer_index; for ( buffer_index = 0; buffer_index < bracket_download; ++buffer_index ) { fd = open_file(output_file, counter+frameNo-bracket_download+buffer_index+1, ufft); while ( save_buffer(camhandle, buffer_index, fd, &status, uff, quality) ) { usleep(10000); } pslr_delete_buffer(camhandle, buffer_index); if (fd != 1) { close(fd); } } } ++bracket_index; } if (need_bulb_new_cleanup) { bulb_new_cleanup(camhandle); } if (need_one_push_bracketing_cleanup) { pslr_set_setting_by_name(camhandle, "one_push_bracketing", 1); } pslr_camera_close(camhandle); exit(0); } libpktriggercord-0.85.1/src/pslr_scsi.c0000644000175100017510000000225214136175550017336 0ustar debiandebian/* pkTriggerCord Copyright (C) 2011-2019 Andras Salamon Remote control of Pentax DSLR cameras. based on: PK-Remote Remote control of Pentax DSLR cameras. Copyright (C) 2008 Pontus Lidman This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU General Public License and GNU Lesser General Public License along with this program. If not, see . */ #if defined(WIN32) || defined(RAD10) #include "pslr_scsi_win.c" #else /* Ugly hack. More generic ifs required */ #ifdef __OpenBSD__ #include "pslr_scsi_openbsd.c" #else #include "pslr_scsi_linux.c" #endif #endif libpktriggercord-0.85.1/src/pslr_enum.c0000644000175100017510000002337214136175550017347 0ustar debiandebian/* pkTriggerCord Copyright (C) 2011-2019 Andras Salamon Remote control of Pentax DSLR cameras. Support for K200D added by Jens Dreyer 04/2011 Support for K-r added by Vincenc Podobnik 06/2011 Support for K-30 added by Camilo Polymeris 09/2012 Support for K-01 added by Ethan Queen 01/2013 Support for K-3 added by Tao Wang 01/2016 based on: PK-Remote Remote control of Pentax DSLR cameras. Copyright (C) 2008 Pontus Lidman PK-Remote for Windows Copyright (C) 2010 Tomasz Kos This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU General Public License and GNU Lesser General Public License along with this program. If not, see . */ #include "pslr_enum.h" #include #include #include #include const char* pslr_color_space_str[PSLR_COLOR_SPACE_MAX] = { "sRGB", "AdobeRGB" }; const char* pslr_af_mode_str[PSLR_AF_MODE_MAX] = { "MF", "AF.S", "AF.C", "AF.A" }; const char* pslr_ae_metering_str[PSLR_AE_METERING_MAX] = { "Multi", "Center", "Spot" }; const char* pslr_flash_mode_str[PSLR_FLASH_MODE_MAX] = { "Manual", "Manual-RedEye", "Slow", "Slow-RedEye", "TrailingCurtain", "Auto", "Auto-RedEye", "TrailingCurtain", /* maybe in manual mode?? */ "Wireless" }; const char* pslr_drive_mode_str[PSLR_DRIVE_MODE_MAX] = { "Single", /* Bracketing also returns Single */ "Continuous-HI", "SelfTimer-12", "SelfTimer-2", "Remote", "Remote-3", "Continuous-LO" }; const char* pslr_af_point_sel_str[PSLR_AF_POINT_SEL_MAX] = { "Auto-5", "Select", "Spot", "Auto-11", "Expanded" }; const char* pslr_af11_point_str[11] = { "topleft", "topmiddle", "topright", "farleft", "middleleft", "middlemiddle", "middleright", "farright", "bottomleft", "bottommiddle", "bottomright" }; const char* pslr_jpeg_image_tone_str[PSLR_JPEG_IMAGE_TONE_MAX] = { "Natural", "Bright", "Portrait", "Landscape", "Vibrant", "Monochrome", "Muted", "ReversalFilm", "BleachBypass", "Radiant", "CrossProcessing", "Flat", "Auto" }; const char* pslr_white_balance_mode_str[PSLR_WHITE_BALANCE_MODE_MAX] = { "Auto", "Daylight", "Shade", "Cloudy", "Fluorescent_D", "Fluorescent_N", "Fluorescent_W", "Tungsten", "Flash", "Manual", /* sometimes called Manual1 */ "Manual2", "Manual3", "Kelvin1", "Kelvin2", "Kelvin3", "Fluorescent_L", "CTE", "MultiAuto" }; const char* pslr_custom_ev_steps_str[PSLR_CUSTOM_EV_STEPS_MAX] = { "1/2", "1/3" }; const char* pslr_custom_sensitivity_steps_str[PSLR_CUSTOM_SENSITIVITY_STEPS_MAX] = { "1", "As" }; const char* pslr_image_format_str[PSLR_IMAGE_FORMAT_MAX] = { "JPEG", "RAW", "RAW+" }; const char* pslr_raw_format_str[PSLR_RAW_FORMAT_MAX] = { "PEF", "DNG" }; const char* pslr_scene_mode_str[PSLR_SCENE_MODE_MAX] = { "NONE", "HISPEED", "DOF", "MTF", "STANDARD", "PORTRAIT", "LANDSCAPE", "MACRO", "SPORT", "NIGHTSCENEPORTRAIT", "NOFLASH", "NIGHTSCENE", "SURFANDSNOW", "TEXT", "SUNSET", "KIDS", "PET", "CANDLELIGHT", "MUSEUM", "19", "FOOD", "STAGE", "NIGHTSNAP", "SWALLOWDOF", "24", "NIGHTSCENEHDR", "BLUESKY", "FOREST", "28", "BLACKLIGHTSILHOUETTE" }; /* case insenstive comparison - strnicmp */ int str_comparison_i (const char *s1, const char *s2, int n) { if ( s1 == NULL ) { return s2 == NULL ? 0 : -(*s2); } if (s2 == NULL) { return *s1; } char c1='\0', c2='\0'; int length=0; while ( length found_index_length) ) { found_index_length = string_length; found_index = i; } } return found_index; } static const char *get_pslr_str( const char** array, int length, int value ) { if (value >=0 && value < length) { return array[value]; } else { char *ret = malloc(128); sprintf (ret, "Unknown value: %d", value); return ret; } } pslr_color_space_t pslr_get_color_space( char *str ) { return find_in_array( pslr_color_space_str, sizeof(pslr_color_space_str)/sizeof(pslr_color_space_str[0]),str); } const char *pslr_get_color_space_str( pslr_color_space_t value ) { return get_pslr_str( pslr_color_space_str, sizeof(pslr_color_space_str)/sizeof(pslr_color_space_str[0]),value); } pslr_af_mode_t pslr_get_af_mode( char *str ) { return find_in_array( pslr_af_mode_str, sizeof(pslr_af_mode_str)/sizeof(pslr_af_mode_str[0]),str); } const char *pslr_get_af_mode_str( pslr_af_mode_t value ) { return get_pslr_str( pslr_af_mode_str, sizeof(pslr_af_mode_str)/sizeof(pslr_af_mode_str[0]),value); } pslr_ae_metering_t pslr_get_ae_metering( char *str ) { return find_in_array( pslr_ae_metering_str, sizeof(pslr_ae_metering_str)/sizeof(pslr_ae_metering_str[0]),str); } const char *pslr_get_ae_metering_str( pslr_ae_metering_t value ) { return get_pslr_str( pslr_ae_metering_str, sizeof(pslr_ae_metering_str)/sizeof(pslr_ae_metering_str[0]),value); } pslr_flash_mode_t pslr_get_flash_mode( char *str ) { return find_in_array( pslr_flash_mode_str, sizeof(pslr_flash_mode_str)/sizeof(pslr_flash_mode_str[0]),str); } const char *pslr_get_flash_mode_str( pslr_flash_mode_t value ) { return get_pslr_str( pslr_flash_mode_str, sizeof(pslr_flash_mode_str)/sizeof(pslr_flash_mode_str[0]),value); } pslr_drive_mode_t pslr_get_drive_mode( char *str ) { return find_in_array( pslr_drive_mode_str, sizeof(pslr_drive_mode_str)/sizeof(pslr_drive_mode_str[0]),str); } const char *pslr_get_drive_mode_str( pslr_drive_mode_t value ) { return get_pslr_str( pslr_drive_mode_str, sizeof(pslr_drive_mode_str)/sizeof(pslr_drive_mode_str[0]),value); } pslr_af_point_sel_t pslr_get_af_point_sel( char *str ) { return find_in_array( pslr_af_point_sel_str, sizeof(pslr_af_point_sel_str)/sizeof(pslr_af_point_sel_str[0]),str); } const char *pslr_get_af_point_sel_str( pslr_af_point_sel_t value ) { return get_pslr_str( pslr_af_point_sel_str, sizeof(pslr_af_point_sel_str)/sizeof(pslr_af_point_sel_str[0]),value); } char *pslr_get_af11_point_str( uint32_t value ) { if (value==0) { return "none"; } int bitidx=0; char *ret = malloc(1024); int pos = sprintf(ret, "%s", ""); while (value>0 && bitidx<11) { if ((value & 0x01) == 1) { int written = sprintf(ret + pos, "%s%s", pos == 0 ? "" : ",", pslr_af11_point_str[bitidx]); if (written < 0) { return ret; } pos += written; } value >>= 1; ++bitidx; } if (value>0) { sprintf(ret, "%s", "invalid"); } return ret; } pslr_jpeg_image_tone_t pslr_get_jpeg_image_tone( char *str ) { return find_in_array( pslr_jpeg_image_tone_str, sizeof(pslr_jpeg_image_tone_str)/sizeof(pslr_jpeg_image_tone_str[0]),str); } const char *pslr_get_jpeg_image_tone_str( pslr_jpeg_image_tone_t value ) { return get_pslr_str( pslr_jpeg_image_tone_str, sizeof(pslr_jpeg_image_tone_str)/sizeof(pslr_jpeg_image_tone_str[0]),value); } pslr_white_balance_mode_t pslr_get_white_balance_mode( char *str ) { return find_in_array( pslr_white_balance_mode_str, sizeof(pslr_white_balance_mode_str)/sizeof(pslr_white_balance_mode_str[0]),str); } const char *pslr_get_white_balance_mode_str( pslr_white_balance_mode_t value ) { return get_pslr_str( pslr_white_balance_mode_str, sizeof(pslr_white_balance_mode_str)/sizeof(pslr_white_balance_mode_str[0]),value); } const char *pslr_get_custom_ev_steps_str( pslr_custom_ev_steps_t value ) { return get_pslr_str( pslr_custom_ev_steps_str, sizeof(pslr_custom_ev_steps_str)/sizeof(pslr_custom_ev_steps_str[0]),value); } const char *pslr_get_custom_sensitivity_steps_str( pslr_custom_sensitivity_steps_t value ) { return get_pslr_str( pslr_custom_sensitivity_steps_str, sizeof(pslr_custom_sensitivity_steps_str)/sizeof(pslr_custom_sensitivity_steps_str[0]),value); } const char *pslr_get_image_format_str( pslr_image_format_t value ) { return get_pslr_str( pslr_image_format_str, sizeof(pslr_image_format_str)/sizeof(pslr_image_format_str[0]),value); } const char *pslr_get_raw_format_str( pslr_raw_format_t value ) { return get_pslr_str( pslr_raw_format_str, sizeof(pslr_raw_format_str)/sizeof(pslr_raw_format_str[0]),value); } const char *pslr_get_scene_mode_str( pslr_scene_mode_t value ) { return get_pslr_str( pslr_scene_mode_str, sizeof(pslr_scene_mode_str)/sizeof(pslr_scene_mode_str[0]),value); } libpktriggercord-0.85.1/src/pslr_model.c0000644000175100017510000013233114136175550017477 0ustar debiandebian/* pkTriggerCord Copyright (C) 2011-2019 Andras Salamon Remote control of Pentax DSLR cameras. Support for K200D added by Jens Dreyer 04/2011 Support for K-r added by Vincenc Podobnik 06/2011 Support for K-30 added by Camilo Polymeris 09/2012 Support for K-01 added by Ethan Queen 01/2013 Support for K-3 added by Tao Wang 01/2016 based on: PK-Remote Remote control of Pentax DSLR cameras. Copyright (C) 2008 Pontus Lidman PK-Remote for Windows Copyright (C) 2010 Tomasz Kos This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU General Public License and GNU Lesser General Public License along with this program. If not, see . */ #include #include #include #include #include #include #ifndef RAD10 #include #endif #include "js0n.h" #include #include #include "pslr_model.h" #include "pslr_log.h" #include "pslr.h" static uint8_t lastbuf[MAX_STATUS_BUF_SIZE]; static int first = 1; static char *jsontext=NULL; static int jsonsize; static int dir_exists(char *dir) { int res = 0; struct stat info; if ( (stat(dir, &info) == 0) && (info.st_mode & S_IFDIR) ) { res = 1; } return res; } static void ipslr_status_diff(uint8_t *buf) { int n; int diffs; if (first) { hexdump(buf, MAX_STATUS_BUF_SIZE); memcpy(lastbuf, buf, MAX_STATUS_BUF_SIZE); first = 0; } diffs = 0; for (n = 0; n < MAX_STATUS_BUF_SIZE; n++) { if (lastbuf[n] != buf[n]) { DPRINT("\t\tbuf[%03X] last %02Xh %3d new %02Xh %3d\n", n, lastbuf[n], lastbuf[n], buf[n], buf[n]); diffs++; } } if (diffs) { DPRINT("---------------------------\n"); memcpy(lastbuf, buf, MAX_STATUS_BUF_SIZE); } } static uint16_t get_uint16_be(const uint8_t *buf) { uint16_t res; res = buf[0] << 8 | buf[1]; return res; } uint32_t get_uint32_be(uint8_t *buf) { uint32_t res; res = buf[0] << 24 | buf[1] << 16 | buf[2] << 8 | buf[3]; return res; } static int32_t get_int32_be(uint8_t *buf) { int32_t res; res = buf[0] << 24 | buf[1] << 16 | buf[2] << 8 | buf[3]; return res; } static uint16_t get_uint16_le(const uint8_t *buf) { uint16_t res; res = buf[1] << 8 | buf[0]; return res; } uint32_t get_uint32_le(uint8_t *buf) { uint32_t res; res = buf[3] << 24 | buf[2] << 16 | buf[1] << 8 | buf[0]; return res; } static int32_t get_int32_le(uint8_t *buf) { int32_t res; res = buf[3] << 24 | buf[2] << 16 | buf[1] << 8 | buf[0]; return res; } void set_uint32_le(uint32_t v, uint8_t *buf) { buf[0] = v; buf[1] = v >> 8; buf[2] = v >> 16; buf[3] = v >> 24; } void set_uint32_be(uint32_t v, uint8_t *buf) { buf[0] = v >> 24; buf[1] = v >> 16; buf[2] = v >> 8; buf[3] = v; } char *pslr_hexdump(uint8_t *buf, uint32_t bufLen) { char *ret = malloc(4*bufLen); uint32_t i; sprintf(ret,"%s",""); for (i = 0; i < bufLen; i++) { if (i % 16 == 0) { sprintf(ret+strlen(ret),"0x%04x | ", i); } sprintf(ret+strlen(ret), "%02x ", buf[i]); if (i % 8 == 7) { sprintf(ret+strlen(ret), " "); } if (i % 16 == 15) { sprintf(ret+strlen(ret), "\n"); } } if (i % 16 != 15) { sprintf(ret+strlen(ret), "\n"); } return ret; } void hexdump(uint8_t *buf, uint32_t bufLen) { char *dmp = pslr_hexdump(buf, bufLen); printf("%s",dmp); free(dmp); } void hexdump_debug(uint8_t *buf, uint32_t bufLen) { char *dmp = pslr_hexdump(buf, bufLen); DPRINT("%s",dmp); free(dmp); } // based on http://stackoverflow.com/a/657202/21348 const char* int_to_binary( uint16_t x ) { static char b[sizeof(uint16_t)*8+1] = {0}; int y; long long z; for (z=(1LL<0; z>>=1,y++) { b[y] = ( ((x & z) == z) ? '1' : '0'); } b[y] = 0; return b; } static int _get_user_jpeg_stars( ipslr_model_info_t *model, int hwqual ) { if ( model->id == 0x12f71 ) { // K5IIs hack // TODO: test it if ( hwqual == model->max_jpeg_stars -1 ) { return model->max_jpeg_stars; } else { return model->max_jpeg_stars - 1 - hwqual; } } else { return model->max_jpeg_stars - hwqual; } } int pslr_get_hw_jpeg_quality( ipslr_model_info_t *model, int user_jpeg_stars) { if ( model->id == 0x12f71 ) { // K5IIs hack // TODO: test it if ( user_jpeg_stars == model->max_jpeg_stars ) { return model->max_jpeg_stars-1; } else { return model->max_jpeg_stars - 1 - user_jpeg_stars; } } else { return model->max_jpeg_stars - user_jpeg_stars; } } static void ipslr_status_parse_k10d(ipslr_handle_t *p, pslr_status *status) { uint8_t *buf = p->status_buffer; if ( PSLR_DEBUG_ENABLED ) { ipslr_status_diff(buf); } memset(status, 0, sizeof (*status)); status->bufmask = get_uint16_be(&buf[0x16]); status->user_mode_flag = get_uint32_be(&buf[0x1c]); status->set_shutter_speed.nom = get_uint32_be(&buf[0x2c]); status->set_shutter_speed.denom = get_uint32_be(&buf[0x30]); status->set_aperture.nom = get_uint32_be(&buf[0x34]); status->set_aperture.denom = get_uint32_be(&buf[0x38]); status->ec.nom = get_uint32_be(&buf[0x3c]); status->ec.denom = get_uint32_be(&buf[0x40]); status->fixed_iso = get_uint32_be(&buf[0x60]); status->image_format = get_uint32_be(&buf[0x78]); status->jpeg_resolution = get_uint32_be(&buf[0x7c]); status->jpeg_quality = _get_user_jpeg_stars( p->model, get_uint32_be(&buf[0x80])); status->raw_format = get_uint32_be(&buf[0x84]); status->jpeg_image_tone = get_uint32_be(&buf[0x88]); status->jpeg_saturation = get_uint32_be(&buf[0x8c]); status->jpeg_sharpness = get_uint32_be(&buf[0x90]); status->jpeg_contrast = get_uint32_be(&buf[0x94]); status->custom_ev_steps = get_uint32_be(&buf[0x9c]); status->custom_sensitivity_steps = get_uint32_be(&buf[0xa0]); status->af_point_select = get_uint32_be(&buf[0xbc]); status->selected_af_point = get_uint32_be(&buf[0xc0]); status->exposure_mode = get_uint32_be(&buf[0xac]); status->current_shutter_speed.nom = get_uint32_be(&buf[0xf4]); status->current_shutter_speed.denom = get_uint32_be(&buf[0xf8]); status->current_aperture.nom = get_uint32_be(&buf[0xfc]); status->current_aperture.denom = get_uint32_be(&buf[0x100]); status->current_iso = get_uint32_be(&buf[0x11c]); status->light_meter_flags = get_uint32_be(&buf[0x124]); status->lens_min_aperture.nom = get_uint32_be(&buf[0x12c]); status->lens_min_aperture.denom = get_uint32_be(&buf[0x130]); status->lens_max_aperture.nom = get_uint32_be(&buf[0x134]); status->lens_max_aperture.denom = get_uint32_be(&buf[0x138]); status->focused_af_point = get_uint32_be(&buf[0x150]); status->zoom.nom = get_uint32_be(&buf[0x16c]); status->zoom.denom = get_uint32_be(&buf[0x170]); status->focus = get_int32_be(&buf[0x174]); } static void ipslr_status_parse_k20d(ipslr_handle_t *p, pslr_status *status) { uint8_t *buf = p->status_buffer; if ( PSLR_DEBUG_ENABLED ) { ipslr_status_diff(buf); } memset(status, 0, sizeof (*status)); status->bufmask = get_uint16_be( &buf[0x16]); status->user_mode_flag = get_uint32_be(&buf[0x1c]); status->set_shutter_speed.nom = get_uint32_be(&buf[0x2c]); status->set_shutter_speed.denom = get_uint32_be(&buf[0x30]); status->set_aperture.nom = get_uint32_be(&buf[0x34]); status->set_aperture.denom = get_uint32_be(&buf[0x38]); status->ec.nom = get_uint32_be(&buf[0x3c]); status->ec.denom = get_uint32_be(&buf[0x40]); status->fixed_iso = get_uint32_be(&buf[0x60]); status->image_format = get_uint32_be(&buf[0x78]); status->jpeg_resolution = get_uint32_be(&buf[0x7c]); status->jpeg_quality = _get_user_jpeg_stars( p->model, get_uint32_be(&buf[0x80])); status->raw_format = get_uint32_be(&buf[0x84]); status->jpeg_image_tone = get_uint32_be(&buf[0x88]); status->jpeg_saturation = get_uint32_be(&buf[0x8c]); // commands do now work for it? status->jpeg_sharpness = get_uint32_be(&buf[0x90]); // commands do now work for it? status->jpeg_contrast = get_uint32_be(&buf[0x94]); // commands do now work for it? status->custom_ev_steps = get_uint32_be(&buf[0x9c]); status->custom_sensitivity_steps = get_uint32_be(&buf[0xa0]); status->ae_metering_mode = get_uint32_be(&buf[0xb4]); // same as c4 status->af_mode = get_uint32_be(&buf[0xb8]); status->af_point_select = get_uint32_be(&buf[0xbc]); // not sure status->selected_af_point = get_uint32_be(&buf[0xc0]); status->exposure_mode = get_uint32_be(&buf[0xac]); status->current_shutter_speed.nom = get_uint32_be(&buf[0x108]); status->current_shutter_speed.denom = get_uint32_be(&buf[0x10C]); status->current_aperture.nom = get_uint32_be(&buf[0x110]); status->current_aperture.denom = get_uint32_be(&buf[0x114]); status->current_iso = get_uint32_be(&buf[0x130]); status->light_meter_flags = get_uint32_be(&buf[0x138]); status->lens_min_aperture.nom = get_uint32_be(&buf[0x140]); status->lens_min_aperture.denom = get_uint32_be(&buf[0x144]); status->lens_max_aperture.nom = get_uint32_be(&buf[0x148]); status->lens_max_aperture.denom = get_uint32_be(&buf[0x14B]); status->focused_af_point = get_uint32_be(&buf[0x160]); // unsure about it, a lot is changing when the camera focuses status->zoom.nom = get_uint32_be(&buf[0x180]); status->zoom.denom = get_uint32_be(&buf[0x184]); status->focus = get_int32_be(&buf[0x188]); // current focus ring position? // 0x158 current ev? // 0x160 and 0x164 change when AF } static void ipslr_status_parse_istds(ipslr_handle_t *p, pslr_status *status) { uint8_t *buf = p->status_buffer; /* *ist DS status block */ memset(status, 0, sizeof (*status)); status->bufmask = get_uint16_be(&buf[0x12]); status->set_shutter_speed.nom = get_uint32_be(&buf[0x80]); status->set_shutter_speed.denom = get_uint32_be(&buf[0x84]); status->set_aperture.nom = get_uint32_be(&buf[0x88]); status->set_aperture.denom = get_uint32_be(&buf[0x8c]); status->lens_min_aperture.nom = get_uint32_be(&buf[0xb8]); status->lens_min_aperture.denom = get_uint32_be(&buf[0xbc]); status->lens_max_aperture.nom = get_uint32_be(&buf[0xc0]); status->lens_max_aperture.denom = get_uint32_be(&buf[0xc4]); // no DNG support so raw format is PEF status->raw_format = PSLR_RAW_FORMAT_PEF; } // some of the cameras share most of the status fields // this method is used for K-x, K-7, K-5, K-r // // some cameras also have this data block, but it's shifted a bit static void ipslr_status_parse_common(ipslr_handle_t *p, pslr_status *status, int shift) { uint8_t *buf = p->status_buffer; get_uint32_func get_uint32_func_ptr; get_int32_func get_int32_func_ptr; get_uint16_func get_uint16_func_ptr; if (p->model->is_little_endian) { get_uint32_func_ptr = get_uint32_le; get_int32_func_ptr = get_int32_le; get_uint16_func_ptr = get_uint16_le; } else { get_uint32_func_ptr = get_uint32_be; get_int32_func_ptr = get_int32_be; get_uint16_func_ptr = get_uint16_be; } // 0x0C: 0x85 0xA5 // 0x0F: beginning 0 sometime changes to 1 // 0x14: LCD panel 2: turned off 3: on? status->bufmask = (*get_uint16_func_ptr)( &buf[0x1E + shift]); status->user_mode_flag = (*get_uint32_func_ptr)(&buf[0x24 + shift]); status->flash_mode = (*get_uint32_func_ptr)(&buf[0x28 + shift]); status->flash_exposure_compensation = (*get_int32_func_ptr)(&buf[0x2C + shift]); status->set_shutter_speed.nom = (*get_uint32_func_ptr)(&buf[0x34 + shift]); status->set_shutter_speed.denom = (*get_uint32_func_ptr)(&buf[0x38 + shift]); status->set_aperture.nom = (*get_uint32_func_ptr)(&buf[0x3C + shift]); status->set_aperture.denom = (*get_uint32_func_ptr)(&buf[0x40 + shift]); status->ec.nom = (*get_uint32_func_ptr)(&buf[0x44 + shift]); status->ec.denom = (*get_uint32_func_ptr)(&buf[0x48 + shift]); status->auto_bracket_mode = (*get_uint32_func_ptr)(&buf[0x4C + shift]); status->auto_bracket_ev.nom = (*get_uint32_func_ptr)(&buf[0x50 + shift]); status->auto_bracket_ev.denom = (*get_uint32_func_ptr)(&buf[0x54 + shift]); status->auto_bracket_picture_count = (*get_uint32_func_ptr)(&buf[0x58 + shift]); status->drive_mode = (*get_uint32_func_ptr)(&buf[0x5C + shift]); status->fixed_iso = (*get_uint32_func_ptr)(&buf[0x68 + shift]); status->auto_iso_min = (*get_uint32_func_ptr)(&buf[0x6C + shift]); status->auto_iso_max = (*get_uint32_func_ptr)(&buf[0x70 + shift]); status->white_balance_mode = (*get_uint32_func_ptr)(&buf[0x74 + shift]); status->white_balance_adjust_mg = (*get_uint32_func_ptr)(&buf[0x78 + shift]); // 0: M7 7: 0 14: G7 status->white_balance_adjust_ba = (*get_uint32_func_ptr)(&buf[0x7C + shift]); // 0: B7 7: 0 14: A7 status->image_format = (*get_uint32_func_ptr)(&buf[0x80 + shift]); status->jpeg_resolution = (*get_uint32_func_ptr)(&buf[0x84 + shift]); status->jpeg_quality = _get_user_jpeg_stars( p->model, (*get_uint32_func_ptr)(&buf[0x88 + shift])); status->raw_format = (*get_uint32_func_ptr)(&buf[0x8C + shift]); status->jpeg_image_tone = (*get_uint32_func_ptr)(&buf[0x90 + shift]); status->jpeg_saturation = (*get_uint32_func_ptr)(&buf[0x94 + shift]); status->jpeg_sharpness = (*get_uint32_func_ptr)(&buf[0x98 + shift]); status->jpeg_contrast = (*get_uint32_func_ptr)(&buf[0x9C + shift]); status->color_space = (*get_uint32_func_ptr)(&buf[0xA0 + shift]); status->custom_ev_steps = (*get_uint32_func_ptr)(&buf[0xA4 + shift]); status->custom_sensitivity_steps = (*get_uint32_func_ptr)(&buf[0xa8 + shift]); status->exposure_mode = (*get_uint32_func_ptr)(&buf[0xb4 + shift]); status->scene_mode = (*get_uint32_func_ptr)(&buf[0xb8 + shift]); status->ae_metering_mode = (*get_uint32_func_ptr)(&buf[0xbc + shift]); // same as cc status->af_mode = (*get_uint32_func_ptr)(&buf[0xC0 + shift]); status->af_point_select = (*get_uint32_func_ptr)(&buf[0xc4 + shift]); status->selected_af_point = (*get_uint32_func_ptr)(&buf[0xc8 + shift]); status->shake_reduction = (*get_uint32_func_ptr)(&buf[0xE0 + shift]); status->auto_bracket_picture_counter = (*get_uint32_func_ptr)(&buf[0xE4 + shift]); status->jpeg_hue = (*get_uint32_func_ptr)(&buf[0xFC + shift]); status->current_shutter_speed.nom = (*get_uint32_func_ptr)(&buf[0x10C + shift]); status->current_shutter_speed.denom = (*get_uint32_func_ptr)(&buf[0x110 + shift]); status->current_aperture.nom = (*get_uint32_func_ptr)(&buf[0x114 + shift]); status->current_aperture.denom = (*get_uint32_func_ptr)(&buf[0x118 + shift]); status->max_shutter_speed.nom = (*get_uint32_func_ptr)(&buf[0x12C + shift]); status->max_shutter_speed.denom = (*get_uint32_func_ptr)(&buf[0x130 + shift]); status->current_iso = (*get_uint32_func_ptr)(&buf[0x134 + shift]); status->light_meter_flags = (*get_uint32_func_ptr)(&buf[0x13C + shift]); status->lens_min_aperture.nom = (*get_uint32_func_ptr)(&buf[0x144 + shift]); status->lens_min_aperture.denom = (*get_uint32_func_ptr)(&buf[0x148 + shift]); status->lens_max_aperture.nom = (*get_uint32_func_ptr)(&buf[0x14C + shift]); status->lens_max_aperture.denom = (*get_uint32_func_ptr)(&buf[0x150 + shift]); status->manual_mode_ev = (*get_int32_func_ptr)(&buf[0x15C + shift]); status->focused_af_point = (*get_uint32_func_ptr)(&buf[0x168 + shift]); //d, unsure about it, a lot is changing when the camera focuses // probably voltage*100 // battery_1 > battery2 ( noload vs load voltage?) status->battery_1 = (*get_uint32_func_ptr)( &buf[0x170 + shift] ); status->battery_2 = (*get_uint32_func_ptr)( &buf[0x174 + shift] ); status->battery_3 = (*get_uint32_func_ptr)( &buf[0x180 + shift] ); status->battery_4 = (*get_uint32_func_ptr)( &buf[0x184 + shift] ); } static void ipslr_status_parse_kx(ipslr_handle_t *p, pslr_status *status) { uint8_t *buf = p->status_buffer; if ( PSLR_DEBUG_ENABLED ) { ipslr_status_diff(buf); } memset(status, 0, sizeof (*status)); ipslr_status_parse_common( p, status, 0); status->zoom.nom = get_uint32_be(&buf[0x198]); status->zoom.denom = get_uint32_be(&buf[0x19C]); status->focus = get_int32_be(&buf[0x1A0]); status->lens_id1 = get_uint32_be(&buf[0x188]) & 0x0F; status->lens_id2 = get_uint32_be( &buf[0x194]); // selected_af_point: cannot find the field, 0xc8 is always zero } // Vince: K-r support 2011-06-22 // static void ipslr_status_parse_kr(ipslr_handle_t *p, pslr_status *status) { uint8_t *buf = p->status_buffer; if ( PSLR_DEBUG_ENABLED ) { ipslr_status_diff(buf); } memset(status, 0, sizeof (*status)); ipslr_status_parse_common( p, status, 0 ); status->zoom.nom = get_uint32_be(&buf[0x19C]); status->zoom.denom = get_uint32_be(&buf[0x1A0]); status->focus = get_int32_be(&buf[0x1A4]); status->lens_id1 = get_uint32_be(&buf[0x18C]) & 0x0F; status->lens_id2 = get_uint32_be( &buf[0x198]); } static void ipslr_status_parse_k5(ipslr_handle_t *p, pslr_status *status) { uint8_t *buf = p->status_buffer; if ( PSLR_DEBUG_ENABLED ) { ipslr_status_diff(buf); } memset(status, 0, sizeof (*status)); ipslr_status_parse_common( p, status, 0 ); status->zoom.nom = get_uint32_be(&buf[0x1A0]); status->zoom.denom = get_uint32_be(&buf[0x1A4]); status->focus = get_int32_be(&buf[0x1A8]); // ? status->lens_id1 = get_uint32_be(&buf[0x190]) & 0x0F; status->lens_id2 = get_uint32_be( &buf[0x19C]); // TODO: check these fields //status.focused = getInt32(statusBuf, 0x164); } static void ipslr_status_parse_k30(ipslr_handle_t *p, pslr_status *status) { uint8_t *buf = p->status_buffer; if ( PSLR_DEBUG_ENABLED ) { ipslr_status_diff(buf); } memset(status, 0, sizeof (*status)); ipslr_status_parse_common( p, status, 0 ); //~ status->jpeg_contrast -= 4; //~ status->jpeg_hue -= 4; //~ status->jpeg_sharpness -= 4; //~ status->jpeg_saturation -= 4; status->zoom.nom = get_uint32_be(&buf[0x1A0]); status->zoom.denom = 100; status->focus = get_int32_be(&buf[0x1A8]); // ? status->lens_id1 = get_uint32_be(&buf[0x190]) & 0x0F; status->lens_id2 = get_uint32_be( &buf[0x19C]); } // status check seems to be the same as K30 static void ipslr_status_parse_k01(ipslr_handle_t *p, pslr_status *status) { uint8_t *buf = p->status_buffer; if ( PSLR_DEBUG_ENABLED ) { ipslr_status_diff(buf); } memset(status, 0, sizeof (*status)); ipslr_status_parse_common( p, status, 0 ); //~ status->jpeg_contrast -= 4; //~ status->jpeg_hue -= 4; //~ status->jpeg_sharpness -= 4; //~ status->jpeg_saturation -= 4; status->zoom.nom = get_uint32_be(&buf[0x1A0]); // - good for K01 status->zoom.denom = 100; // good for K-01 status->focus = get_int32_be(&buf[0x1A8]); // ? - good for K01 status->lens_id1 = get_uint32_be(&buf[0x190]) & 0x0F; // - good for K01 status->lens_id2 = get_uint32_be( &buf[0x19C]); // - good for K01 } static void ipslr_status_parse_k50(ipslr_handle_t *p, pslr_status *status) { uint8_t *buf = p->status_buffer; if ( PSLR_DEBUG_ENABLED ) { ipslr_status_diff(buf); } memset(status, 0, sizeof (*status)); ipslr_status_parse_common( p, status, 0 ); status->zoom.nom = get_uint32_be(&buf[0x1A0]); status->zoom.denom = get_uint32_be(&buf[0x1A4]); // status->focus = get_int32_be(&buf[0x1A8]); // ? status->lens_id1 = get_uint32_be(&buf[0x190]) & 0x0F; status->lens_id2 = get_uint32_be( &buf[0x19C]); } static void ipslr_status_parse_k500(ipslr_handle_t *p, pslr_status *status) { uint8_t *buf = p->status_buffer; if ( PSLR_DEBUG_ENABLED ) { ipslr_status_diff(buf); } memset(status, 0, sizeof (*status)); ipslr_status_parse_common( p, status, 0 ); status->zoom.nom = get_uint32_be(&buf[0x1A0]); status->zoom.denom = get_uint32_be(&buf[0x1A4]); // status->focus = get_int32_be(&buf[0x1A8]); // ? status->lens_id1 = get_uint32_be(&buf[0x190]) & 0x0F; status->lens_id2 = get_uint32_be( &buf[0x19C]); // cannot read max_shutter_speed from status buffer, hardwire the values here status->max_shutter_speed.nom = 1; status->max_shutter_speed.denom = 6000; } static void ipslr_status_parse_km(ipslr_handle_t *p, pslr_status *status) { uint8_t *buf = p->status_buffer; if ( PSLR_DEBUG_ENABLED ) { ipslr_status_diff(buf); } memset(status, 0, sizeof (*status)); ipslr_status_parse_common( p, status, -4); status->zoom.nom = get_uint32_be(&buf[0x180]); status->zoom.denom = get_uint32_be(&buf[0x184]); status->lens_id1 = get_uint32_be(&buf[0x170]) & 0x0F; status->lens_id2 = get_uint32_be( &buf[0x17c]); // TODO // status.focused = getInt32(statusBuf, 0x164); } // K-3 returns data in little-endian static void ipslr_status_parse_k3(ipslr_handle_t *p, pslr_status *status) { uint8_t *buf = p->status_buffer; if ( PSLR_DEBUG_ENABLED ) { ipslr_status_diff(buf); } memset(status, 0, sizeof (*status)); ipslr_status_parse_common( p, status, 0 ); status->bufmask = get_uint16_le( &buf[0x1C]); status->zoom.nom = get_uint32_le(&buf[0x1A0]); status->zoom.denom = get_uint32_le(&buf[0x1A4]); status->focus = get_int32_le(&buf[0x1A8]); status->lens_id1 = get_uint32_le(&buf[0x190]) & 0x0F; status->lens_id2 = get_uint32_le( &buf[0x19C]); // cannot read max_shutter_speed from status buffer, hardwire the values here status->max_shutter_speed.nom = 1; status->max_shutter_speed.denom = 8000; } static void ipslr_status_parse_ks1(ipslr_handle_t *p, pslr_status *status) { uint8_t *buf = p->status_buffer; if ( PSLR_DEBUG_ENABLED ) { ipslr_status_diff(buf); } memset(status, 0, sizeof (*status)); ipslr_status_parse_common( p, status, 0 ); status->bufmask = get_uint16_le( &buf[0x0C]); status->zoom.nom = get_uint32_le(&buf[0x1A0]); status->zoom.denom = get_uint32_le(&buf[0x1A4]); status->focus = get_int32_le(&buf[0x1A8]); status->lens_id1 = get_uint32_le(&buf[0x190]) & 0x0F; status->lens_id2 = get_uint32_le( &buf[0x19C]); } static void ipslr_status_parse_k1(ipslr_handle_t *p, pslr_status *status) { uint8_t *buf = p->status_buffer; if ( PSLR_DEBUG_ENABLED ) { ipslr_status_diff(buf); } memset(status, 0, sizeof (*status)); ipslr_status_parse_common( p, status, 0 ); // parse_common returns invalid values for the following fields. Fixing the fields: status->jpeg_hue = get_uint32_le(&buf[0x100]); status->current_shutter_speed.nom = get_uint32_le(&buf[0x110]); status->current_shutter_speed.denom = get_uint32_le(&buf[0x114]); status->current_aperture.nom = get_uint32_le(&buf[0x118]); status->current_aperture.denom = get_uint32_le(&buf[0x11c]); status->max_shutter_speed.nom = get_uint32_le(&buf[0x130]); status->max_shutter_speed.denom = get_uint32_le(&buf[0x134]); status->current_iso = get_uint32_le(&buf[0x138]); status->light_meter_flags = get_uint32_le(&buf[0x140]); // ? status->lens_min_aperture.nom = get_uint32_le(&buf[0x148]); status->lens_min_aperture.denom = get_uint32_le(&buf[0x14c]); status->lens_max_aperture.nom = get_uint32_le(&buf[0x150]); status->lens_max_aperture.denom = get_uint32_le(&buf[0x154]); status->manual_mode_ev = get_uint32_le(&buf[0x160]); // ? status->focused_af_point = get_uint32_le(&buf[0x16c]); // ? status->battery_1 = get_uint32_le(&buf[0x174]); status->battery_2 = get_uint32_le(&buf[0x178]); // selected_af_point // toprow left: 0x04000000 // toprow leftmiddle: 0x02000000 // toprow middle: 0x01000000 // toprow rightmiddle: 0x00800000 // bottomright: 0x00000004 status->bufmask = get_uint16_le( &buf[0x0C]); status->zoom.nom = get_uint32_le(&buf[0x1A4]); status->zoom.denom = get_uint32_le(&buf[0x1A8]); // status->focus = get_int32_le(&buf[0x1A8]); status->lens_id1 = get_uint32_le(&buf[0x194]) & 0x0F; status->lens_id2 = get_uint32_le( &buf[0x1A0]); } static void ipslr_status_parse_k70(ipslr_handle_t *p, pslr_status *status) { uint8_t *buf = p->status_buffer; if ( PSLR_DEBUG_ENABLED ) { ipslr_status_diff(buf); } memset(status, 0, sizeof (*status)); ipslr_status_parse_common( p, status, 0 ); // parse_common returns invalid values for the following fields. Fixing the fields: status->auto_bracket_picture_counter = get_uint32_le(&buf[0xE8]); status->jpeg_hue = get_uint32_le(&buf[0x100]); status->current_shutter_speed.nom = get_uint32_le(&buf[0x110]); status->current_shutter_speed.denom = get_uint32_le(&buf[0x114]); status->current_aperture.nom = get_uint32_le(&buf[0x118]); status->current_aperture.denom = get_uint32_le(&buf[0x11c]); status->max_shutter_speed.nom = get_uint32_le(&buf[0x130]); status->max_shutter_speed.denom = get_uint32_le(&buf[0x134]); status->current_iso = get_uint32_le(&buf[0x138]); status->light_meter_flags = get_uint32_le(&buf[0x140]); // ? status->lens_min_aperture.nom = get_uint32_le(&buf[0x148]); status->lens_min_aperture.denom = get_uint32_le(&buf[0x14c]); status->lens_max_aperture.nom = get_uint32_le(&buf[0x150]); status->lens_max_aperture.denom = get_uint32_le(&buf[0x154]); status->manual_mode_ev = get_uint32_le(&buf[0x160]); // ? status->focused_af_point = get_uint32_le(&buf[0x16c]); // ? switch ( status->af_point_select) { case 0: status->af_point_select=PSLR_AF_POINT_SEL_SPOT; break; case 1: status->af_point_select=PSLR_AF_POINT_SEL_SELECT; break; case 2: status->af_point_select=PSLR_AF_POINT_SEL_EXPANDED; break; case 5: status->af_point_select=PSLR_AF_POINT_SEL_AUTO_5; break; case 6: status->af_point_select=PSLR_AF_POINT_SEL_AUTO_11; break; } status->battery_1 = get_uint32_le(&buf[0x174]); status->battery_2 = get_uint32_le(&buf[0x178]); status->battery_3 = 0; status->battery_4 = 0; uint32_t converted_selected_af_point=0; int convert_bit_index[11] = { 26, 24, 22, 1, 16, 14, 12, 0, 6, 4, 2}; int bitidx=0; for (bitidx=0; bitidx<11; ++bitidx) { if (status->selected_af_point & 1<selected_af_point = converted_selected_af_point; status->bufmask = get_uint16_le( &buf[0x0C]); status->zoom.nom = get_uint32_le(&buf[0x1A4]); status->zoom.denom = get_uint32_le(&buf[0x1A8]); // status->focus = get_int32_le(&buf[0x1A8]); status->lens_id1 = get_uint32_le(&buf[0x194]) & 0x0F; status->lens_id2 = get_uint32_le( &buf[0x1A0]); status->shake_reduction = get_uint32_le(&buf[0xe4]); } static void ipslr_status_parse_k200d(ipslr_handle_t *p, pslr_status *status) { uint8_t *buf = p->status_buffer; if ( PSLR_DEBUG_ENABLED ) { ipslr_status_diff(buf); } memset(status, 0, sizeof (*status)); status->bufmask = get_uint16_be(&buf[0x16]); status->user_mode_flag = get_uint32_be(&buf[0x1c]); status->set_shutter_speed.nom = get_uint32_be(&buf[0x2c]); status->set_shutter_speed.denom = get_uint32_be(&buf[0x30]); status->current_aperture.nom = get_uint32_be(&buf[0x034]); status->current_aperture.denom = get_uint32_be(&buf[0x038]); status->set_aperture.nom = get_uint32_be(&buf[0x34]); status->set_aperture.denom = get_uint32_be(&buf[0x38]); status->ec.nom = get_uint32_be(&buf[0x3c]); status->ec.denom = get_uint32_be(&buf[0x40]); status->current_iso = get_uint32_be(&buf[0x060]); status->fixed_iso = get_uint32_be(&buf[0x60]); status->auto_iso_min = get_uint32_be(&buf[0x64]); status->auto_iso_max = get_uint32_be(&buf[0x68]); status->image_format = get_uint32_be(&buf[0x78]); status->jpeg_resolution = get_uint32_be(&buf[0x7c]); status->jpeg_quality = _get_user_jpeg_stars( p->model, get_uint32_be(&buf[0x80])); status->raw_format = get_uint32_be(&buf[0x84]); status->jpeg_image_tone = get_uint32_be(&buf[0x88]); status->jpeg_saturation = get_uint32_be(&buf[0x8c]); status->jpeg_sharpness = get_uint32_be(&buf[0x90]); status->jpeg_contrast = get_uint32_be(&buf[0x94]); //status->custom_ev_steps = get_uint32_be(&buf[0x9c]); //status->custom_sensitivity_steps = get_uint32_be(&buf[0xa0]); status->exposure_mode = get_uint32_be(&buf[0xac]); status->af_mode = get_uint32_be(&buf[0xb8]); status->af_point_select = get_uint32_be(&buf[0xbc]); status->selected_af_point = get_uint32_be(&buf[0xc0]); status->drive_mode = get_uint32_be(&buf[0xcc]); status->shake_reduction = get_uint32_be(&buf[0xda]); status->jpeg_hue = get_uint32_be(&buf[0xf4]); status->current_shutter_speed.nom = get_uint32_be(&buf[0x0104]); status->current_shutter_speed.denom = get_uint32_be(&buf[0x108]); status->light_meter_flags = get_uint32_be(&buf[0x124]); status->lens_min_aperture.nom = get_uint32_be(&buf[0x13c]); status->lens_min_aperture.denom = get_uint32_be(&buf[0x140]); status->lens_max_aperture.nom = get_uint32_be(&buf[0x144]); status->lens_max_aperture.denom = get_uint32_be(&buf[0x148]); status->focused_af_point = get_uint32_be(&buf[0x150]); status->zoom.nom = get_uint32_be(&buf[0x17c]); status->zoom.denom = get_uint32_be(&buf[0x180]); status->focus = get_int32_be(&buf[0x184]); // Drive mode: 0=Single shot, 1= Continous Hi, 2= Continous Low or Self timer 12s, 3=Self timer 2s // 4= remote, 5= remote 3s delay } pslr_setting_def_t *pslr_find_setting_by_name (pslr_setting_def_t *array, int array_length, char *name) { if (array == NULL || array_length == 0) { return NULL; } int i; for ( i = 0; ivalue != NULL) { bool_setting = (pslr_bool_setting) { PSLR_SETTING_STATUS_HARDWIRED, strcmp("false", def->value) == 0 ? false : true }; } else if (def->address != 0) { uint8_t target = strcmp(def->type, "boolean!") == 0 ? 0 : 1; bool_setting = (pslr_bool_setting) { PSLR_SETTING_STATUS_READ, buf[def->address] == target }; } else { bool_setting = (pslr_bool_setting) { PSLR_SETTING_STATUS_NA, false }; } return bool_setting; } pslr_uint16_setting ipslr_settings_parse_uint16(const uint8_t *buf, const pslr_setting_def_t *def) { pslr_uint16_setting uint16_setting; if (def->value != NULL) { uint16_setting = (pslr_uint16_setting) { PSLR_SETTING_STATUS_HARDWIRED, atoi(def->value) }; } else if (def->address != 0) { uint16_setting = (pslr_uint16_setting) { PSLR_SETTING_STATUS_READ, get_uint16_be(&buf[def->address]) }; } else { uint16_setting = (pslr_uint16_setting) { PSLR_SETTING_STATUS_NA, 0 }; } return uint16_setting; } void ipslr_settings_parser_json(const char *cameraid, ipslr_handle_t *p, pslr_settings *settings) { uint8_t *buf = p->settings_buffer; memset(settings, 0, sizeof (*settings)); int def_num; pslr_setting_def_t *defs = setting_file_process(cameraid,&def_num); int def_index=0; while (def_index < def_num) { pslr_bool_setting bool_setting; pslr_uint16_setting uint16_setting; pslr_setting_def_t def = defs[def_index]; if (strncmp(def.type, "boolean", 7) == 0) { bool_setting = ipslr_settings_parse_bool(buf, &def); } else if (strcmp(def.type, "uint16") == 0) { uint16_setting = ipslr_settings_parse_uint16(buf, &def); } else { pslr_write_log(PSLR_ERROR, "Invalid json type: %s\n", def.type); } if (strcmp(def.name, "bulb_mode_press_press") == 0) { settings->bulb_mode_press_press = bool_setting; } else if (strcmp(def.name, "remote_bulb_mode_press_press") == 0) { settings->remote_bulb_mode_press_press = bool_setting; } else if (strcmp(def.name, "one_push_bracketing") == 0) { settings->one_push_bracketing = bool_setting; } else if (strcmp(def.name, "bulb_timer") == 0) { settings->bulb_timer = bool_setting; } else if (strcmp(def.name, "bulb_timer_sec") == 0) { settings->bulb_timer_sec = uint16_setting; } else if (strcmp(def.name, "using_aperture_ring") == 0) { settings->using_aperture_ring = bool_setting; } else if (strcmp(def.name, "shake_reduction") == 0) { settings->shake_reduction = bool_setting; } else if (strcmp(def.name, "astrotracer") == 0) { settings->astrotracer = bool_setting; } else if (strcmp(def.name, "astrotracer_timer_sec") == 0) { settings->astrotracer_timer_sec = uint16_setting; } else if (strcmp(def.name, "horizon_correction") == 0) { settings->horizon_correction = bool_setting; } ++def_index; } } ipslr_model_info_t camera_models[] = { { 0x12aa2, "*ist DS", true, true, true, false, false, false, 264, 3, {6, 4, 2}, 5, 4000, 200, 3200, 200, 3200, PSLR_JPEG_IMAGE_TONE_BRIGHT, false, 11, ipslr_status_parse_istds}, { 0x12cd2, "K20D", false, true, true, false, false, false, 412, 4, {14, 10, 6, 2}, 7, 4000, 100, 3200, 100, 6400, PSLR_JPEG_IMAGE_TONE_MONOCHROME, true, 11, ipslr_status_parse_k20d}, { 0x12c1e, "K10D", false, true, true, false, false, false, 392, 3, {10, 6, 2}, 7, 4000, 100, 1600, 100, 1600, PSLR_JPEG_IMAGE_TONE_BRIGHT, false, 11, ipslr_status_parse_k10d}, { 0x12c20, "GX10", false, true, true, false, false, false, 392, 3, {10, 6, 2}, 7, 4000, 100, 1600, 100, 1600, PSLR_JPEG_IMAGE_TONE_BRIGHT, false, 11, ipslr_status_parse_k10d}, { 0x12cd4, "GX20", false, true, true, false, false, false, 412, 4, {14, 10, 6, 2}, 7, 4000, 100, 3200, 100, 6400, PSLR_JPEG_IMAGE_TONE_MONOCHROME, true, 11, ipslr_status_parse_k20d}, { 0x12dfe, "K-x", false, true, true, false, false, false, 436, 3, {12, 10, 6, 2}, 9, 6000, 200, 6400, 100, 12800, PSLR_JPEG_IMAGE_TONE_MONOCHROME, true, 11, ipslr_status_parse_kx}, //muted: bug { 0x12cfa, "K200D", false, true, true, false, false, false, 408, 3, {10, 6, 2}, 9, 4000, 100, 1600, 100, 1600, PSLR_JPEG_IMAGE_TONE_MONOCHROME, true, 11, ipslr_status_parse_k200d}, { 0x12db8, "K-7", false, true, true, false, false, false, 436, 4, {14, 10, 6, 2}, 9, 8000, 100, 3200, 100, 6400, PSLR_JPEG_IMAGE_TONE_MUTED, true, 11, ipslr_status_parse_kx}, { 0x12e6c, "K-r", false, true, true, false, false, false, 440, 3, {12, 10, 6, 2}, 9, 6000, 200,12800, 100, 25600, PSLR_JPEG_IMAGE_TONE_BLEACH_BYPASS, true, 11, ipslr_status_parse_kr}, { 0x12e76, "K-5", false, true, true, false, false, false, 444, 4, {16, 10, 6, 2}, 9, 8000, 100,12800, 80, 51200, PSLR_JPEG_IMAGE_TONE_BLEACH_BYPASS, true, 11, ipslr_status_parse_k5}, { 0x12d72, "K-2000", false, true, true, false, false, false, 412, 3, {10, 6, 2}, 9, 4000, 100, 3200, 100, 3200, PSLR_JPEG_IMAGE_TONE_MONOCHROME, true, 11, ipslr_status_parse_km}, { 0x12d73, "K-m", false, true, true, false, false, false, 412, 3, {10, 6, 2}, 9, 4000, 100, 3200, 100, 3200, PSLR_JPEG_IMAGE_TONE_MONOCHROME, true, 11, ipslr_status_parse_km}, { 0x12f52, "K-30", false, true, false, false, false, false, 452, 3, {16, 12, 8, 5}, 9, 6000, 100,12800, 100, 25600, PSLR_JPEG_IMAGE_TONE_BLEACH_BYPASS, true, 11, ipslr_status_parse_k30}, { 0x12ef8, "K-01", false, true, true, false, false, false, 452, 3, {16, 12, 8, 5}, 9, 4000, 100,12800, 100, 25600, PSLR_JPEG_IMAGE_TONE_BLEACH_BYPASS, true, 11, ipslr_status_parse_k01}, { 0x12f70, "K-5II", false, true, true, false, false, false, 444, 4, {16, 10, 6, 2}, 9, 8000, 100, 12800, 80, 51200, PSLR_JPEG_IMAGE_TONE_BLEACH_BYPASS, true, 11, ipslr_status_parse_k5}, { 0x12f71, "K-5IIs", false, true, true, false, false, false, 444, 4, {16, 10, 6, 2}, 9, 8000, 100, 12800, 80, 51200, PSLR_JPEG_IMAGE_TONE_BLEACH_BYPASS, true, 11, ipslr_status_parse_k5}, { 0x12fb6, "K-50", false, true, true, false, false, false, 452, 4, {16, 12, 8, 5}, 9, 6000, 100, 51200, 100, 51200, PSLR_JPEG_IMAGE_TONE_BLEACH_BYPASS, true, 11, ipslr_status_parse_k50}, { 0x12fc0, "K-3", false, true, true, false, false, true, 452, 4, {24, 14, 6, 2}, 9, 8000, 100, 51200, 100, 51200, PSLR_JPEG_IMAGE_TONE_BLEACH_BYPASS, true, 27, ipslr_status_parse_k3}, { 0x1309c, "K-3II", false, false, true, true, false, true, 452, 4, {24, 14, 6, 2}, 9, 8000, 100, 51200, 100, 51200, PSLR_JPEG_IMAGE_TONE_BLEACH_BYPASS, true, 27, ipslr_status_parse_k3}, { 0x12fca, "K-500", false, true, true, false, false, false, 452, 3, {16, 12, 8, 5}, 9, 6000, 100, 51200, 100, 51200, PSLR_JPEG_IMAGE_TONE_CROSS_PROCESSING, true, 11, ipslr_status_parse_k500}, // only limited support from here { 0x12994, "*ist D", true, true, true, false, false, false, 0, 3, {6, 4, 2}, 3, 4000, 200, 3200, 200, 3200, PSLR_JPEG_IMAGE_TONE_NONE, false, 11, NULL}, // buffersize: 264 { 0x12b60, "*ist DS2", true, true, true, false, false, false, 0, 3, {6, 4, 2}, 5, 4000, 200, 3200, 200, 3200, PSLR_JPEG_IMAGE_TONE_BRIGHT, false, 11, NULL}, { 0x12b1a, "*ist DL", true, true, true, false, false, false, 0, 3, {6, 4, 2}, 5, 4000, 200, 3200, 200, 3200, PSLR_JPEG_IMAGE_TONE_BRIGHT, false, 11, NULL}, { 0x12b80, "GX-1L", true, true, true, false, false, false, 0, 3, {6, 4, 2}, 5, 4000, 200, 3200, 200, 3200, PSLR_JPEG_IMAGE_TONE_BRIGHT, false, 11, NULL}, { 0x12b9d, "K110D", false, true, true, false, false, false, 0, 3, {6, 4, 2}, 5, 4000, 200, 3200, 200, 3200, PSLR_JPEG_IMAGE_TONE_BRIGHT, false, 11, NULL}, { 0x12b9c, "K100D", true, true, true, false, false, false, 0, 3, {6, 4, 2}, 5, 4000, 200, 3200, 200, 3200, PSLR_JPEG_IMAGE_TONE_BRIGHT, false, 11, NULL}, { 0x12ba2, "K100D Super", true, true, true, false, false, false, 0, 3, {6, 4, 2}, 5, 4000, 200, 3200, 200, 3200, PSLR_JPEG_IMAGE_TONE_BRIGHT, false, 11, NULL}, { 0x1301a, "K-S1", false, true, true, false, false, true, 452, 3, {20, 12, 6, 2}, 9, 6000, 100, 51200, 100, 51200, PSLR_JPEG_IMAGE_TONE_CROSS_PROCESSING, true, 11, ipslr_status_parse_ks1}, { 0x13024, "K-S2", false, true, true, false, false, true, 452, 3, {20, 12, 6, 2}, 9, 6000, 100, 51200, 100, 51200, PSLR_JPEG_IMAGE_TONE_CROSS_PROCESSING, true, 11, ipslr_status_parse_k3}, { 0x13092, "K-1", false, false, true, true, false, true, 456, 3, {36, 22, 12, 2}, 9, 8000, 100, 204800, 100, 204800, PSLR_JPEG_IMAGE_TONE_FLAT, true, 33, ipslr_status_parse_k1 }, { 0x13240, "K-1 II", false, false, true, true, false, true, 456, 3, {36, 22, 12, 2}, 9, 8000, 100, 819200, 100, 819200, PSLR_JPEG_IMAGE_TONE_FLAT, true, 33, ipslr_status_parse_k1 }, { 0x13222, "K-70", false, false, true, true, true, true, 456, 3, {24, 14, 6, 2}, 9, 6000, 100, 102400, 100, 102400, PSLR_JPEG_IMAGE_TONE_AUTO, true, 11, ipslr_status_parse_k70}, { 0x1322c, "KP", false, false, true, true, false, true, 456, 3, {24, 14, 6, 2}, 9, 6000, 100, 819200, 100, 819200, PSLR_JPEG_IMAGE_TONE_AUTO, true, 27, ipslr_status_parse_k70}, { 0x13010, "645Z", false, false, true, true, false, false, 0, 3, {51, 32, 21, 3}, 9, 4000, 100, 204800, 100, 204800, PSLR_JPEG_IMAGE_TONE_CROSS_PROCESSING, true, 35, NULL} }; ipslr_model_info_t *pslr_find_model_by_id( uint32_t id ) { unsigned int i; for ( i = 0; i Remote control of Pentax DSLR cameras. based on: PK-Remote Remote control of Pentax DSLR cameras. Copyright (C) 2008 Pontus Lidman Pentax lens database comes from ExifTool ( http://www.sno.phy.queensu.ca/~phil/exiftool/ ) This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU General Public License and GNU Lesser General Public License along with this program. If not, see . */ #ifndef PSLR_LENS_H #define PSLR_LENS_H #include const char *pslr_get_lens_name( uint32_t id1, uint32_t id2); #endif libpktriggercord-0.85.1/src/pslr_utils.h0000644000175100017510000000265214136175550017546 0ustar debiandebian/* pkTriggerCord Copyright (C) 2011-2020 Andras Salamon Remote control of Pentax DSLR cameras. based on: PK-Remote Remote control of Pentax DSLR cameras. Copyright (C) 2008 Pontus Lidman PK-Remote for Windows Copyright (C) 2010 Tomasz Kos This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU General Public License and GNU Lesser General Public License along with this program. If not, see . */ #ifndef PKTRIGGERCORD_COMMON_H #define PKTRIGGERCORD_COMMON_H #ifdef RAD10 #include #else #include #endif #include #include #include "pslr_model.h" double timeval_diff_sec(struct timeval *t2, struct timeval *t1); void sleep_sec(double sec); pslr_rational_t parse_shutter_speed(char *shutter_speed_str); pslr_rational_t parse_aperture(char *aperture_str); #endiflibpktriggercord-0.85.1/src/pentax_settings.json0000644000175100017510000001267314136175550021313 0ustar debiandebian{ "0x13222": { "fields": [ { "name": "bulb_mode_press_press", "type": "boolean", "address": "0x178" }, { "name": "one_push_bracketing", "type": "boolean", "address": "0x17e" }, { "name": "bulb_timer", "type": "boolean", "address": "0x133" }, { "name": "bulb_timer_sec", "type": "uint16", "address": "0x134" }, { "name": "using_aperture_ring", "type": "boolean", "address": "0x18c" }, { "name": "shake_reduction", "type": "boolean!", "address": "0x07d" }, { "name": "astrotracer", "type": "boolean", "address": "0x087" }, { "name": "horizon_correction", "type": "boolean!", "address": "0x080" } ] }, "0x12dfe": { "fields": [ { "name": "bulb_mode_press_press", "type": "boolean", "value": "false" }, { "name": "remote_bulb_mode_press_press", "type": "boolean!", "address": "0x132" }, { "name": "one_push_bracketing", "type": "boolean", "value": "false" }, { "name": "bulb_timer", "type": "boolean", "value": "false" }, { "name": "bulb_timer_sec", "type": "uint16", "value": 0 }, { "name": "using_aperture_ring", "type": "boolean", "address": "0x142" }, { "name": "shake_reduction", "type": "boolean!", "address": "0x065" }, { "name": "astrotracer", "type": "boolean", "value": "false" }, { "name": "astrotracer_timer_sec", "type": "uint16", "value": "0" }, { "name": "horizon_correction", "type": "boolean", "value": "false" } ] }, "0x12f70": { "fields": [ { "name": "bulb_mode_press_press", "type": "boolean", "value": "false" }, { "name": "remote_bulb_mode_press_press", "type": "boolean!", "address": "0x0db" }, { "name": "one_push_bracketing", "type": "boolean", "address": "0x0d1" }, { "name": "bulb_timer", "type": "boolean", "value": "false" }, { "name": "bulb_timer_sec", "type": "uint16", "value": 0 }, { "name": "using_aperture_ring", "type": "boolean", "address": "0x0e3" }, { "name": "shake_reduction", "type": "boolean!", "address": "0x092" }, { "name": "astrotracer", "type": "boolean", "address": "0x0be" }, { "name": "astrotracer_timer_sec", "type": "uint16", "address": "0x0bf" }, { "name": "horizon_correction", "type": "boolean!", "address": "0x091" } ] }, "0x12fb6": { "fields": [ { "name": "bulb_mode_press_press", "type": "boolean", "address": "0x0f2" } ] }, "0x12ef8": { "fields": [ { "name": "bulb_mode_press_press", "type": "boolean", "address": "0x0f2" } ] }, "0x13092": { "fields": [ { "name": "bulb_timer", "type": "boolean", "address": "0x131" }, { "name": "bulb_timer_sec", "type": "uint16", "address": "0x132" } ] }, "0x1309c": { "fields": [ { "name": "astrotracer", "type": "boolean", "address": "0x1ac" }, { "name": "astrotracer_timer_sec", "type": "uint16", "address": "0x1ad" } ] }, "0x13240": { "fields": [ { "name": "bulb_timer", "type": "boolean", "address": "0x131" }, { "name": "bulb_timer_sec", "type": "uint16", "address": "0x132" } ] } } libpktriggercord-0.85.1/src/samsung.rules0000644000175100017510000000072614136175550017726 0ustar debiandebianACTION!="add", GOTO="samsung_rules_end" SUBSYSTEM=="scsi_generic", GOTO="samsung_rules_start" SUBSYSTEM!="scsi_generic", GOTO="samsung_rules_end" LABEL="samsung_rules_start" # WAIT_FOR_SYSFS="device/vendor" ATTRS{vendor}=="SAMSUNG", ATTRS{model}=="DIGITAL_CAMERA", MODE="0666", GROUP="users" ATTRS{vendor}=="SAMSUNG", ATTRS{model}=="DSC*", MODE="0666", GROUP="users" ATTRS{vendor}=="SAMSUNG", ATTRS{model}=="K*", MODE="0666", GROUP="users" LABEL="samsung_rules_end" libpktriggercord-0.85.1/src/pslr_utils.c0000644000175100017510000000537414136175550017545 0ustar debiandebian/* pkTriggerCord Remote control of Pentax DSLR cameras. Copyright (C) 2011-2020 Andras Salamon based on: pslr-shoot Command line remote control of Pentax DSLR cameras. Copyright (C) 2009 Ramiro Barreiro With fragments of code from PK-Remote by Pontus Lidman. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU General Public License and GNU Lesser General Public License along with this program. If not, see . */ #ifdef RAD10 #include #include #include "tdbtimes.h" #else #include #include #endif #include "pslr.h" #include "pslr_utils.h" double timeval_diff_sec(struct timeval *t2, struct timeval *t1) { //DPRINT("tv2 %ld %ld t1 %ld %ld\n", t2->tv_sec, t2->tv_usec, t1->tv_sec, t1->tv_usec); return (t2->tv_usec - t1->tv_usec) / 1000000.0 + (t2->tv_sec - t1->tv_sec); } void sleep_sec(double sec) { int i; for (i=0; i 100, even for a pinhole. On the other hand, the fastest lens I know of is a f:0.8 Zeiss*/ if (F > 100 || F < 0.8) { F = 0; } aperture.nom = F * 10; aperture.denom = 10; return aperture; } pslr_rational_t parse_shutter_speed(char *shutter_speed_str) { char C; float F = 0; pslr_rational_t shutter_speed = {0, 0}; if (sscanf(shutter_speed_str, "%d/%d%c", &shutter_speed.nom, &shutter_speed.denom, &C) == 2) { // noop } else if ((sscanf(shutter_speed_str, "%d%c", &shutter_speed.nom, &C)) == 1) { shutter_speed.denom = 1; } else if ((sscanf(shutter_speed_str, "%f%c", &F, &C)) == 1) { F = F * 1000; shutter_speed.denom = 1000; shutter_speed.nom = F; } else { shutter_speed.nom = 0; shutter_speed.denom = 0; } return shutter_speed; } libpktriggercord-0.85.1/src/pslr_scsi.h0000644000175100017510000000510314136175550017341 0ustar debiandebian/* pkTriggerCord Copyright (C) 2011-2019 Andras Salamon Remote control of Pentax DSLR cameras. based on: PK-Remote Remote control of Pentax DSLR cameras. Copyright (C) 2008 Pontus Lidman This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU General Public License and GNU Lesser General Public License along with this program. If not, see . */ #ifndef PSLR_SCSI_H #define PSLR_SCSI_H #include #include #include #include #ifdef RAD10 #include #endif #define CHECK(x) do { \ int __r; \ __r = (x); \ if (__r != PSLR_OK) { \ pslr_write_log(PSLR_ERROR, "%s:%d:%s failed: %d\n", __FILE__, __LINE__, #x, __r); \ return __r; \ } \ } while (0) typedef enum { PSLR_OK = 0, PSLR_DEVICE_ERROR, PSLR_SCSI_ERROR, PSLR_COMMAND_ERROR, PSLR_READ_ERROR, PSLR_NO_MEMORY, PSLR_PARAM, /* Invalid parameters to API */ PSLR_ERROR_MAX } pslr_result; /* This also could be used to specify FDTYPE HANDLE for Win32, but this seems tricky with includes */ #ifdef LIBGPHOTO2 typedef struct _GPPort GPPort; #define FDTYPE GPPort* #else /* classic UNIX style handle */ #define FDTYPE int #endif int scsi_read(FDTYPE sg_fd, uint8_t *cmd, uint32_t cmdLen, uint8_t *buf, uint32_t bufLen); int scsi_write(FDTYPE sg_fd, uint8_t *cmd, uint32_t cmdLen, uint8_t *buf, uint32_t bufLen); char **get_drives(int *drive_num); pslr_result get_drive_info(char* drive_name, FDTYPE* device, char* vendor_id, int vendor_id_size_max, char* product_id, int product_id_size_max); void close_drive(FDTYPE *device); #endif libpktriggercord-0.85.1/src/pktriggercord-servermode.c0000644000175100017510000003776714136175550022377 0ustar debiandebian/* pkTriggerCord Remote control of Pentax DSLR cameras. Copyright (C) 2011-2019 Andras Salamon based on: pslr-shoot Command line remote control of Pentax DSLR cameras. Copyright (C) 2009 Ramiro Barreiro With fragments of code from PK-Remote by Pontus Lidman. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU General Public License and GNU Lesser General Public License along with this program. If not, see . */ #ifdef RAD10 #include #include #include "tdbtimes.h" #else #include #include #endif #ifndef WIN32 #include #include #include #endif #include #include #include "pslr_log.h" #include "pslr.h" #include "pslr_lens.h" #include "pslr_utils.h" #include "pktriggercord-servermode.h" void pslr_camera_close(pslr_handle_t camhandle) { pslr_disconnect(camhandle); pslr_shutdown(camhandle); } pslr_handle_t pslr_camera_connect( char *model, char *device, int timeout, char *error_message ) { struct timeval prev_time; struct timeval current_time; pslr_handle_t camhandle; int r; gettimeofday(&prev_time, NULL); while (!(camhandle = pslr_init( model, device ))) { gettimeofday(¤t_time, NULL); DPRINT("diff: %f\n", timeval_diff_sec(¤t_time, &prev_time)); if ( timeout == 0 || timeout > timeval_diff_sec(¤t_time, &prev_time)) { DPRINT("sleep 1 sec\n"); sleep_sec(1); } else { snprintf(error_message, 1000, "%d %ds timeout exceeded\n", 1, timeout); return NULL; } } DPRINT("before connect\n"); if (camhandle) { if ((r=pslr_connect(camhandle)) ) { if ( r != -1 ) { snprintf(error_message, 1000, "%d Cannot connect to Pentax camera. Please start the program as root.\n",1); } else { snprintf(error_message, 1000, "%d Unknown Pentax camera found.\n",1); } return NULL; } } return camhandle; } #ifndef WIN32 int client_sock; void write_socket_answer( char *answer ) { ssize_t r = write(client_sock, answer, strlen(answer)); if (r < 0 || (size_t)r != strlen(answer)) { fprintf(stderr, "write(answer) failed"); } } void write_socket_answer_bin( uint8_t *answer, uint32_t length ) { ssize_t r = write(client_sock, answer, length); if (r < 0 || (size_t)r != length) { fprintf(stderr, "write(answer) failed"); } } char *is_string_prefix(char *str, char *prefix) { if ( !strncmp(str, prefix, strlen(prefix) ) ) { if ( strlen(str) <= strlen(prefix)+1 ) { return str; } else { return str+strlen(prefix)+1; } } else { return NULL; } } bool check_camera(pslr_handle_t camhandle) { if ( !camhandle ) { write_socket_answer("1 No camera connected\n"); return false; } else { return true; } } void strip(char *s) { char *p2 = s; while (*s != '\0') { if (*s != '\r' && *s != '\n') { *p2++ = *s++; } else { ++s; } } *p2 = '\0'; } int servermode_socket(int servermode_timeout) { int socket_desc, c, read_size; struct sockaddr_in server, client; char client_message[2000]; char *arg; char buf[2100]; pslr_handle_t camhandle=NULL; pslr_status status; pslr_buffer_type buffer_type=PSLR_BUF_DNG; char C; pslr_rational_t shutter_speed = {0, 0}; pslr_rational_t aperture = {0, 0}; uint32_t iso = 0; uint32_t auto_iso_min = 0; uint32_t auto_iso_max = 0; //Create socket socket_desc = socket(AF_INET, SOCK_STREAM, 0); if (socket_desc == -1) { pslr_write_log(PSLR_ERROR, "Could not create socket"); } int enable = 1; if (setsockopt(socket_desc, SOL_SOCKET, SO_REUSEADDR, &enable, sizeof(int)) < 0) { pslr_write_log(PSLR_ERROR, "setsockopt(SO_REUSEADDR) failed"); } DPRINT("Socket created\n"); //Prepare the sockaddr_in structure server.sin_family = AF_INET; server.sin_addr.s_addr = INADDR_ANY; server.sin_port = htons( 8888 ); //Bind if ( bind(socket_desc,(struct sockaddr *)&server, sizeof(server)) < 0) { pslr_write_log(PSLR_ERROR, "bind failed. Error"); return 1; } DPRINT("bind done\n"); //Listen listen(socket_desc, 3); //Accept and incoming connection DPRINT("Waiting for incoming connections...\n"); c = sizeof(struct sockaddr_in); while ( true ) { fd_set rfds; struct timeval tv; int retval; FD_ZERO(&rfds); FD_SET(socket_desc, &rfds); tv.tv_sec = servermode_timeout; tv.tv_usec = 0; retval = select(socket_desc+1, &rfds, NULL, NULL, &tv); if (retval == -1) { DPRINT("select error\n"); exit(1); } else if (retval) { client_sock = accept(socket_desc, (struct sockaddr *)&client, (socklen_t*)&c); if (client_sock < 0) { pslr_write_log(PSLR_ERROR, "accept failed"); return 1; } DPRINT("Connection accepted\n"); } else { DPRINT("Timeout\n"); close(socket_desc); exit(0); } //Receive a message from client while ( (read_size = recv(client_sock, client_message, 2000, 0)) > 0 ) { client_message[read_size]='\0'; strip( client_message ); DPRINT(":%s:\n",client_message); if ( !strcmp(client_message, "stopserver" ) ) { if ( camhandle ) { pslr_camera_close(camhandle); } write_socket_answer("0\n"); exit(0); } else if ( !strcmp(client_message, "disconnect" ) ) { if ( camhandle ) { pslr_camera_close(camhandle); } write_socket_answer("0\n"); } else if ( (arg = is_string_prefix( client_message, "echo")) != NULL ) { sprintf( buf, "0 %.100s\n", arg); write_socket_answer(buf); } else if ( (arg = is_string_prefix( client_message, "usleep")) != NULL ) { int microseconds = atoi(arg); usleep(microseconds); write_socket_answer("0\n"); } else if ( !strcmp(client_message, "connect") ) { if ( camhandle ) { write_socket_answer("0\n"); } else if ( (camhandle = pslr_camera_connect( NULL, NULL, -1, buf )) ) { write_socket_answer("0\n"); } else { write_socket_answer(buf); } } else if ( !strcmp(client_message, "update_status") ) { if ( check_camera(camhandle) ) { if ( !pslr_get_status(camhandle, &status) ) { sprintf( buf, "%d\n", 0); } else { sprintf( buf, "%d\n", 1); } write_socket_answer(buf); } } else if ( !strcmp(client_message, "get_camera_name") ) { if ( check_camera(camhandle) ) { sprintf(buf, "%d %s\n", 0, pslr_get_camera_name(camhandle)); write_socket_answer(buf); } } else if ( !strcmp(client_message, "pslr_get_lens_name") ) { if ( check_camera(camhandle) ) { sprintf(buf, "%d %s\n", 0, pslr_get_lens_name(status.lens_id1, status.lens_id2)); write_socket_answer(buf); } } else if ( !strcmp(client_message, "get_current_shutter_speed") ) { if ( check_camera(camhandle) ) { sprintf(buf, "%d %d/%d\n", 0, status.current_shutter_speed.nom, status.current_shutter_speed.denom); write_socket_answer(buf); } } else if ( !strcmp(client_message, "get_current_aperture") ) { if ( check_camera(camhandle) ) { sprintf(buf, "%d %s\n", 0, pslr_format_rational( status.current_aperture, "%.1f")); write_socket_answer(buf); } } else if ( !strcmp(client_message, "get_current_iso") ) { if ( check_camera(camhandle) ) { sprintf(buf, "%d %d\n", 0, status.current_iso); write_socket_answer(buf); } } else if ( !strcmp(client_message, "get_bufmask") ) { if ( check_camera(camhandle) ) { sprintf(buf, "%d %d\n", 0, status.bufmask); write_socket_answer(buf); } } else if ( !strcmp(client_message, "get_auto_bracket_mode") ) { if ( check_camera(camhandle) ) { sprintf(buf, "%d %d\n", 0, status.auto_bracket_mode); write_socket_answer(buf); } } else if ( !strcmp(client_message, "get_auto_bracket_picture_count") ) { if ( check_camera(camhandle) ) { sprintf(buf, "%d %d\n", 0, status.auto_bracket_picture_count); write_socket_answer(buf); } } else if ( !strcmp(client_message, "focus") ) { if ( check_camera(camhandle) ) { pslr_focus(camhandle); sprintf(buf, "%d\n", 0); write_socket_answer(buf); } } else if ( !strcmp(client_message, "shutter") ) { if ( check_camera(camhandle) ) { pslr_shutter(camhandle); sprintf(buf, "%d\n", 0); write_socket_answer(buf); } } else if ( (arg = is_string_prefix( client_message, "delete_buffer")) != NULL ) { int bufno = atoi(arg); if ( check_camera(camhandle) ) { pslr_delete_buffer(camhandle,bufno); sprintf(buf, "%d\n", 0); write_socket_answer(buf); } } else if ( (arg = is_string_prefix( client_message, "get_preview_buffer")) != NULL ) { int bufno = atoi(arg); if ( check_camera(camhandle) ) { uint8_t *pImage; uint32_t imageSize; if ( pslr_get_buffer(camhandle, bufno, PSLR_BUF_PREVIEW, 4, &pImage, &imageSize) ) { sprintf(buf, "%d %d\n", 1, imageSize); write_socket_answer(buf); } else { sprintf(buf, "%d %d\n", 0, imageSize); write_socket_answer(buf); write_socket_answer_bin(pImage, imageSize); } } } else if ( (arg = is_string_prefix( client_message, "get_buffer_type")) != NULL ) { if ( buffer_type == PSLR_BUF_PEF ) { sprintf(buf,"0 PEF\n"); } else if ( buffer_type == PSLR_BUF_DNG ) { sprintf(buf,"0 DNG\n"); } else { sprintf(buf,"1 Invalid buffer type.\n"); } write_socket_answer(buf); } else if ( (arg = is_string_prefix( client_message, "get_buffer")) != NULL ) { int bufno = atoi(arg); if ( check_camera(camhandle) ) { uint32_t imageSize; if ( pslr_buffer_open(camhandle, bufno, buffer_type, 0) ) { sprintf(buf, "%d\n", 1); write_socket_answer(buf); } else { imageSize = pslr_buffer_get_size(camhandle); sprintf(buf, "%d %d\n", 0, imageSize); write_socket_answer(buf); uint32_t current = 0; while (1) { uint32_t bytes; uint8_t buf[65536]; bytes = pslr_buffer_read(camhandle, buf, sizeof (buf)); if (bytes == 0) { break; } write_socket_answer_bin( buf, bytes); current += bytes; } pslr_buffer_close(camhandle); } } } else if ( (arg = is_string_prefix( client_message, "set_buffer_type")) != NULL ) { if ( !strcmp(arg, "PEF") ) { buffer_type = PSLR_BUF_PEF; sprintf(buf,"0 PEF\n"); } else if ( !strcmp(arg, "DNG") ) { buffer_type = PSLR_BUF_DNG; sprintf(buf,"0 DNG\n"); } else { sprintf(buf,"1 Invalid buffer type (must be PEF or DNG).\n"); } write_socket_answer(buf); } else if ( (arg = is_string_prefix( client_message, "set_shutter_speed")) != NULL ) { if ( check_camera(camhandle) ) { shutter_speed = parse_shutter_speed(arg); if (shutter_speed.nom == 0) { sprintf(buf,"1 Invalid shutter speed value.\n"); } else { sprintf(buf, "%d %d %d\n", 0, shutter_speed.nom, shutter_speed.denom); pslr_set_shutter(camhandle, shutter_speed); } write_socket_answer(buf); } } else if ( (arg = is_string_prefix( client_message, "set_aperture")) != NULL ) { if ( check_camera(camhandle) ) { aperture = parse_aperture(arg); if (aperture.nom == 0) { sprintf(buf,"1 Invalid aperture value.\n"); } else { pslr_set_aperture(camhandle, aperture); sprintf(buf, "%d %.1f\n", 0, aperture.nom / 10.0); } write_socket_answer(buf); } } else if ( (arg = is_string_prefix( client_message, "set_iso")) != NULL ) { if ( check_camera(camhandle) ) { // TODO: merge with pktriggercord-cli shutter iso if (sscanf(arg, "%d-%d%c", &auto_iso_min, &auto_iso_max, &C) != 2) { auto_iso_min = 0; auto_iso_max = 0; iso = atoi(arg); } else { iso = 0; } if (iso==0 && auto_iso_min==0) { sprintf(buf,"1 Invalid iso value.\n"); } else { pslr_set_iso(camhandle, iso, auto_iso_min, auto_iso_max); sprintf(buf, "%d %d %d-%d\n", 0, iso, auto_iso_min, auto_iso_max); } write_socket_answer(buf); } } else { write_socket_answer("1 Invalid servermode command\n"); } } if (read_size == 0) { DPRINT("Client disconnected\n"); fflush(stdout); } else if (read_size == -1) { pslr_write_log(PSLR_ERROR, "recv failed\n"); } } return 0; } #endif libpktriggercord-0.85.1/src/pslr.h0000644000175100017510000002135414136175550016326 0ustar debiandebian/* pkTriggerCord Copyright (C) 2011-2019 Andras Salamon Remote control of Pentax DSLR cameras. Support for K200D added by Jens Dreyer 04/2011 Support for K-r added by Vincenc Podobnik 06/2011 Support for K-30 added by Camilo Polymeris 09/2012 Support for K-01 added by Ethan Queen 01/2013 Support for K-3 added by Tao Wang 01/2016 based on: PK-Remote Remote control of Pentax DSLR cameras. Copyright (C) 2008 Pontus Lidman PK-Remote for Windows Copyright (C) 2010 Tomasz Kos This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU General Public License and GNU Lesser General Public License along with this program. If not, see . */ #ifndef PSLR_H #define PSLR_H #include "pslr_enum.h" #include "pslr_scsi.h" #include "pslr_model.h" #define PSLR_LIGHT_METER_AE_LOCK 0x8 typedef enum { PSLR_BUF_PEF, PSLR_BUF_DNG, PSLR_BUF_JPEG_MAX, PSLR_BUF_JPEG_MAX_M1, PSLR_BUF_JPEG_MAX_M2, PSLR_BUF_JPEG_MAX_M3, PSLR_BUF_PREVIEW = 8, PSLR_BUF_THUMBNAIL = 9 // 7 works also } pslr_buffer_type; typedef enum { USER_FILE_FORMAT_PEF, USER_FILE_FORMAT_DNG, USER_FILE_FORMAT_JPEG, USER_FILE_FORMAT_MAX } user_file_format; typedef struct { user_file_format uff; const char *file_format_name; const char *extension; } user_file_format_t; extern user_file_format_t pslr_user_file_formats[3]; user_file_format_t *pslr_get_user_file_format_t( user_file_format uff ); // OFF-AUTO: Off-Auto-Aperture typedef enum { PSLR_EXPOSURE_MODE_P = 0, PSLR_EXPOSURE_MODE_GREEN = 1, // PSLR_EXPOSURE_MODE_HYP = 2, // PSLR_EXPOSURE_MODE_AUTO_PICT = 1, // PSLR_EXPOSURE_MODE_GREEN = 3, maybe 1 is AUTO_PICT PSLR_EXPOSURE_MODE_TV = 4, PSLR_EXPOSURE_MODE_AV = 5, // PSLR_EXPOSURE_MODE_TV_SHIFT = 6, //? // PSLR_EXPOSURE_MODE_AV_SHIFT = 7, //? PSLR_EXPOSURE_MODE_M = 8, PSLR_EXPOSURE_MODE_B = 9, PSLR_EXPOSURE_MODE_AV_OFFAUTO = 10, PSLR_EXPOSURE_MODE_M_OFFAUTO = 11, PSLR_EXPOSURE_MODE_B_OFFAUTO = 12, PSLR_EXPOSURE_MODE_TAV = 13, // ? PSLR_EXPOSURE_MODE_SV = 15, PSLR_EXPOSURE_MODE_X = 16, // ? PSLR_EXPOSURE_MODE_MAX = 17 } pslr_exposure_mode_t; typedef enum { PSLR_GUI_EXPOSURE_MODE_GREEN, PSLR_GUI_EXPOSURE_MODE_P, PSLR_GUI_EXPOSURE_MODE_SV, PSLR_GUI_EXPOSURE_MODE_TV, PSLR_GUI_EXPOSURE_MODE_AV, PSLR_GUI_EXPOSURE_MODE_TAV, PSLR_GUI_EXPOSURE_MODE_M, PSLR_GUI_EXPOSURE_MODE_B, PSLR_GUI_EXPOSURE_MODE_X, PSLR_GUI_EXPOSURE_MODE_MAX } pslr_gui_exposure_mode_t; typedef void *pslr_handle_t; typedef struct { uint32_t a; uint32_t b; uint32_t addr; uint32_t length; } pslr_buffer_segment_info; typedef void (*pslr_progress_callback_t)(uint32_t current, uint32_t total); pslr_handle_t pslr_init(char *model, char *device); int pslr_connect(pslr_handle_t h); int pslr_disconnect(pslr_handle_t h); int pslr_shutdown(pslr_handle_t h); const char *pslr_model(uint32_t id); int pslr_shutter(pslr_handle_t h); int pslr_focus(pslr_handle_t h); int pslr_get_status(pslr_handle_t h, pslr_status *sbuf); int pslr_get_status_buffer(pslr_handle_t h, uint8_t *st_buf); int pslr_get_settings_json(pslr_handle_t h, pslr_settings *ps); int pslr_get_settings_buffer(pslr_handle_t h, uint8_t *st_buf); char *pslr_get_status_info( pslr_handle_t h, pslr_status status ); char *pslr_get_settings_info( pslr_handle_t h, pslr_settings settings ); int pslr_get_buffer(pslr_handle_t h, int bufno, pslr_buffer_type type, int resolution, uint8_t **pdata, uint32_t *pdatalen); int pslr_set_progress_callback(pslr_handle_t h, pslr_progress_callback_t cb, uintptr_t user_data); int pslr_set_shutter(pslr_handle_t h, pslr_rational_t value); int pslr_set_aperture(pslr_handle_t h, pslr_rational_t value); int pslr_set_iso(pslr_handle_t h, uint32_t value, uint32_t auto_min_value, uint32_t auto_max_value); int pslr_set_expose_compensation(pslr_handle_t h, pslr_rational_t value); int pslr_set_white_balance(pslr_handle_t h, pslr_white_balance_mode_t wb_mode); int pslr_set_white_balance_adjustment(pslr_handle_t h, pslr_white_balance_mode_t wb_mode, uint32_t wbadj_mg, uint32_t wbadj_ba); int pslr_set_flash_mode(pslr_handle_t h, pslr_flash_mode_t value); int pslr_set_flash_exposure_compensation(pslr_handle_t h, pslr_rational_t value); int pslr_set_drive_mode(pslr_handle_t h, pslr_drive_mode_t drive_mode); int pslr_set_af_mode(pslr_handle_t h, pslr_af_mode_t af_mode); int pslr_set_af_point_sel(pslr_handle_t h, pslr_af_point_sel_t af_point_sel); int pslr_set_ae_metering_mode(pslr_handle_t h, pslr_ae_metering_t ae_metering_mode); int pslr_set_color_space(pslr_handle_t h, pslr_color_space_t color_space); int pslr_set_jpeg_stars(pslr_handle_t h, int jpeg_stars); int pslr_set_jpeg_resolution(pslr_handle_t h, int megapixel); int pslr_set_jpeg_image_tone(pslr_handle_t h, pslr_jpeg_image_tone_t image_mode); int pslr_set_jpeg_sharpness(pslr_handle_t h, int32_t sharpness); int pslr_set_jpeg_contrast(pslr_handle_t h, int32_t contrast); int pslr_set_jpeg_saturation(pslr_handle_t h, int32_t saturation); int pslr_set_jpeg_hue(pslr_handle_t h, int32_t hue); int pslr_set_image_format(pslr_handle_t h, pslr_image_format_t format); int pslr_set_raw_format(pslr_handle_t h, pslr_raw_format_t format); int pslr_set_user_file_format(pslr_handle_t h, user_file_format uff); user_file_format pslr_get_user_file_format( pslr_status *st ); int pslr_delete_buffer(pslr_handle_t h, int bufno); int pslr_green_button(pslr_handle_t h); int pslr_button_test(pslr_handle_t h, int bno, int arg); int pslr_ae_lock(pslr_handle_t h, bool lock); int pslr_dust_removal(pslr_handle_t h); int pslr_bulb(pslr_handle_t h, bool on ); int pslr_buffer_open(pslr_handle_t h, int bufno, pslr_buffer_type type, int resolution); uint32_t pslr_buffer_read(pslr_handle_t h, uint8_t *buf, uint32_t size); uint32_t pslr_fullmemory_read(pslr_handle_t h, uint8_t *buf, uint32_t offset, uint32_t size); void pslr_buffer_close(pslr_handle_t h); uint32_t pslr_buffer_get_size(pslr_handle_t h); int pslr_set_exposure_mode(pslr_handle_t h, pslr_exposure_mode_t mode); int pslr_set_selected_af_point(pslr_handle_t h, uint32_t point); const char *pslr_get_camera_name(pslr_handle_t h); int pslr_get_model_max_jpeg_stars(pslr_handle_t h); int pslr_get_model_jpeg_property_levels(pslr_handle_t h); int pslr_get_model_status_buffer_size(pslr_handle_t h); int pslr_get_model_fastest_shutter_speed(pslr_handle_t h); int pslr_get_model_base_iso_min(pslr_handle_t h); int pslr_get_model_base_iso_max(pslr_handle_t h); int pslr_get_model_extended_iso_min(pslr_handle_t h); int pslr_get_model_extended_iso_max(pslr_handle_t h); int *pslr_get_model_jpeg_resolutions(pslr_handle_t h); bool pslr_get_model_only_limited(pslr_handle_t h); bool pslr_get_model_has_jpeg_hue(pslr_handle_t h); bool pslr_get_model_need_exposure_conversion(pslr_handle_t h); pslr_jpeg_image_tone_t pslr_get_model_max_supported_image_tone(pslr_handle_t h); bool pslr_get_model_has_settings_parser(pslr_handle_t h); int pslr_get_model_af_point_num(pslr_handle_t h); bool pslr_get_model_old_bulb_mode(pslr_handle_t h); bool pslr_get_model_bufmask_single(pslr_handle_t h); pslr_buffer_type pslr_get_jpeg_buffer_type(pslr_handle_t h, int quality); int pslr_get_jpeg_resolution(pslr_handle_t h, int hwres); int pslr_get_datetime(pslr_handle_t *h, int *year, int *month, int *day, int *hour, int *min, int *sec); int pslr_get_dspinfo(pslr_handle_t *h, char *firmware); int pslr_get_setting(pslr_handle_t *h, int offset, uint32_t *value); int pslr_set_setting(pslr_handle_t *h, int offset, uint32_t value); int pslr_set_setting_by_name(pslr_handle_t *h, char *name, uint32_t value); bool pslr_has_setting_by_name(pslr_handle_t *h, char *name); int pslr_get_settings(pslr_handle_t *h); pslr_gui_exposure_mode_t exposure_mode_conversion( pslr_exposure_mode_t exp ); char *pslr_format_rational( pslr_rational_t rational, char * fmt ); int pslr_test( pslr_handle_t h, bool cmd9_wrap, int subcommand, int argnum, int arg1, int arg2, int arg3, int arg4); char *pslr_copyright(void); int pslr_set_debugmode(ipslr_handle_t *p, char debug_mode); #endif libpktriggercord-0.85.1/src/pslr.c0000644000175100017510000017614314136175550016330 0ustar debiandebian/* pkTriggerCord Copyright (C) 2011-2019 Andras Salamon Remote control of Pentax DSLR cameras. Support for K200D added by Jens Dreyer 04/2011 Support for K-r added by Vincenc Podobnik 06/2011 Support for K-30 added by Camilo Polymeris 09/2012 Support for K-01 added by Ethan Queen 01/2013 Support for K-3 added by Tao Wang 01/2016 based on: PK-Remote Remote control of Pentax DSLR cameras. Copyright (C) 2008 Pontus Lidman PK-Remote for Windows Copyright (C) 2010 Tomasz Kos This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU General Public License and GNU Lesser General Public License along with this program. If not, see . */ #include #include #include #include #include #include #include #include #ifdef RAD10 #include #include #include "tdbtime.h" #else #include #endif #include #include #include #include "pslr.h" #include "pslr_log.h" #include "pslr_scsi.h" #include "pslr_lens.h" #include "pslr_utils.h" #include "indimacros.h" // INDI modification, reapply for next update #define POLL_INTERVAL 50000 /* Number of us to wait when polling */ #define BLKSZ 65536 /* Block size for downloads; if too big, we get * memory allocation error from sg driver */ #define BLOCK_RETRY 3 /* Number of retries, since we can occasionally * get SCSI errors when downloading data */ ipslr_handle_t pslr; static int ipslr_set_mode(ipslr_handle_t *p, uint32_t mode); static int ipslr_cmd_00_09(ipslr_handle_t *p, uint32_t mode); static int ipslr_cmd_10_0a(ipslr_handle_t *p, uint32_t mode); static int ipslr_cmd_00_05(ipslr_handle_t *p); static int ipslr_status(ipslr_handle_t *p, uint8_t *buf); static int ipslr_status_full(ipslr_handle_t *p, pslr_status *status); static int ipslr_press_shutter(ipslr_handle_t *p, bool fullpress); static int ipslr_select_buffer(ipslr_handle_t *p, int bufno, pslr_buffer_type buftype, int bufres); static int ipslr_buffer_segment_info(ipslr_handle_t *p, pslr_buffer_segment_info *pInfo); static int ipslr_next_segment(ipslr_handle_t *p); static int ipslr_download(ipslr_handle_t *p, uint32_t addr, uint32_t length, uint8_t *buf); static int ipslr_identify(ipslr_handle_t *p); static int _ipslr_write_args(uint8_t cmd_2, ipslr_handle_t *p, int n, ...); #define ipslr_write_args(p,n,...) _ipslr_write_args(0,(p),(n),__VA_ARGS__) #define ipslr_write_args_special(p,n,...) _ipslr_write_args(4,(p),(n),__VA_ARGS__) static int command(FDTYPE fd, int a, int b, int c); static int get_status(FDTYPE fd); static int get_result(FDTYPE fd); static int read_result(FDTYPE fd, uint8_t *buf, uint32_t n); void hexdump(uint8_t *buf, uint32_t bufLen); static pslr_progress_callback_t progress_callback = NULL; user_file_format_t pslr_user_file_formats[3] = { { USER_FILE_FORMAT_PEF, "PEF", "pef"}, { USER_FILE_FORMAT_DNG, "DNG", "dng"}, { USER_FILE_FORMAT_JPEG, "JPEG", "jpg"}, }; const char* valid_vendors[3] = {"PENTAX", "SAMSUNG", "RICOHIMG"}; const char* valid_models[3] = {"DIGITAL_CAMERA", "DSC", "Digital Camera"}; // x18 subcommands to change camera properties // X18_n: unknown effect typedef enum { X18_00, X18_EXPOSURE_MODE, X18_02, X18_AE_METERING_MODE, X18_FLASH_MODE, X18_AF_MODE, X18_AF_POINT_SEL, X18_AF_POINT, X18_08, X18_09, X18_0A, X18_0B, X18_0C, X18_0D, X18_0E, X18_0F, X18_WHITE_BALANCE, X18_WHITE_BALANCE_ADJ, X18_IMAGE_FORMAT, X18_JPEG_STARS, X18_JPEG_RESOLUTION, X18_ISO, X18_SHUTTER, X18_APERTURE, X18_EC, X18_19, X18_FLASH_EXPOSURE_COMPENSATION, X18_JPEG_IMAGE_TONE, X18_DRIVE_MODE, X18_1D, X18_1E, X18_RAW_FORMAT, X18_JPEG_SATURATION, X18_JPEG_SHARPNESS, X18_JPEG_CONTRAST, X18_COLOR_SPACE, X18_24, X18_JPEG_HUE } x18_subcommands_t; // x10 subcommands for buttons // X10_n: unknown effect typedef enum { X10_00, X10_01, X10_02, X10_03, X10_04, X10_SHUTTER, X10_AE_LOCK, X10_GREEN, X10_AE_UNLOCK, X10_09, X10_CONNECT, X10_0B, X10_CONTINUOUS, X10_BULB, X10_0E, X10_0F, X10_10, X10_DUST } x10_subcommands_t; /* ************** Enabling/disabling debug mode *************/ /* Done by reverse engineering the USB communication between PK Tether and */ /* Pentax K-10D camera. The debug on/off should work without breaking the */ /* camera, but you are invoking this subroutines without any warranties */ /* Written by: Samo Penic, 2014 */ #define DEBUG_OFF 0 #define DEBUG_ON 1 /* a different write_args function needs to be done with slightly changed */ /* command sequence. Original function was ipslr_write_args(). */ static int pslr_get_buffer_status(ipslr_handle_t *p, uint32_t *x, uint32_t *y) { //ipslr_handle_t *p = (ipslr_handle_t *) h; DPRINT("[C]\t\tipslr_get_buffer_status()\n"); uint8_t buf[8]; int n; CHECK(command(p->fd, 0x02, 0x00, 0)); n = get_result(p->fd); DPRINT("[C]\t\tipslr_get_buffer_status() bytes: %d\n",n); if (n!= 8) { return PSLR_READ_ERROR; } CHECK(read_result(p->fd, buf, n)); int i; for (i=0; imodel->is_little_endian) { get_uint32_func_ptr = get_uint32_le; } else { get_uint32_func_ptr = get_uint32_be; } *x = (*get_uint32_func_ptr)(buf); *y = (*get_uint32_func_ptr)(buf+4); return PSLR_OK; } /* Commands in form 23 XX YY. I know it is stupid, but ipslr_cmd functions */ /* are sooooo handy. */ static int ipslr_cmd_23_XX(ipslr_handle_t *p, char XX, char YY, uint32_t mode) { DPRINT("[C]\t\tipslr_cmd_23_XX(%x, %x, mode=%x)\n", XX, YY, mode); CHECK(ipslr_write_args(p, 1, mode)); CHECK(command(p->fd, 0x23, XX, YY)); CHECK(get_status(p->fd)); return PSLR_OK; } /* First of two exceptions. Command 0x23 0x06 0x14 behaves differently than */ /* generic 23 XX YY commands */ static int ipslr_cmd_23_06(ipslr_handle_t *p, char debug_on_off) { DPRINT("[C]\t\tipslr_cmd_23_06(debug=%d)\n", debug_on_off); CHECK(ipslr_write_args(p, 1, 3)); if (debug_on_off==0) { CHECK(ipslr_write_args_special(p, 4,0,0,0,0)); } else { CHECK(ipslr_write_args_special(p, 4,1,1,0,0)); } CHECK(command(p->fd, 0x23, 0x06, 0x14)); CHECK(get_status(p->fd)); return PSLR_OK; } /* Second exception. Command 0x23 0x04 0x08 behaves differently than generic */ /* 23 XX YY commands */ static int ipslr_cmd_23_04(ipslr_handle_t *p) { DPRINT("[C]\t\tipslr_cmd_23_04()\n"); CHECK(ipslr_write_args(p, 1, 3)); // posebni ARGS-i CHECK(ipslr_write_args_special(p, 1, 1)); // posebni ARGS-i CHECK(command(p->fd, 0x23, 0x04, 0x08)); CHECK(get_status(p->fd)); return PSLR_OK; } /* Function called to enable/disable debug mode. If debug_mode argument is 0 */ /* function disables debug mode, else debug mode is enabled */ int pslr_set_debugmode(ipslr_handle_t *p, char debug_mode) { DPRINT("[C]\tpslr_set_debugmode(%d)\n", debug_mode); uint8_t buf[16]; /* buffer for storing statuses and read_results */ ipslr_cmd_00_09(p,1); ipslr_cmd_23_XX(p,0x07,0x04,3); read_result(p->fd,buf,0x10); ipslr_cmd_23_XX(p,0x05,0x04,3); read_result(p->fd,buf,0x04); ipslr_status(p,buf); if (debug_mode==0) { ipslr_cmd_23_06(p,DEBUG_OFF); } else { ipslr_cmd_23_06(p,DEBUG_ON); } ipslr_status(p,buf); ipslr_cmd_23_04(p); ipslr_cmd_23_XX(p,0x00,0x04, 0); ipslr_cmd_00_09(p,2); ipslr_status(p,buf); return PSLR_OK; } /* ************* End enabling/disabling debug mode ************ */ user_file_format_t *pslr_get_user_file_format_t( user_file_format uff ) { unsigned int i; for (i = 0; iraw_format; int imgfmt = st->image_format; if (imgfmt == PSLR_IMAGE_FORMAT_JPEG) { return USER_FILE_FORMAT_JPEG; } else { if (rawfmt == PSLR_RAW_FORMAT_PEF) { return USER_FILE_FORMAT_PEF; } else { return USER_FILE_FORMAT_DNG; } } } // most of the cameras require this exposure mode conversion step pslr_gui_exposure_mode_t exposure_mode_conversion( pslr_exposure_mode_t exp ) { switch ( exp ) { case PSLR_EXPOSURE_MODE_GREEN: return PSLR_GUI_EXPOSURE_MODE_GREEN; case PSLR_EXPOSURE_MODE_P: return PSLR_GUI_EXPOSURE_MODE_P; case PSLR_EXPOSURE_MODE_SV: return PSLR_GUI_EXPOSURE_MODE_SV; case PSLR_EXPOSURE_MODE_TV: return PSLR_GUI_EXPOSURE_MODE_TV; case PSLR_EXPOSURE_MODE_AV: case PSLR_EXPOSURE_MODE_AV_OFFAUTO: return PSLR_GUI_EXPOSURE_MODE_AV; case PSLR_EXPOSURE_MODE_TAV: return PSLR_GUI_EXPOSURE_MODE_TAV; case PSLR_EXPOSURE_MODE_M: case PSLR_EXPOSURE_MODE_M_OFFAUTO: return PSLR_GUI_EXPOSURE_MODE_M; case PSLR_EXPOSURE_MODE_B: case PSLR_EXPOSURE_MODE_B_OFFAUTO: return PSLR_GUI_EXPOSURE_MODE_B; case PSLR_EXPOSURE_MODE_X: return PSLR_GUI_EXPOSURE_MODE_X; case PSLR_EXPOSURE_MODE_MAX: return PSLR_GUI_EXPOSURE_MODE_MAX; } return 0; } pslr_handle_t pslr_init( char *model, char *device ) { FDTYPE fd; char vendorId[20]; char productId[20]; int driveNum; char **drives; const char *camera_name; DPRINT("[C]\tpslr_init()\n"); if ( device == NULL ) { drives = get_drives(&driveNum); } else { driveNum = 1; drives = malloc( driveNum * sizeof(char*) ); drives[0] = strdup( device ); } DPRINT("driveNum:%d\n",driveNum); int i; for ( i=0; imodel ) { DPRINT("\nUnknown Pentax camera.\n"); return -1; } CHECK(ipslr_status_full(p, &p->status)); DPRINT("\tinit bufmask=0x%x\n", p->status.bufmask); if ( !p->model->old_scsi_command ) { CHECK(ipslr_cmd_00_09(p, 2)); } CHECK(ipslr_status_full(p, &p->status)); CHECK(ipslr_cmd_10_0a(p, 1)); if ( p->model->old_scsi_command ) { CHECK(ipslr_cmd_00_05(p)); } CHECK(ipslr_status_full(p, &p->status)); return 0; } int pslr_disconnect(pslr_handle_t h) { DPRINT("[C]\tpslr_disconnect()\n"); ipslr_handle_t *p = (ipslr_handle_t *) h; uint8_t statusbuf[28]; CHECK(ipslr_cmd_10_0a(p, 0)); CHECK(ipslr_set_mode(p, 0)); CHECK(ipslr_status(p, statusbuf)); return PSLR_OK; } int pslr_shutdown(pslr_handle_t h) { DPRINT("[C]\tpslr_shutdown()\n"); ipslr_handle_t *p = (ipslr_handle_t *) h; close_drive(&p->fd); return PSLR_OK; } int pslr_shutter(pslr_handle_t h) { DPRINT("[C]\tpslr_shutter()\n"); ipslr_handle_t *p = (ipslr_handle_t *) h; return ipslr_press_shutter(p, true); } int pslr_focus(pslr_handle_t h) { DPRINT("[C]\tpslr_focus()\n"); ipslr_handle_t *p = (ipslr_handle_t *) h; return ipslr_press_shutter(p, false); } int pslr_get_status(pslr_handle_t h, pslr_status *ps) { DPRINT("[C]\tpslr_get_status()\n"); ipslr_handle_t *p = (ipslr_handle_t *) h; memset( ps, 0, sizeof( pslr_status )); CHECK(ipslr_status_full(p, &p->status)); memcpy(ps, &p->status, sizeof (pslr_status)); return PSLR_OK; } char *pslr_format_rational( pslr_rational_t rational, char * fmt ) { char *ret = malloc(32); if ( rational.denom == 0 ) { snprintf( ret, 32, "unknown" ); } else { snprintf( ret, 32, fmt, 1.0 * rational.nom / rational.denom ); } return ret; } static char *get_white_balance_single_adjust_str( uint32_t adjust, char negativeChar, char positiveChar ) { char *ret = malloc(4); if ( adjust < 7 ) { snprintf( ret, 4, "%c%d", negativeChar, 7-adjust); } else if ( adjust > 7 ) { snprintf( ret, 4, "%c%d", positiveChar, adjust-7); } else { strcpy(ret,""); } return ret; } static char *get_white_balance_adjust_str( uint32_t adjust_mg, uint32_t adjust_ba ) { char *ret = malloc(8); if ( adjust_mg != 7 || adjust_ba != 7 ) { snprintf(ret, 8, "%s%s", get_white_balance_single_adjust_str(adjust_mg, 'M', 'G'),get_white_balance_single_adjust_str(adjust_ba, 'B', 'A')); } else { strcpy(ret,"0"); } return ret; } char *pslr_get_af_name(pslr_handle_t h, uint32_t af_point) { ipslr_handle_t *p = (ipslr_handle_t *) h; if (p->model->af_point_num==11) { return pslr_get_af11_point_str(af_point); } else { char *raw = malloc(11); sprintf(raw, "%d", af_point); return raw; } } char *pslr_get_status_info( pslr_handle_t h, pslr_status status ) { char *strbuffer = malloc(8192); sprintf(strbuffer,"%-32s: %d\n", "current iso", status.current_iso); sprintf(strbuffer+strlen(strbuffer),"%-32s: %d/%d\n", "current shutter speed", status.current_shutter_speed.nom, status.current_shutter_speed.denom); sprintf(strbuffer+strlen(strbuffer),"%-32s: %d/%d\n", "camera max shutter speed", status.max_shutter_speed.nom, status.max_shutter_speed.denom); sprintf(strbuffer+strlen(strbuffer),"%-32s: %s\n", "current aperture", pslr_format_rational( status.current_aperture, "%.1f")); sprintf(strbuffer+strlen(strbuffer),"%-32s: %s\n", "lens max aperture", pslr_format_rational( status.lens_max_aperture, "%.1f")); sprintf(strbuffer+strlen(strbuffer),"%-32s: %s\n", "lens min aperture", pslr_format_rational( status.lens_min_aperture, "%.1f")); sprintf(strbuffer+strlen(strbuffer),"%-32s: %d/%d\n", "set shutter speed", status.set_shutter_speed.nom, status.set_shutter_speed.denom); sprintf(strbuffer+strlen(strbuffer),"%-32s: %s\n", "set aperture", pslr_format_rational( status.set_aperture, "%.1f")); sprintf(strbuffer+strlen(strbuffer),"%-32s: %d\n", "fixed iso", status.fixed_iso); sprintf(strbuffer+strlen(strbuffer),"%-32s: %d-%d\n", "auto iso", status.auto_iso_min,status.auto_iso_max); sprintf(strbuffer+strlen(strbuffer),"%-32s: %d\n", "jpeg quality", status.jpeg_quality); sprintf(strbuffer+strlen(strbuffer),"%-32s: %dM\n", "jpeg resolution", pslr_get_jpeg_resolution( h, status.jpeg_resolution)); sprintf(strbuffer+strlen(strbuffer),"%-32s: %s\n", "jpeg image tone", pslr_get_jpeg_image_tone_str(status.jpeg_image_tone)); sprintf(strbuffer+strlen(strbuffer),"%-32s: %d\n", "jpeg saturation", status.jpeg_saturation); sprintf(strbuffer+strlen(strbuffer),"%-32s: %d\n", "jpeg contrast", status.jpeg_contrast); sprintf(strbuffer+strlen(strbuffer),"%-32s: %d\n", "jpeg sharpness", status.jpeg_sharpness); sprintf(strbuffer+strlen(strbuffer),"%-32s: %d\n", "jpeg hue", status.jpeg_hue); sprintf(strbuffer+strlen(strbuffer),"%-32s: %s mm\n", "zoom", pslr_format_rational(status.zoom, "%.2f")); sprintf(strbuffer+strlen(strbuffer),"%-32s: %d\n", "focus", status.focus); sprintf(strbuffer+strlen(strbuffer),"%-32s: %s\n", "color space", pslr_get_color_space_str(status.color_space)); sprintf(strbuffer+strlen(strbuffer),"%-32s: %s\n", "image format", pslr_get_image_format_str(status.image_format)); sprintf(strbuffer+strlen(strbuffer),"%-32s: %s\n", "raw format", pslr_get_raw_format_str(status.raw_format)); sprintf(strbuffer+strlen(strbuffer),"%-32s: %d\n", "light meter flags", status.light_meter_flags); sprintf(strbuffer+strlen(strbuffer),"%-32s: %s\n", "ec", pslr_format_rational( status.ec, "%.2f" ) ); sprintf(strbuffer+strlen(strbuffer),"%-32s: %s EV steps\n", "custom ev steps", pslr_get_custom_ev_steps_str(status.custom_ev_steps)); sprintf(strbuffer+strlen(strbuffer),"%-32s: %s EV steps\n", "custom sensitivity steps", pslr_get_custom_sensitivity_steps_str(status.custom_sensitivity_steps)); sprintf(strbuffer+strlen(strbuffer),"%-32s: %d\n", "exposure mode", status.exposure_mode); sprintf(strbuffer+strlen(strbuffer),"%-32s: %s\n", "scene mode", pslr_get_scene_mode_str(status.scene_mode)); sprintf(strbuffer+strlen(strbuffer),"%-32s: %d\n", "user mode flag", status.user_mode_flag); sprintf(strbuffer+strlen(strbuffer),"%-32s: %s\n", "ae metering mode", pslr_get_ae_metering_str(status.ae_metering_mode)); sprintf(strbuffer+strlen(strbuffer),"%-32s: %s\n", "af mode", pslr_get_af_mode_str(status.af_mode)); sprintf(strbuffer+strlen(strbuffer),"%-32s: %s\n", "af point select", pslr_get_af_point_sel_str(status.af_point_select)); sprintf(strbuffer+strlen(strbuffer),"%-32s: %s\n", "selected af point", pslr_get_af_name( h, status.selected_af_point)); sprintf(strbuffer+strlen(strbuffer),"%-32s: %s\n", "focused af point", pslr_get_af_name( h, status.focused_af_point)); sprintf(strbuffer+strlen(strbuffer),"%-32s: %s\n", "drive mode", pslr_get_drive_mode_str(status.drive_mode)); sprintf(strbuffer+strlen(strbuffer),"%-32s: %s\n", "auto bracket mode", status.auto_bracket_mode > 0 ? "on" : "off"); sprintf(strbuffer+strlen(strbuffer),"%-32s: %d\n", "auto bracket picture count", status.auto_bracket_picture_count); sprintf(strbuffer+strlen(strbuffer),"%-32s: %d\n", "auto bracket picture counter", status.auto_bracket_picture_counter); sprintf(strbuffer+strlen(strbuffer),"%-32s: %s\n", "auto bracket ev", pslr_format_rational(status.auto_bracket_ev, "%.2f")); sprintf(strbuffer+strlen(strbuffer),"%-32s: %s\n", "shake reduction", status.shake_reduction > 0 ? "on" : "off"); sprintf(strbuffer+strlen(strbuffer),"%-32s: %s\n", "white balance mode", pslr_get_white_balance_mode_str(status.white_balance_mode)); sprintf(strbuffer+strlen(strbuffer),"%-32s: %s\n", "white balance adjust", get_white_balance_adjust_str(status.white_balance_adjust_mg, status.white_balance_adjust_ba)); sprintf(strbuffer+strlen(strbuffer),"%-32s: %s\n", "flash mode", pslr_get_flash_mode_str(status.flash_mode)); sprintf(strbuffer+strlen(strbuffer),"%-32s: %.2f\n", "flash exposure compensation", (1.0 * status.flash_exposure_compensation/256)); sprintf(strbuffer+strlen(strbuffer),"%-32s: %.2f\n", "manual mode ev", (1.0 * status.manual_mode_ev / 10)); sprintf(strbuffer+strlen(strbuffer),"%-32s: %s\n", "lens", pslr_get_lens_name(status.lens_id1, status.lens_id2)); sprintf(strbuffer+strlen(strbuffer),"%-32s: %.2fV %.2fV %.2fV %.2fV\n", "battery", 0.01 * status.battery_1, 0.01 * status.battery_2, 0.01 * status.battery_3, 0.01 * status.battery_4); sprintf(strbuffer+strlen(strbuffer),"%-32s: %s\n", "buffer mask", int_to_binary(status.bufmask)); return strbuffer; } static char *get_hardwired_setting_bool_info( pslr_bool_setting setting) { char *strbuffer = malloc(32+1); sprintf(strbuffer,"%-32s", setting.pslr_setting_status == PSLR_SETTING_STATUS_HARDWIRED ? "\t[hardwired]" : ""); return strbuffer; } static char *get_special_setting_info( pslr_setting_status_t setting_status) { char *strbuffer = malloc(32); switch ( setting_status ) { case PSLR_SETTING_STATUS_NA: sprintf(strbuffer,"N/A"); break; case PSLR_SETTING_STATUS_UNKNOWN: sprintf(strbuffer,"Unknown"); break; default: free(strbuffer); return NULL; } return strbuffer; } static char *get_hardwired_setting_uint16_info( pslr_uint16_setting setting) { char *strbuffer = malloc(32+1); sprintf(strbuffer,"%-32s", setting.pslr_setting_status == PSLR_SETTING_STATUS_HARDWIRED ? "\t[hardwired]" : ""); return strbuffer; } char *pslr_get_settings_info( pslr_handle_t h, pslr_settings settings ) { INDI_UNUSED(h); // INDI modification, replay for next update (search for all INDI_UNUSED) char *strbuffer = malloc(8192); sprintf(strbuffer,"%-32s: %-8s%s\n", "one push bracketing", get_special_setting_info(settings.one_push_bracketing.pslr_setting_status) ?: settings.one_push_bracketing.value ? "on" : "off", get_hardwired_setting_bool_info(settings.one_push_bracketing)); sprintf(strbuffer+strlen(strbuffer),"%-32s: %-8s%s\n", "bulb mode", get_special_setting_info(settings.bulb_mode_press_press.pslr_setting_status) ?: settings.bulb_mode_press_press.value ? "press-press" : "press-hold", get_hardwired_setting_bool_info(settings.bulb_mode_press_press)); sprintf(strbuffer+strlen(strbuffer),"%-32s: %-8s%s\n", "bulb timer", get_special_setting_info(settings.bulb_timer.pslr_setting_status) ?: settings.bulb_timer.value ? "on" : "off", get_hardwired_setting_bool_info(settings.bulb_timer)); char *bulb_timer_sec = malloc(32); sprintf(bulb_timer_sec, "%d s", settings.bulb_timer_sec.value); sprintf(strbuffer+strlen(strbuffer),"%-32s: %-8s%s\n", "bulb timer sec", get_special_setting_info(settings.bulb_timer_sec.pslr_setting_status) ?: bulb_timer_sec, get_hardwired_setting_uint16_info(settings.bulb_timer_sec)); sprintf(strbuffer+strlen(strbuffer),"%-32s: %-8s%s\n", "remote bulb mode", get_special_setting_info(settings.remote_bulb_mode_press_press.pslr_setting_status) ?: settings.remote_bulb_mode_press_press.value ? "press-press" : "press-hold", get_hardwired_setting_bool_info(settings.remote_bulb_mode_press_press)); sprintf(strbuffer+strlen(strbuffer),"%-32s: %-8s%s\n", "using aperture ring", get_special_setting_info(settings.using_aperture_ring.pslr_setting_status) ?: settings.using_aperture_ring.value ? "on" : "off", get_hardwired_setting_bool_info(settings.using_aperture_ring)); sprintf(strbuffer+strlen(strbuffer),"%-32s: %-8s%s\n", "shake reduction", get_special_setting_info(settings.shake_reduction.pslr_setting_status) ?: settings.shake_reduction.value ? "on" : "off", get_hardwired_setting_bool_info(settings.shake_reduction)); sprintf(strbuffer+strlen(strbuffer),"%-32s: %-8s%s\n", "astrotracer", get_special_setting_info(settings.astrotracer.pslr_setting_status) ?: settings.astrotracer.value ? "on" : "off", get_hardwired_setting_bool_info(settings.astrotracer)); char *astrotracer_timer_sec = malloc(32); sprintf(astrotracer_timer_sec, "%d s", settings.astrotracer_timer_sec.value); sprintf(strbuffer+strlen(strbuffer),"%-32s: %-8s%s\n", "astrotracer timer sec", get_special_setting_info(settings.astrotracer_timer_sec.pslr_setting_status) ?: astrotracer_timer_sec, get_hardwired_setting_uint16_info(settings.astrotracer_timer_sec)); sprintf(strbuffer+strlen(strbuffer),"%-32s: %-8s%s\n", "horizon correction", get_special_setting_info(settings.horizon_correction.pslr_setting_status) ?: settings.horizon_correction.value ? "on" : "off", get_hardwired_setting_bool_info(settings.horizon_correction)); return strbuffer; } int pslr_get_status_buffer(pslr_handle_t h, uint8_t *st_buf) { DPRINT("[C]\tpslr_get_status_buffer()\n"); ipslr_handle_t *p = (ipslr_handle_t *) h; memset( st_buf, 0, MAX_STATUS_BUF_SIZE); // CHECK(ipslr_status_full(p, &p->status)); // ipslr_status_full(p, &p->status); memcpy(st_buf, p->status_buffer, MAX_STATUS_BUF_SIZE); return PSLR_OK; } int pslr_get_settings_buffer(pslr_handle_t h, uint8_t *st_buf) { DPRINT("[C]\tpslr_get_settings_buffer()\n"); ipslr_handle_t *p = (ipslr_handle_t *) h; memset( st_buf, 0, SETTINGS_BUFFER_SIZE); memcpy(st_buf, p->settings_buffer, SETTINGS_BUFFER_SIZE); return PSLR_OK; } int pslr_get_buffer(pslr_handle_t h, int bufno, pslr_buffer_type type, int resolution, uint8_t **ppData, uint32_t *pLen) { DPRINT("[C]\tpslr_get_buffer()\n"); uint8_t *buf = 0; int ret; ret = pslr_buffer_open(h, bufno, type, resolution); if ( ret != PSLR_OK ) { return ret; } uint32_t size = pslr_buffer_get_size(h); buf = malloc(size); if (!buf) { return PSLR_NO_MEMORY; } uint32_t bufpos = 0; while (true) { uint32_t nextread = size - bufpos > 65536 ? 65536 : size - bufpos; if (nextread == 0) { break; } uint32_t bytes = pslr_buffer_read(h, buf+bufpos, nextread); if (bytes == 0) { break; } bufpos += bytes; } if ( bufpos != size ) { free(buf); return PSLR_READ_ERROR; } pslr_buffer_close(h); if (ppData) { *ppData = buf; } if (pLen) { *pLen = size; } return PSLR_OK; } int pslr_set_progress_callback(pslr_handle_t h, pslr_progress_callback_t cb, uintptr_t user_data) { INDI_UNUSED(h); INDI_UNUSED(user_data); progress_callback = cb; return PSLR_OK; } static int ipslr_handle_command_x18( ipslr_handle_t *p, bool cmd9_wrap, int subcommand, int argnum, ...) { DPRINT("[C]\t\tipslr_handle_command_x18(0x%x, %d)\n", subcommand, argnum); if ( cmd9_wrap ) { CHECK(ipslr_cmd_00_09(p, 1)); } // max 4 args va_list ap; int args[4]; int i; for ( i = 0; i < 4; ++i ) { args[i] = 0; } va_start(ap, argnum); for (i = 0; i < argnum; i++) { args[i] = va_arg(ap, int); } va_end(ap); CHECK(ipslr_write_args(p, argnum, args[0], args[1], args[2], args[3])); CHECK(command(p->fd, 0x18, subcommand, 4 * argnum)); CHECK(get_status(p->fd)); if ( cmd9_wrap ) { CHECK(ipslr_cmd_00_09(p, 2)); } return PSLR_OK; } int pslr_test( pslr_handle_t h, bool cmd9_wrap, int subcommand, int argnum, int arg1, int arg2, int arg3, int arg4) { DPRINT("[C]\tpslr_test(wrap=%d, subcommand=0x%x, %x, %x, %x, %x)\n", cmd9_wrap, subcommand, arg1, arg2, arg3, arg4); ipslr_handle_t *p = (ipslr_handle_t *) h; return ipslr_handle_command_x18( p, cmd9_wrap, subcommand, argnum, arg1, arg2, arg3, arg4); } int pslr_set_shutter(pslr_handle_t h, pslr_rational_t value) { DPRINT("[C]\tpslr_set_shutter(%x %x)\n", value.nom, value.denom); ipslr_handle_t *p = (ipslr_handle_t *) h; return ipslr_handle_command_x18( p, true, X18_SHUTTER, 2, value.nom, value.denom, 0); } int pslr_set_aperture(pslr_handle_t h, pslr_rational_t value) { DPRINT("[C]\tpslr_set_aperture(%x %x)\n", value.nom, value.denom); ipslr_handle_t *p = (ipslr_handle_t *) h; return ipslr_handle_command_x18( p, false, X18_APERTURE, 3, value.nom, value.denom, 0); } int pslr_set_iso(pslr_handle_t h, uint32_t value, uint32_t auto_min_value, uint32_t auto_max_value) { DPRINT("[C]\tpslr_set_iso(0x%X, auto_min=%X, auto_max=%X)\n", value, auto_min_value, auto_max_value); ipslr_handle_t *p = (ipslr_handle_t *) h; return ipslr_handle_command_x18( p, true, X18_ISO, 3, value, auto_min_value, auto_max_value); } int pslr_set_expose_compensation(pslr_handle_t h, pslr_rational_t value) { DPRINT("[C]\tpslr_set_expose_compensation(0x%X 0x%X)\n", value.nom, value.denom); ipslr_handle_t *p = (ipslr_handle_t *) h; return ipslr_handle_command_x18( p, true, X18_EC, 2, value.nom, value.denom, 0); } int pslr_set_white_balance(pslr_handle_t h, pslr_white_balance_mode_t wb_mode) { DPRINT("[C]\tpslr_set_white_balance(0x%X)\n", wb_mode); ipslr_handle_t *p = (ipslr_handle_t *) h; return ipslr_handle_command_x18( p, true, X18_WHITE_BALANCE, 1, wb_mode); } int pslr_set_white_balance_adjustment(pslr_handle_t h, pslr_white_balance_mode_t wb_mode, uint32_t wbadj_mg, uint32_t wbadj_ba) { DPRINT("[C]\tpslr_set_white_balance_adjustment(mode=0x%X, tint=0x%X, temp=0x%X)\n", wb_mode, wbadj_mg, wbadj_ba); ipslr_handle_t *p = (ipslr_handle_t *) h; return ipslr_handle_command_x18( p, true, X18_WHITE_BALANCE_ADJ, 3, wb_mode, wbadj_mg, wbadj_ba); } int pslr_set_flash_mode(pslr_handle_t h, pslr_flash_mode_t value) { DPRINT("[C]\tpslr_set_flash_mode(%X)\n", value); ipslr_handle_t *p = (ipslr_handle_t *) h; return ipslr_handle_command_x18( p, true, X18_FLASH_MODE, 1, value, 0, 0); } int pslr_set_flash_exposure_compensation(pslr_handle_t h, pslr_rational_t value) { DPRINT("[C]\tpslr_set_flash_exposure_compensation(%X %X)\n", value.nom, value.denom); ipslr_handle_t *p = (ipslr_handle_t *) h; return ipslr_handle_command_x18( p, true, X18_FLASH_EXPOSURE_COMPENSATION, 2, value.nom, value.denom, 0); } int pslr_set_drive_mode(pslr_handle_t h, pslr_drive_mode_t drive_mode) { DPRINT("[C]\tpslr_set_drive_mode(%X)\n", drive_mode); ipslr_handle_t *p = (ipslr_handle_t *) h; return ipslr_handle_command_x18( p, true, X18_DRIVE_MODE, 1, drive_mode, 0, 0); } int pslr_set_ae_metering_mode(pslr_handle_t h, pslr_ae_metering_t ae_metering_mode) { DPRINT("[C]\tpslr_set_ae_metering_mode(%X)\n", ae_metering_mode); ipslr_handle_t *p = (ipslr_handle_t *) h; return ipslr_handle_command_x18( p, true, X18_AE_METERING_MODE, 1, ae_metering_mode, 0, 0); } int pslr_set_af_mode(pslr_handle_t h, pslr_af_mode_t af_mode) { DPRINT("[C]\tpslr_set_af_mode(%X)\n", af_mode); ipslr_handle_t *p = (ipslr_handle_t *) h; return ipslr_handle_command_x18( p, true, X18_AF_MODE, 1, af_mode, 0, 0); } int pslr_set_af_point_sel(pslr_handle_t h, pslr_af_point_sel_t af_point_sel) { DPRINT("[C]\tpslr_set_af_point_sel(%X)\n", af_point_sel); ipslr_handle_t *p = (ipslr_handle_t *) h; return ipslr_handle_command_x18( p, true, X18_AF_POINT_SEL, 1, af_point_sel, 0, 0); } int pslr_set_jpeg_stars(pslr_handle_t h, int jpeg_stars ) { DPRINT("[C]\tpslr_set_jpeg_stars(%X)\n", jpeg_stars); int hwqual; ipslr_handle_t *p = (ipslr_handle_t *) h; if ( jpeg_stars > p->model->max_jpeg_stars ) { return PSLR_PARAM; } hwqual = pslr_get_hw_jpeg_quality( p->model, jpeg_stars ); return ipslr_handle_command_x18( p, true, X18_JPEG_STARS, 2, 1, hwqual, 0); } static int _get_user_jpeg_resolution( ipslr_model_info_t *model, int hwres ) { return model->jpeg_resolutions[hwres]; } int pslr_get_jpeg_resolution(pslr_handle_t h, int hwres) { ipslr_handle_t *p = (ipslr_handle_t *) h; return _get_user_jpeg_resolution( p->model, hwres ); } static int _get_hw_jpeg_resolution( ipslr_model_info_t *model, int megapixel) { int resindex = 0; while ( resindex < MAX_RESOLUTION_SIZE && model->jpeg_resolutions[resindex] > megapixel ) { ++resindex; } return resindex < MAX_RESOLUTION_SIZE ? resindex : MAX_RESOLUTION_SIZE-1; } int pslr_set_jpeg_resolution(pslr_handle_t h, int megapixel) { DPRINT("[C]\tpslr_set_jpeg_resolution(%X)\n", megapixel); ipslr_handle_t *p = (ipslr_handle_t *) h; int hwres = _get_hw_jpeg_resolution( p->model, megapixel ); return ipslr_handle_command_x18( p, true, X18_JPEG_RESOLUTION, 2, 1, hwres, 0); } int pslr_set_jpeg_image_tone(pslr_handle_t h, pslr_jpeg_image_tone_t image_tone) { DPRINT("[C]\tpslr_set_jpeg_image_tone(%X)\n", image_tone); ipslr_handle_t *p = (ipslr_handle_t *) h; if (image_tone < 0 || image_tone > PSLR_JPEG_IMAGE_TONE_MAX) { return PSLR_PARAM; } return ipslr_handle_command_x18( p, true, X18_JPEG_IMAGE_TONE, 1, image_tone, 0, 0); } int pslr_set_jpeg_sharpness(pslr_handle_t h, int32_t sharpness) { DPRINT("[C]\tpslr_set_jpeg_sharpness(%X)\n", sharpness); ipslr_handle_t *p = (ipslr_handle_t *) h; int hw_sharpness = sharpness + (pslr_get_model_jpeg_property_levels( h )-1) / 2; if (hw_sharpness < 0 || hw_sharpness >= p->model->jpeg_property_levels) { return PSLR_PARAM; } return ipslr_handle_command_x18( p, false, X18_JPEG_SHARPNESS, 2, 0, hw_sharpness, 0); } int pslr_set_jpeg_contrast(pslr_handle_t h, int32_t contrast) { DPRINT("[C]\tpslr_set_jpeg_contrast(%X)\n", contrast); ipslr_handle_t *p = (ipslr_handle_t *) h; int hw_contrast = contrast + (pslr_get_model_jpeg_property_levels( h )-1) / 2; if (hw_contrast < 0 || hw_contrast >= p->model->jpeg_property_levels) { return PSLR_PARAM; } return ipslr_handle_command_x18( p, false, X18_JPEG_CONTRAST, 2, 0, hw_contrast, 0); } int pslr_set_jpeg_hue(pslr_handle_t h, int32_t hue) { DPRINT("[C]\tpslr_set_jpeg_hue(%X)\n", hue); ipslr_handle_t *p = (ipslr_handle_t *) h; int hw_hue = hue + (pslr_get_model_jpeg_property_levels( h )-1) / 2; DPRINT("hw_hue: %d\n", hw_hue); if (hw_hue < 0 || hw_hue >= p->model->jpeg_property_levels) { return PSLR_PARAM; } DPRINT("before return\n"); return ipslr_handle_command_x18( p, false, X18_JPEG_HUE, 2, 0, hw_hue, 0); } int pslr_set_jpeg_saturation(pslr_handle_t h, int32_t saturation) { DPRINT("[C]\tpslr_set_jpeg_saturation(%X)\n", saturation); ipslr_handle_t *p = (ipslr_handle_t *) h; int hw_saturation = saturation + (pslr_get_model_jpeg_property_levels( h )-1) / 2; if (hw_saturation < 0 || hw_saturation >= p->model->jpeg_property_levels) { return PSLR_PARAM; } return ipslr_handle_command_x18( p, false, X18_JPEG_SATURATION, 2, 0, hw_saturation, 0); } int pslr_set_image_format(pslr_handle_t h, pslr_image_format_t format) { DPRINT("[C]\tpslr_set_image_format(%X)\n", format); ipslr_handle_t *p = (ipslr_handle_t *) h; if (format >= PSLR_IMAGE_FORMAT_MAX) { return PSLR_PARAM; } return ipslr_handle_command_x18( p, true, X18_IMAGE_FORMAT, 2, 1, format, 0); } int pslr_set_raw_format(pslr_handle_t h, pslr_raw_format_t format) { DPRINT("[C]\tpslr_set_raw_format(%X)\n", format); ipslr_handle_t *p = (ipslr_handle_t *) h; if (format >= PSLR_RAW_FORMAT_MAX) { return PSLR_PARAM; } return ipslr_handle_command_x18( p, true, X18_RAW_FORMAT, 2, 1, format, 0); } int pslr_set_color_space(pslr_handle_t h, pslr_color_space_t color_space) { DPRINT("[C]\tpslr_set_raw_format(%X)\n", color_space); ipslr_handle_t *p = (ipslr_handle_t *) h; if (color_space >= PSLR_COLOR_SPACE_MAX) { return PSLR_PARAM; } return ipslr_handle_command_x18( p, true, X18_COLOR_SPACE, 1, color_space, 0, 0); } int pslr_delete_buffer(pslr_handle_t h, int bufno) { DPRINT("[C]\tpslr_delete_buffer(%X)\n", bufno); ipslr_handle_t *p = (ipslr_handle_t *) h; if (bufno < 0 || bufno > 9) { return PSLR_PARAM; } CHECK(ipslr_write_args(p, 1, bufno)); CHECK(command(p->fd, 0x02, 0x03, 0x04)); CHECK(get_status(p->fd)); return PSLR_OK; } int pslr_green_button(pslr_handle_t h) { DPRINT("[C]\tpslr_green_button()\n"); ipslr_handle_t *p = (ipslr_handle_t *) h; CHECK(command(p->fd, 0x10, X10_GREEN, 0x00)); CHECK(get_status(p->fd)); return PSLR_OK; } int pslr_dust_removal(pslr_handle_t h) { DPRINT("[C]\tpslr_dust_removal()\n"); ipslr_handle_t *p = (ipslr_handle_t *) h; CHECK(command(p->fd, 0x10, X10_DUST, 0x00)); CHECK(get_status(p->fd)); return PSLR_OK; } int pslr_bulb(pslr_handle_t h, bool on ) { DPRINT("[C]\tpslr_bulb(%d)\n", on); ipslr_handle_t *p = (ipslr_handle_t *) h; CHECK(ipslr_write_args(p, 1, on ? 1 : 0)); CHECK(command(p->fd, 0x10, X10_BULB, 0x04)); CHECK(get_status(p->fd)); return PSLR_OK; } int pslr_button_test(pslr_handle_t h, int bno, int arg) { DPRINT("[C]\tpslr_button_test(%X, %X)\n", bno, arg); int r; ipslr_handle_t *p = (ipslr_handle_t *) h; CHECK(ipslr_write_args(p, 1, arg)); CHECK(command(p->fd, 0x10, bno, 4)); r = get_status(p->fd); DPRINT("\tbutton result code: 0x%x\n", r); return PSLR_OK; } int pslr_ae_lock(pslr_handle_t h, bool lock) { DPRINT("[C]\tpslr_ae_lock(%X)\n", lock); ipslr_handle_t *p = (ipslr_handle_t *) h; if (lock) { CHECK(command(p->fd, 0x10, X10_AE_LOCK, 0x00)); } else { CHECK(command(p->fd, 0x10, X10_AE_UNLOCK, 0x00)); } CHECK(get_status(p->fd)); return PSLR_OK; } int pslr_set_exposure_mode(pslr_handle_t h, pslr_exposure_mode_t mode) { DPRINT("[C]\tpslr_set_exposure_mode(%X)\n", mode); ipslr_handle_t *p = (ipslr_handle_t *) h; if (mode >= PSLR_EXPOSURE_MODE_MAX) { return PSLR_PARAM; } if ( p->model->need_exposure_mode_conversion ) { mode = (pslr_exposure_mode_t) exposure_mode_conversion( mode ); // cast as pslr_exposure_mode_t = INDI modification, reapply for next update } return ipslr_handle_command_x18( p, true, X18_EXPOSURE_MODE, 2, 1, mode, 0); } int pslr_buffer_open(pslr_handle_t h, int bufno, pslr_buffer_type buftype, int bufres) { DPRINT("[C]\tpslr_buffer_open(#%X, type=%X, res=%X)\n", bufno, buftype, bufres); pslr_buffer_segment_info info; uint16_t bufs; uint32_t buf_total = 0; int i, j; int ret; int retry = 0; int retry2 = 0; ipslr_handle_t *p = (ipslr_handle_t *) h; memset(&info, 0, sizeof (info)); CHECK(ipslr_status_full(p, &p->status)); bufs = p->status.bufmask; DPRINT("\tp->status.bufmask = %x\n", p->status.bufmask); if ( p->model->status_parser_function && (bufs & (1 << bufno)) == 0) { // do not check this for limited support cameras DPRINT("\tNo buffer data (%d)\n", bufno); return PSLR_READ_ERROR; } while (retry < 3) { /* If we get response 0x82 from the camera, there is a * desynch. We can recover by stepping through segment infos * until we get the last one (b = 2). Retry up to 3 times. */ ret = ipslr_select_buffer(p, bufno, buftype, bufres); if (ret == PSLR_OK) { break; } retry++; retry2 = 0; /* Try up to 9 times to reach segment info type 2 (last * segment) */ do { CHECK(ipslr_buffer_segment_info(p, &info)); CHECK(ipslr_next_segment(p)); DPRINT("\tRecover: b=%d\n", info.b); } while (++retry2 < 10 && info.b != 2); } if (retry == 3) { return ret; } i = 0; j = 0; do { CHECK(ipslr_buffer_segment_info(p, &info)); DPRINT("\t%d: Addr: 0x%X Len: %d(0x%08X) B=%d\n", i, info.addr, info.length, info.length, info.b); if (info.b == 4) { p->segments[j].offset = info.length; } else if (info.b == 3) { if (j == MAX_SEGMENTS) { DPRINT("\tToo many segments.\n"); return PSLR_NO_MEMORY; } p->segments[j].addr = info.addr; p->segments[j].length = info.length; j++; } CHECK(ipslr_next_segment(p)); buf_total += info.length; i++; } while (i < 9 && info.b != 2); p->segment_count = j; p->offset = 0; return PSLR_OK; } uint32_t pslr_buffer_read(pslr_handle_t h, uint8_t *buf, uint32_t size) { ipslr_handle_t *p = (ipslr_handle_t *) h; uint32_t i; uint32_t pos = 0; uint32_t seg_offs; uint32_t addr; uint32_t blksz; int ret; DPRINT("[C]\tpslr_buffer_read(%d)\n", size); /* Find current segment */ for (i = 0; i < p->segment_count; i++) { if (p->offset < pos + p->segments[i].length) { break; } pos += p->segments[i].length; } seg_offs = p->offset - pos; addr = p->segments[i].addr + seg_offs; /* Compute block size */ blksz = size; if (blksz > p->segments[i].length - seg_offs) { blksz = p->segments[i].length - seg_offs; } if (blksz > BLKSZ) { blksz = BLKSZ; } // DPRINT("File offset %d segment: %d offset %d address 0x%x read size %d\n", p->offset, // i, seg_offs, addr, blksz); ret = ipslr_download(p, addr, blksz, buf); if (ret != PSLR_OK) { return 0; } p->offset += blksz; return blksz; } uint32_t pslr_fullmemory_read(pslr_handle_t h, uint8_t *buf, uint32_t offset, uint32_t size) { ipslr_handle_t *p = (ipslr_handle_t *) h; int ret; DPRINT("[C]\tpslr_fullmemory_read(%d)\n", size); ret = ipslr_download(p, offset, size, buf); if (ret != PSLR_OK) { return 0; } return size; } uint32_t pslr_buffer_get_size(pslr_handle_t h) { ipslr_handle_t *p = (ipslr_handle_t *) h; uint32_t i; uint32_t len = 0; for (i = 0; i < p->segment_count; i++) { len += p->segments[i].length; } DPRINT("\tbuffer get size:%d\n",len); return len; } void pslr_buffer_close(pslr_handle_t h) { ipslr_handle_t *p = (ipslr_handle_t *) h; memset(&p->segments[0], 0, sizeof (p->segments)); p->offset = 0; p->segment_count = 0; } int pslr_set_selected_af_point(pslr_handle_t h, uint32_t point) { ipslr_handle_t *p = (ipslr_handle_t *) h; return ipslr_handle_command_x18( p, true, X18_AF_POINT, 1, point, 0, 0); } int pslr_get_model_max_jpeg_stars(pslr_handle_t h) { ipslr_handle_t *p = (ipslr_handle_t *) h; return p->model->max_jpeg_stars; } int pslr_get_model_status_buffer_size(pslr_handle_t h) { ipslr_handle_t *p = (ipslr_handle_t *) h; return p->model->status_buffer_size; } int pslr_get_model_jpeg_property_levels(pslr_handle_t h) { ipslr_handle_t *p = (ipslr_handle_t *) h; return p->model->jpeg_property_levels; } int *pslr_get_model_jpeg_resolutions(pslr_handle_t h) { ipslr_handle_t *p = (ipslr_handle_t *) h; return p->model->jpeg_resolutions; } bool pslr_get_model_only_limited(pslr_handle_t h) { ipslr_handle_t *p = (ipslr_handle_t *) h; return p->model->status_buffer_size == 0 && !p->model->status_parser_function; } bool pslr_get_model_has_jpeg_hue(pslr_handle_t h) { ipslr_handle_t *p = (ipslr_handle_t *) h; return p->model->has_jpeg_hue; } bool pslr_get_model_need_exposure_conversion(pslr_handle_t h) { ipslr_handle_t *p = (ipslr_handle_t *) h; return p->model->need_exposure_mode_conversion; } int pslr_get_model_fastest_shutter_speed(pslr_handle_t h) { ipslr_handle_t *p = (ipslr_handle_t *) h; return p->model->fastest_shutter_speed; } int pslr_get_model_base_iso_min(pslr_handle_t h) { ipslr_handle_t *p = (ipslr_handle_t *) h; return p->model->base_iso_min; } int pslr_get_model_base_iso_max(pslr_handle_t h) { ipslr_handle_t *p = (ipslr_handle_t *) h; return p->model->base_iso_max; } int pslr_get_model_extended_iso_min(pslr_handle_t h) { ipslr_handle_t *p = (ipslr_handle_t *) h; return p->model->extended_iso_min; } int pslr_get_model_extended_iso_max(pslr_handle_t h) { ipslr_handle_t *p = (ipslr_handle_t *) h; return p->model->extended_iso_max; } pslr_jpeg_image_tone_t pslr_get_model_max_supported_image_tone(pslr_handle_t h) { ipslr_handle_t *p = (ipslr_handle_t *) h; return p->model->max_supported_image_tone; } int pslr_get_model_af_point_num(pslr_handle_t h) { ipslr_handle_t *p = (ipslr_handle_t *) h; return p->model->af_point_num; } bool pslr_get_model_old_bulb_mode(pslr_handle_t h) { ipslr_handle_t *p = (ipslr_handle_t *) h; return p->model->old_bulb_mode; } bool pslr_get_model_bufmask_single(pslr_handle_t h) { ipslr_handle_t *p = (ipslr_handle_t *) h; return p->model->bufmask_single; } bool pslr_get_model_has_settings_parser(pslr_handle_t h) { ipslr_handle_t *p = (ipslr_handle_t *) h; char cameraid[10]; sprintf(cameraid, "0x%0x", p->model->id); int def_num; setting_file_process(cameraid, &def_num); return def_num>0; } const char *pslr_get_camera_name(pslr_handle_t h) { DPRINT("[C]\tpslr_get_camera_name()\n"); ipslr_handle_t *p = (ipslr_handle_t *) h; int ret; if (p->id == 0) { ret = ipslr_identify(p); if (ret != PSLR_OK) { return NULL; } } if (p->model) { return p->model->name; } else { static char unk_name[256]; snprintf(unk_name, sizeof (unk_name), "ID#%x", p->id); unk_name[sizeof (unk_name) - 1] = '\0'; return unk_name; } } pslr_buffer_type pslr_get_jpeg_buffer_type(pslr_handle_t h, int jpeg_stars) { ipslr_handle_t *p = (ipslr_handle_t *) h; return 2 + pslr_get_hw_jpeg_quality( p->model, jpeg_stars ); } static int ipslr_set_mode(ipslr_handle_t *p, uint32_t mode) { DPRINT("[C]\t\tipslr_set_mode(0x%x)\n", mode); CHECK(ipslr_write_args(p, 1, mode)); CHECK(command(p->fd, 0, 0, 4)); CHECK(get_status(p->fd)); return PSLR_OK; } static int ipslr_cmd_00_09(ipslr_handle_t *p, uint32_t mode) { DPRINT("[C]\t\tipslr_cmd_00_09(0x%x)\n", mode); CHECK(ipslr_write_args(p, 1, mode)); CHECK(command(p->fd, 0, 9, 4)); CHECK(get_status(p->fd)); return PSLR_OK; } static int ipslr_cmd_10_0a(ipslr_handle_t *p, uint32_t mode) { DPRINT("[C]\t\tipslr_cmd_10_0a(0x%x)\n", mode); CHECK(ipslr_write_args(p, 1, mode)); CHECK(command(p->fd, 0x10, X10_CONNECT, 4)); CHECK(get_status(p->fd)); return PSLR_OK; } static int ipslr_cmd_00_05(ipslr_handle_t *p) { DPRINT("[C]\t\tipslr_cmd_00_05()\n"); int n; uint8_t buf[0xb8]; CHECK(command(p->fd, 0x00, 0x05, 0x00)); n = get_result(p->fd); if (n != 0xb8) { DPRINT("\tonly got %d bytes\n", n); return PSLR_READ_ERROR; } CHECK(read_result(p->fd, buf, n)); return PSLR_OK; } static int ipslr_status(ipslr_handle_t *p, uint8_t *buf) { int n; DPRINT("[C]\t\tipslr_status()\n"); CHECK(command(p->fd, 0, 1, 0)); n = get_result(p->fd); if (n == 16 || n == 28) { return read_result(p->fd, buf, n); } else { return PSLR_READ_ERROR; } } static int ipslr_status_full(ipslr_handle_t *p, pslr_status *status) { int n; DPRINT("[C]\t\tipslr_status_full()\n"); CHECK(command(p->fd, 0, 8, 0)); n = get_result(p->fd); DPRINT("\tread %d bytes\n", n); int expected_bufsize = p->model != NULL ? p->model->status_buffer_size : 0; if ( p->model == NULL ) { DPRINT("\tp model null\n"); } DPRINT("\texpected_bufsize: %d\n",expected_bufsize); CHECK(read_result(p->fd, p->status_buffer, n > MAX_STATUS_BUF_SIZE ? MAX_STATUS_BUF_SIZE: n)); if ( expected_bufsize == 0 || !p->model->status_parser_function ) { // limited support only return PSLR_OK; } else if ( expected_bufsize > 0 && expected_bufsize != n ) { DPRINT("\tWaiting for %d bytes but got %d\n", expected_bufsize, n); return PSLR_READ_ERROR; } else { // everything OK (*p->model->status_parser_function)(p, status); if ( p->model->need_exposure_mode_conversion ) { status->exposure_mode = exposure_mode_conversion( status->exposure_mode ); } if ( p->model->bufmask_command ) { uint32_t x, y; int ret; ret = pslr_get_buffer_status(p, &x, &y); if (ret != PSLR_OK) { return ret; } status->bufmask = x; } return PSLR_OK; } } // fullpress: take picture // halfpress: autofocus static int ipslr_press_shutter(ipslr_handle_t *p, bool fullpress) { DPRINT("[C]\t\tipslr_press_shutter(fullpress = %s)\n", (fullpress ? "true" : "false")); int r; CHECK(ipslr_status_full(p, &p->status)); DPRINT("\t\tbefore: mask=0x%x\n", p->status.bufmask); CHECK(ipslr_write_args(p, 1, fullpress ? 2 : 1)); CHECK(command(p->fd, 0x10, X10_SHUTTER, 0x04)); r = get_status(p->fd); DPRINT("\t\tshutter result code: 0x%x\n", r); return PSLR_OK; } static int ipslr_select_buffer(ipslr_handle_t *p, int bufno, pslr_buffer_type buftype, int bufres) { int r; DPRINT("\t\tSelect buffer %d,%d,%d,0\n", bufno, buftype, bufres); if ( !p->model->old_scsi_command ) { CHECK(ipslr_write_args(p, 4, bufno, buftype, bufres, 0)); CHECK(command(p->fd, 0x02, 0x01, 0x10)); } else { /* older cameras: 3-arg select buffer */ CHECK(ipslr_write_args(p, 4, bufno, buftype, bufres)); CHECK(command(p->fd, 0x02, 0x01, 0x0c)); } r = get_status(p->fd); if (r != 0) { return PSLR_COMMAND_ERROR; } return PSLR_OK; } static int ipslr_next_segment(ipslr_handle_t *p) { DPRINT("[C]\t\tipslr_next_segment()\n"); int r; CHECK(ipslr_write_args(p, 1, 0)); CHECK(command(p->fd, 0x04, 0x01, 0x04)); usleep(100000); // needed !! 100 too short, 1000 not short enough for PEF r = get_status(p->fd); if (r == 0) { return PSLR_OK; } return PSLR_COMMAND_ERROR; } static int ipslr_buffer_segment_info(ipslr_handle_t *p, pslr_buffer_segment_info *pInfo) { DPRINT("[C]\t\tipslr_buffer_segment_info()\n"); uint8_t buf[16]; uint32_t n; int num_try = 20; pInfo->b = 0; while ( pInfo->b == 0 && --num_try > 0 ) { CHECK(command(p->fd, 0x04, 0x00, 0x00)); n = get_result(p->fd); if (n != 16) { return PSLR_READ_ERROR; } CHECK(read_result(p->fd, buf, 16)); // use the right function based on the endian. get_uint32_func get_uint32_func_ptr; if (p->model->is_little_endian) { get_uint32_func_ptr = get_uint32_le; } else { get_uint32_func_ptr = get_uint32_be; } pInfo->a = (*get_uint32_func_ptr)(&buf[0]); pInfo->b = (*get_uint32_func_ptr)(&buf[4]); pInfo->addr = (*get_uint32_func_ptr)(&buf[8]); pInfo->length = (*get_uint32_func_ptr)(&buf[12]); if ( pInfo-> b == 0 ) { DPRINT("\tWaiting for segment info addr: 0x%x len: %d B=%d\n", pInfo->addr, pInfo->length, pInfo->b); sleep_sec( 0.1 ); } } return PSLR_OK; } static int ipslr_download(ipslr_handle_t *p, uint32_t addr, uint32_t length, uint8_t *buf) { DPRINT("[C]\t\tipslr_download(address = 0x%X, length = %d)\n", addr, length); uint8_t downloadCmd[8] = {0xf0, 0x24, 0x06, 0x02, 0x00, 0x00, 0x00, 0x00}; uint32_t block; int n; int retry; uint32_t length_start = length; retry = 0; while (length > 0) { if (length > BLKSZ) { block = BLKSZ; } else { block = length; } //DPRINT("Get 0x%x bytes from 0x%x\n", block, addr); CHECK(ipslr_write_args(p, 2, addr, block)); CHECK(command(p->fd, 0x06, 0x00, 0x08)); get_status(p->fd); n = scsi_read(p->fd, downloadCmd, sizeof (downloadCmd), buf, block); get_status(p->fd); if (n < 0) { if (retry < BLOCK_RETRY) { retry++; continue; } return PSLR_READ_ERROR; } buf += n; length -= n; addr += n; retry = 0; if (progress_callback) { progress_callback(length_start - length, length_start); } } return PSLR_OK; } static int ipslr_identify(ipslr_handle_t *p) { DPRINT("[C]\t\tipslr_identify()\n"); uint8_t idbuf[8]; int n; CHECK(command(p->fd, 0, 4, 0)); n = get_result(p->fd); if (n != 8) { return PSLR_READ_ERROR; } CHECK(read_result(p->fd, idbuf, 8)); // Check the camera endian, which affect ID if (idbuf[0] == 0) { p->id = get_uint32_be(&idbuf[0]); } else { p->id = get_uint32_le(&idbuf[0]); } DPRINT("\tid of the camera: %x\n", p->id); p->model = pslr_find_model_by_id( p->id ); return PSLR_OK; } int pslr_get_datetime(pslr_handle_t *h, int *year, int *month, int *day, int *hour, int *min, int *sec) { ipslr_handle_t *p = (ipslr_handle_t *) h; DPRINT("[C]\t\tipslr_get_datetime()\n"); uint8_t idbuf[800]; int n; CHECK(command(p->fd, 0x20, 0x06, 0)); n = get_result(p->fd); DPRINT("[C]\t\tipslr_get_datetime() bytes: %d\n",n); if (n!= 24) { return PSLR_READ_ERROR; } CHECK(read_result(p->fd, idbuf, n)); get_uint32_func get_uint32_func_ptr; if (p->model->is_little_endian) { get_uint32_func_ptr = get_uint32_le; } else { get_uint32_func_ptr = get_uint32_be; } *year = (*get_uint32_func_ptr)(idbuf); *month = (*get_uint32_func_ptr)(idbuf+4); *day = (*get_uint32_func_ptr)(idbuf+8); *hour = (*get_uint32_func_ptr)(idbuf+12); *min = (*get_uint32_func_ptr)(idbuf+16); *sec = (*get_uint32_func_ptr)(idbuf+20); return PSLR_OK; } int pslr_get_dspinfo(pslr_handle_t *h, char* firmware) { ipslr_handle_t *p = (ipslr_handle_t *) h; DPRINT("[C]\t\tipslr_get_dspinfo()\n"); uint8_t buf[4]; int n; CHECK(command(p->fd, 0x01, 0x01, 0)); n = get_result(p->fd); DPRINT("[C]\t\tipslr_get_dspinfo() bytes: %d\n",n); if (n!= 4) { return PSLR_READ_ERROR; } CHECK(read_result(p->fd, buf, n)); if (p->model->is_little_endian) { snprintf( firmware, 16, "%d.%02d.%02d.%02d", buf[3], buf[2], buf[1], buf[0]); } else { snprintf( firmware, 16, "%d.%02d.%02d.%02d", buf[0], buf[1], buf[2], buf[3]); } return PSLR_OK; } int pslr_get_setting(pslr_handle_t *h, int offset, uint32_t *value) { ipslr_handle_t *p = (ipslr_handle_t *) h; DPRINT("[C]\t\tipslr_get_setting(%d)\n", offset); uint8_t buf[4]; int n; CHECK(ipslr_write_args(p, 1, offset)); CHECK(command(p->fd, 0x20, 0x09, 4)); n = get_result(p->fd); DPRINT("[C]\t\tipslr_get_setting() bytes: %d\n",n); if (n!= 4) { return PSLR_READ_ERROR; } CHECK(read_result(p->fd, buf, n)); get_uint32_func get_uint32_func_ptr; if (p->model->is_little_endian) { get_uint32_func_ptr = get_uint32_le; } else { get_uint32_func_ptr = get_uint32_be; } *value = (*get_uint32_func_ptr)(buf); return PSLR_OK; } int pslr_set_setting(pslr_handle_t *h, int offset, uint32_t value) { ipslr_handle_t *p = (ipslr_handle_t *) h; DPRINT("[C]\t\tipslr_set_setting(%d)=%d\n", offset, value); CHECK(ipslr_cmd_00_09(p, 1)); CHECK(ipslr_write_args(p, 2, offset, value)); CHECK(command(p->fd, 0x20, 0x08, 8)); CHECK(ipslr_cmd_00_09(p, 2)); return PSLR_OK; } int pslr_set_setting_by_name(pslr_handle_t *h, char *name, uint32_t value) { ipslr_handle_t *p = (ipslr_handle_t *) h; int def_num; char cameraid[10]; sprintf(cameraid, "0x%0x", p->model->id); // printf("cameraid: %s\n", cameraid); pslr_setting_def_t *defs = setting_file_process(cameraid, &def_num); pslr_setting_def_t *setting_def = pslr_find_setting_by_name(defs, def_num, name); if (setting_def != NULL) { if (strcmp(setting_def->type,"boolean") == 0) { pslr_set_setting(h, setting_def->address, value); } else if (strcmp(setting_def->type, "uint16") == 0) { pslr_set_setting(h, setting_def->address, value >> 8); pslr_set_setting(h, setting_def->address+1, value & 0xff); } } return PSLR_OK; } bool pslr_has_setting_by_name(pslr_handle_t *h, char *name) { ipslr_handle_t *p = (ipslr_handle_t *) h; int def_num; char cameraid[10]; sprintf(cameraid, "0x%0x", p->model->id); pslr_setting_def_t *defs = setting_file_process(cameraid, &def_num); pslr_setting_def_t *setting_def = pslr_find_setting_by_name(defs, def_num, name); // printf("%d %d\n", def_num, (setting_def != NULL)); return (setting_def != NULL); } int pslr_get_settings(pslr_handle_t *h) { ipslr_handle_t *p = (ipslr_handle_t *) h; int index=0; uint32_t value; int ret; while (indexsettings_buffer[index] = value; ++index; } return PSLR_OK; } int pslr_get_settings_json(pslr_handle_t h, pslr_settings *ps) { DPRINT("[C]\tpslr_get_settings_json()\n"); ipslr_handle_t *p = (ipslr_handle_t *) h; memset( ps, 0, sizeof( pslr_settings )); CHECK(pslr_get_settings(h)); char cameraid[20]; sprintf(cameraid, "0x%05x", p->id); DPRINT("cameraid:%s\n", cameraid); ipslr_settings_parser_json(cameraid, p, &p->settings); memcpy(ps, &p->settings, sizeof (pslr_settings)); return PSLR_OK; } static int _ipslr_write_args(uint8_t cmd_2, ipslr_handle_t *p, int n, ...) { va_list ap; uint8_t cmd[8] = {0xf0, 0x4f, cmd_2, 0x00, 0x00, 0x00, 0x00, 0x00}; uint8_t buf[4 * n]; FDTYPE fd = p->fd; int res; int i; uint32_t data; // print debug info va_start(ap, n); DPRINT("[C]\t\t\t_ipslr_write_args(cmd_2 = 0x%x, {", cmd_2); for (i = 0; i < n; i++) { if (i > 0) { DPRINT(", "); } DPRINT("0x%X", va_arg(ap, uint32_t)); } DPRINT("})\n"); va_end(ap); va_start(ap, n); if ( p->model && !p->model->old_scsi_command ) { /* All at once */ for (i = 0; i < n; i++) { data = va_arg(ap, uint32_t); if (p->model == NULL || !p->model->is_little_endian) { set_uint32_be(data, &buf[4*i]); } else { set_uint32_le(data, &buf[4*i]); } } cmd[4] = 4 * n; res = scsi_write(fd, cmd, sizeof (cmd), buf, 4 * n); if (res != PSLR_OK) { va_end(ap); return res; } } else { /* Arguments one by one */ for (i = 0; i < n; i++) { data = va_arg(ap, uint32_t); if (p->model == NULL || !p->model->is_little_endian) { set_uint32_be(data, &buf[0]); } else { set_uint32_le(data, &buf[0]); } cmd[4] = 4; cmd[2] = i * 4; res = scsi_write(fd, cmd, sizeof (cmd), buf, 4); if (res != PSLR_OK) { va_end(ap); return res; } } } va_end(ap); return PSLR_OK; } static int command(FDTYPE fd, int a, int b, int c) { DPRINT("[C]\t\t\tcommand(fd=%x, %x, %x, %x)\n", fd, a, b, c); uint8_t cmd[8] = {0xf0, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; cmd[2] = a; cmd[3] = b; cmd[4] = c; CHECK(scsi_write(fd, cmd, sizeof (cmd), 0, 0)); return PSLR_OK; } static int read_status(FDTYPE fd, uint8_t *buf) { uint8_t cmd[8] = {0xf0, 0x26, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; int n; n = scsi_read(fd, cmd, 8, buf, 8); if (n != 8) { DPRINT("\tOnly got %d bytes\n", n); /* The *ist DS doesn't know to return the correct number of read bytes for this command, so return PSLR_OK instead of PSLR_READ_ERROR */ return PSLR_OK; } return PSLR_OK; } static int get_status(FDTYPE fd) { DPRINT("[C]\t\t\tget_status(0x%x)\n", fd); uint8_t statusbuf[8]; memset(statusbuf,0,8); while (1) { CHECK(read_status(fd, statusbuf)); DPRINT("[R]\t\t\t\t => ERROR: 0x%02X\n", statusbuf[7]); if (statusbuf[7] != 0x01) { break; } usleep(POLL_INTERVAL); } if (statusbuf[7] != 0) { DPRINT("\tERROR: 0x%x\n", statusbuf[7]); } return statusbuf[7]; } static int get_result(FDTYPE fd) { DPRINT("[C]\t\t\tget_result(0x%x)\n", fd); uint8_t statusbuf[8]; while (1) { //DPRINT("read out status\n"); CHECK(read_status(fd, statusbuf)); //hexdump_debug(statusbuf, 8); if (statusbuf[6] == 0x01) { break; } //DPRINT("Waiting for result\n"); //hexdump_debug(statusbuf, 8); usleep(POLL_INTERVAL); } if ((statusbuf[7] & 0xff) != 0) { DPRINT("\tERROR: 0x%x\n", statusbuf[7]); return -1; } else { DPRINT("[R]\t\t\t\t => [%02X %02X %02X %02X]\n", statusbuf[0], statusbuf[1], statusbuf[2], statusbuf[3]); } return statusbuf[0] | statusbuf[1] << 8 | statusbuf[2] << 16 | statusbuf[3] << 24; } static int read_result(FDTYPE fd, uint8_t *buf, uint32_t n) { DPRINT("[C]\t\t\tread_result(0x%x, size=%d)\n", fd, n); uint8_t cmd[8] = {0xf0, 0x49, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; int r; uint32_t i; set_uint32_le(n, &cmd[4]); r = scsi_read(fd, cmd, sizeof (cmd), buf, n); if ((uint32_t)r != n) { return PSLR_READ_ERROR; } else { // Print first 32 bytes of the result. DPRINT("[R]\t\t\t\t => ["); for (i = 0; i < n && i < 32; ++i) { if (i > 0) { if (i % 16 == 0) { DPRINT("\n\t\t\t\t "); } else if ((i%4) == 0 ) { DPRINT(" "); } DPRINT(" "); } DPRINT("%02X", buf[i]); } if (n > 32) { DPRINT(" ... (%d bytes more)", (n-32)); } DPRINT("]\n"); } return PSLR_OK; } char *pslr_copyright() { char *ret = malloc(sizeof(char)*1024); sprintf(ret, "Copyright (C) 2011-2019 Andras Salamon\n\ \n\ Based on:\n\ pslr-shoot (C) 2009 Ramiro Barreiro\n\ PK-Remote (C) 2008 Pontus Lidman \n\n"); return ret; } libpktriggercord-0.85.1/src/pslr_scsi_linux.c0000644000175100017510000002147214136175550020562 0ustar debiandebian/* pkTriggerCord Copyright (C) 2011-2019 Andras Salamon Remote control of Pentax DSLR cameras. based on: PK-Remote Remote control of Pentax DSLR cameras. Copyright (C) 2008 Pontus Lidman This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU General Public License and GNU Lesser General Public License along with this program. If not, see . */ #include #include #include #include #include #include #ifdef ANDROID #include "android_scsi_sg.h" #else #include #endif #include #include #include "pslr_log.h" #include "pslr_model.h" #include "pslr_scsi.h" static const int MAX_DEVICE_NUM = 256; void print_scsi_error(sg_io_hdr_t *pIo, uint8_t *sense_buffer) { int k; if (pIo->sb_len_wr > 0) { DPRINT("SCSI error: sense data: "); for (k = 0; k < pIo->sb_len_wr; ++k) { if ((k > 0) && (0 == (k % 10))) { DPRINT("\n "); } DPRINT("0x%02x ", sense_buffer[k]); } DPRINT("\n"); } if (pIo->masked_status) { DPRINT("SCSI status=0x%x\n", pIo->status); } if (pIo->host_status) { DPRINT("host_status=0x%x\n", pIo->host_status); } if (pIo->driver_status) { DPRINT("driver_status=0x%x\n", pIo->driver_status); } } const char* device_dirs[2] = {"/sys/class/scsi_generic", "/sys/block"}; const int device_dir_num = sizeof(device_dirs)/sizeof(device_dirs[0]); char **get_drives(int *drive_num) { DIR *d; struct dirent *ent; char *tmp[MAX_DEVICE_NUM]; char **ret=NULL; int j=0,jj; int di; for (di=0; did_name, ".") != 0 && strcmp(ent->d_name, "..") != 0 && strncmp(ent->d_name, "loop",4) != 0) { tmp[j] = strdup( ent->d_name ); ++j; } } closedir(d); } else { DPRINT("Cannot open %s\n", device_dirs[di]); } } *drive_num = j; if (j>0) { ret = malloc( j * sizeof(char*) ); for ( jj=0; jj>> ["); for (i = 0; i < cmdLen; ++i) { if (i > 0) { DPRINT(" "); if ((i%4) == 0 ) { DPRINT(" "); } } DPRINT("%02X", cmd[i]); } DPRINT("]\n"); r = ioctl(sg_fd, SG_IO, &io); if (r == -1) { perror("ioctl"); return -PSLR_DEVICE_ERROR; } if ((io.info & SG_INFO_OK_MASK) != SG_INFO_OK) { print_scsi_error(&io, sense); return -PSLR_SCSI_ERROR; } else { DPRINT("[S]\t\t\t\t\t <<< ["); for (i = 0; i < 32 && i < (bufLen - io.resid); ++i) { if (i > 0) { DPRINT(" "); if (i % 16 == 0) { DPRINT("\n\t\t\t\t\t "); } else if ((i%4) == 0 ) { DPRINT(" "); } } DPRINT("%02X", buf[i]); } DPRINT("]\n"); /* Older Pentax DSLR will report all bytes remaining, so make * a special case for this (treat it as all bytes read). */ if ((uint32_t)io.resid == bufLen) { return bufLen; } else { return bufLen - io.resid; } } } int scsi_write(int sg_fd, uint8_t *cmd, uint32_t cmdLen, uint8_t *buf, uint32_t bufLen) { sg_io_hdr_t io; uint8_t sense[32]; int r; uint32_t i; memset(&io, 0, sizeof (io)); io.interface_id = 'S'; io.cmd_len = cmdLen; /* io.iovec_count = 0; */ /* memset takes care of this */ io.mx_sb_len = sizeof (sense); io.dxfer_direction = SG_DXFER_TO_DEV; io.dxfer_len = bufLen; io.dxferp = buf; io.cmdp = cmd; io.sbp = sense; io.timeout = 20000; /* 20000 millisecs == 20 seconds */ /* io.flags = 0; */ /* take defaults: indirect IO, etc */ /* io.pack_id = 0; */ /* io.usr_ptr = NULL; */ /* print debug scsi cmd */ DPRINT("[S]\t\t\t\t\t >>> ["); for (i = 0; i < cmdLen; ++i) { if (i > 0) { DPRINT(" "); if ((i%4) == 0 ) { DPRINT(" "); } } DPRINT("%02X", cmd[i]); } DPRINT("]\n"); if (bufLen > 0) { /* print debug write buffer */ DPRINT("[S]\t\t\t\t\t >>> ["); for (i = 0; i < 32 && i < bufLen; ++i) { if (i > 0) { DPRINT(" "); if (i % 16 == 0) { DPRINT("\n\t\t\t\t\t "); } else if ((i%4) == 0 ) { DPRINT(" "); } } DPRINT("%02X", buf[i]); } DPRINT("]\n"); } r = ioctl(sg_fd, SG_IO, &io); if (r == -1) { perror("ioctl"); return PSLR_DEVICE_ERROR; } if ((io.info & SG_INFO_OK_MASK) != SG_INFO_OK) { print_scsi_error(&io, sense); return PSLR_SCSI_ERROR; } else { return PSLR_OK; } } libpktriggercord-0.85.1/src/COPYING0000644000175100017510000001674314136175550016236 0ustar debiandebian GNU LESSER GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. This version of the GNU Lesser General Public License incorporates the terms and conditions of version 3 of the GNU General Public License, supplemented by the additional permissions listed below. 0. Additional Definitions. As used herein, "this License" refers to version 3 of the GNU Lesser General Public License, and the "GNU GPL" refers to version 3 of the GNU General Public License. "The Library" refers to a covered work governed by this License, other than an Application or a Combined Work as defined below. An "Application" is any work that makes use of an interface provided by the Library, but which is not otherwise based on the Library. Defining a subclass of a class defined by the Library is deemed a mode of using an interface provided by the Library. A "Combined Work" is a work produced by combining or linking an Application with the Library. The particular version of the Library with which the Combined Work was made is also called the "Linked Version". The "Minimal Corresponding Source" for a Combined Work means the Corresponding Source for the Combined Work, excluding any source code for portions of the Combined Work that, considered in isolation, are based on the Application, and not on the Linked Version. The "Corresponding Application Code" for a Combined Work means the object code and/or source code for the Application, including any data and utility programs needed for reproducing the Combined Work from the Application, but excluding the System Libraries of the Combined Work. 1. Exception to Section 3 of the GNU GPL. You may convey a covered work under sections 3 and 4 of this License without being bound by section 3 of the GNU GPL. 2. Conveying Modified Versions. If you modify a copy of the Library, and, in your modifications, a facility refers to a function or data to be supplied by an Application that uses the facility (other than as an argument passed when the facility is invoked), then you may convey a copy of the modified version: a) under this License, provided that you make a good faith effort to ensure that, in the event an Application does not supply the function or data, the facility still operates, and performs whatever part of its purpose remains meaningful, or b) under the GNU GPL, with none of the additional permissions of this License applicable to that copy. 3. Object Code Incorporating Material from Library Header Files. The object code form of an Application may incorporate material from a header file that is part of the Library. You may convey such object code under terms of your choice, provided that, if the incorporated material is not limited to numerical parameters, data structure layouts and accessors, or small macros, inline functions and templates (ten or fewer lines in length), you do both of the following: a) Give prominent notice with each copy of the object code that the Library is used in it and that the Library and its use are covered by this License. b) Accompany the object code with a copy of the GNU GPL and this license document. 4. Combined Works. You may convey a Combined Work under terms of your choice that, taken together, effectively do not restrict modification of the portions of the Library contained in the Combined Work and reverse engineering for debugging such modifications, if you also do each of the following: a) Give prominent notice with each copy of the Combined Work that the Library is used in it and that the Library and its use are covered by this License. b) Accompany the Combined Work with a copy of the GNU GPL and this license document. c) For a Combined Work that displays copyright notices during execution, include the copyright notice for the Library among these notices, as well as a reference directing the user to the copies of the GNU GPL and this license document. d) Do one of the following: 0) Convey the Minimal Corresponding Source under the terms of this License, and the Corresponding Application Code in a form suitable for, and under terms that permit, the user to recombine or relink the Application with a modified version of the Linked Version to produce a modified Combined Work, in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source. 1) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (a) uses at run time a copy of the Library already present on the user's computer system, and (b) will operate properly with a modified version of the Library that is interface-compatible with the Linked Version. e) Provide Installation Information, but only if you would otherwise be required to provide such information under section 6 of the GNU GPL, and only to the extent that such information is necessary to install and execute a modified version of the Combined Work produced by recombining or relinking the Application with a modified version of the Linked Version. (If you use option 4d0, the Installation Information must accompany the Minimal Corresponding Source and Corresponding Application Code. If you use option 4d1, you must provide the Installation Information in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.) 5. Combined Libraries. You may place library facilities that are a work based on the Library side by side in a single library together with other library facilities that are not Applications and are not covered by this License, and convey such a combined library under terms of your choice, if you do both of the following: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities, conveyed under the terms of this License. b) Give prominent notice with the combined library that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 6. Revised Versions of the GNU Lesser General Public License. The Free Software Foundation may publish revised and/or new versions of the GNU Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library as you received it specifies that a certain numbered version of the GNU Lesser General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that published version or of any later version published by the Free Software Foundation. If the Library as you received it does not specify a version number of the GNU Lesser General Public License, you may choose any version of the GNU Lesser General Public License ever published by the Free Software Foundation. If the Library as you received it specifies that a proxy can decide whether future versions of the GNU Lesser General Public License shall apply, that proxy's public statement of acceptance of any version is permanent authorization for you to choose that version for the Library. libpktriggercord-0.85.1/src/pslr_log.h0000644000175100017510000000446114136175550017167 0ustar debiandebian/* pkTriggerCord Copyright (C) 2011-2020 Andras Salamon Remote control of Pentax DSLR cameras. Support for K200D added by Jens Dreyer 04/2011 Support for K-r added by Vincenc Podobnik 06/2011 Support for K-30 added by Camilo Polymeris 09/2012 Support for K-01 added by Ethan Queen 01/2013 Support for K-3 added by Tao Wang 01/2016 based on: PK-Remote Remote control of Pentax DSLR cameras. Copyright (C) 2008 Pontus Lidman PK-Remote for Windows Copyright (C) 2010 Tomasz Kos This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU General Public License and GNU Lesser General Public License along with this program. If not, see . */ #ifndef PSLR_LOG_H #define PSLR_LOG_H #ifdef ANDROID #include #define DPRINT(...) __android_log_print(ANDROID_LOG_DEBUG, "PkTriggerCord", __VA_ARGS__) #else #ifdef LIBGPHOTO #include #define DPRINT(x...) gp_log (GP_LOG_DEBUG, "pentax", x) #else #define DPRINT(x...) pslr_write_log(PSLR_DEBUG, x) #endif #endif #define PSLR_DEBUG_ENABLED pslr_verbosity_enabled(PSLR_DEBUG) #include typedef enum { PSLR_DEBUG, PSLR_WARNING, PSLR_ERROR, PSLR_SILENT, } pslr_verbosity_t; extern pslr_verbosity_t verbosity_level; void pslr_set_verbosity(pslr_verbosity_t verbosity); pslr_verbosity_t pslr_get_verbosity(); bool pslr_verbosity_enabled(pslr_verbosity_t level); //TODO : offer a write_log_callback equivalent so a caller can fully configure what happends when pslr_write_log is called ? void pslr_write_log(pslr_verbosity_t level, const char* message, ...); #endif libpktriggercord-0.85.1/src/src/0000755000175100017510000000000014136175550015757 5ustar debiandebianlibpktriggercord-0.85.1/src/src/external/0000755000175100017510000000000014136175550017601 5ustar debiandebianlibpktriggercord-0.85.1/src/src/external/js0n/0000755000175100017510000000000014136175550020453 5ustar debiandebianlibpktriggercord-0.85.1/src/src/external/js0n/js0n.c0000644000175100017510000001020114136175550021463 0ustar debiandebian// by jeremie miller - 2014 // public domain or MIT license, contributions/improvements welcome via github at https://github.com/quartzjer/js0n #include // one strncmp() is used to do key comparison, and a strlen(key) if no len passed in // gcc started warning for the init syntax used here, is not helpful so don't generate the spam, supressing the warning is really inconsistently supported across versions #if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) #pragma GCC diagnostic push #endif #pragma GCC diagnostic ignored "-Wunknown-pragmas" #pragma GCC diagnostic ignored "-Wpragmas" #pragma GCC diagnostic ignored "-Winitializer-overrides" #pragma GCC diagnostic ignored "-Woverride-init" // only at depth 1, track start pointers to match key/value #define PUSH(i) if(depth == 1) { if(!index) { val = cur+i; }else{ if(klen && index == 1) start = cur+i; else index--; } } // determine if key matches or value is complete #define CAP(i) if(depth == 1) { if(val && !index) {*vlen = (size_t)((cur+i+1) - val); return val;}; if(klen && start) {index = (klen == (size_t)(cur-start) && strncmp(key,start,klen)==0) ? 0 : 2; start = 0;} } // this makes a single pass across the json bytes, using each byte as an index into a jump table to build an index and transition state const char *js0n(const char *key, size_t klen, const char *json, size_t jlen, size_t *vlen) { const char *val = 0; const char *cur, *end, *start; size_t index = 1; int depth = 0; int utf8_remain = 0; static void *gostruct[] = { [0 ... 255] = &&l_bad, ['\t'] = &&l_loop, [' '] = &&l_loop, ['\r'] = &&l_loop, ['\n'] = &&l_loop, ['"'] = &&l_qup, [':'] = &&l_loop,[','] = &&l_loop, ['['] = &&l_up, [']'] = &&l_down, // tracking [] and {} individually would allow fuller validation but is really messy ['{'] = &&l_up, ['}'] = &&l_down, ['-'] = &&l_bare, [48 ... 57] = &&l_bare, // 0-9 [65 ... 90] = &&l_bare, // A-Z [97 ... 122] = &&l_bare // a-z }; static void *gobare[] = { [0 ... 31] = &&l_bad, [32 ... 126] = &&l_loop, // could be more pedantic/validation-checking ['\t'] = &&l_unbare, [' '] = &&l_unbare, ['\r'] = &&l_unbare, ['\n'] = &&l_unbare, [','] = &&l_unbare, [']'] = &&l_unbare, ['}'] = &&l_unbare, [':'] = &&l_unbare, [127 ... 255] = &&l_bad }; static void *gostring[] = { [0 ... 31] = &&l_bad, [127] = &&l_bad, [32 ... 126] = &&l_loop, ['\\'] = &&l_esc, ['"'] = &&l_qdown, [128 ... 191] = &&l_bad, [192 ... 223] = &&l_utf8_2, [224 ... 239] = &&l_utf8_3, [240 ... 247] = &&l_utf8_4, [248 ... 255] = &&l_bad }; static void *goutf8_continue[] = { [0 ... 127] = &&l_bad, [128 ... 191] = &&l_utf_continue, [192 ... 255] = &&l_bad }; static void *goesc[] = { [0 ... 255] = &&l_bad, ['"'] = &&l_unesc, ['\\'] = &&l_unesc, ['/'] = &&l_unesc, ['b'] = &&l_unesc, ['f'] = &&l_unesc, ['n'] = &&l_unesc, ['r'] = &&l_unesc, ['t'] = &&l_unesc, ['u'] = &&l_unesc }; void **go = gostruct; if(!json || jlen <= 0 || !vlen) return 0; *vlen = 0; // no key is array mode, klen provides requested index if(!key) { index = klen; klen = 0; }else{ if(klen <= 0) klen = strlen(key); // convenience } for(start=cur=json,end=cur+jlen; cur 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) #pragma GCC diagnostic pop #endif libpktriggercord-0.85.1/src/src/external/js0n/js0n.h0000644000175100017510000000106514136175550021500 0ustar debiandebian// key = string to match or null // klen = key length (or 0), or if null key then len is the array offset value // json = json object or array // jlen = length of json // vlen = where to store return value length // returns pointer to value and sets len to value length, or 0 if not found // any parse error will set vlen to the position of the error #include #ifdef __cplusplus extern "C" { #endif const char *js0n(const char *key, size_t klen, const char *json, size_t jlen, size_t *vlen); #ifdef __cplusplus } /* extern "C" */ #endif libpktriggercord-0.85.1/src/src/external/readme.txt0000644000175100017510000000015314136175550021576 0ustar debiandebianThis directory contains external source files: js0n - https://github.com/quartzjer/js0n by Jeremie Miller libpktriggercord-0.85.1/src/pslr_scsi_win.c0000644000175100017510000002030014136175550020205 0ustar debiandebian/* pkTriggerCord Copyright (C) 2011-2019 Andras Salamon Remote control of Pentax DSLR cameras. based on: PK-Remote Remote control of Pentax DSLR cameras. Copyright (C) 2008 Pontus Lidman This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU General Public License and GNU Lesser General Public License along with this program. If not, see . */ #include #include #include #include #include #include #include #include #include #include "pslr_scsi.h" #define IOCTL_SCSI_PASS_THROUGH_DIRECT 0x4D014 #define SCSI_IOCTL_DATA_IN 1 #define SCSI_IOCTL_DATA_OUT 0 typedef struct _SCSI_PASS_THROUGH_DIRECT { USHORT Length; UCHAR ScsiStatus; UCHAR PathId; UCHAR TargetId; UCHAR Lun; UCHAR CdbLength; UCHAR SenseInfoLength; UCHAR DataIn; ULONG DataTransferLength; ULONG TimeOutValue; PVOID DataBuffer; ULONG SenseInfoOffset; UCHAR Cdb[16]; } SCSI_PASS_THROUGH_DIRECT; typedef struct _SCSI_PASS_THROUGH_WITH_BUFFER { SCSI_PASS_THROUGH_DIRECT sptd; ULONG Filler; // realign buffers to double word boundary UCHAR ucSenseBuf[32]; } SCSI_PASS_THROUGH_WITH_BUFFER; char **get_drives(int *driveNum) { char **ret; ret = malloc( ('Z'-'C'+1) * sizeof(char *)); int driveLetter; int j=0; for ( driveLetter = 'C'; driveLetter<='Z'; ++driveLetter ) { #ifdef RAD10 // These Drive types cant be a Pentax. The RAD10 debugger breaks here. TCHAR root[4]; snprintf(root, 4, "%c:\\", driveLetter); switch (GetDriveType(root)) { case DRIVE_UNKNOWN: case DRIVE_NO_ROOT_DIR: case DRIVE_FIXED: case DRIVE_REMOTE: case DRIVE_CDROM: continue; default: ; } #endif ret[j] = malloc( 2 * sizeof (char) ); snprintf(ret[j], 2, "%c", driveLetter); ++j; } *driveNum = j; return ret; } pslr_result get_drive_info(char* drive_name, int* device, char* vendor_id, int vendor_id_size_max, char* product_id, int product_id_size_max ) { bool Status; STORAGE_PROPERTY_QUERY query; STORAGE_DEVICE_DESCRIPTOR* pdescriptor; byte descriptorBuf[256]; DWORD bytesRead; pslr_result drive_status = PSLR_DEVICE_ERROR; HANDLE hDrive; char fullDriveName[7]; vendor_id[0] = '\0'; product_id[0] = '\0'; query.PropertyId = StorageDeviceProperty; query.QueryType = PropertyStandardQuery; snprintf( fullDriveName, 7, "\\\\.\\%s:", drive_name); hDrive = CreateFile(fullDriveName, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL); if (hDrive != INVALID_HANDLE_VALUE) { Status = DeviceIoControl(hDrive, IOCTL_STORAGE_QUERY_PROPERTY, &query, sizeof(query), &descriptorBuf, sizeof(descriptorBuf), &bytesRead, (LPOVERLAPPED)0); if (Status==FALSE) { int LastError = GetLastError(); //lastError alwasy return 1450 if (LastError != 0) { CancelIo(hDrive); } } else { *device = (int)hDrive; drive_status = PSLR_OK; pdescriptor = (STORAGE_DEVICE_DESCRIPTOR *)descriptorBuf; if (pdescriptor->VendorIdOffset != 0) { int i = 0; while ((descriptorBuf[pdescriptor->VendorIdOffset + i] != 0) &&(i < vendor_id_size_max) ) { vendor_id[i] = descriptorBuf[pdescriptor->VendorIdOffset + i]; i++; } vendor_id[i]='\0'; } if (pdescriptor->ProductIdOffset != 0) { int i = 0; while ((descriptorBuf[pdescriptor->ProductIdOffset + i] != 0) &&(i < product_id_size_max) ) { product_id[i] = descriptorBuf[pdescriptor->ProductIdOffset + i]; i++; } product_id[i]='\0'; } } } return drive_status; } void close_drive(int *device) { CloseHandle((HANDLE)*device); } int scsi_read(int sg_fd, uint8_t *cmd, uint32_t cmdLen, uint8_t *buf, uint32_t bufLen) { SCSI_PASS_THROUGH_WITH_BUFFER sptdwb; DWORD outByte=0; int Status; int LastError=0; uint8_t dataIn[64*1024]; sptdwb.sptd.Length = sizeof(SCSI_PASS_THROUGH_DIRECT); sptdwb.sptd.ScsiStatus = 0; sptdwb.sptd.PathId = 0; sptdwb.sptd.TargetId = 0; sptdwb.sptd.Lun = 0; sptdwb.sptd.CdbLength = cmdLen; sptdwb.sptd.SenseInfoLength = sizeof(sptdwb.ucSenseBuf); sptdwb.sptd.DataIn = SCSI_IOCTL_DATA_IN; sptdwb.sptd.DataTransferLength = bufLen; sptdwb.sptd.TimeOutValue = 10; sptdwb.sptd.DataBuffer = dataIn; sptdwb.sptd.SenseInfoOffset = offsetof(SCSI_PASS_THROUGH_WITH_BUFFER,ucSenseBuf); memset(sptdwb.sptd.Cdb, 0, sizeof(sptdwb.sptd.Cdb)); memcpy(sptdwb.sptd.Cdb, cmd, cmdLen); Status=DeviceIoControl((HANDLE)sg_fd, IOCTL_SCSI_PASS_THROUGH_DIRECT, &sptdwb, sizeof(sptdwb), &sptdwb, sizeof(sptdwb), &outByte, NULL); if (Status==0) { LastError = GetLastError(); if (LastError != 0) { CancelIo((HANDLE)sg_fd); } } memcpy(buf,sptdwb.sptd.DataBuffer,bufLen); if (LastError != 0) { return -PSLR_SCSI_ERROR; } else { if (sptdwb.sptd.DataTransferLength == bufLen) { return bufLen; } else { return bufLen - sptdwb.sptd.DataTransferLength; } } } int scsi_write(int sg_fd, uint8_t *cmd, uint32_t cmdLen, uint8_t *buf, uint32_t bufLen) { SCSI_PASS_THROUGH_WITH_BUFFER sptdwb; DWORD outByte=0; int Status; int LastError=0; sptdwb.sptd.Length = sizeof(SCSI_PASS_THROUGH_DIRECT); sptdwb.sptd.ScsiStatus = 0; sptdwb.sptd.PathId = 0; sptdwb.sptd.TargetId = 0; sptdwb.sptd.Lun = 0; sptdwb.sptd.CdbLength = cmdLen; sptdwb.sptd.SenseInfoLength = sizeof(sptdwb.ucSenseBuf); sptdwb.sptd.DataIn = SCSI_IOCTL_DATA_OUT; sptdwb.sptd.DataTransferLength = bufLen; sptdwb.sptd.TimeOutValue = 10; sptdwb.sptd.DataBuffer = buf; sptdwb.sptd.SenseInfoOffset = offsetof(SCSI_PASS_THROUGH_WITH_BUFFER,ucSenseBuf); memset(sptdwb.sptd.Cdb, 0, sizeof(sptdwb.sptd.Cdb)); memcpy(sptdwb.sptd.Cdb, cmd, cmdLen); Status=DeviceIoControl((HANDLE)sg_fd, IOCTL_SCSI_PASS_THROUGH_DIRECT, &sptdwb, sizeof(sptdwb), &sptdwb, sizeof(sptdwb), &outByte, NULL); if (Status==0) { LastError = GetLastError(); if (LastError != 0) { CancelIo((HANDLE)sg_fd); } } if (LastError != 0) { return PSLR_SCSI_ERROR; } else { return PSLR_OK; } } libpktriggercord-0.85.1/src/exiftool_pentax_lens.txt0000644000175100017510000002415614136175550022172 0ustar debiandebian{0, 0, "M-42 or No Lens"}, {1, 0, "K or M Lens"}, {2, 0, "A Series Lens"}, {3, 0, "Sigma"}, {3, 17, "smc PENTAX-FA SOFT 85mm F2.8"}, {3, 18, "smc PENTAX-F 1.7X AF ADAPTER"}, {3, 19, "smc PENTAX-F 24-50mm F4"}, {3, 20, "smc PENTAX-F 35-80mm F4-5.6"}, {3, 21, "smc PENTAX-F 80-200mm F4.7-5.6"}, {3, 22, "smc PENTAX-F FISH-EYE 17-28mm F3.5-4.5"}, {3, 23, "smc PENTAX-F 100-300mm F4.5-5.6 or Sigma Lens"}, {3, 24, "smc PENTAX-F 35-135mm F3.5-4.5"}, {3, 25, "smc PENTAX-F 35-105mm F4-5.6 or Sigma or Tokina Lens"}, {3, 26, "smc PENTAX-F* 250-600mm F5.6 ED[IF]"}, {3, 27, "smc PENTAX-F 28-80mm F3.5-4.5 or Tokina Lens"}, {3, 28, "smc PENTAX-F 35-70mm F3.5-4.5 or Tokina Lens"}, {3, 29, "PENTAX-F 28-80mm F3.5-4.5 or Sigma or Tokina Lens"}, {3, 30, "PENTAX-F 70-200mm F4-5.6"}, {3, 31, "smc PENTAX-F 70-210mm F4-5.6 or Tokina or Takumar Lens"}, {3, 32, "smc PENTAX-F 50mm F1.4"}, {3, 33, "smc PENTAX-F 50mm F1.7"}, {3, 34, "smc PENTAX-F 135mm F2.8 [IF]"}, {3, 35, "smc PENTAX-F 28mm F2.8"}, {3, 36, "Sigma 20mm F1.8 EX DG Aspherical RF"}, {3, 38, "smc PENTAX-F* 300mm F4.5 ED[IF]"}, {3, 39, "smc PENTAX-F* 600mm F4 ED[IF]"}, {3, 40, "smc PENTAX-F Macro 100mm F2.8"}, {3, 41, "smc PENTAX-F Macro 50mm F2.8 or Sigma Lens"}, {3, 42, "Sigma 300mm F2.8 EX DG APO IF"}, {3, 44, "Sigma or Tamron Lens (3 44)"}, {3, 46, "Sigma or Samsung Lens (3 46)"}, {3, 50, "smc PENTAX-FA 28-70mm F4 AL"}, {3, 51, "Sigma 28mm F1.8 EX DG Aspherical Macro"}, {3, 52, "smc PENTAX-FA 28-200mm F3.8-5.6 AL[IF] or Tamron Lens"}, {3, 53, "smc PENTAX-FA 28-80mm F3.5-5.6 AL"}, {3, 247, "smc PENTAX-DA FISH-EYE 10-17mm F3.5-4.5 ED[IF]"}, {3, 248, "smc PENTAX-DA 12-24mm F4 ED AL[IF]"}, {3, 250, "smc PENTAX-DA 50-200mm F4-5.6 ED"}, {3, 251, "smc PENTAX-DA 40mm F2.8 Limited"}, {3, 252, "smc PENTAX-DA 18-55mm F3.5-5.6 AL"}, {3, 253, "smc PENTAX-DA 14mm F2.8 ED[IF]"}, {3, 254, "smc PENTAX-DA 16-45mm F4 ED AL"}, {3, 255, "Sigma Lens (3 255)"}, {4, 1, "smc PENTAX-FA SOFT 28mm F2.8"}, {4, 2, "smc PENTAX-FA 80-320mm F4.5-5.6"}, {4, 3, "smc PENTAX-FA 43mm F1.9 Limited"}, {4, 6, "smc PENTAX-FA 35-80mm F4-5.6"}, {4, 8, "Irix 150mm F2.8 Macro"}, {4, 9, "Irix 11mm F4 Firefly"}, {4, 10, "Irix 15mm F2.4"}, {4, 12, "smc PENTAX-FA 50mm F1.4"}, {4, 15, "smc PENTAX-FA 28-105mm F4-5.6 [IF]"}, {4, 16, "Tamron AF 80-210mm F4-5.6 (178D)"}, {4, 19, "Tamron SP AF 90mm F2.8 (172E)"}, {4, 20, "smc PENTAX-FA 28-80mm F3.5-5.6"}, {4, 21, "Cosina AF 100-300mm F5.6-6.7"}, {4, 22, "Tokina 28-80mm F3.5-5.6"}, {4, 23, "smc PENTAX-FA 20-35mm F4 AL"}, {4, 24, "smc PENTAX-FA 77mm F1.8 Limited"}, {4, 25, "Tamron SP AF 14mm F2.8"}, {4, 26, "smc PENTAX-FA Macro 100mm F3.5 or Cosina Lens"}, {4, 27, "Tamron AF 28-300mm F3.5-6.3 LD Aspherical[IF] Macro (185D/285D)"}, {4, 28, "smc PENTAX-FA 35mm F2 AL"}, {4, 29, "Tamron AF 28-200mm F3.8-5.6 LD Super II Macro (371D)"}, {4, 34, "smc PENTAX-FA 24-90mm F3.5-4.5 AL[IF]"}, {4, 35, "smc PENTAX-FA 100-300mm F4.7-5.8"}, {4, 36, "Tamron AF 70-300mm F4-5.6 LD Macro 1:2"}, {4, 37, "Tamron SP AF 24-135mm F3.5-5.6 AD AL (190D)"}, {4, 38, "smc PENTAX-FA 28-105mm F3.2-4.5 AL[IF]"}, {4, 39, "smc PENTAX-FA 31mm F1.8 AL Limited"}, {4, 41, "Tamron AF 28-200mm Super Zoom F3.8-5.6 Aspherical XR [IF] Macro (A03)"}, {4, 43, "smc PENTAX-FA 28-90mm F3.5-5.6"}, {4, 44, "smc PENTAX-FA J 75-300mm F4.5-5.8 AL"}, {4, 45, "Tamron Lens (4 45)"}, {4, 46, "smc PENTAX-FA J 28-80mm F3.5-5.6 AL"}, {4, 47, "smc PENTAX-FA J 18-35mm F4-5.6 AL"}, {4, 49, "Tamron SP AF 28-75mm F2.8 XR Di LD Aspherical [IF] Macro"}, {4, 51, "smc PENTAX-D FA 50mm F2.8 Macro"}, {4, 52, "smc PENTAX-D FA 100mm F2.8 Macro"}, {4, 55, "Samsung/Schneider D-XENOGON 35mm F2"}, {4, 56, "Samsung/Schneider D-XENON 100mm F2.8 Macro"}, {4, 75, "Tamron SP AF 70-200mm F2.8 Di LD [IF] Macro (A001)"}, {4, 214, "smc PENTAX-DA 35mm F2.4 AL"}, {4, 229, "smc PENTAX-DA 18-55mm F3.5-5.6 AL II"}, {4, 230, "Tamron SP AF 17-50mm F2.8 XR Di II"}, {4, 231, "smc PENTAX-DA 18-250mm F3.5-6.3 ED AL [IF]"}, {4, 237, "Samsung/Schneider D-XENOGON 10-17mm F3.5-4.5"}, {4, 239, "Samsung/Schneider D-XENON 12-24mm F4 ED AL [IF]"}, {4, 242, "smc PENTAX-DA* 16-50mm F2.8 ED AL [IF] SDM (SDM unused)"}, {4, 243, "smc PENTAX-DA 70mm F2.4 Limited"}, {4, 244, "smc PENTAX-DA 21mm F3.2 AL Limited"}, {4, 245, "Samsung/Schneider D-XENON 50-200mm F4-5.6"}, {4, 246, "Samsung/Schneider D-XENON 18-55mm F3.5-5.6"}, {4, 247, "smc PENTAX-DA FISH-EYE 10-17mm F3.5-4.5 ED[IF]"}, {4, 248, "smc PENTAX-DA 12-24mm F4 ED AL [IF]"}, {4, 249, "Tamron XR DiII 18-200mm F3.5-6.3 (A14)"}, {4, 250, "smc PENTAX-DA 50-200mm F4-5.6 ED"}, {4, 251, "smc PENTAX-DA 40mm F2.8 Limited"}, {4, 252, "smc PENTAX-DA 18-55mm F3.5-5.6 AL"}, {4, 253, "smc PENTAX-DA 14mm F2.8 ED[IF]"}, {4, 254, "smc PENTAX-DA 16-45mm F4 ED AL"}, {5, 1, "smc PENTAX-FA* 24mm F2 AL[IF]"}, {5, 2, "smc PENTAX-FA 28mm F2.8 AL"}, {5, 3, "smc PENTAX-FA 50mm F1.7"}, {5, 4, "smc PENTAX-FA 50mm F1.4"}, {5, 5, "smc PENTAX-FA* 600mm F4 ED[IF]"}, {5, 6, "smc PENTAX-FA* 300mm F4.5 ED[IF]"}, {5, 7, "smc PENTAX-FA 135mm F2.8 [IF]"}, {5, 8, "smc PENTAX-FA Macro 50mm F2.8"}, {5, 9, "smc PENTAX-FA Macro 100mm F2.8"}, {5, 10, "smc PENTAX-FA* 85mm F1.4 [IF]"}, {5, 11, "smc PENTAX-FA* 200mm F2.8 ED[IF]"}, {5, 12, "smc PENTAX-FA 28-80mm F3.5-4.7"}, {5, 13, "smc PENTAX-FA 70-200mm F4-5.6"}, {5, 14, "smc PENTAX-FA* 250-600mm F5.6 ED[IF]"}, {5, 15, "smc PENTAX-FA 28-105mm F4-5.6"}, {5, 16, "smc PENTAX-FA 100-300mm F4.5-5.6"}, {5, 98, "smc PENTAX-FA 100-300mm F4.5-5.6"}, {6, 1, "smc PENTAX-FA* 85mm F1.4 [IF]"}, {6, 2, "smc PENTAX-FA* 200mm F2.8 ED[IF]"}, {6, 3, "smc PENTAX-FA* 300mm F2.8 ED[IF]"}, {6, 4, "smc PENTAX-FA* 28-70mm F2.8 AL"}, {6, 5, "smc PENTAX-FA* 80-200mm F2.8 ED[IF]"}, {6, 6, "smc PENTAX-FA* 28-70mm F2.8 AL"}, {6, 7, "smc PENTAX-FA* 80-200mm F2.8 ED[IF]"}, {6, 8, "smc PENTAX-FA 28-70mm F4AL"}, {6, 9, "smc PENTAX-FA 20mm F2.8"}, {6, 10, "smc PENTAX-FA* 400mm F5.6 ED[IF]"}, {6, 13, "smc PENTAX-FA* 400mm F5.6 ED[IF]"}, {6, 14, "smc PENTAX-FA* Macro 200mm F4 ED[IF]"}, {7, 0, "smc PENTAX-DA 21mm F3.2 AL Limited"}, {7, 58, "smc PENTAX-D FA Macro 100mm F2.8 WR"}, {7, 75, "Tamron SP AF 70-200mm F2.8 Di LD [IF] Macro (A001)"}, {7, 201, "smc Pentax-DA L 50-200mm F4-5.6 ED WR"}, {7, 202, "smc PENTAX-DA L 18-55mm F3.5-5.6 AL WR"}, {7, 203, "HD PENTAX-DA 55-300mm F4-5.8 ED WR"}, {7, 204, "HD PENTAX-DA 15mm F4 ED AL Limited"}, {7, 205, "HD PENTAX-DA 35mm F2.8 Macro Limited"}, {7, 206, "HD PENTAX-DA 70mm F2.4 Limited"}, {7, 207, "HD PENTAX-DA 21mm F3.2 ED AL Limited"}, {7, 208, "HD PENTAX-DA 40mm F2.8 Limited"}, {7, 212, "smc PENTAX-DA 50mm F1.8"}, {7, 213, "smc PENTAX-DA 40mm F2.8 XS"}, {7, 214, "smc PENTAX-DA 35mm F2.4 AL"}, {7, 216, "smc PENTAX-DA L 55-300mm F4-5.8 ED"}, {7, 217, "smc PENTAX-DA 50-200mm F4-5.6 ED WR"}, {7, 218, "smc PENTAX-DA 18-55mm F3.5-5.6 AL WR"}, {7, 220, "Tamron SP AF 10-24mm F3.5-4.5 Di II LD Aspherical [IF]"}, {7, 221, "smc PENTAX-DA L 50-200mm F4-5.6 ED"}, {7, 222, "smc PENTAX-DA L 18-55mm F3.5-5.6"}, {7, 223, "Samsung/Schneider D-XENON 18-55mm F3.5-5.6 II"}, {7, 224, "smc PENTAX-DA 15mm F4 ED AL Limited"}, {7, 225, "Samsung/Schneider D-XENON 18-250mm F3.5-6.3"}, {7, 226, "smc PENTAX-DA* 55mm F1.4 SDM (SDM unused)"}, {7, 227, "smc PENTAX-DA* 60-250mm F4 [IF] SDM (SDM unused)"}, {7, 228, "Samsung 16-45mm F4 ED"}, {7, 229, "smc PENTAX-DA 18-55mm F3.5-5.6 AL II"}, {7, 230, "Tamron AF 17-50mm F2.8 XR Di-II LD (Model A16)"}, {7, 231, "smc PENTAX-DA 18-250mm F3.5-6.3 ED AL [IF]"}, {7, 233, "smc PENTAX-DA 35mm F2.8 Macro Limited"}, {7, 234, "smc PENTAX-DA* 300mm F4 ED [IF] SDM (SDM unused)"}, {7, 235, "smc PENTAX-DA* 200mm F2.8 ED [IF] SDM (SDM unused)"}, {7, 236, "smc PENTAX-DA 55-300mm F4-5.8 ED"}, {7, 238, "Tamron AF 18-250mm F3.5-6.3 Di II LD Aspherical [IF] Macro"}, {7, 241, "smc PENTAX-DA* 50-135mm F2.8 ED [IF] SDM (SDM unused)"}, {7, 242, "smc PENTAX-DA* 16-50mm F2.8 ED AL [IF] SDM (SDM unused)"}, {7, 243, "smc PENTAX-DA 70mm F2.4 Limited"}, {7, 244, "smc PENTAX-DA 21mm F3.2 AL Limited"}, {8, 0, "Sigma 50-150mm F2.8 II APO EX DC HSM"}, {8, 3, "Sigma 18-125mm F3.8-5.6 DC HSM"}, {8, 4, "Sigma 50mm F1.4 EX DG HSM"}, {8, 6, "Sigma 4.5mm F2.8 EX DC Fisheye"}, {8, 7, "Sigma 24-70mm F2.8 IF EX DG HSM"}, {8, 8, "Sigma 18-250mm F3.5-6.3 DC OS HSM"}, {8, 11, "Sigma 10-20mm F3.5 EX DC HSM"}, {8, 12, "Sigma 70-300mm F4-5.6 DG OS"}, {8, 13, "Sigma 120-400mm F4.5-5.6 APO DG OS HSM"}, {8, 14, "Sigma 17-70mm F2.8-4.0 DC Macro OS HSM"}, {8, 15, "Sigma 150-500mm F5-6.3 APO DG OS HSM"}, {8, 16, "Sigma 70-200mm F2.8 EX DG Macro HSM II"}, {8, 17, "Sigma 50-500mm F4.5-6.3 DG OS HSM"}, {8, 18, "Sigma 8-16mm F4.5-5.6 DC HSM"}, {8, 20, "Sigma 18-50mm F2.8-4.5 DC HSM"}, {8, 21, "Sigma 17-50mm F2.8 EX DC OS HSM"}, {8, 22, "Sigma 85mm F1.4 EX DG HSM"}, {8, 23, "Sigma 70-200mm F2.8 APO EX DG OS HSM"}, {8, 25, "Sigma 17-50mm F2.8 EX DC HSM"}, {8, 27, "Sigma 18-200mm F3.5-6.3 II DC HSM"}, {8, 28, "Sigma 18-250mm F3.5-6.3 DC Macro HSM"}, {8, 29, "Sigma 35mm F1.4 DG HSM"}, {8, 30, "Sigma 17-70mm F2.8-4 DC Macro HSM | C"}, {8, 31, "Sigma 18-35mm F1.8 DC HSM"}, {8, 32, "Sigma 30mm F1.4 DC HSM | A"}, {8, 33, "Sigma 18-200mm F3.5-6.3 DC Macro HSM"}, {8, 34, "Sigma 18-300mm F3.5-6.3 DC Macro HSM"}, {8, 59, "HD PENTAX-D FA 150-450mm F4.5-5.6 ED DC AW"}, {8, 60, "HD PENTAX-D FA* 70-200mm F2.8 ED DC AW"}, {8, 61, "HD PENTAX-D FA 28-105mm F3.5-5.6 ED DC WR"}, {8, 62, "HD PENTAX-D FA 24-70mm F2.8 ED SDM WR"}, {8, 63, "HD PENTAX-D FA 15-30mm F2.8 ED SDM WR"}, {8, 64, "HD PENTAX-D FA* 50mm F1.4 SDM AW"}, {8, 65, "HD PENTAX-D FA 70-210mm F4 ED SDM WR"}, {8, 196, "HD PENTAX-DA* 11-18mm F2.8 ED DC AW"}, {8, 197, "HD PENTAX-DA 55-300mm F4.5-6.3 ED PLM WR RE"}, {8, 198, "smc PENTAX-DA L 18-50mm F4-5.6 DC WR RE"}, {8, 199, "HD PENTAX-DA 18-50mm F4-5.6 DC WR RE"}, {8, 200, "HD PENTAX-DA 16-85mm F3.5-5.6 ED DC WR"}, {8, 209, "HD PENTAX-DA 20-40mm F2.8-4 ED Limited DC WR"}, {8, 210, "smc PENTAX-DA 18-270mm F3.5-6.3 ED SDM"}, {8, 211, "HD PENTAX-DA 560mm F5.6 ED AW"}, {8, 215, "smc PENTAX-DA 18-135mm F3.5-5.6 ED AL [IF] DC WR"}, {8, 226, "smc PENTAX-DA* 55mm F1.4 SDM"}, {8, 227, "smc PENTAX-DA* 60-250mm F4 [IF] SDM"}, {8, 232, "smc PENTAX-DA 17-70mm F4 AL [IF] SDM"}, {8, 234, "smc PENTAX-DA* 300mm F4 ED [IF] SDM"}, {8, 235, "smc PENTAX-DA* 200mm F2.8 ED [IF] SDM"}, {8, 241, "smc PENTAX-DA* 50-135mm F2.8 ED [IF] SDM"}, {8, 242, "smc PENTAX-DA* 16-50mm F2.8 ED AL [IF] SDM"}, {8, 255, "Sigma Lens (8 255)"}, {9, 0, "645 Manual Lens"}, libpktriggercord-0.85.1/src/pslr_model.h0000644000175100017510000001677614136175550017522 0ustar debiandebian/* pkTriggerCord Copyright (C) 2011-2019 Andras Salamon Remote control of Pentax DSLR cameras. Support for K200D added by Jens Dreyer 04/2011 Support for K-r added by Vincenc Podobnik 06/2011 Support for K-30 added by Camilo Polymeris 09/2012 Support for K-01 added by Ethan Queen 01/2013 Support for K-3 added by Tao Wang 01/2016 based on: PK-Remote Remote control of Pentax DSLR cameras. Copyright (C) 2008 Pontus Lidman PK-Remote for Windows Copyright (C) 2010 Tomasz Kos This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU General Public License and GNU Lesser General Public License along with this program. If not, see . */ #ifndef PSLR_MODEL_H #define PSLR_MODEL_H #include "pslr_enum.h" #include "pslr_scsi.h" #define MAX_RESOLUTION_SIZE 4 #define MAX_STATUS_BUF_SIZE 456 #define SETTINGS_BUFFER_SIZE 1024 #define MAX_SEGMENTS 4 typedef struct ipslr_handle ipslr_handle_t; typedef struct { int32_t nom; int32_t denom; } pslr_rational_t; typedef struct { uint16_t bufmask; uint32_t current_iso; pslr_rational_t current_shutter_speed; pslr_rational_t current_aperture; pslr_rational_t lens_max_aperture; pslr_rational_t lens_min_aperture; pslr_rational_t set_shutter_speed; pslr_rational_t set_aperture; pslr_rational_t max_shutter_speed; uint32_t auto_bracket_mode; pslr_rational_t auto_bracket_ev; uint32_t auto_bracket_picture_count; uint32_t auto_bracket_picture_counter; uint32_t fixed_iso; uint32_t jpeg_resolution; uint32_t jpeg_saturation; uint32_t jpeg_quality; uint32_t jpeg_contrast; uint32_t jpeg_sharpness; uint32_t jpeg_image_tone; uint32_t jpeg_hue; pslr_rational_t zoom; int32_t focus; uint32_t image_format; uint32_t raw_format; uint32_t light_meter_flags; pslr_rational_t ec; uint32_t custom_ev_steps; uint32_t custom_sensitivity_steps; uint32_t exposure_mode; uint32_t scene_mode; uint32_t user_mode_flag; uint32_t ae_metering_mode; uint32_t af_mode; uint32_t af_point_select; uint32_t selected_af_point; uint32_t focused_af_point; uint32_t auto_iso_min; uint32_t auto_iso_max; uint32_t drive_mode; uint32_t shake_reduction; uint32_t white_balance_mode; uint32_t white_balance_adjust_mg; uint32_t white_balance_adjust_ba; uint32_t flash_mode; int32_t flash_exposure_compensation; /* 1/256 */ int32_t manual_mode_ev; /* 1/10 */ uint32_t color_space; uint32_t lens_id1; uint32_t lens_id2; uint32_t battery_1; uint32_t battery_2; uint32_t battery_3; uint32_t battery_4; } pslr_status; typedef enum { PSLR_SETTING_STATUS_UNKNOWN, PSLR_SETTING_STATUS_READ, PSLR_SETTING_STATUS_HARDWIRED, PSLR_SETTING_STATUS_NA } pslr_setting_status_t; typedef struct { pslr_setting_status_t pslr_setting_status; bool value; } pslr_bool_setting; typedef struct { pslr_setting_status_t pslr_setting_status; uint16_t value; } pslr_uint16_setting; typedef struct { pslr_bool_setting one_push_bracketing; pslr_bool_setting bulb_mode_press_press; pslr_bool_setting bulb_timer; pslr_uint16_setting bulb_timer_sec; pslr_bool_setting using_aperture_ring; pslr_bool_setting shake_reduction; pslr_bool_setting astrotracer; pslr_uint16_setting astrotracer_timer_sec; pslr_bool_setting horizon_correction; pslr_bool_setting remote_bulb_mode_press_press; } pslr_settings; typedef struct { const char *name; unsigned long address; const char *value; const char *type; } pslr_setting_def_t; typedef void (*ipslr_status_parse_t)(ipslr_handle_t *p, pslr_status *status); pslr_setting_def_t *pslr_find_setting_by_name (pslr_setting_def_t *array, int array_length, char *name); void ipslr_settings_parser_json(const char *cameraid, ipslr_handle_t *p, pslr_settings *settings); pslr_setting_def_t *setting_file_process(const char *cameraid, int *def_num); typedef struct { uint32_t id; // Pentax model ID const char *name; // name bool old_scsi_command; // true for *ist cameras, false for the newer cameras bool old_bulb_mode; // true for older cameras bool need_exposure_mode_conversion; // is exposure_mode_conversion required bool bufmask_command; // true if bufmask determined by calling command 0x02 0x00 bool bufmask_single; // true if buffer cannot handle multiple images bool is_little_endian; // whether the return value should be parsed as little-endian int status_buffer_size; // status buffer size in bytes int max_jpeg_stars; // maximum jpeg stars int jpeg_resolutions[MAX_RESOLUTION_SIZE]; // jpeg resolution table int jpeg_property_levels; // 5 [-2, 2] or 7 [-3,3] or 9 [-4,4] int fastest_shutter_speed; // fastest shutter speed denominator int base_iso_min; // base iso minimum int base_iso_max; // base iso maximum int extended_iso_min; // extended iso minimum int extended_iso_max; // extended iso maximum pslr_jpeg_image_tone_t max_supported_image_tone; // last supported jpeg image tone bool has_jpeg_hue; // camera has jpeg hue setting int af_point_num; // number of AF points ipslr_status_parse_t status_parser_function; // parse function for status buffer } ipslr_model_info_t; typedef struct { uint32_t offset; uint32_t addr; uint32_t length; } ipslr_segment_t; struct ipslr_handle { FDTYPE fd; pslr_status status; pslr_settings settings; uint32_t id; ipslr_model_info_t *model; ipslr_segment_t segments[MAX_SEGMENTS]; uint32_t segment_count; uint32_t offset; uint8_t status_buffer[MAX_STATUS_BUF_SIZE]; uint8_t settings_buffer[SETTINGS_BUFFER_SIZE]; }; ipslr_model_info_t *pslr_find_model_by_id( uint32_t id ); int pslr_get_hw_jpeg_quality( ipslr_model_info_t *model, int user_jpeg_stars); uint32_t get_uint32_be(uint8_t *buf); uint32_t get_uint32_le(uint8_t *buf); void set_uint32_be(uint32_t v, uint8_t *buf); void set_uint32_le(uint32_t v, uint8_t *buf); typedef uint32_t (*get_uint32_func)(uint8_t *buf); typedef uint16_t (*get_uint16_func)(const uint8_t *buf); typedef int32_t (*get_int32_func)(uint8_t *buf); char *pslr_hexdump(uint8_t *buf, uint32_t bufLen); void hexdump(uint8_t *buf, uint32_t bufLen); void hexdump_debug(uint8_t *buf, uint32_t bufLen); const char* int_to_binary( uint16_t x ); #endif libpktriggercord-0.85.1/src/pslr_lens.c0000644000175100017510000000304314136175550017335 0ustar debiandebian/* pkTriggerCord Copyright (C) 2011-2019 Andras Salamon Remote control of Pentax DSLR cameras. based on: PK-Remote Remote control of Pentax DSLR cameras. Copyright (C) 2008 Pontus Lidman Pentax lens database comes from ExifTool ( http://www.sno.phy.queensu.ca/~phil/exiftool/ ) This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU General Public License and GNU Lesser General Public License along with this program. If not, see . */ #include "pslr_lens.h" #include static const struct { uint32_t id1; uint32_t id2; const char *name; } lens_id[] = { #include "exiftool_pentax_lens.txt" }; const char *pslr_get_lens_name( uint32_t id1, uint32_t id2) { int lens_num = sizeof(lens_id)/sizeof(lens_id[0]); int i; for ( i=0; i Remote control of Pentax DSLR cameras. based on: PK-Remote Remote control of Pentax DSLR cameras. Copyright (C) 2008 Pontus Lidman PK-Remote for Windows Copyright (C) 2010 Tomasz Kos This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU General Public License and GNU Lesser General Public License along with this program. If not, see . */ #ifndef PKTRIGGERCORD_SERVERMODE_H #define PKTRIGGERCORD_SERVERMODE_H int servermode_socket(int servermode_timeout); pslr_handle_t pslr_camera_connect( char *model, char *device, int timeout, char *error_message ); void pslr_camera_close(pslr_handle_t camhandle); #endif libpktriggercord-0.85.1/src/pslr_scsi_openbsd.c0000644000175100017510000001703314136175550021053 0ustar debiandebian/* pkTriggerCord Copyright (C) 2011-2019 Andras Salamon Remote control of Pentax DSLR cameras. based on: PK-Remote Remote control of Pentax DSLR cameras. Copyright (C) 2008 Pontus Lidman This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU General Public License and GNU Lesser General Public License along with this program. If not, see . */ #include #include #include #include #include #include #include #include #include #include "pslr_model.h" #include "pslr_scsi.h" #include #define SCSI_INQUIRY 0x12 void print_scsi_error(scsireq_t *req) { int k; if (req->senselen_used > 0) { DPRINT("SCSI error: sense data: "); for (k = 0; k < req->senselen_used; ++k) { if ((k > 0) && (0 == (k % 10))) { DPRINT("\n "); } DPRINT("0x%02x ", req->sense[k]); } DPRINT("\n"); } DPRINT("SCSI status=0x%x\n", req->status); } char **get_drives(int *drive_num) { DIR *d; struct dirent *ent; char *tmp[256]; char **ret; int j,jj; d = opendir("/dev"); if ( !d ) { DPRINT("Cannot open /dev\n"); *drive_num = 0; return NULL; } j=0; while ( (ent = readdir(d)) ) { if (strncmp(ent->d_name, "rsd", 3) == 0 && strnlen(ent->d_name, 6) > 4 && ent->d_name[4] == 'c') { tmp[j] = malloc( strlen(ent->d_name)+1 ); strncpy(tmp[j], ent->d_name, strlen(ent->d_name)+1); ++j; } } closedir(d); ret = malloc( j * sizeof(char*) ); for ( jj=0; jj p && q[-1] == ' ') { q--; } memcpy(vendor_id, p, q - p); vendor_id[q - p] = '\0'; /* Product */ p = buf + 16; q = p + ((16 < product_id_size_max)?16:product_id_size_max); while (q > p && q[-1] == ' ') { q--; } memcpy(product_id, p, q - p); product_id[q - p] = '\0'; close(fd); *device = open(deviceName, O_RDWR); if ( *device == -1) { return PSLR_DEVICE_ERROR; } return PSLR_OK; } void close_drive(int *device) { close( *device ); } int scsi_read(int sg_fd, uint8_t *cmd, uint32_t cmdLen, uint8_t *buf, uint32_t bufLen) { int r; unsigned int i; scsireq_t screq; memset(&screq, 0, sizeof(screq)); screq.flags = SCCMD_READ; screq.timeout = 20000; assert(cmdLen < CMDBUFLEN); memcpy(screq.cmd, cmd, cmdLen); screq.cmdlen = cmdLen; screq.senselen = SENSEBUFLEN; screq.databuf = buf; screq.datalen = bufLen; DPRINT("[S]\t\t\t\t\t >>> ["); for (i = 0; i < cmdLen; ++i) { if (i > 0) { DPRINT(" "); if ((i%4) == 0 ) { DPRINT(" "); } } DPRINT("%02X", cmd[i]); } DPRINT("]\n"); r = ioctl(sg_fd, SCIOCCOMMAND, &screq); if (r == -1) { perror("ioctl"); return -PSLR_DEVICE_ERROR; } if (screq.retsts != SCCMD_OK) { print_scsi_error(&screq); return -PSLR_SCSI_ERROR; } else { DPRINT("[S]\t\t\t\t\t <<< ["); for (i = 0; i < 32 && i < screq.datalen_used; ++i) { if (i > 0) { DPRINT(" "); if (i % 16 == 0) { DPRINT("\n\t\t\t\t\t "); } else if ((i%4) == 0 ) { DPRINT(" "); } } DPRINT("%02X", buf[i]); } DPRINT("]\n"); /* Older Pentax DSLR will report all bytes remaining, so make * a special case for this (treat it as all bytes read). */ /* Linux solution: if (io.resid == bufLen) return bufLen; else return bufLen - io.resid; */ /* In BSD this could be something like: if (screq.datalen_used == 0) return bufLen; */ return screq.datalen_used; } } int scsi_write(int sg_fd, uint8_t *cmd, uint32_t cmdLen, uint8_t *buf, uint32_t bufLen) { int r; unsigned int i; scsireq_t screq; memset(&screq, 0, sizeof(screq)); screq.flags = SCCMD_WRITE; screq.timeout = 20000; assert(cmdLen < CMDBUFLEN); memcpy(screq.cmd, cmd, cmdLen); screq.cmdlen = cmdLen; screq.senselen = SENSEBUFLEN; screq.databuf = buf; screq.datalen = bufLen; // print debug scsi cmd DPRINT("[S]\t\t\t\t\t >>> ["); for (i = 0; i < cmdLen; ++i) { if (i > 0) { DPRINT(" "); if ((i%4) == 0 ) { DPRINT(" "); } } DPRINT("%02X", cmd[i]); } DPRINT("]\n"); if (bufLen > 0) { // print debug write buffer DPRINT("[S]\t\t\t\t\t >>> ["); for (i = 0; i < 32 && i < bufLen; ++i) { if (i > 0) { DPRINT(" "); if (i % 16 == 0) { DPRINT("\n\t\t\t\t\t "); } else if ((i%4) == 0 ) { DPRINT(" "); } } DPRINT("%02X", buf[i]); } DPRINT("]\n"); } r = ioctl(sg_fd, SCIOCCOMMAND, &screq); if (r == -1) { perror("ioctl"); return PSLR_DEVICE_ERROR; } if (screq.retsts != SCCMD_OK) { print_scsi_error(&screq); return PSLR_SCSI_ERROR; } else { return PSLR_OK; } } libpktriggercord-0.85.1/src/pslr_enum.h0000644000175100017510000001632014136175550017347 0ustar debiandebian/* pkTriggerCord Copyright (C) 2011-2019 Andras Salamon Remote control of Pentax DSLR cameras. based on: PK-Remote Remote control of Pentax DSLR cameras. Copyright (C) 2008 Pontus Lidman PK-Remote for Windows Copyright (C) 2010 Tomasz Kos This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU General Public License and GNU Lesser General Public License along with this program. If not, see . */ #ifndef PSLR_ENUM_H #define PSLR_ENUM_H #include typedef enum { PSLR_COLOR_SPACE_SRGB, PSLR_COLOR_SPACE_ADOBERGB, PSLR_COLOR_SPACE_MAX } pslr_color_space_t; typedef enum { PSLR_AF_MODE_MF, PSLR_AF_MODE_AF_S, PSLR_AF_MODE_AF_C, PSLR_AF_MODE_AF_A, PSLR_AF_MODE_MAX } pslr_af_mode_t; typedef enum { PSLR_AE_METERING_MULTI, PSLR_AE_METERING_CENTER, PSLR_AE_METERING_SPOT, PSLR_AE_METERING_MAX } pslr_ae_metering_t; typedef enum { PSLR_FLASH_MODE_MANUAL = 0, PSLR_FLASH_MODE_MANUAL_REDEYE = 1, PSLR_FLASH_MODE_SLOW = 2, PSLR_FLASH_MODE_SLOW_REDEYE = 3, PSLR_FLASH_MODE_TRAILING_CURTAIN = 4, PSLR_FLASH_MODE_AUTO = 5, PSLR_FLASH_MODE_AUTO_REDEYE = 6, /* 7 not used */ PSLR_FLASH_MODE_WIRELESS = 8, PSLR_FLASH_MODE_MAX = 9 } pslr_flash_mode_t; typedef enum { PSLR_DRIVE_MODE_SINGLE, PSLR_DRIVE_MODE_CONTINUOUS_HI, PSLR_DRIVE_MODE_SELF_TIMER_12, PSLR_DRIVE_MODE_SELF_TIMER_2, PSLR_DRIVE_MODE_REMOTE, PSLR_DRIVE_MODE_REMOTE_3, PSLR_DRIVE_MODE_CONTINUOUS_LO, PSLR_DRIVE_MODE_MAX } pslr_drive_mode_t; typedef enum { PSLR_AF_POINT_SEL_AUTO_5, PSLR_AF_POINT_SEL_SELECT, PSLR_AF_POINT_SEL_SPOT, PSLR_AF_POINT_SEL_AUTO_11, /* maybe not for all cameras */ PSLR_AF_POINT_SEL_EXPANDED, /* only for newer */ PSLR_AF_POINT_SEL_MAX } pslr_af_point_sel_t; typedef enum { PSLR_AF11_POINT_TOP_LEFT = 0x01, PSLR_AF11_POINT_TOP_MID = 0x2, PSLR_AF11_POINT_TOP_RIGHT = 0x4, PSLR_AF11_POINT_FAR_LEFT = 0x8, PSLR_AF11_POINT_MID_LEFT = 0x10, PSLR_AF11_POINT_MID_MID = 0x20, PSLR_AF11_POINT_MID_RIGHT = 0x40, PSLR_AF11_POINT_FAR_RIGHT = 0x80, PSLR_AF11_POINT_BOT_LEFT = 0x100, PSLR_AF11_POINT_BOT_MID = 0x200, PSLR_AF11_POINT_BOT_RIGHT = 0x400 } pslr_af11_point_t; typedef enum { PSLR_JPEG_IMAGE_TONE_NONE = -1, PSLR_JPEG_IMAGE_TONE_NATURAL, PSLR_JPEG_IMAGE_TONE_BRIGHT, PSLR_JPEG_IMAGE_TONE_PORTRAIT, PSLR_JPEG_IMAGE_TONE_LANDSCAPE, PSLR_JPEG_IMAGE_TONE_VIBRANT, PSLR_JPEG_IMAGE_TONE_MONOCHROME, PSLR_JPEG_IMAGE_TONE_MUTED, PSLR_JPEG_IMAGE_TONE_REVERSAL_FILM, PSLR_JPEG_IMAGE_TONE_BLEACH_BYPASS, PSLR_JPEG_IMAGE_TONE_RADIANT, PSLR_JPEG_IMAGE_TONE_CROSS_PROCESSING, PSLR_JPEG_IMAGE_TONE_FLAT, PSLR_JPEG_IMAGE_TONE_AUTO, PSLR_JPEG_IMAGE_TONE_MAX } pslr_jpeg_image_tone_t; typedef enum { PSLR_WHITE_BALANCE_MODE_AUTO, PSLR_WHITE_BALANCE_MODE_DAYLIGHT, PSLR_WHITE_BALANCE_MODE_SHADE, PSLR_WHITE_BALANCE_MODE_CLOUDY, PSLR_WHITE_BALANCE_MODE_FLUORESCENT_DAYLIGHT_COLOR, PSLR_WHITE_BALANCE_MODE_FLUORESCENT_DAYLIGHT_WHITE, PSLR_WHITE_BALANCE_MODE_FLUORESCENT_COOL_WHITE, PSLR_WHITE_BALANCE_MODE_TUNGSTEN, PSLR_WHITE_BALANCE_MODE_FLASH, PSLR_WHITE_BALANCE_MODE_MANUAL, PSLR_WHITE_BALANCE_MODE_MANUAL_2, PSLR_WHITE_BALANCE_MODE_MANUAL_3, PSLR_WHITE_BALANCE_MODE_KELVIN_1, PSLR_WHITE_BALANCE_MODE_KELVIN_2, PSLR_WHITE_BALANCE_MODE_KELVIN_3, PSLR_WHITE_BALANCE_MODE_FLUORESCENT_WARM_WHITE, PSLR_WHITE_BALANCE_MODE_CTE, PSLR_WHITE_BALANCE_MODE_MULTI_AUTO, PSLR_WHITE_BALANCE_MODE_MAX } pslr_white_balance_mode_t; typedef enum { PSLR_CUSTOM_EV_STEPS_1_2, PSLR_CUSTOM_EV_STEPS_1_3, PSLR_CUSTOM_EV_STEPS_MAX } pslr_custom_ev_steps_t; typedef enum { PSLR_CUSTOM_SENSITIVITY_STEPS_1EV, PSLR_CUSTOM_SENSITIVITY_STEPS_AS_EV, PSLR_CUSTOM_SENSITIVITY_STEPS_MAX } pslr_custom_sensitivity_steps_t; typedef enum { PSLR_IMAGE_FORMAT_JPEG, PSLR_IMAGE_FORMAT_RAW, PSLR_IMAGE_FORMAT_RAW_PLUS, PSLR_IMAGE_FORMAT_MAX } pslr_image_format_t; typedef enum { PSLR_RAW_FORMAT_PEF, PSLR_RAW_FORMAT_DNG, PSLR_RAW_FORMAT_MAX } pslr_raw_format_t; typedef enum { PSLR_SCENE_MODE_NONE, PSLR_SCENE_MODE_HISPEED, PSLR_SCENE_MODE_DOF, PSLR_SCENE_MODE_MTF, PSLR_SCENE_MODE_STANDARD, PSLR_SCENE_MODE_PORTRAIT, PSLR_SCENE_MODE_LANDSCAPE, PSLR_SCENE_MODE_MACRO, PSLR_SCENE_MODE_SPORT, PSLR_SCENE_MODE_NIGHTSCENEPORTRAIT, PSLR_SCENE_MODE_NOFLASH, PSLR_SCENE_MODE_NIGHTSCENE, PSLR_SCENE_MODE_SURFANDSNOW, PSLR_SCENE_MODE_TEXT, PSLR_SCENE_MODE_SUNSET, PSLR_SCENE_MODE_KIDS, PSLR_SCENE_MODE_PET, PSLR_SCENE_MODE_CANDLELIGHT, PSLR_SCENE_MODE_MUSEUM, PSLR_SCENE_MODE_19, PSLR_SCENE_MODE_FOOD, PSLR_SCENE_MODE_STAGE, PSLR_SCENE_MODE_NIGHTSNAP, PSLR_SCENE_MODE_SWALLOWDOF, PSLR_SCENE_MODE_24, PSLR_SCENE_MODE_NIGHTSCENEHDR, PSLR_SCENE_MODE_BLUESKY, PSLR_SCENE_MODE_FOREST, PSLR_SCENE_MODE_28, PSLR_SCENE_MODE_BLACKLIGHTSILHOUETTE, PSLR_SCENE_MODE_MAX } pslr_scene_mode_t; int str_comparison_i (const char *s1, const char *s2, int n); int find_in_array( const char** array, int length, char* str ); pslr_color_space_t pslr_get_color_space( char *str ); const char *pslr_get_color_space_str( pslr_color_space_t value ); pslr_af_mode_t pslr_get_af_mode( char *str ); const char *pslr_get_af_mode_str( pslr_af_mode_t value ); pslr_ae_metering_t pslr_get_ae_metering( char *str ); const char *pslr_get_ae_metering_str( pslr_ae_metering_t value ); pslr_flash_mode_t pslr_get_flash_mode( char *str ); const char *pslr_get_flash_mode_str( pslr_flash_mode_t value ); pslr_drive_mode_t pslr_get_drive_mode( char *str ); const char *pslr_get_drive_mode_str( pslr_drive_mode_t value ); pslr_af_point_sel_t pslr_get_af_point_sel( char *str ); const char *pslr_get_af_point_sel_str( pslr_af_point_sel_t value ); char *pslr_get_af11_point_str( uint32_t value ); pslr_jpeg_image_tone_t pslr_get_jpeg_image_tone( char *str ); const char *pslr_get_jpeg_image_tone_str( pslr_jpeg_image_tone_t value ); pslr_white_balance_mode_t pslr_get_white_balance_mode( char *str ); const char *pslr_get_white_balance_mode_str( pslr_white_balance_mode_t value ); /* pslr_custom_ev_steps_t get_pslr_custom_ev_steps( char *str ); */ const char *pslr_get_custom_ev_steps_str( pslr_custom_ev_steps_t value ); const char *pslr_get_custom_sensitivity_steps_str( pslr_custom_sensitivity_steps_t value ); const char *pslr_get_image_format_str( pslr_image_format_t value ); const char *pslr_get_raw_format_str( pslr_raw_format_t value ); const char *pslr_get_scene_mode_str( pslr_scene_mode_t value ); #endif libpktriggercord-0.85.1/README.md0000644000175100017510000000116714136175550015665 0ustar debiandebian# libpktriggercord Shared library wrapper for pktriggercord by Karl Rees (2020) The files in the source directory are copied from PkTriggerCord. Thanks to Andras Salamon for developing PkTriggerCord. See http://pktriggercord.melda.info/ To update for new versions of PkTriggerCord, copy over the latest versions of the corresponding PkTriggerCord source files found in the src subfolder. You may need to update the header file include/libpktriggercord.h if any functions in pktriggercord-cli.c have changed. (TODO: automate extraction of header file directly from pktriggercord-cli.c). Then run: cmake . sudo make install libpktriggercord-0.85.1/.gitignore0000644000175100017510000000006414136175550016371 0ustar debiandebian95-pentax.rules 95-samsung.rules libpktriggercord.c libpktriggercord-0.85.1/include/0000755000175100017510000000000014136175550016024 5ustar debiandebianlibpktriggercord-0.85.1/include/libpktriggercord.h0000644000175100017510000000421414136175550021533 0ustar debiandebian/* Header file for libpktriggercord Shared library wrapper for pkTriggerCord Copyright (c) 2020 Karl Rees for: pkTriggerCord Remote control of Pentax DSLR cameras. Copyright (C) 2011-2019 Andras Salamon which is based on: pslr-shoot Command line remote control of Pentax DSLR cameras. Copyright (C) 2009 Ramiro Barreiro With fragments of code from PK-Remote by Pontus Lidman. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU General Public License and GNU Lesser General Public License along with this program. If not, see . */ #include "pslr.h" #include "pktriggercord-servermode.h" // Header file for functions in pktriggercord-cli.c int save_buffer(pslr_handle_t camhandle, int bufno, int fd, pslr_status *status, user_file_format filefmt, int jpeg_stars); void save_memory(pslr_handle_t camhandle, int fd, uint32_t length); void print_status_info( pslr_handle_t h, pslr_status status ); void print_settings_info( pslr_handle_t h, pslr_settings settings ); int open_file(char* output_file, int frameNo, user_file_format_t ufft); void warning_message( const char* message, ... ); void process_wbadj( const char* argv0, const char chr, uint32_t adj, uint32_t *wbadj_mg, uint32_t *wbadj_ba ); char *copyright_version(char *name, char *version); void bulb_old(pslr_handle_t camhandle, pslr_rational_t shutter_speed, struct timeval prev_time); void bulb_new(pslr_handle_t camhandle, pslr_rational_t shutter_speed); void bulb_new_cleanup(pslr_handle_t camhandle); libpktriggercord-0.85.1/INSTALL0000644000175100017510000000014214136175550015427 0ustar debiandebianINSTALL ============ 1) $ cmake -DCMAKE_INSTALL_PREFIX=/usr . 2) $ make 3) $ sudo make install