projects
/
can2joy.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Document which bits are clutch and brake, respectively
[can2joy.git]
/
can2joy.c
diff --git
a/can2joy.c
b/can2joy.c
index a4ad4d4e0dd58ee60c0d1bf2296d15ac856d66e2..02460bfb6cf0cf40854915542c6979169fcd3d59 100644
(file)
--- 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;
* 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));
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));
ev.code = BTN_THUMB;
ev.value = !(!(frm.data[6] & 4));
write(fd_uinput, &ev, sizeof(ev));