Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(174)

Unified Diff: tools/android/adb_reboot/adb_reboot.c

Issue 12733012: Provision Android devices after the 'device_status_check' step. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove process detachment Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« build/android/host_heartbeat.py ('K') | « build/android/provision_devices.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/android/adb_reboot/adb_reboot.c
diff --git a/tools/android/adb_reboot/adb_reboot.c b/tools/android/adb_reboot/adb_reboot.c
index 1cc75339ceb58ede73ff542ad7e75ce6420419ea..1ae079e5c8fd0fa87ea924e74b5f93bdbc43bcf2 100644
--- a/tools/android/adb_reboot/adb_reboot.c
+++ b/tools/android/adb_reboot/adb_reboot.c
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include <sys/types.h>
+#include <sys/stat.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
@@ -23,10 +25,14 @@ int main(int argc, char ** argv) {
setsid(); /* obtain a new process group */
while (1) {
- system("touch /sdcard/host_heartbeat");
sleep(120);
- if (fopen("/sdcard/host_heartbeat", "r") != NULL) {
- // File exists, was not removed from host.
+
+ struct stat ft;
+ time_t ct;
navabi 2013/03/27 22:05:29 Declare these at the top of the method instead of
Siva Chandra 2013/03/27 22:13:43 Done.
+ stat("/sdcard/host_heartbeat", &ft);
+ time(&ct);
+ if (ct - ft.st_mtime > 120) {
+ /* File was not touched for some time. */
system("stop adbd");
system("sleep 2");
system("start adbd");
« build/android/host_heartbeat.py ('K') | « build/android/provision_devices.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698