diff --git a/References/DualSense/note.txt b/References/DualSense/note.txt new file mode 100644 index 0000000..39e9fe1 --- /dev/null +++ b/References/DualSense/note.txt @@ -0,0 +1,2 @@ +ffff88813967c900 1248578633 C Ii:5:002:4 0:8 64 = 017e8080 7e0000a9 0800X000 2736395a f7fff5ff 0400bcff fc1fc205 1fcc9337 +Where X is 1 for Lfn, 2 for Rfn, 3 for both pressed \ No newline at end of file diff --git a/logic.c b/logic.c index 92dd72c..583d86d 100644 --- a/logic.c +++ b/logic.c @@ -22,6 +22,8 @@ int logic_create(logic_t *const logic) { logic->gamepad.option = 0; logic->gamepad.share = 0; logic->gamepad.center = 0; + logic->gamepad.rfn = 0; + logic->gamepad.lfn = 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 4f49861..f89c8e5 100644 --- a/logic.h +++ b/logic.h @@ -36,6 +36,9 @@ typedef struct gamepad_status { uint8_t share; uint8_t center; + uint8_t rfn; + uint8_t lfn; + struct timeval last_gyro_motion_time; struct timeval last_accel_motion_time; diff --git a/output_dev.c b/output_dev.c index 4901894..6135420 100644 --- a/output_dev.c +++ b/output_dev.c @@ -717,6 +717,24 @@ static void update_gs_from_ev(gamepad_status_t *const gs, message_t *const msg, if (settings->enable_qam) { gs->flags |= GAMEPAD_STATUS_FLAGS_OPEN_STEAM_QAM; } + } else if ( + (msg->data.event.ev_count == 2) && + (msg->data.event.ev[0].type == EV_MSC) && + (msg->data.event.ev[0].code == MSC_SCAN) && + (msg->data.event.ev[0].value == 458860) && + (msg->data.event.ev[1].type == EV_KEY) && + (msg->data.event.ev[1].code == KEY_F17) + ) { + gs->rfn = msg->data.event.ev[1].value; + } else if ( + (msg->data.event.ev_count == 2) && + (msg->data.event.ev[0].type == EV_MSC) && + (msg->data.event.ev[0].code == MSC_SCAN) && + (msg->data.event.ev[0].value == 458861) && + (msg->data.event.ev[1].type == EV_KEY) && + (msg->data.event.ev[1].code == KEY_F18) + ) { + gs->lfn = msg->data.event.ev[1].value; } for (uint32_t i = 0; i < msg->data.event.ev_count; ++i) { diff --git a/virt_ds5.c b/virt_ds5.c index 3026040..808865c 100644 --- a/virt_ds5.c +++ b/virt_ds5.c @@ -401,6 +401,7 @@ static int send_data(int fd, logic_t *const logic) { (gs.r3 ? 0x80 : 0x00); buf[10] = (gs.center ? 0x01 : 0x00); + buf[11] = (gs.lfn ? 0x01 : 0x00) | (gs.rfn ? 0x02 : 0x00); //buf[12] = 0x20; // [12] battery level | this is called sensor_temparature in the kernel driver but is never used... memcpy(&buf[16], &g_x, sizeof(int16_t));