adb: Fix emulator support.

Signed-off-by: Mike Lockwood <lockwood@android.com>
diff --git a/adb/adb.c b/adb/adb.c
index 9980bad..283ebce 100644
--- a/adb/adb.c
+++ b/adb/adb.c
@@ -851,7 +851,7 @@
     HOST = 1;
     usb_vendors_init();
     usb_init();
-    local_init();
+    local_init(ADB_LOCAL_TRANSPORT_PORT);
 
     if(install_listener("tcp:5037", "*smartsocket*", NULL)) {
         exit(1);
@@ -923,13 +923,15 @@
         ** is not set, otherwise start the network transport.
         */
     property_get("service.adb.tcp.port", value, "0");
-    if (sscanf(value, "%d", &port) == 0) {
-        port = 0;
-    }
-    if (port == 0 && access("/dev/android_adb", F_OK) == 0) {
+    if (sscanf(value, "%d", &port) == 1 && port > 0) {
+        // listen on TCP port specified by service.adb.tcp.port property
+        local_init(port);
+    } else if (access("/dev/android_adb", F_OK) == 0) {
+        // listen on USB
         usb_init();
     } else {
-        local_init(port);
+        // listen on default port
+        local_init(ADB_LOCAL_TRANSPORT_PORT);
     }
     init_jdwp();
 #endif