Simple usb keyboard/mouse driver implementation after ExitBootServices


gomidas95@...
 

Hello, I am an amateur. I made a uefi app for reading some type of images (bmp os/2) and files in folders. That also provides mice and keyboard support. I did not use edk2 but gnu-efi later I will switch it to edk2. Gnu do not have any doc about drivers. When I exit boot services my keyboard (console output text) and mice (graphical cursor on screen) becomes unresponsive.

I exit like this:
SystemTable->BootServices->ExitBootServices(ImageHandle, 0);

For, qemu emulator I did a trick, I made a third event for 'gEfiSimpleTextInProtocolGuid' and keyboard became responsive again after I called exitbootservices:

SimpleKeyboard(EFI_EVENT kbEvent)
{
gBS->CreateEventEx
(
EVT_NOTIFY_SIGNAL,
TPL_NOTIFY,
NULL,
NULL,
&gEfiSimpleTextInProtocolGuid,
(VOID**)&kbEvent
);
}

in main.c:
Events[0] = mouse->WaitForInput;

//Keyboard - will become useless after exitbootservices.
Events[1] = gST->ConIn->WaitForKey;

//keyboard - work in emulator as a trick.
SimpleKeyboard(Events[2]);

When switched to real hardware keyboard became unresponsive again, qemu do not have mouse support and did not test it. I did the app for hobby and I do not have enough knowledge about drivers.

What I should I do to allow keyboard and mice again on a real hardware ?

Join discuss@edk2.groups.io to automatically receive all group messages.