diff --git a/.vscode/settings.json b/.vscode/settings.json index fe63518..38d2fcc 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -17,6 +17,8 @@ "C_Cpp_Runner.enableWarnings": true, "C_Cpp_Runner.warningsAsError": false, "files.associations": { - "pulseaudio.h": "c" + "pulseaudio.h": "c", + "confuse.h": "c", + "rtosc.h": "c" } } \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 6d97705..edc63ed 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,27 @@ # Minimal version of CMake cmake_minimum_required (VERSION 3.13) + + +#Include RTOSC +if(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/lib/rtosc/CMakeLists.txt") + message(STATUS "RTOSC NOT FOUND") + message(STATUS "Attempting to checkout submodule") + find_package(Git REQUIRED) + execute_process(COMMAND git submodule update --init) + if(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/lib/rtosc/CMakeLists.txt") + message(FATAL_ERROR "FAILED TO CHECKOUT RTOSC\n" + "please check file permissions and your network") + endif() +else() + message(STATUS "Found Rtosc Submodule...") +endif() + +set(RTOSC_NO_INSTALL TRUE) +include("lib/rtosc/cmake/ColorMessage.cmake") +add_subdirectory(lib/rtosc) +include_directories(lib/rtosc/include) + # Build type if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) message(STATUS "Setting build type to 'Release' as none was specified.") @@ -66,7 +87,11 @@ endfunction(install_conf) # Link libs -target_link_libraries(volumehidtoosc confuse) +target_link_libraries(volumehidtoosc rtosc rtosc-cpp confuse) +# target_link_libraries(volumehidtoosc confuse) # Install systemd unit files -# install_conf (./volumehidtoosc.service ${SYSTEMD_UNIT_DIR}) +#install_conf (./volumehidtoosc.service ${SYSTEMD_UNIT_DIR}) + +# Install config +install_conf (./volumehidtoosc.conf ${VOLUMEHIDTOOSC_CONF_DIR}) diff --git a/README.md b/README.md index 7fb96f4..d354bd0 100644 --- a/README.md +++ b/README.md @@ -4,8 +4,8 @@ working: * usb device detection * count logic - +* config file + todo: -* config file build copy and cmake * OSC sending * ci \ No newline at end of file diff --git a/rebuild.sh b/rebuild.sh index c0ca36f..86f2ac6 100755 --- a/rebuild.sh +++ b/rebuild.sh @@ -1,8 +1,4 @@ #!/bin/bash -# rm -rf /etc/volumehidtoosc/volumehidtoosc.conf -# rm -rf /usr/lib/systemd/system/volumehidtoosc.service -# rm -rf /usr/lib/systemd/user/volumehidtoosc.service -# rm -rf /usr/bin/volumehidtoosc rm -rf build mkdir build cd build @@ -11,8 +7,9 @@ make mkdir packageroot cp -rf ../DEBIAN packageroot/ mkdir -p packageroot/usr/bin/ -mkdir -p packageroot/usr/lib/systemd/user/ +mkdir -p packageroot/etc/volumehidtoosc/ cp bin/volumehidtoosc packageroot/usr/bin/ +cp ../volumehidtoosc.conf packageroot/etc/volumehidtoosc/ dpkg-deb -b packageroot volumehidtoosc_1.0.0_amd64.deb diff --git a/src/volumehidtoosc.c b/src/volumehidtoosc.c index 2ccf8fc..8441b58 100644 --- a/src/volumehidtoosc.c +++ b/src/volumehidtoosc.c @@ -34,6 +34,7 @@ #include #include #include +#include cfg_opt_t opts[] = { @@ -41,14 +42,14 @@ cfg_opt_t opts[] = CFG_STR("PRODUCT", "Product=484d", CFGF_NONE), CFG_STR("EV", "EV=1f", CFGF_NONE), CFG_INT("VOL_PLUS",115,CFGF_NONE), - CFG_INT("VOL_PLUS_TIMES",4,CFGF_NONE), + CFG_INT("VOL_PLUS_TIMES",2,CFGF_NONE), CFG_INT("VOL_MINUS",114,CFGF_NONE), - CFG_INT("VOL_MINUS_TIMES",4,CFGF_NONE), + CFG_INT("VOL_MINUS_TIMES",2,CFGF_NONE), CFG_INT("MUTE_TOGGLE",113,CFGF_NONE), CFG_INT("MUTE_TOGGLE_TIMES",2,CFGF_NONE), CFG_INT("VOL_MIN",0,CFGF_NONE), CFG_INT("VOL_MAX",100,CFGF_NONE), - CFG_INT("VOL_STEP",2,CFGF_NONE), + CFG_INT("VOL_STEP",1,CFGF_NONE), CFG_INT("VOL_START",30,CFGF_NONE), CFG_END() }; diff --git a/volumehidtoosc.conf b/volumehidtoosc.conf new file mode 100644 index 0000000..b9639aa --- /dev/null +++ b/volumehidtoosc.conf @@ -0,0 +1,14 @@ +VENDOR='Vendor=2341' +PRODUCT='Product=484d' +EV='EV=1f' +VOL_PLUS=115 +VOL_PLUS_TIMES=2 +VOL_MINUS=114 +VOL_MINUS_TIMES=2 +MUTE_TOGGLE=113 +MUTE_TOGGLE_TIMES=2 +VOL_MIN=0 +VOL_MAX=100 +VOL_STEP=2 +VOL_START=30 +