Yes indeed.

This commit is contained in:
Denis 2023-11-29 18:23:20 +01:00
parent 2fa46bf62f
commit 650fc88127
No known key found for this signature in database
GPG key ID: DD9B63F805CF5C03
4 changed files with 8 additions and 7 deletions

View file

@ -22,8 +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.r4 = 0;
logic->gamepad.l4 = 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));

View file

@ -36,8 +36,9 @@ typedef struct gamepad_status {
uint8_t share;
uint8_t center;
uint8_t rfn;
uint8_t lfn;
uint8_t l4;
uint8_t r4;
struct timeval last_gyro_motion_time;
struct timeval last_accel_motion_time;

View file

@ -725,7 +725,7 @@ static void update_gs_from_ev(gamepad_status_t *const gs, message_t *const msg,
(msg->data.event.ev[1].type == EV_KEY) &&
(msg->data.event.ev[1].code == KEY_F17)
) {
gs->rfn = msg->data.event.ev[1].value;
gs->l4 = msg->data.event.ev[1].value;
} else if (
(msg->data.event.ev_count == 2) &&
(msg->data.event.ev[0].type == EV_MSC) &&
@ -734,7 +734,7 @@ static void update_gs_from_ev(gamepad_status_t *const gs, message_t *const msg,
(msg->data.event.ev[1].type == EV_KEY) &&
(msg->data.event.ev[1].code == KEY_F18)
) {
gs->lfn = msg->data.event.ev[1].value;
gs->r4 = msg->data.event.ev[1].value;
}
for (uint32_t i = 0; i < msg->data.event.ev_count; ++i) {

View file

@ -400,7 +400,7 @@ static int send_data(int fd, logic_t *const logic) {
(gs.l3 ? 0x40 : 0x00) |
(gs.r3 ? 0x80 : 0x00);
buf[10] = (gs.lfn ? 0x10 : 0x00) | (gs.rfn ? 0x20 : 0x00) | (gs.center ? 0x01 : 0x00);
buf[10] = (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...