android_adb: Listen for ADB connections on, not localhost

QEMU's inet_listen() routine only listens on the first result
it gets back for the hostname it is passed; if that is an IPv6
address, as it is on Windows, then we end up listening on the
IPv6 loopback address, and the adb server fails to connect to
us because it is expecting to use IPv4. Use the explicit IPv4
loopback address to ensure we are listening where
the adb server expects to find us.

Signed-off-by: Peter Maydell <>
diff --git a/hw/misc/android_adb.c b/hw/misc/android_adb.c
index 68da548..3fbfe51 100644
--- a/hw/misc/android_adb.c
+++ b/hw/misc/android_adb.c
@@ -331,7 +331,7 @@
     Error *err = NULL;
     int fd;
-    host_port = g_strdup_printf("localhost:%d", port);
+    host_port = g_strdup_printf("", port);
     fd = inet_listen(host_port, NULL, 0, SOCK_STREAM, 0, &err);
     if (fd < 0) {
         return false;