-
Notifications
You must be signed in to change notification settings - Fork 183
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
Add ADB (Android Debug Bridge) Support #1564
base: master
Are you sure you want to change the base?
Conversation
d234f34
to
15a4ce4
Compare
Codecov ReportAttention: Patch coverage is
✅ All tests successful. No failed tests found.
Additional details and impacted files@@ Coverage Diff @@
## master #1564 +/- ##
========================================
- Coverage 56.2% 55.9% -0.3%
========================================
Files 170 172 +2
Lines 13248 13429 +181
========================================
+ Hits 7449 7516 +67
- Misses 5799 5913 +114
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
e346334
to
892693a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some minor comments in regard to subcommand handling and attribute naming.
labgrid/remote/client.py
Outdated
if resource.extra.get("proxy_required") or self.args.proxy: | ||
proxy = resource.extra.get("proxy") | ||
scrcpy_cmd.append(f"--tunnel-host={ip_addr}") | ||
scrcpy_cmd.append(f"--tunnel-port={sshmanager.request_forward(proxy, host, 27183)}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this always the same port? How will this interact with multiple devices connected over ADB to the same host?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, I had not tested multiple simultaneous screen sharing sessions. I have added some code to find a free port on the exporter and use that. It is based on the "get_free_port" code within labgrid that gets a free port on the client machine.
Is this worth moving into a more general location? Maybe within SSHConnection
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
get_free_port
should already be in util.helper
, so you should be able to import it directly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That returns a free port on the machine running the labgrid client, I require a free port on the exporter. The way scrcpy works is that it runs a server on the android device and creates a port forward between it and the ADB host (the exporter in this case)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You might be able to handle that within the remote resource for the exporter, the SerialPortExport
does something similar to choose a free port for ser2net.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is an additional complication to the scrcpy
command.
I already use get_free_port
in the ADBExport
to get a port for the ADB server, which is started by the ADBExport
.
The scrcpy
server is not setup at this time, it is started by the scrcpy
client when it connects to the device. It first connects via ADB, transfers over the binaries, starts the server, then uses ADB to create a port forward between the device and the ADB host (the exporter).
I am unable to know at the time of starting the exporter what ports will be available at the time scrcpy
is launched, which could be weeks later.
Some forms of reset can reset the device into different modes. For example: - Reboot - Reboot into bootloader mode - Reboot into recovery mode Signed-off-by: Sebastian Goscik <[email protected]>
ADB is expected to be installed and working on the exporter and client machines. For screensharing "scrcpy" needs to be installed on the client. Signed-off-by: Sebastian Goscik <[email protected]>
This pull request add support for ADB (Android Debug Bridge) devices in labgrid.
adb
for interfacing with the device by theadb
cliscrcpy
for remote screen/touch/keyboard/clipboard/etc. sharingChecklist