-
Notifications
You must be signed in to change notification settings - Fork 0
/
log.h
234 lines (179 loc) · 7.67 KB
/
log.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
/*
* log.h
* This file acts as an interface to interact with the users
*
* Copyright (c) 2012, wcypierre <[email protected]>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef LOG_H // header guard
#define LOG_H
extern std::string device_id;
const float AIOLOG_VERSION = 0.7;
const char ADB_START_SERVER[] = "adb start-server";
const char ADB_WAIT_FOR_DEVICE[] = " wait-for-device";
const char ADB_DEVICES[] = "adb devices";
const char ADB_GET_SERIAL_NO[] = "adb get-serialno";
const char ADB_GETPROP_PRODUCT_MODEL[] = "adb shell getprop ro.product.model";
const char GET_SERIAL_NO[] = " get-serialno";
const char GETPROP_PRODUCT_MODEL[] = " shell getprop ro.product.model";
const char ADB_WITH_DEVICE_ID[] = "adb -s ";
const char DEVICE_NOT_FOUND_INDICATOR[] = "unknown";
const char LOGCAT[] = "logcat";
const char LOGCAT_RADIO[] = "logcat_radio";
const char KMSG[] = "kmsg";
const char LAST_KMSG[] = "last_kmsg";
const char DMESG[] = "dmesg";
const char KERNEL_VERSION[] = "kernel_version";
const char LOG_ESSENTIAL[] = "log_essential";
const char LOG_ALL[] = "log_all";
const char DIR_AIOLOG_CREATE[] = " shell mkdir -p /mnt/sdcard/aiolog";
const char DIR_DOT_AIOLOG_CREATE[] = " shell mkdir -p /mnt/sdcard/.aiolog";
const char LOGCAT_THREADTIME[] = " logcat -d -v threadtime > logcat.txt";
const char LOGCAT_CONTINUOUS_THREADTIME[] = " logcat -v threadtime > logcat.txt";
const char LOGCAT_RADIO_THREADTIME[] = " logcat -d -v threadtime -b radio > logcat_radio.txt";
const char LOGCAT_CLEAR[] = " logcat -c";
const char LOGCAT_MESSAGE[] = "Logcat saved at logcat.txt";
const char LOGCAT_CONTINUOUS_MESSAGE[] = "Logcat will be saved at logcat.txt \nPlease press CTRL and C to close the program and stop the logging";
const char LOGCAT_RADIO_MESSAGE[] = "Logcat for radio issues will be saved at logcat_radio.txt";
const char LOGCAT_CLEAR_MESSAGE[] = "Logcat is cleared";
const char LOGCAT_FILENAME[] = "logcat.txt";
const char LOGCAT_PHONE_ROOT_FILENAME[] = "/mnt/sdcard/logcat.txt";
const char LOGCAT_PHONE_AIOLOG_FILENAME[] = "/mnt/sdcard/aiolog/logcat.txt";
const char LOGCAT_PHONE_DOT_AIOLOG_FILENAME[] = "/mnt/sdcard/.aiolog/logcat.txt";
const char LOGCAT_RADIO_FILENAME[] = "logcat_radio.txt";
const char LOGCAT_RADIO_PHONE_ROOT_FILENAME[] = "/mnt/sdcard/logcat_radio.txt";
const char LOGCAT_RADIO_PHONE_AIOLOG_FILENAME[] = "/mnt/sdcard/aiolog/logcat_radio.txt";
const char LOGCAT_RADIO_PHONE_DOT_AIOLOG_FILENAME[] = "/mnt/sdcard/.aiolog/logcat_radio.txt";
const char LAST_KMSG_CODE[] = " shell cat /proc/last_kmsg > last_kmsg.txt";
const char LAST_KMSG_MESSAGE[] = "last_kmsg saved at last_kmsg.txt";
const char LAST_KMSG_FILENAME[] = "last_kmsg.txt";
const char LAST_KMSG_PHONE_ROOT_FILENAME[] = "/mnt/sdcard/last_kmsg.txt";
const char LAST_KMSG_PHONE_AIOLOG_FILENAME[] = "/mnt/sdcard/aiolog/last_kmsg.txt";
const char LAST_KMSG_PHONE_DOT_AIOLOG_FILENAME[] = "/mnt/sdcard/.aiolog/last_kmsg.txt";
const char KMSG_CODE[] = " shell cat -f /proc/kmsg > kmsg.txt";
const char KMSG_CONTINUOUS_CODE[] = " shell cat /proc/kmsg > kmsg.txt";
const char KMSG_MESSAGE[] = "kmsg saved at kmsg.txt";
const char KMSG_CONTINUOUS_MESSAGE[] = "kmsg will be saved at kmsg.txt\nPlease press CTRL and C to close the program and stop the logging";
const char KMSG_FILENAME[] = "kmsg.txt";
const char KMSG_PHONE_ROOT_FILENAME[] = "/mnt/sdcard/kmsg.txt";
const char KMSG_PHONE_AIOLOG_FILENAME[] = "/mnt/sdcard/aiolog/kmsg.txt";
const char KMSG_PHONE_DOT_AIOLOG_FILENAME[] = "/mnt/sdcard/.aiolog/kmsg.txt";
const char DMESG_CODE[] = " shell dmesg > dmesg.txt";
const char DMESG_CLEAR_CODE[] = " shell dmesg -c > .tmp";
const char DMESG_MESSAGE[] = "dmesg saved at dmesg.txt";
const char DMESG_CLEAR_MESSAGE[] = "Dmesg is cleared";
const char DMESG_FILENAME[] = "dmesg.txt";
const char DMESG_PHONE_ROOT_FILENAME[] = "/mnt/sdcard/dmesg.txt";
const char DMESG_PHONE_AIOLOG_FILENAME[] = "/mnt/sdcard/aiolog/dmesg.txt";
const char DMESG_PHONE_DOT_AIOLOG_FILENAME[] = "/mnt/sdcard/.aiolog/dmesg.txt";
const char KERNEL_VERSION_FILENAME[] = "kernel_version.txt";
const char KERNEL_VERSION_CODE[] = " shell uname -a > kernel_version.txt";
const char KERNEL_VERSION_LOCAL_CODE[] = " shell uname -a";
const char KERNEL_VERSION_MESSAGE[] = "Kernel Version is saved at kernel_version.txt";
const char CID_CODE[] = " shell getprop ro.cid";
const char CID_MESSAGE[] = "dmesg saved at dmesg.txt";
const char CID_FILENAME[] = "cid.txt";
const char CID_PHONE_ROOT_FILENAME[] = "/mnt/sdcard/cid.txt";
const char CID_PHONE_AIOLOG_FILENAME[] = "/mnt/sdcard/aiolog/cid.txt";
const char CID_PHONE_DOT_AIOLOG_FILENAME[] = "/mnt/sdcard/.aiolog/cid.txt";
const char LOG_ESSENTIAL_INPUT_FILENAME[] = "logcat.txt kmsg.txt dmesg.txt last_kmsg.txt";
const char LOG_ALL_INPUT_FILENAME[] = "logcat.txt kmsg.txt dmesg.txt last_kmsg.txt";
const int BUFFER_SIZE = 50;
const char SDCARD_LOCATION[] = "/mnt/sdcard/";
const char AIOLOG_SLASH[] = "aiolog/";
const char AIOLOG_DOT_SLASH[] = ".aiolog/";
const char READ_MODE[] = "r";
const char WRITE_MODE[] = "w";
const char ZIP_CREATE[] = "7za a -tzip ";
const char TAR_CREATE[] = "tar cvf ";
const char ZIP_PARAM[] = " -mmt -aot -y";
const char ZIP_DOT[] = ".zip";
const char TAR_DOT[] = ".tar";
const char WHITESPACE[] = " ";
const char EMPTY[] = "";
const char NEWLINE = '\n';
const char DEVICE_NOT_FOUND_MESSAGE[] = "error: device not found";
const char ADB_PUSH_CODE[] = " push ";
const char CLEAR_SCREEN_WIN[] = "cls";
const char CLEAR_SCREEN_UNIX[] = "clear";
#ifdef _WIN64
const int os_type = 0;
const std::string separator = "";
#elif _WIN32
const int os_type = 0;
const std::string separator = "";
#elif __APPLE__
const int os_type = 1;
const std::string separator = "";
#elif __linux
const int os_type = 1;
const std::string separator = "";
#elif __unix
const int os_type = 1;
const std::string separator = "";
#elif __posix
const int os_type = 1;
const std::string separator = "";
#endif
void log_essential();
void log_all();
void log_logcat();
void log_logcat_continuous();
void log_last_kmsg();
void log_dmesg();
void log_kmsg();
void log_kmsg_continuous();
void log_push(std::string, std::string);
void dir_create();
void log_archive(std::string);
void log_archive_linux(std::string, std::string);
void log_archive_win(std::string, std::string);
void header();
void help();
void misc_options();
void log_kernel_version();
void log_cid_version();
void settings_options();
void set_device_id(std::string &);
void advanced_options();
void log_logcat_radio();
void log_logcat_clear();
void log_dmesg_clear();
void adb_start_server();
void wait_for_device();
void adb_devices();
void clear_screen();
// To be added
void log_logcat_option();
void log_dmesg_option();
void log_last_kmsg_option();
void log_kmsg_option();
void log_recovery_logcat();
void log_archive_mac();
void log_cpu_min_frequency();
void log_cpu_max_frequency();
void log_tegra3_cpu_variant();
void log_recovery();
void log_fix_permissions();
void reboot_recovery();
void reboot_bootloader();
void reboot_download();
void reboot();
void shutdown();
void html_logcat();
void html_dmesg();
void html_kmsg();
void html_last_kmsg();
#endif