Project

General

Profile

Actions

Emulator Issues #13406

open

IOS USB_KBD: ioctl is incorrectly non-blocking

Added by Rairii 12 months ago. Updated 12 months ago.

Status:
Fix pending
Priority:
Normal
Assignee:
-
% Done:

0%

Operating system:
N/A
Issue type:
Bug
Milestone:
Regression:
No
Relates to usability:
No
Relates to performance:
No
Easy:
No
Relates to maintainability:
No
Regression start:
Fixed in:

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

usbkbd_test.zip (141 KB) usbkbd_test.zip Rairii, 11/25/2023 05:10 PM
Actions #1

Updated by pokechu22 12 months 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.)

Actions #2

Updated by pokechu22 12 months 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.)

Actions

Also available in: Atom PDF