Fastbootd: General fixes and changes

read data once bug fix
ability to run fastbootd without network and named socket configuration in init.rc
vendortrigger name changed to fastbootd
deleted unused function from default implementation of OEM library

Change-Id: Ib957fae8172530f20d51bb51b5e07bccab07e555
diff --git a/fastbootd/fastbootd.c b/fastbootd/fastbootd.c
index 9318c99..2b51b33 100644
--- a/fastbootd/fastbootd.c
+++ b/fastbootd/fastbootd.c
@@ -38,17 +38,19 @@
 {
     int socket_client = 0;
     int c;
+    int network = 1;
 
     klog_init();
     klog_set_level(6);
 
     const struct option longopts[] = {
         {"socket", no_argument, 0, 'S'},
+        {"nonetwork", no_argument, 0, 'n'},
         {0, 0, 0, 0}
     };
 
     while (1) {
-        c = getopt_long(argc, argv, "S", longopts, NULL);
+        c = getopt_long(argc, argv, "Sn", longopts, NULL);
         /* Alphabetical cases */
         if (c < 0)
             break;
@@ -56,6 +58,9 @@
         case 'S':
             socket_client = 1;
             break;
+        case 'n':
+            network = 0;
+            break;
         case '?':
             return 1;
         default:
@@ -70,6 +75,7 @@
     klog_set_level(6);
 
     if (socket_client) {
+        //TODO: Shouldn't we change current tty into raw mode?
         run_socket_client();
     }
     else {
@@ -78,10 +84,14 @@
         load_trigger();
         commands_init();
         usb_init();
-        if (!transport_socket_init())
-            exit(1);
-        ssh_server_start();
-        network_discovery_init();
+
+        if (network) {
+            if (!transport_socket_init())
+                exit(1);
+            ssh_server_start();
+            network_discovery_init();
+        }
+
         while (1) {
             sleep(1);
         }