Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

added a function to show log

  • Loading branch information...
commit e89f0f17983da6e852aef7ebccd744b3543f2001 1 parent a7e6e81
@tpruvot authored
Showing with 24 additions and 0 deletions.
  1. +1 −0  common.h
  2. +7 −0 extendedcommands.c
  3. +1 −0  nandroid.c
  4. +15 −0 ui.c
View
1  common.h
@@ -33,6 +33,7 @@ void ui_clear_key_queue();
// The screen is small, and users may need to report these messages to support,
// so keep the output short and not too cryptic.
void ui_print(const char *fmt, ...) __attribute__((format(printf, 1, 2)));
+void ui_printlogtail(int nb_lines);
void ui_reset_text_col();
void ui_set_show_text(int value);
View
7 extendedcommands.c
@@ -869,6 +869,7 @@ void show_advanced_menu()
"Report Error",
"Kill adbd",
"Start adbd",
+ "Show Log",
#ifndef BOARD_HAS_SMALL_RECOVERY
"Partition SD Card",
"Fix Permissions",
@@ -944,6 +945,12 @@ void show_advanced_menu()
__system("echo 'msc_adb' > /dev/usb_device_mode");
__system("/sbin/adbd.root &");
ui_print("adbd started.\n");
+ break;
+ }
+ case 6:
+ {
+ ui_printlogtail(5);
+ break;
}
#else
case 5:
View
1  nandroid.c
@@ -254,6 +254,7 @@ int nandroid_restore_partition_extended(const char* backup_path, const char* mou
*/
if (0 != (ret = format_volume(mount_point))) {
ui_print("Error while formatting %s!\n", mount_point);
+ ui_printlogtail(4);
return ret;
}
View
15 ui.c
@@ -481,6 +481,21 @@ void ui_print(const char *fmt, ...)
pthread_mutex_unlock(&gUpdateMutex);
}
+void ui_printlogtail(int nb_lines) {
+ char log_data[2048]="\0";
+ char tmp[PATH_MAX];
+ FILE * f;
+ sprintf(tmp, "tail -n %d /tmp/recovery.log > /tmp/tail.log", nb_lines);
+ __system(tmp);
+ f = fopen("/tmp/tail.log", "rb");
+ if (f != NULL) {
+ fread(log_data, 2048, 1, f);
+ fclose(f);
+ ui_print("%s", log_data);
+ }
+}
+
+
void ui_reset_text_col()
{
pthread_mutex_lock(&gUpdateMutex);
Please sign in to comment.
Something went wrong with that request. Please try again.