[openbeos] PS/2 keyboard glitch & looking at the code of InputServer

I'm trying to figure out a bug. Here's what I see:

Unless there's also a PS/2 mouse, my PS/2 keyboard 
won't work at bootup, but it does seem to be there, sort of.
Typing on the PS/2 keyboard has no visible result, but doing
any of the following will kick the PS/2 keyboard into gear:

- change keymap in the Keymap preferences
- choose defaults in the Keyboard preferences
- run /bin/keymap -r
- hey input_server 'Iskm'
(a IS_RESTORE_KEY_MAP message)

A few key presses that have been buffered up will spill out.

InputServer::HandleGetSetKeyMap() will be called, which 
in turn calls InputServer::_LoadKeymap() or _LoadSystemKeymap()

This will load the InputServer's fKeys (key_map) with data from
B_USER_SETTINGS_DIRECTORY / Key_map
or use defaults

Now, why doesn't this happen at bootup? 
Does it?

_InitKeyboardMouseStates(); is called from the constructor
of InputServer (which inherits from BApplication), but this 
seems too early as the AppServerLink is not set up until
InputServer::ReadyToRun().

The comments in InputServer::_InitKeyboardMouseStates()
seems to state that the app_server will have to provide some
data. If that is the case, _InitKeyboardMouseStates() should
be called in ReadyToRun after the AppServerLink is set up,
at the earliest, no?

This part of _InitKeyboardMouseStates()

        BMessage msg(B_MOUSE_MOVED);
        HandleSetMousePosition(&msg, &msg);

is a dead end as 

HandleSetMousePosition(BMessage* message, BMessage* reply)
will return B_BAD_VALUE, doing nothing, on empty messages:

        BPoint where;
        if (message->FindPoint("where", &where) != B_OK)
                return B_BAD_VALUE;

Perhaps that part of _InitKeyboardMouseStates() should be 

        BMessage msg(B_MOUSE_MOVED);
        msg.AddPoint("where", &fMousePos);   // ADDED
        HandleSetMousePosition(&msg, &msg);

I've tried adding that line, and also calling InitKeyboardMouseStates()
from the end of InputServer::ReadyToRun(), but so far I haven't been
able to have PS/2 keyboard work at bootup.

Anyone got an eyeball to spare?

/Jonas Sundström.

Other related posts: