Input: fixes and tweaks.

This commit is contained in:
sorgelig
2019-03-19 03:13:46 +08:00
parent 7f6bc8caa2
commit 14df06a0d3
2 changed files with 15 additions and 8 deletions

View File

@@ -2235,18 +2235,19 @@ int input_test(int getchar)
//printf("last_state=%d, axis_state=%d\n", last_state, axis_state);
if (last_state != axis_state)
{
uint16_t ecode = ev.code<<1;
ev.type = EV_KEY;
if (last_state)
{
ev.value = 0;
ev.code = KEY_EMU + (ev.code * 2) + last_state - 1;
ev.code = KEY_EMU + ecode + last_state - 1;
input_cb(&ev, 0, i);
}
if (axis_state)
{
ev.value = 1;
ev.code = KEY_EMU + (ev.code * 2) + axis_state - 1;
ev.code = KEY_EMU + ecode + axis_state - 1;
input_cb(&ev, 0, i);
}
}