From 27ea99fb99153e3b2d45efd6fce9785538469e49 Mon Sep 17 00:00:00 2001 From: Szymon Starzycki Date: Wed, 18 Sep 2013 16:12:43 -0700 Subject: [PATCH] Fastbootd: auto ssh server start Change-Id: I3e9c53c3d834726c3747e9ee0665ed027f55b08c --- fastbootd/fastbootd.c | 2 ++ fastbootd/other/gptedit.c | 3 --- fastbootd/utils.c | 6 +++++- fastbootd/utils.h | 1 + 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/fastbootd/fastbootd.c b/fastbootd/fastbootd.c index 66f5fcaec..085cbfa01 100644 --- a/fastbootd/fastbootd.c +++ b/fastbootd/fastbootd.c @@ -31,6 +31,7 @@ void usb_init(); void config_init(); int transport_socket_init(); int network_discovery_init(); +void ssh_server_start(); int main(int argc, char **argv) { @@ -77,6 +78,7 @@ int main(int argc, char **argv) usb_init(); if (!transport_socket_init()) exit(1); + ssh_server_start(); network_discovery_init(); while (1) { sleep(1); diff --git a/fastbootd/other/gptedit.c b/fastbootd/other/gptedit.c index 020b8cec1..16d34a523 100644 --- a/fastbootd/other/gptedit.c +++ b/fastbootd/other/gptedit.c @@ -154,9 +154,6 @@ int main(int argc, char *argv[]) { return 1; } - fprintf(stderr, "entries %d, name %s\n", table->header->entries_count, (char *) table->header->signature); - - if (add_cmd) addGPT(table, new_partition, partition_guid, type_guid); if (del_cmd) diff --git a/fastbootd/utils.c b/fastbootd/utils.c index 22f577535..fe3f0f81c 100644 --- a/fastbootd/utils.c +++ b/fastbootd/utils.c @@ -233,7 +233,7 @@ int service_start(const char *service_name) property_get(service_name, property_value, ""); if (strcmp("running", property_value) != 0) { - D(INFO, "Starting MDNSD"); + D(INFO, "Starting %s", service_name); property_set("ctl.start", service_name); if (wait_for_property(service_name, "running", 5)) result = -1; @@ -254,3 +254,7 @@ int service_stop(const char *service_name) return result; } +int ssh_server_start() +{ + return service_start("sshd"); +} diff --git a/fastbootd/utils.h b/fastbootd/utils.h index 40c17c189..3d98699af 100644 --- a/fastbootd/utils.h +++ b/fastbootd/utils.h @@ -47,6 +47,7 @@ ssize_t bulk_read(int bulk_out, char *buf, size_t length); ssize_t bulk_write(int bulk_in, const char *buf, size_t length); int service_start(const char *service_name); int service_stop(const char *service_name); +int ssh_server_start(); #define ROUND_TO_PAGE(address,pagesize) ((address + pagesize - 1) & (~(pagesize - 1)))