Repository navigation
Description
Environment
- OS: Windows 11
- Scrcpy version: 4.0 and later
- Installation method: Windows release
- Device model: Galaxy Tab S11 Ultra
- Android version: 16
- Keyboard: K995p
- **Keyboard layout:**Korean / US
Describe the bug
When using scrcpy with UHID keyboard mode (-K / --keyboard=uhid), the Right Shift key does not work as a Shift modifier, while the Left Shift key works correctly.
This appears to be a regression introduced in scrcpy 4.0. The same PC, keyboard, and Android device worked correctly with scrcpy versions before 4.0.
Since scrcpy 4.0 migrated from SDL2 to SDL3, this might be related to SDL3 keyboard/scancode handling, but I have not confirmed the root cause.
Steps to reproduce
- Start scrcpy with UHID keyboard mode and verbose logging:
scrcpy -K -Vverbose- Hold Left Shift and press some keys.
- Release Left Shift.
- Hold Right Shift and press the same keys.
Expected behavior
Both Shift keys should work as Shift modifiers.
For UHID keyboard input, I would expect:
- Left Shift: HID scancode
0xe1, modifier0x02 - Right Shift: HID scancode
0xe5, modifier0x20
Actual behavior
Left Shift works correctly. For example, while holding Left Shift:
VERBOSE: keys[51] = true
VERBOSE: hid keyboard: key down scancode=51 (81) mod=02
VERBOSE: input: UHID input [1] 02 00 51 00 00 00 00 00
VERBOSE: keys[51] = false
VERBOSE: hid keyboard: key up scancode=51 (81) mod=02
VERBOSE: input: UHID input [1] 02 00 00 00 00 00 00 00
VERBOSE: keys[52] = true
VERBOSE: hid keyboard: key down scancode=52 (82) mod=02
VERBOSE: input: UHID input [1] 02 00 52 00 00 00 00 00
VERBOSE: keys[52] = false
VERBOSE: hid keyboard: key up scancode=52 (82) mod=02
VERBOSE: input: UHID input [1] 02 00 00 00 00 00 00 00
VERBOSE: hid keyboard: key up scancode=e1 (225) mod=00
VERBOSE: input: UHID input [1] 00 00 00 00 00 00 00 00
Without Shift, the same keys correctly use mod=00:
VERBOSE: keys[51] = true
VERBOSE: hid keyboard: key down scancode=51 (81) mod=00
VERBOSE: input: UHID input [1] 00 00 51 00 00 00 00 00
VERBOSE: keys[51] = false
VERBOSE: hid keyboard: key up scancode=51 (81) mod=00
VERBOSE: input: UHID input [1] 00 00 00 00 00 00 00 00
VERBOSE: keys[52] = true
VERBOSE: hid keyboard: key down scancode=52 (82) mod=00
VERBOSE: input: UHID input [1] 00 00 52 00 00 00 00 00
VERBOSE: keys[52] = false
VERBOSE: hid keyboard: key up scancode=52 (82) mod=00
VERBOSE: input: UHID input [1] 00 00 00 00 00 00 00 00
However, when I press Right Shift, it does not work as a Shift modifier.
In particular, I do not see the expected Right Shift HID scancode:
scancode=e5 (229)
or the expected Right Shift modifier:
mod=20
in the verbose output.
The issue is reproducible with scrcpy 4.0 and later, while the same setup works correctly with versions before 4.0.
Could this be a regression related to the SDL2 → SDL3 migration in scrcpy 4.0, possibly in the keyboard event/scancode handling?
Activity
rom1v commentedon Aug 10, 2026
I cannot reproduce on Linux:
Left-shift down and up:
Right-shift down and up:
To be tested on Windows (I currently can't).
Vishnu070803 commentedon Aug 16, 2026
hey, I successfully reproduced this! it's true, when switching to the korean layout in windows the right shift fails.
your were right. the root cause is a regression introduced in commit c8479fe. because of how windows handles the korean layout, sdl3 strips the virtual keycode for right shift (making it unknown), but it still passes the physical scancode (e5).
that commit aggressively drops any key event with an unknown virtual keycode. this completely breaks uhid mode, since uhid only cares about the physical scancode anyway and is supposed to bypass the os layout.
i just submitted a fix in PR #6990. it relaxes that filter so it doesn't drop the event as long as the physical scancode is valid. this should fully restore right shift for korean keyboards in uhid mode!
Fix dropped keys in UHID for some keyboard layouts