From d9d1ca47802395e9e42e7deb05b2683d9d306598 Mon Sep 17 00:00:00 2001 From: Stefan Hilzinger Date: Mon, 26 Apr 2010 10:17:43 +0100 Subject: Let "adb connect" connect to emulators too - adb can now connect to an emulator configured with an arbitrary pair of . These two ports do not have to be adjacent. This can be done from the commandline at any time using adb connect emu:, - Emulators running on ports outside the normal range (5554/5555-5584/5585) register themselves on startup if they follow the convention "console port+1==abd port". - Emulators outside the normal port range will not be auto-detected on adb startup as these ports are not probed. - The index into local_transports[] array in transport_local.c does no longer indicate the port number of the local transport. Use the altered atransport struct to get the port number. - I have chosen not to document the adb connect emu:console_port,adb_port syntax on adb's help screen as this might be confusing to most readers and useful to very few. - I don't expect this to introduce any (backwards) compatibility issues. Change-Id: Iad3eccb2dcdde174b24ef0644d705ecfbff6e59d Signed-off-by: Mike Lockwood --- adb/adb.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'adb/adb.h') diff --git a/adb/adb.h b/adb/adb.h index a2b611e6..292e4159 100644 --- a/adb/adb.h +++ b/adb/adb.h @@ -183,6 +183,7 @@ struct atransport /* used to identify transports for clients */ char *serial; char *product; + int adb_port; // Use for emulators (local transport) /* a list of adisconnect callbacks called when the transport is kicked */ int kicked; @@ -262,6 +263,9 @@ void run_transport_disconnects( atransport* t ); void kick_transport( atransport* t ); /* initialize a transport object's func pointers and state */ +#if ADB_HOST +int get_available_local_transport_index(); +#endif int init_socket_transport(atransport *t, int s, int port, int local); void init_usb_transport(atransport *t, usb_handle *usb, int state); @@ -280,6 +284,9 @@ void register_usb_transport(usb_handle *h, const char *serial, unsigned writeabl void unregister_usb_transport(usb_handle *usb); atransport *find_transport(const char *serial); +#if ADB_HOST +atransport* find_emulator_transport_by_adb_port(int adb_port); +#endif int service_to_fd(const char *name); #if ADB_HOST @@ -368,6 +375,7 @@ typedef enum { void local_init(int port); int local_connect(int port); +int local_connect_arbitrary_ports(int console_port, int adb_port); /* usb host/client interface */ void usb_init(); -- cgit v1.2.3