summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornorly <ny-git@enpas.org>2024-04-07 13:55:41 +0200
committernorly <ny-git@enpas.org>2024-04-07 13:55:41 +0200
commit6cc39e1bb103330f0a80ee2c38310d6549c831a6 (patch)
tree6c8c03b2686e8aa989cc7029f494c600c5f6ddc8
parent9ded906bed31f77bb5b12348afa99e65de162908 (diff)
Document which bits are clutch and brake, respectivelyHEADmaster
-rw-r--r--can2joy.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/can2joy.c b/can2joy.c
index a4ad4d4..02460bf 100644
--- a/can2joy.c
+++ b/can2joy.c
@@ -135,10 +135,13 @@ static void receive_one(int fd_can, int fd_uinput)
* control of your simulated Lamborghini!
*/
ev.type = EV_KEY;
+
+ /* Brake sets bits 0 and 1 (value 3) in byte 4 */
ev.code = BTN_TRIGGER;
ev.value = !(!(frm.data[4] & 3));
write(fd_uinput, &ev, sizeof(ev));
+ /* Clutch sets bit 2 (value 4) in byte 6 */
ev.code = BTN_THUMB;
ev.value = !(!(frm.data[6] & 4));
write(fd_uinput, &ev, sizeof(ev));