A program to automatically switch keyboards for syscons

Norbert Koch NKoch at demig.de
Fri Dec 17 05:48:27 PST 2004


Hello.

For an embedded system I need FreeBSD to accept
input from two keyboards at the same time.
As syscons cannot do that and it is obviously
not trivial to change that, I wrote the enclosed
program.

After switching syscons to the first keyboard
available, it calls select for the other keyboard(s).
If there is any input available the active keyboard
for syscons is changed.

This works, more or less. (I am using FreeBSD 4.10)
The problem is that after switching, the first
key pressed on the new keyboard is lost.

Does anyone have an idea about that? Am I doing
something wrong? Any other - possibly better - idea
to have more than one keyboard at the same time?

You may notice, that I flush the old keyboard
after detaching and before re-attaching the new
one. I do that because I saw an endless switching
(kbd1->kbd0->kbd1->kbd0->...) when not doing that.
I do not understand, why select should return
anything from a keyboard where I do not press
any key. May be, I am missing something.

Any help appreciated.

Thanks,
Norbert

P.S.: If there is any interest, I could
 make a port out of that program.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kbautosw.c
Type: application/octet-stream
Size: 6353 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-hackers/attachments/20041217/a145af93/kbautosw.obj


More information about the freebsd-hackers mailing list