Use bluetooth dualshock

This commit is contained in:
Denis 2023-12-21 02:04:54 +01:00
parent 8857d30a58
commit a4b98139ee
No known key found for this signature in database
GPG key ID: DD9B63F805CF5C03
6 changed files with 937 additions and 75 deletions

View file

@ -64,7 +64,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 -levdev -ludev -lconfig -lm)
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 +80,7 @@ install(TARGETS ${ROGUE_EXECUTABLE_NAME} DESTINATION bin)
set_property(TARGET ${STRAY_EXECUTABLE_NAME} PROPERTY C_STANDARD 17)
target_link_libraries(${STRAY_EXECUTABLE_NAME} PRIVATE Threads::Threads -levdev -ludev -lconfig -lm)
target_link_libraries(${STRAY_EXECUTABLE_NAME} PRIVATE Threads::Threads -levdev -ludev -lconfig -lm -lz)
set_target_properties(${STRAY_EXECUTABLE_NAME} PROPERTIES LINKER_LANGUAGE C)

View file

@ -427,7 +427,7 @@ void *dev_out_thread_func(void *ptr) {
const int64_t gamepad_report_timing_us = 1250;
if (current_gamepad == GAMEPAD_DUALSENSE) {
const int ds5_init_res = virt_dualsense_init(&controller_data.ds5);
const int ds5_init_res = virt_dualsense_init(&controller_data.ds5, true);
if (ds5_init_res != 0) {
fprintf(stderr, "Unable to initialize the DualSense device: %d\n", ds5_init_res);
} else {

View file

@ -1141,7 +1141,15 @@ static void rc71l_platform_deinit(const dev_in_settings_t *const conf, void** pl
*platform_data = NULL;
}
/**
* This function should use the following:
* pub static DBUS_NAME: &str = "org.asuslinux.Daemon";
* pub static DBUS_PATH: &str = "/org/asuslinux/Daemon";
* pub static DBUS_IFACE: &str = "org.asuslinux.Daemon";
*/
static int rc71l_platform_leds(const dev_in_settings_t *const conf, uint8_t r, uint8_t g, uint8_t b, void* platform_data) {
return 0;
}

View file

@ -44,6 +44,8 @@
#include <libudev.h>
#include <zlib.h>
#define LSB_PER_RAD_S_2000_DEG_S ((double)0.001064724)
#define LSB_PER_RAD_S_2000_DEG_S_STR "0.001064724"

File diff suppressed because it is too large Load diff

View file

@ -13,6 +13,8 @@ typedef struct virt_dualsense {
bool debug;
bool bluetooth;
uint8_t seq_num;
uint32_t dt_sum;
@ -23,7 +25,7 @@ typedef struct virt_dualsense {
uint64_t last_time;
} virt_dualsense_t;
int virt_dualsense_init(virt_dualsense_t *const gamepad);
int virt_dualsense_init(virt_dualsense_t *const gamepad, bool bluetooth);
int virt_dualsense_get_fd(virt_dualsense_t *const gamepad);