From 612fb701c597173ebb3249cf2129154e8c887600 Mon Sep 17 00:00:00 2001 From: Denis Date: Sat, 6 Jan 2024 23:49:08 +0100 Subject: [PATCH] use asusctl command to set leds --- CMakeLists.txt | 9 ++------- rog_ally.c | 20 ++++++++++---------- rogue_enemy.h | 2 -- 3 files changed, 12 insertions(+), 19 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 34da9dc..9aeeb08 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,11 +15,6 @@ set(ALLINONE_EXECUTABLE_NAME "allynone") find_package(PkgConfig REQUIRED) # Include functions provided by PkgConfig module. -pkg_check_modules(DBUS REQUIRED dbus-1) # This calls pkgconfig with appropriate arguments -# Use results of pkg_check_modules() call. -include_directories(${DBUS_INCLUDE_DIRS}) -link_directories(${DBUS_LIBRARY_DIRS}) - set(THREADS_PREFER_PTHREAD_FLAG ON) find_package(Threads REQUIRED) @@ -72,7 +67,7 @@ add_executable(${ALLINONE_EXECUTABLE_NAME} set_property(TARGET ${ALLINONE_EXECUTABLE_NAME} PROPERTY C_STANDARD 17) -target_link_libraries(${ALLINONE_EXECUTABLE_NAME} PRIVATE Threads::Threads ${DBUS_LIBRARIES} -levdev -ludev -lconfig -lm -lz) +target_link_libraries(${ALLINONE_EXECUTABLE_NAME} PRIVATE Threads::Threads -levdev -ludev -lconfig -lm -lz) set_target_properties(${ALLINONE_EXECUTABLE_NAME} PROPERTIES LINKER_LANGUAGE C) @@ -80,7 +75,7 @@ install(TARGETS ${ALLINONE_EXECUTABLE_NAME} DESTINATION bin) set_property(TARGET ${ROGUE_EXECUTABLE_NAME} PROPERTY C_STANDARD 17) -target_link_libraries(${ROGUE_EXECUTABLE_NAME} PRIVATE Threads::Threads ${DBUS_LIBRARIES} -levdev -ludev -lconfig -lm) +target_link_libraries(${ROGUE_EXECUTABLE_NAME} PRIVATE Threads::Threads -levdev -ludev -lconfig -lm) set_target_properties(${ROGUE_EXECUTABLE_NAME} PROPERTIES LINKER_LANGUAGE C) diff --git a/rog_ally.c b/rog_ally.c index 890a358..3181d6f 100644 --- a/rog_ally.c +++ b/rog_ally.c @@ -63,9 +63,11 @@ typedef struct rc71l_platform { rc71l_timer_user_data_t* timer_data; - DBusError dbus_error; - - DBusConnection * dbus_conn; + struct { + uint8_t r; + uint8_t g; + uint8_t b; + } static_led_color; } rc71l_platform_t; @@ -101,7 +103,6 @@ static rc71l_platform_t hw_platform = { .kbd_user_data = &asus_userdata, .xbox360_user_data = &controller_user_data, .timer_data = &timer_user_data, - .dbus_conn = NULL, }; static char* find_kernel_sysfs_device_path(struct udev *udev) { @@ -1235,8 +1236,6 @@ static int rc71l_platform_init(const dev_in_settings_t *const conf, void** platf goto rc71l_platform_init_err; } - dbus_error_init(&platform->dbus_error); - res = 0; rc71l_platform_init_err: @@ -1250,9 +1249,6 @@ static void rc71l_platform_deinit(const dev_in_settings_t *const conf, void** pl if (platform->kbd_user_data != NULL) { udev_unref(platform->kbd_user_data->udev); } - - // Close the D-Bus connection - dbus_connection_close(platform->dbus_conn); } *platform_data = NULL; @@ -1265,8 +1261,12 @@ static int rc71l_platform_leds(const dev_in_settings_t *const conf, uint8_t r, u return 0; } + platform->static_led_color.r = r; + platform->static_led_color.g = g; + platform->static_led_color.b = b; + char command_str[64] = "\0"; - sprintf(command_str, "asusctl led-mode static -c %02X%02X%02X",r ,g ,b); + sprintf(command_str, "asusctl led-mode static -c %02X%02X%02X", r ,g ,b); return system(command_str); } diff --git a/rogue_enemy.h b/rogue_enemy.h index 0c8c3d0..c13675d 100644 --- a/rogue_enemy.h +++ b/rogue_enemy.h @@ -46,8 +46,6 @@ #include -#include - #define LSB_PER_RAD_S_2000_DEG_S ((double)0.001064724) #define LSB_PER_RAD_S_2000_DEG_S_STR "0.001064724"