detect adb: (invalid in normal hostname) as android remote target

* For now, just redirect to 127.0.0.1 and assume the user has proper
  port forwarding set up, but in future we'd do this ourselves and maybe
  parse out a device name after the adb:
This commit is contained in:
baldurk
2016-09-12 20:05:51 +02:00
parent 80fbe84fb1
commit 4dc9857341
3 changed files with 25 additions and 1 deletions
+7
View File
@@ -1187,6 +1187,13 @@ RENDERDOC_CreateRemoteServerConnection(const char *host, uint32_t port, RemoteSe
if(host != NULL && host[0] != '\0')
s = host;
if(!strncmp(host, "adb:", 4))
{
s = "127.0.0.1";
// could parse out an (optional) device name from host+4 here.
}
if(port == 0)
port = RENDERDOC_GetDefaultRemoteServerPort();
+11 -1
View File
@@ -705,12 +705,22 @@ extern "C" RENDERDOC_API TargetControl *RENDERDOC_CC RENDERDOC_CreateTargetContr
if(host != NULL && host[0] != '\0')
s = host;
bool android = false;
if(!strncmp(host, "adb:", 4))
{
android = true;
s = "127.0.0.1";
// could parse out an (optional) device name from host+4 here.
}
Network::Socket *sock = Network::CreateClientSocket(s.c_str(), ident & 0xffff, 750);
if(sock == NULL)
return NULL;
bool localhost = Network::GetIPOctet(sock->GetRemoteIP(), 0) == 127;
bool localhost = !android && (Network::GetIPOctet(sock->GetRemoteIP(), 0) == 127);
TargetControl *remote = new TargetControl(sock, clientName, forceConnection != 0, localhost);
+7
View File
@@ -477,6 +477,13 @@ extern "C" RENDERDOC_API uint32_t RENDERDOC_CC RENDERDOC_EnumerateRemoteTargets(
if(host != NULL && host[0] != '\0')
s = host;
if(!strncmp(host, "adb:", 4))
{
s = "127.0.0.1";
// could parse out an (optional) device name from host+4 here.
}
// initial case is we're called with 0, start with the first port.
// otherwise we're called with the last successful ident, so increment
// before continuing to enumerate.