Skip to content

Commit

Permalink
added rtosc
Browse files Browse the repository at this point in the history
  • Loading branch information
Apfelwurm committed Sep 6, 2021
1 parent 90fbe8c commit 8087739
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 13 deletions.
4 changes: 3 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
29 changes: 27 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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.")
Expand Down Expand Up @@ -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})
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ working:

* usb device detection
* count logic

* config file

todo:
* config file build copy and cmake
* OSC sending
* ci
7 changes: 2 additions & 5 deletions rebuild.sh
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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

Expand Down
7 changes: 4 additions & 3 deletions src/volumehidtoosc.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,22 @@
#include <unistd.h>
#include <stdbool.h>
#include <confuse.h>
#include <rtosc/rtosc.h>

cfg_opt_t opts[] =
{
CFG_STR("VENDOR", "Vendor=2341", CFGF_NONE),
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()
};
Expand Down
14 changes: 14 additions & 0 deletions volumehidtoosc.conf
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 8087739

Please sign in to comment.