steam qam and menu btn

This commit is contained in:
Denis 2023-12-09 14:04:01 +01:00
parent 4d0a2d9a6f
commit e66a91e520
No known key found for this signature in database
GPG key ID: DD9B63F805CF5C03
3 changed files with 115 additions and 9 deletions

View file

@ -1,5 +1,6 @@
#include "dev_out.h" #include "dev_out.h"
#include "devices_status.h"
#include "virt_ds4.h" #include "virt_ds4.h"
#include "virt_ds5.h" #include "virt_ds5.h"
@ -7,9 +8,11 @@ static void handle_incoming_message_gamepad_action(
const in_message_gamepad_action_t *const msg_payload, const in_message_gamepad_action_t *const msg_payload,
gamepad_status_t *const inout_gamepad gamepad_status_t *const inout_gamepad
) { ) {
if (msg_payload == GAMEPAD_ACTION_PRESS_AND_RELEASE_CENTER) { if (*msg_payload == GAMEPAD_ACTION_PRESS_AND_RELEASE_CENTER) {
inout_gamepad->flags |= GAMEPAD_STATUS_FLAGS_PRESS_AND_REALEASE_CENTER; inout_gamepad->flags |= GAMEPAD_STATUS_FLAGS_PRESS_AND_REALEASE_CENTER;
} } else if (*msg_payload == GAMEPAD_ACTION_OPEN_STEAM_QAM) {
inout_gamepad->flags |= GAMEPAD_STATUS_FLAGS_OPEN_STEAM_QAM;
}
} }
static void handle_incoming_message_gamepad_set( static void handle_incoming_message_gamepad_set(
@ -65,6 +68,22 @@ static void handle_incoming_message_gamepad_set(
inout_gamepad->r3 = msg_payload->status.btn; inout_gamepad->r3 = msg_payload->status.btn;
break; break;
} }
case GAMEPAD_BTN_L4: {
inout_gamepad->l4 = msg_payload->status.btn;
break;
}
case GAMEPAD_BTN_R4: {
inout_gamepad->r4 = msg_payload->status.btn;
break;
}
case GAMEPAD_BTN_L5: {
inout_gamepad->l5 = msg_payload->status.btn;
break;
}
case GAMEPAD_BTN_R5: {
inout_gamepad->r5 = msg_payload->status.btn;
break;
}
case GAMEPAD_BTN_TOUCHPAD: { case GAMEPAD_BTN_TOUCHPAD: {
inout_gamepad->touchpad_press = msg_payload->status.btn; inout_gamepad->touchpad_press = msg_payload->status.btn;
break; break;

View file

@ -19,6 +19,10 @@ typedef enum in_message_gamepad_btn {
GAMEPAD_BTN_R2_TRIGGER, GAMEPAD_BTN_R2_TRIGGER,
GAMEPAD_BTN_L3, GAMEPAD_BTN_L3,
GAMEPAD_BTN_R3, GAMEPAD_BTN_R3,
GAMEPAD_BTN_L4,
GAMEPAD_BTN_R4,
GAMEPAD_BTN_L5,
GAMEPAD_BTN_R5,
GAMEPAD_BTN_TOUCHPAD, GAMEPAD_BTN_TOUCHPAD,
GAMEPAD_LEFT_JOYSTICK_X, GAMEPAD_LEFT_JOYSTICK_X,
@ -41,6 +45,7 @@ typedef struct in_message_gamepad_set_element {
typedef enum in_message_gamepad_action { typedef enum in_message_gamepad_action {
GAMEPAD_ACTION_PRESS_AND_RELEASE_CENTER, GAMEPAD_ACTION_PRESS_AND_RELEASE_CENTER,
GAMEPAD_ACTION_OPEN_STEAM_QAM,
} in_message_gamepad_action_t; } in_message_gamepad_action_t;
typedef enum in_in_message_type { typedef enum in_in_message_type {

View file

@ -435,13 +435,95 @@ static const uint8_t rc71l_mode_switch_commands[][23][64] = {
void asus_kbd_ev_map(const evdev_collected_t *const e, int in_messages_pipe_fd, void* user_data) { void asus_kbd_ev_map(const evdev_collected_t *const e, int in_messages_pipe_fd, void* user_data) {
in_message_t current_message; in_message_t current_message;
if ( // this is what happens at release of the left-screen button of the ROG Ally
/* (e->ev_count == 2) &&
const ssize_t in_message_pipe_write_res = write(in_messages_pipe_fd, (void*)&current_message, sizeof(in_message_t)); (e->ev[0].type == EV_MSC) &&
if (in_message_pipe_write_res != sizeof(in_message_t)) { (e->ev[0].code == MSC_SCAN) &&
fprintf(stderr, "Unable to write data to the in_message pipe: %zu\n", in_message_pipe_write_res); (e->ev[0].value == -13565786) &&
} (e->ev[1].type == EV_KEY) &&
*/ (e->ev[1].code == KEY_F16) &&
(e->ev[1].value == 1)
) {
in_message_t current_message = {
.type = GAMEPAD_ACTION,
.data = {
.action = GAMEPAD_ACTION_PRESS_AND_RELEASE_CENTER,
}
};
const ssize_t in_message_pipe_write_res = write(in_messages_pipe_fd, (void*)&current_message, sizeof(in_message_t));
if (in_message_pipe_write_res != sizeof(in_message_t)) {
fprintf(stderr, "Unable to write data for MENU to the in_message pipe: %zu\n", in_message_pipe_write_res);
}
} else if ( // this is what happens at release of the right-screen button of the ROG Ally
(e->ev_count == 2) &&
(e->ev[0].type == EV_MSC) &&
(e->ev[0].code == MSC_SCAN) &&
(e->ev[0].value == -13565896) &&
(e->ev[1].type == EV_KEY) &&
(e->ev[1].code == KEY_PROG1) &&
(e->ev[1].value == 1)
) {
in_message_t current_message = {
.type = GAMEPAD_ACTION,
.data = {
.action = GAMEPAD_ACTION_OPEN_STEAM_QAM,
}
};
const ssize_t in_message_pipe_write_res = write(in_messages_pipe_fd, (void*)&current_message, sizeof(in_message_t));
if (in_message_pipe_write_res != sizeof(in_message_t)) {
fprintf(stderr, "Unable to write data for QAM to the in_message pipe: %zu\n", in_message_pipe_write_res);
}
} else if (
(e->ev_count == 2) &&
(e->ev[0].type == EV_MSC) &&
(e->ev[0].code == MSC_SCAN) &&
(e->ev[0].value == 458860) &&
(e->ev[1].type == EV_KEY) &&
(e->ev[1].code == KEY_F17)
) {
in_message_t current_message = {
.type = GAMEPAD_SET_ELEMENT,
.data = {
.gamepad_set = {
.element = GAMEPAD_BTN_L4,
.status = {
.btn = e->ev[1].code,
}
}
}
};
const ssize_t in_message_pipe_write_res = write(in_messages_pipe_fd, (void*)&current_message, sizeof(in_message_t));
if (in_message_pipe_write_res != sizeof(in_message_t)) {
fprintf(stderr, "Unable to write data for L4 to the in_message pipe: %zu\n", in_message_pipe_write_res);
}
} else if (
(e->ev_count == 2) &&
(e->ev[0].type == EV_MSC) &&
(e->ev[0].code == MSC_SCAN) &&
(e->ev[0].value == 458861) &&
(e->ev[1].type == EV_KEY) &&
(e->ev[1].code == KEY_F18)
) {
in_message_t current_message = {
.type = GAMEPAD_SET_ELEMENT,
.data = {
.gamepad_set = {
.element = GAMEPAD_BTN_R4,
.status = {
.btn = e->ev[1].code,
}
}
}
};
const ssize_t in_message_pipe_write_res = write(in_messages_pipe_fd, (void*)&current_message, sizeof(in_message_t));
if (in_message_pipe_write_res != sizeof(in_message_t)) {
fprintf(stderr, "Unable to write data for R4 to the in_message pipe: %zu\n", in_message_pipe_write_res);
}
}
} }
static hidraw_filters_t n_key_hidraw_filters = { static hidraw_filters_t n_key_hidraw_filters = {