Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can not connect to device with leading space in device serial number #3537

Open
2 tasks done
CameronBanga opened this issue Oct 14, 2022 · 2 comments
Open
2 tasks done

Comments

@CameronBanga
Copy link

  • I have read the FAQ.
  • I have searched in existing issues.

Environment

  • OS: macOS
  • scrcpy version: [e.g. 1.24]
  • installation method: brew
  • device model: Glorystar GAD-101
  • Android version: 5.1

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
@rom1v
Copy link
Collaborator

rom1v commented Oct 14, 2022

Thank you for the report.

I started to work on supporting serial with spaces. I thought it was easy: adb devices uses a tab separator between the serial and the state, but adb devices -l uses spaces, so a space in the serial is theoretically indistinguishable from a separator. We could make a special case for leading spaces, but it seems odd :/

@CameronBanga
Copy link
Author

If it helps anyone who happens to stumble upon this, as an interim fix, I have the following script that resolves issue. Have to run again after a power cycle though:

#!/bin/bash

adb root
adb shell 'echo -n "WhateverSerialNumberYouWantHere" > /sys/class/android_usb/android0/iSerial'
adb kill-server && adb start-server

# After Completing, you need to unplug and then re-plug in your USB cable to device.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants