Can not connect to device with leading space in device serial number (original) (raw)

Environment

Describe the bug
See issue #3534 (comment) for further information.

While trying to connect using scrcpy, I get the following:

scrcpy 1.24 <https://github.com/Genymobile/scrcpy>
2022-10-14 14:33:40.022 scrcpy[12626:145516] ERROR: Could not find any ADB device
2022-10-14 14:33:40.415 scrcpy[12626:145515] ERROR: Server connection failed

As determined by @rom1v, this is due to my device serial number starting with a leading space:

Downloads|⇒ adb -s GS101200400611 shell echo ok
adb: device 'GS101200400611' not found

Downloads|⇒ adb -s ' GS101200400611' shell echo ok
ok