From 43130790f57f1d68d47dc4e11767dc35d9d5614c Mon Sep 17 00:00:00 2001 From: Denis Date: Wed, 29 Nov 2023 19:08:59 +0100 Subject: [PATCH] prepare R5 and L5 logic --- logic.c | 2 ++ logic.h | 2 ++ virt_ds5.c | 7 ++++++- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/logic.c b/logic.c index 458d3c0..362b27f 100644 --- a/logic.c +++ b/logic.c @@ -24,6 +24,8 @@ int logic_create(logic_t *const logic) { logic->gamepad.center = 0; logic->gamepad.r4 = 0; logic->gamepad.l4 = 0; + logic->gamepad.r5 = 0; + logic->gamepad.l5 = 0; logic->gamepad.rumble_events_count = 0; memset(logic->gamepad.gyro, 0, sizeof(logic->gamepad.gyro)); memset(logic->gamepad.accel, 0, sizeof(logic->gamepad.accel)); diff --git a/logic.h b/logic.h index 8789a76..428794b 100644 --- a/logic.h +++ b/logic.h @@ -39,6 +39,8 @@ typedef struct gamepad_status { uint8_t l4; uint8_t r4; + uint8_t l5; + uint8_t r5; struct timeval last_gyro_motion_time; struct timeval last_accel_motion_time; diff --git a/virt_ds5.c b/virt_ds5.c index 264d66f..c8677b1 100644 --- a/virt_ds5.c +++ b/virt_ds5.c @@ -401,7 +401,12 @@ static int send_data(int fd, logic_t *const logic) { (gs.l3 ? 0x40 : 0x00) | (gs.r3 ? 0x80 : 0x00); - buf[10] = (gs.l4 ? 0x10 : 0x00) | (gs.r4 ? 0x20 : 0x00) | (gs.center ? 0x01 : 0x00); + // mic button press is 0x04, touchpad press is 0x02 + buf[10] = (gs.l5 ? 0x40 : 0x00) | + (gs.r5 ? 0x80 : 0x00) | + (gs.l4 ? 0x10 : 0x00) | + (gs.r4 ? 0x20 : 0x00) | + (gs.center ? 0x01 : 0x00); //buf[11] = ; //buf[12] = 0x20; // [12] battery level | this is called sensor_temparature in the kernel driver but is never used...