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:
- 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, modifier 0x02
- Right Shift: HID scancode
0xe5, modifier 0x20
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:
or the expected Right Shift modifier:
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?
Environment
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
Expected behavior
Both Shift keys should work as Shift modifiers.
For UHID keyboard input, I would expect:
0xe1, modifier0x020xe5, modifier0x20Actual behavior
Left Shift works correctly. For example, while holding Left Shift:
Without Shift, the same keys correctly use
mod=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:
or the expected Right Shift modifier:
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?