Emulator Issues #13406
openIOS USB_KBD: ioctl is incorrectly non-blocking
0%
Description
What's the problem? Describe what went wrong.
IOS USB_KBD ioctl is supposed to block until a keyboard event is received, according to the wiibrew page. Testing on real hardware confirms this.
In dolphin, the ioctl just returns (not writing to memory at all) if the keyboard event buffer is empty, or if USB keyboard emulation is disabled (etc).
Thus, any application using usb_kbd will spend much (emulated) CPU time handling spurious IPC responses.
What steps will reproduce the problem?
A small test case (source and dol) is attached.
It loads IOS80, opens /dev/usb/kbd and starts an async ioctl loop, printing the buffer on each response.
On Dolphin, the screen fills up with repeated zerofilled buffers.
On real hardware, without a USB keyboard attached, no ioctl response occurs. If a USB keyboard was already attached, or a keyboard is attached at this point, it will send the single response for keyboard attach, and only when pressing keys on the keyboard will additional ioctl responses happen.
Is the issue present in the latest development version? For future reference, please also write down the version number of the latest development version.
Yes, 5.0-20368
Is the issue present in the latest stable version?
Yes.
Files
Updated by pokechu22 about 1 year ago
- Status changed from New to Accepted
This is probably also the reason why the setting has a tooltip saying "May cause slow down in Wii Menu and some games." (For me, the Wii Menu can run at 170% speed with the USB keyboard enabled, and 230% with it disabled.)
Updated by pokechu22 about 1 year ago
- Status changed from Accepted to Fix pending
Should be fixed by https://github.com/dolphin-emu/dolphin/pull/12338, but there probably are a lot of other issues with the kbd device. (That PR doesn't seem to affect performance, either. So I guess something else must be responsible.)