Skip to content

Commit

Permalink
When connecting devices, prioritize the use of transport_id
Browse files Browse the repository at this point in the history
  • Loading branch information
shamork authored Jun 5, 2024
1 parent 987a519 commit 5e3d826
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
5 changes: 4 additions & 1 deletion AdvancedSharpAdbClient.Tests/Dummys/DummyAdbSocket.cs
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,10 @@ public void SetDevice(DeviceData device)
// to a specific device
if (device != null)
{
SendAdbRequest($"host:transport:{device.Serial}");
if(!string.IsNullOrWhiteSpace(device.TransportId) && uint.TryParse(device.TransportId,out var tid))
SendAdbRequest($"host:transport-id:{tid}");
else
SendAdbRequest($"host:transport:{device.Serial}");

try
{
Expand Down
5 changes: 4 additions & 1 deletion AdvancedSharpAdbClient/AdbSocket.Async.cs
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,10 @@ public async Task SetDeviceAsync(DeviceData device, CancellationToken cancellati
// to a specific device
if (device != null)
{
await SendAdbRequestAsync($"host:transport:{device.Serial}", cancellationToken).ConfigureAwait(false);
if(!string.IsNullOrWhiteSpace(device.TransportId) && uint.TryParse(device.TransportId,out var tid))
await SendAdbRequestAsync($"host:transport-id:{tid}", cancellationToken).ConfigureAwait(false);
else
await SendAdbRequestAsync($"host:transport:{device.Serial}", cancellationToken).ConfigureAwait(false);

try
{
Expand Down
5 changes: 4 additions & 1 deletion AdvancedSharpAdbClient/AdbSocket.cs
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,10 @@ public void SetDevice(DeviceData device)
// to a specific device
if (device != null)
{
SendAdbRequest($"host:transport:{device.Serial}");
if(!string.IsNullOrWhiteSpace(device.TransportId) && uint.TryParse(device.TransportId,out var tid))
SendAdbRequest($"host:transport-id:{tid}");
else
SendAdbRequest($"host:transport:{device.Serial}");

try
{
Expand Down

0 comments on commit 5e3d826

Please sign in to comment.