uinput problem
Hello everybody,
I'm trying to write a small userspace program to receive keys via rs232 and sent the corresponding key events.
Everything seems to work fine, except when I'm sending something like Aa oder aA where die keycode is the same. Then only AA or aa is recognized. I did't set the EV_REP bit because i don't need any auto-repeat features.
I'm sending the events via the following function.
void SysKeypress(int fd, int code, int down) {
struct input_event ev; memset (&ev, 0, sizeof(ev)); ev.type=EV_KEY; ev.code=code; ev.value=down; write (fd, &ev, sizeof(ev)); }
and if I hardcode an
SysKeypress (uinput_fd, KEY_LEFTSHIFT, 1); SysKeypress (uinput_fd, KEY_1, 1); SysKeypress (uinput_fd, KEY_1, 0); SysKeypress (uinput_fd, KEY_LEFTSHIFT, 0); SysKeypress (uinput_fd, KEY_1, 1); SysKeypress (uinput_fd, KEY_1, 0);
it only receices an !! and if I change the blocks an 11.
I read the documentfile about input drivers, but i didn't find anything special about uinput.
I can't see what I'm doing wrong and hope someone might help me.
Regards
Tobias
Hi Tobias,
Quoted 25 lines · Tobias M??ller
Hello everybody,
I'm trying to write a small userspace program to receive keys via rs232 and sent the corresponding key events.
Everything seems to work fine, except when I'm sending something like Aa oder aA where die keycode is the same. Then only AA or aa is recognized. I did't set the
EV_REPbit because i don't need any auto-repeat features.I'm sending the events via the following function.
void
SysKeypress(int fd, int code, int down){struct input_event ev; memset (&ev, 0, sizeof(ev)); ev.type=EV_KEY; ev.code=code; ev.value=down; write (fd, &ev, sizeof(ev)); }and if I hardcode an
SysKeypress (uinput_fd, KEY_LEFTSHIFT, 1); SysKeypress (uinput_fd, KEY_1, 1); SysKeypress (uinput_fd, KEY_1, 0); SysKeypress (uinput_fd, KEY_LEFTSHIFT, 0); SysKeypress (uinput_fd, KEY_1, 1); SysKeypress (uinput_fd, KEY_1, 0);
Quoted 4 lines
it only receices an !! and if I change the blocks an 11.
I read the documentfile about input drivers, but i didn't find anything special about uinput.
Are you working in the console or in X? What keyboard driver are you using? You may want to send EV_SYN/SYN_REPORT calls in between keypress events since consumers might rely on them.
Signature · 1 line
Dmitry
Hi Dmitry!
Quoted 1 line · Dmitry Torokhov
Are you working in the console or in X?
In X. I tried it in the console and it seems to work. Problem occurs only within X.
Quoted 1 line
What keyboard driver are you using?
In xorg.conf is
Driver "keyboard"
set.
Quoted 2 lines
You may want to send EV_SYN/SYN_REPORT calls in between keypress events since consumers might rely on them.
I added a function
void SysSync(int fd) {
struct input_event ev;
memset (&ev, 0, sizeof(ev));
ev.type=EV_SYN; ev.code=SYN_REPORT; ev.value=0;
write (fd, &ev, sizeof(ev));
}and then tried
SysKeypress (uinput_fd, KEY_LEFTSHIFT, 1); SysSync(uinput_fd); SysKeypress (uinput_fd, KEY_1, 1); SysSync(uinput_fd); SysKeypress (uinput_fd, KEY_1, 0); SysSync(uinput_fd); SysKeypress (uinput_fd, KEY_LEFTSHIFT, 0); SysSync(uinput_fd); SysKeypress (uinput_fd, KEY_1, 1); SysSync(uinput_fd); SysKeypress (uinput_fd, KEY_1, 0); SysSync(uinput_fd);
but same behaviour within X.
Regards
Tobias
Quoted 6 lines · Tobias M??ller
Hi Dmitry!
Quoted 1 line · Dmitry Torokhov
Are you working in the console or in X?
In X. I tried it in the console and it seems to work. Problem occurs only within X.
In this case I would recommend contacting X guys. You see that your uinput program works and the in-kernel consode driver works as well. Does xev reports the events you expect?
Signature · 1 line
Dmitry