Adding the joystick was simpler than I thought.
in probe
/* * The G13 has a thumbstick and 3 buttons. */ if (g15->model == LG_G13) { input_set_capability(input, EV_KEY, ABS_X); input_set_capability(input, EV_KEY, ABS_Y); /* 4 center values */ input_set_abs_params(input, ABS_X, 0, 0xff, 0, 4); input_set_abs_params(input, ABS_Y, 0, 0xff, 0, 4); input_set_capability(input, EV_KEY, BTN_TRIGGER); input_set_capability(input, EV_KEY, BTN_THUMB); input_set_capability(input, EV_KEY, BTN_THUMB2); }
and the event handler:
input_report_abs(g15->input, ABS_X, data[1]); input_report_abs(g15->input, ABS_Y, data[2]); input_report_key(g15->input, BTN_TRIGGER, data[7] & 0x02); input_report_key(g15->input, BTN_THUMB, data[7] & 0x04); input_report_key(g15->input, BTN_THUMB2, data[7] & 0x08);
Shows up in jstest-gtk:
Also remapping the joystick to a mouse works in https://github.com/sezanzeb/key-mapper.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.