diff options
author | Dominik Riebeling <Dominik.Riebeling@gmail.com> | 2011-12-03 09:41:44 +0000 |
---|---|---|
committer | Dominik Riebeling <Dominik.Riebeling@gmail.com> | 2011-12-03 09:41:44 +0000 |
commit | 059cb71c96d0248b7b4898722b47f289dd15ad2d (patch) | |
tree | 8c5e69447d299060ef920216204ff9c4bb2638e4 /rbutil | |
parent | 07da9ce5ea9ca26436db04a63e281842467ff7fd (diff) | |
download | rockbox-059cb71c96d0248b7b4898722b47f289dd15ad2d.tar.gz rockbox-059cb71c96d0248b7b4898722b47f289dd15ad2d.zip |
Extend return codes for chinachip_patch().
Instead of passing error messages using a callback function (which becomes
awkward when used from a C++ class object) return distinct error codes from
chinachip_patch(). This also removes the kludge to support translations for
Rockbox Utility and moves the strings to translate to the installation class
where they belong.
As a side effect info messages won't be passed to Rockbox Utility anymore, but
the details of the patching progress aren't of that much interest for the user
anyway.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31115 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'rbutil')
-rw-r--r-- | rbutil/chinachippatcher/chinachip.c | 87 | ||||
-rw-r--r-- | rbutil/chinachippatcher/chinachip.h | 23 | ||||
-rw-r--r-- | rbutil/chinachippatcher/main.c | 21 | ||||
-rw-r--r-- | rbutil/rbutilqt/base/bootloaderinstallchinachip.cpp | 83 | ||||
-rw-r--r-- | rbutil/rbutilqt/base/bootloaderinstallchinachip.h | 1 |
5 files changed, 111 insertions, 104 deletions
diff --git a/rbutil/chinachippatcher/chinachip.c b/rbutil/chinachippatcher/chinachip.c index dc1d2a40bb..d9e3e75817 100644 --- a/rbutil/chinachippatcher/chinachip.c +++ b/rbutil/chinachippatcher/chinachip.c | |||
@@ -27,8 +27,6 @@ | |||
27 | #include <time.h> | 27 | #include <time.h> |
28 | #include "chinachip.h" | 28 | #include "chinachip.h" |
29 | 29 | ||
30 | #define tr(x) x /* Qt translation support */ | ||
31 | |||
32 | /* From http://www.rockbox.org/wiki/ChinaChip */ | 30 | /* From http://www.rockbox.org/wiki/ChinaChip */ |
33 | struct header | 31 | struct header |
34 | { | 32 | { |
@@ -63,22 +61,11 @@ static long int filesize(FILE* fd) | |||
63 | return len; | 61 | return len; |
64 | } | 62 | } |
65 | 63 | ||
66 | #ifdef STANDALONE | ||
67 | #define ERR(fmt, ...) err(userdata, "[ERR] "fmt"\n", ##__VA_ARGS__) | ||
68 | #define INFO(fmt, ...) info(userdata, "[INFO] "fmt"\n", ##__VA_ARGS__) | ||
69 | #define tr(x) x | ||
70 | #else | ||
71 | #define ERR(fmt, ...) err(userdata, fmt, ##__VA_ARGS__) | ||
72 | #define INFO(fmt, ...) info(userdata, fmt, ##__VA_ARGS__) | ||
73 | #endif | ||
74 | #define FCLOSE(fd) fclose(fd); fd = NULL; | 64 | #define FCLOSE(fd) fclose(fd); fd = NULL; |
75 | #define CCPMPBIN_HEADER_SIZE (sizeof(uint32_t)*2 + sizeof(uint8_t) + 9) | 65 | #define CCPMPBIN_HEADER_SIZE (sizeof(uint32_t)*2 + sizeof(uint8_t) + 9) |
76 | #define TOTAL_SIZE (fsize + CCPMPBIN_HEADER_SIZE + bsize) | 66 | #define TOTAL_SIZE (fsize + CCPMPBIN_HEADER_SIZE + bsize) |
77 | int chinachip_patch(const char* firmware, const char* bootloader, | 67 | enum cc_error chinachip_patch(const char* firmware, const char* bootloader, |
78 | const char* output, const char* ccpmp_backup, | 68 | const char* output, const char* ccpmp_backup) |
79 | void (*info)(void*, char*, ...), | ||
80 | void (*err)(void*, char*, ...), | ||
81 | void* userdata) | ||
82 | { | 69 | { |
83 | char header_time[13]; | 70 | char header_time[13]; |
84 | time_t cur_time; | 71 | time_t cur_time; |
@@ -87,46 +74,52 @@ int chinachip_patch(const char* firmware, const char* bootloader, | |||
87 | FILE *fd = NULL, *bd = NULL, *od = NULL; | 74 | FILE *fd = NULL, *bd = NULL, *od = NULL; |
88 | unsigned int ccpmp_size = 0, i, fsize, bsize; | 75 | unsigned int ccpmp_size = 0, i, fsize, bsize; |
89 | signed int checksum = 0, ccpmp_pos; | 76 | signed int checksum = 0, ccpmp_pos; |
77 | int result = E_OK; | ||
90 | 78 | ||
91 | fd = fopen(firmware, "rb"); | 79 | fd = fopen(firmware, "rb"); |
92 | if(!fd) | 80 | if(!fd) |
93 | { | 81 | { |
94 | ERR(tr("Can't open file %s!"), firmware); | 82 | fprintf(stderr, "[ERR] Can't open file %s!\n", firmware); |
83 | result = E_OPEN_FIRMWARE; | ||
95 | goto err; | 84 | goto err; |
96 | } | 85 | } |
97 | bd = fopen(bootloader, "rb"); | 86 | bd = fopen(bootloader, "rb"); |
98 | if(!bd) | 87 | if(!bd) |
99 | { | 88 | { |
100 | ERR(tr("Can't open file %s!"), bootloader); | 89 | fprintf(stderr, "[ERR] Can't open file %s!\n", bootloader); |
90 | result = E_OPEN_BOOTLOADER; | ||
101 | goto err; | 91 | goto err; |
102 | } | 92 | } |
103 | 93 | ||
104 | bsize = filesize(bd); | 94 | bsize = filesize(bd); |
105 | INFO(tr("Bootloader size is %d bytes"), bsize); | 95 | fprintf(stderr, "[INFO] Bootloader size is %d bytes\n", bsize); |
106 | FCLOSE(bd); | 96 | FCLOSE(bd); |
107 | 97 | ||
108 | fsize = filesize(fd); | 98 | fsize = filesize(fd); |
109 | INFO(tr("Firmware size is %d bytes"), fsize); | 99 | fprintf(stderr, "[INFO] Firmware size is %d bytes\n", fsize); |
110 | 100 | ||
111 | buf = malloc(TOTAL_SIZE); | 101 | buf = malloc(TOTAL_SIZE); |
112 | if(buf == NULL) | 102 | if(buf == NULL) |
113 | { | 103 | { |
114 | ERR(tr("Can't allocate %d bytes!"), fsize); | 104 | fprintf(stderr, "[ERR] Can't allocate %d bytes!\n", fsize); |
105 | result = E_MEMALLOC; | ||
115 | goto err; | 106 | goto err; |
116 | } | 107 | } |
117 | memset(buf, 0, TOTAL_SIZE); | 108 | memset(buf, 0, TOTAL_SIZE); |
118 | 109 | ||
119 | INFO(tr("Reading %s into memory..."), firmware); | 110 | fprintf(stderr, "[INFO] Reading %s into memory...\n", firmware); |
120 | if(fread(buf, fsize, 1, fd) != 1) | 111 | if(fread(buf, fsize, 1, fd) != 1) |
121 | { | 112 | { |
122 | ERR(tr("Can't read file %s to memory!"), firmware); | 113 | fprintf(stderr, "[ERR] Can't read file %s to memory!\n", firmware); |
114 | result = E_LOAD_FIRMWARE; | ||
123 | goto err; | 115 | goto err; |
124 | } | 116 | } |
125 | FCLOSE(fd); | 117 | FCLOSE(fd); |
126 | 118 | ||
127 | if(memcmp(buf, "WADF", 4)) | 119 | if(memcmp(buf, "WADF", 4)) |
128 | { | 120 | { |
129 | ERR(tr("File %s isn't a valid ChinaChip firmware!"), firmware); | 121 | fprintf(stderr, "[ERR] File %s isn't a valid ChinaChip firmware!\n", firmware); |
122 | result = E_INVALID_FILE; | ||
130 | goto err; | 123 | goto err; |
131 | } | 124 | } |
132 | 125 | ||
@@ -148,10 +141,11 @@ int chinachip_patch(const char* firmware, const char* bootloader, | |||
148 | 141 | ||
149 | if(i >= fsize) | 142 | if(i >= fsize) |
150 | { | 143 | { |
151 | ERR(tr("Couldn't find ccpmp.bin in %s!"), firmware); | 144 | fprintf(stderr, "[ERR] Couldn't find ccpmp.bin in %s!\n", firmware); |
145 | result = E_NO_CCPMP; | ||
152 | goto err; | 146 | goto err; |
153 | } | 147 | } |
154 | INFO(tr("Found ccpmp.bin at %d bytes"), ccpmp_pos); | 148 | fprintf(stderr, "[INFO] Found ccpmp.bin at %d bytes\n", ccpmp_pos); |
155 | 149 | ||
156 | if(ccpmp_backup) | 150 | if(ccpmp_backup) |
157 | { | 151 | { |
@@ -159,20 +153,22 @@ int chinachip_patch(const char* firmware, const char* bootloader, | |||
159 | bd = fopen(ccpmp_backup, "wb"); | 153 | bd = fopen(ccpmp_backup, "wb"); |
160 | if(!bd) | 154 | if(!bd) |
161 | { | 155 | { |
162 | ERR(tr("Can't open file %s!"), ccpmp_backup); | 156 | fprintf(stderr, "[ERR] Can't open file %s!\n", ccpmp_backup); |
157 | result = E_OPEN_BACKUP; | ||
163 | goto err; | 158 | goto err; |
164 | } | 159 | } |
165 | 160 | ||
166 | INFO(tr("Writing %d bytes to %s..."), ccpmp_size, ccpmp_backup); | 161 | fprintf(stderr, "[INFO] Writing %d bytes to %s...\n", ccpmp_size, ccpmp_backup); |
167 | if(fwrite(&buf[ccpmp_data_pos], ccpmp_size, 1, bd) != 1) | 162 | if(fwrite(&buf[ccpmp_data_pos], ccpmp_size, 1, bd) != 1) |
168 | { | 163 | { |
169 | ERR(tr("Can't write to file %s!"), ccpmp_backup); | 164 | fprintf(stderr, "[ERR] Can't write to file %s!\n", ccpmp_backup); |
165 | result = E_WRITE_BACKUP; | ||
170 | goto err; | 166 | goto err; |
171 | } | 167 | } |
172 | FCLOSE(bd); | 168 | FCLOSE(bd); |
173 | } | 169 | } |
174 | 170 | ||
175 | INFO(tr("Renaming it to ccpmp.old...")); | 171 | fprintf(stderr, "[INFO] Renaming it to ccpmp.old...\n"); |
176 | buf[ccpmp_pos + 6] = 'o'; | 172 | buf[ccpmp_pos + 6] = 'o'; |
177 | buf[ccpmp_pos + 7] = 'l'; | 173 | buf[ccpmp_pos + 7] = 'l'; |
178 | buf[ccpmp_pos + 8] = 'd'; | 174 | buf[ccpmp_pos + 8] = 'd'; |
@@ -180,27 +176,29 @@ int chinachip_patch(const char* firmware, const char* bootloader, | |||
180 | bd = fopen(bootloader, "rb"); | 176 | bd = fopen(bootloader, "rb"); |
181 | if(!bd) | 177 | if(!bd) |
182 | { | 178 | { |
183 | ERR(tr("Can't open file %s!"), bootloader); | 179 | fprintf(stderr, "[ERR] Can't open file %s!\n", bootloader); |
180 | result = E_OPEN_BOOTLOADER; | ||
184 | goto err; | 181 | goto err; |
185 | } | 182 | } |
186 | 183 | ||
187 | /* Also include path size */ | 184 | /* Also include path size */ |
188 | ccpmp_pos -= sizeof(uint32_t); | 185 | ccpmp_pos -= sizeof(uint32_t); |
189 | 186 | ||
190 | INFO(tr("Making place for ccpmp.bin...")); | 187 | fprintf(stderr, "[INFO] Making place for ccpmp.bin...\n"); |
191 | memmove(&buf[ccpmp_pos + bsize + CCPMPBIN_HEADER_SIZE], | 188 | memmove(&buf[ccpmp_pos + bsize + CCPMPBIN_HEADER_SIZE], |
192 | &buf[ccpmp_pos], fsize - ccpmp_pos); | 189 | &buf[ccpmp_pos], fsize - ccpmp_pos); |
193 | 190 | ||
194 | INFO(tr("Reading %s into memory..."), bootloader); | 191 | fprintf(stderr, "[INFO] Reading %s into memory...\n", bootloader); |
195 | if(fread(&buf[ccpmp_pos + CCPMPBIN_HEADER_SIZE], | 192 | if(fread(&buf[ccpmp_pos + CCPMPBIN_HEADER_SIZE], |
196 | bsize, 1, bd) != 1) | 193 | bsize, 1, bd) != 1) |
197 | { | 194 | { |
198 | ERR(tr("Can't read file %s to memory!"), bootloader); | 195 | fprintf(stderr, "[ERR] Can't read file %s to memory!\n", bootloader); |
196 | result = E_LOAD_BOOTLOADER; | ||
199 | goto err; | 197 | goto err; |
200 | } | 198 | } |
201 | FCLOSE(bd); | 199 | FCLOSE(bd); |
202 | 200 | ||
203 | INFO(tr("Adding header to %s..."), bootloader); | 201 | fprintf(stderr, "[INFO] Adding header to %s...\n", bootloader); |
204 | int2le(&buf[ccpmp_pos ], 9); /* Pathname Size */ | 202 | int2le(&buf[ccpmp_pos ], 9); /* Pathname Size */ |
205 | memcpy(&buf[ccpmp_pos + 4 ], "ccpmp.bin", 9); /* Pathname */ | 203 | memcpy(&buf[ccpmp_pos + 4 ], "ccpmp.bin", 9); /* Pathname */ |
206 | memset(&buf[ccpmp_pos + 4 + 9 ], 0x20, sizeof(uint8_t)); /* File Type */ | 204 | memset(&buf[ccpmp_pos + 4 + 9 ], 0x20, sizeof(uint8_t)); /* File Type */ |
@@ -210,7 +208,8 @@ int chinachip_patch(const char* firmware, const char* bootloader, | |||
210 | time_info = localtime(&cur_time); | 208 | time_info = localtime(&cur_time); |
211 | if(time_info == NULL) | 209 | if(time_info == NULL) |
212 | { | 210 | { |
213 | ERR(tr("Can't obtain current time!")); | 211 | fprintf(stderr, "[ERR] Can't obtain current time!\n"); |
212 | result = E_GET_TIME; | ||
214 | goto err; | 213 | goto err; |
215 | } | 214 | } |
216 | 215 | ||
@@ -220,11 +219,11 @@ int chinachip_patch(const char* firmware, const char* bootloader, | |||
220 | time_info->tm_hour, | 219 | time_info->tm_hour, |
221 | time_info->tm_min); | 220 | time_info->tm_min); |
222 | 221 | ||
223 | INFO(tr("Computing checksum...")); | 222 | fprintf(stderr, "[INFO] Computing checksum...\n"); |
224 | for(i = sizeof(struct header); i < TOTAL_SIZE; i+=4) | 223 | for(i = sizeof(struct header); i < TOTAL_SIZE; i+=4) |
225 | checksum += le2int(&buf[i]); | 224 | checksum += le2int(&buf[i]); |
226 | 225 | ||
227 | INFO(tr("Updating main header...")); | 226 | fprintf(stderr, "[INFO] Updating main header...\n"); |
228 | memcpy(&buf[offsetof(struct header, timestamp)], header_time, 12); | 227 | memcpy(&buf[offsetof(struct header, timestamp)], header_time, 12); |
229 | int2le(&buf[offsetof(struct header, size) ], TOTAL_SIZE); | 228 | int2le(&buf[offsetof(struct header, size) ], TOTAL_SIZE); |
230 | int2le(&buf[offsetof(struct header, checksum) ], checksum); | 229 | int2le(&buf[offsetof(struct header, checksum) ], checksum); |
@@ -232,20 +231,18 @@ int chinachip_patch(const char* firmware, const char* bootloader, | |||
232 | od = fopen(output, "wb"); | 231 | od = fopen(output, "wb"); |
233 | if(!od) | 232 | if(!od) |
234 | { | 233 | { |
235 | ERR(tr("Can't open file %s!"), output); | 234 | fprintf(stderr, "[ERR] Can't open file %s!\n", output); |
235 | result = E_OPEN_OUTFILE; | ||
236 | goto err; | 236 | goto err; |
237 | } | 237 | } |
238 | 238 | ||
239 | INFO(tr("Writing output to %s..."), output); | 239 | fprintf(stderr, "[INFO] Writing output to %s...\n", output); |
240 | if(fwrite(buf, TOTAL_SIZE, 1, od) != 1) | 240 | if(fwrite(buf, TOTAL_SIZE, 1, od) != 1) |
241 | { | 241 | { |
242 | ERR(tr("Can't write to file %s!"), output); | 242 | fprintf(stderr, "[ERR] Can't write to file %s!\n", output); |
243 | result = E_WRITE_OUTFILE; | ||
243 | goto err; | 244 | goto err; |
244 | } | 245 | } |
245 | fclose(od); | ||
246 | free(buf); | ||
247 | |||
248 | return 0; | ||
249 | 246 | ||
250 | err: | 247 | err: |
251 | if(buf) | 248 | if(buf) |
@@ -257,6 +254,6 @@ err: | |||
257 | if(od) | 254 | if(od) |
258 | fclose(od); | 255 | fclose(od); |
259 | 256 | ||
260 | return -1; | 257 | return result; |
261 | } | 258 | } |
262 | 259 | ||
diff --git a/rbutil/chinachippatcher/chinachip.h b/rbutil/chinachippatcher/chinachip.h index 2f8ba9e18a..b92066bb8b 100644 --- a/rbutil/chinachippatcher/chinachip.h +++ b/rbutil/chinachippatcher/chinachip.h | |||
@@ -26,11 +26,24 @@ | |||
26 | extern "C" { | 26 | extern "C" { |
27 | #endif | 27 | #endif |
28 | 28 | ||
29 | int chinachip_patch(const char* firmware, const char* bootloader, | 29 | enum cc_error { |
30 | const char* output, const char* ccpmp_backup, | 30 | E_OK, |
31 | void (*info)(void*, char*, ...), | 31 | E_OPEN_FIRMWARE, |
32 | void (*err)(void*, char*, ...), | 32 | E_OPEN_BOOTLOADER, |
33 | void* userdata); | 33 | E_MEMALLOC, |
34 | E_LOAD_FIRMWARE, | ||
35 | E_INVALID_FILE, | ||
36 | E_NO_CCPMP, | ||
37 | E_OPEN_BACKUP, | ||
38 | E_WRITE_BACKUP, | ||
39 | E_LOAD_BOOTLOADER, | ||
40 | E_GET_TIME, | ||
41 | E_OPEN_OUTFILE, | ||
42 | E_WRITE_OUTFILE, | ||
43 | }; | ||
44 | |||
45 | enum cc_error chinachip_patch(const char* firmware, const char* bootloader, | ||
46 | const char* output, const char* ccpmp_backup); | ||
34 | 47 | ||
35 | #ifdef __cplusplus | 48 | #ifdef __cplusplus |
36 | } | 49 | } |
diff --git a/rbutil/chinachippatcher/main.c b/rbutil/chinachippatcher/main.c index 12b3a3543f..0553b7d798 100644 --- a/rbutil/chinachippatcher/main.c +++ b/rbutil/chinachippatcher/main.c | |||
@@ -25,24 +25,6 @@ | |||
25 | #define VERSION "0.1" | 25 | #define VERSION "0.1" |
26 | #define PRINT(fmt, ...) fprintf(stderr, fmt"\n", ##__VA_ARGS__) | 26 | #define PRINT(fmt, ...) fprintf(stderr, fmt"\n", ##__VA_ARGS__) |
27 | 27 | ||
28 | static void info(void* userdata, char* fmt, ...) | ||
29 | { | ||
30 | (void)userdata; | ||
31 | va_list args; | ||
32 | va_start(args, fmt); | ||
33 | vfprintf(stderr, fmt, args); | ||
34 | va_end(args); | ||
35 | } | ||
36 | |||
37 | static void err(void* userdata, char* fmt, ...) | ||
38 | { | ||
39 | (void)userdata; | ||
40 | va_list args; | ||
41 | va_start(args, fmt); | ||
42 | vfprintf(stderr, fmt, args); | ||
43 | va_end(args); | ||
44 | } | ||
45 | |||
46 | void usage(char* name) | 28 | void usage(char* name) |
47 | { | 29 | { |
48 | PRINT("Usage:"); | 30 | PRINT("Usage:"); |
@@ -66,7 +48,6 @@ int main(int argc, char* argv[]) | |||
66 | return 1; | 48 | return 1; |
67 | } | 49 | } |
68 | 50 | ||
69 | return chinachip_patch(argv[1], argv[2], argv[3], argc > 4 ? argv[4] : NULL, | 51 | return chinachip_patch(argv[1], argv[2], argv[3], argc > 4 ? argv[4] : NULL); |
70 | &info, &err, NULL); | ||
71 | } | 52 | } |
72 | 53 | ||
diff --git a/rbutil/rbutilqt/base/bootloaderinstallchinachip.cpp b/rbutil/rbutilqt/base/bootloaderinstallchinachip.cpp index 013549d037..32cc3c4cf1 100644 --- a/rbutil/rbutilqt/base/bootloaderinstallchinachip.cpp +++ b/rbutil/rbutilqt/base/bootloaderinstallchinachip.cpp | |||
@@ -42,34 +42,6 @@ QString BootloaderInstallChinaChip::ofHint() | |||
42 | "file."); | 42 | "file."); |
43 | } | 43 | } |
44 | 44 | ||
45 | void BootloaderInstallChinaChip::logString(char* format, va_list args, int type) | ||
46 | { | ||
47 | QString translation = QCoreApplication::translate("", format, NULL, QCoreApplication::UnicodeUTF8); | ||
48 | |||
49 | emit logItem(QString().vsprintf(translation.toLocal8Bit(), args), type); | ||
50 | QCoreApplication::processEvents(); | ||
51 | } | ||
52 | |||
53 | static void info(void* userdata, char* format, ...) | ||
54 | { | ||
55 | BootloaderInstallChinaChip* pThis = (BootloaderInstallChinaChip*) userdata; | ||
56 | va_list args; | ||
57 | |||
58 | va_start(args, format); | ||
59 | pThis->logString(format, args, LOGINFO); | ||
60 | va_end(args); | ||
61 | } | ||
62 | |||
63 | static void err(void* userdata, char* format, ...) | ||
64 | { | ||
65 | BootloaderInstallChinaChip* pThis = (BootloaderInstallChinaChip*) userdata; | ||
66 | va_list args; | ||
67 | |||
68 | va_start(args, format); | ||
69 | pThis->logString(format, args, LOGERROR); | ||
70 | va_end(args); | ||
71 | } | ||
72 | |||
73 | bool BootloaderInstallChinaChip::install() | 45 | bool BootloaderInstallChinaChip::install() |
74 | { | 46 | { |
75 | if(m_offile.isEmpty()) | 47 | if(m_offile.isEmpty()) |
@@ -85,17 +57,62 @@ bool BootloaderInstallChinaChip::install() | |||
85 | 57 | ||
86 | void BootloaderInstallChinaChip::installStage2() | 58 | void BootloaderInstallChinaChip::installStage2() |
87 | { | 59 | { |
60 | enum cc_error result; | ||
61 | bool error = true; | ||
88 | m_tempfile.open(); | 62 | m_tempfile.open(); |
89 | QString blfile = m_tempfile.fileName(); | 63 | QString blfile = m_tempfile.fileName(); |
90 | m_tempfile.close(); | 64 | m_tempfile.close(); |
91 | 65 | ||
92 | QString backupfile = QFileInfo(m_blfile).absoluteDir().absoluteFilePath("ccpmp.bin"); | 66 | QString backupfile = QFileInfo(m_blfile).absoluteDir().absoluteFilePath("ccpmp.bin"); |
93 | 67 | ||
94 | int ret = chinachip_patch(m_offile.toLocal8Bit(), blfile.toLocal8Bit(), m_blfile.toLocal8Bit(), | 68 | result = chinachip_patch(m_offile.toLocal8Bit(), blfile.toLocal8Bit(), |
95 | backupfile.toLocal8Bit(), &info, &err, (void*)this); | 69 | m_blfile.toLocal8Bit(), backupfile.toLocal8Bit()); |
96 | qDebug() << "chinachip_patch" << ret; | 70 | switch(result) { |
97 | 71 | case E_OK: | |
98 | emit done(ret); | 72 | error = false; |
73 | break; | ||
74 | case E_OPEN_FIRMWARE: | ||
75 | emit logItem(tr("Could not open firmware file"), LOGERROR); | ||
76 | break; | ||
77 | case E_OPEN_BOOTLOADER: | ||
78 | emit logItem(tr("Could not open bootloader file"), LOGERROR); | ||
79 | break; | ||
80 | case E_MEMALLOC: | ||
81 | emit logItem(tr("Could not allocate memory"), LOGERROR); | ||
82 | break; | ||
83 | case E_LOAD_FIRMWARE: | ||
84 | emit logItem(tr("Could not load firmware file"), LOGERROR); | ||
85 | break; | ||
86 | case E_INVALID_FILE: | ||
87 | emit logItem(tr("File is not a valid ChinaChip firmware"), LOGERROR); | ||
88 | break; | ||
89 | case E_NO_CCPMP: | ||
90 | emit logItem(tr("Could not find ccpmp.bin in input file"), LOGERROR); | ||
91 | break; | ||
92 | case E_OPEN_BACKUP: | ||
93 | emit logItem(tr("Could not open backup file for ccpmp.bin"), LOGERROR); | ||
94 | break; | ||
95 | case E_WRITE_BACKUP: | ||
96 | emit logItem(tr("Could not write backup file for ccpmp.bin"), LOGERROR); | ||
97 | break; | ||
98 | case E_LOAD_BOOTLOADER: | ||
99 | emit logItem(tr("Could not load bootloader file"), LOGERROR); | ||
100 | break; | ||
101 | case E_GET_TIME: | ||
102 | emit logItem(tr("Could not get current time"), LOGERROR); | ||
103 | break; | ||
104 | case E_OPEN_OUTFILE: | ||
105 | emit logItem(tr("Could not open output file"), LOGERROR); | ||
106 | break; | ||
107 | case E_WRITE_OUTFILE: | ||
108 | emit logItem(tr("Could not write output file"), LOGERROR); | ||
109 | break; | ||
110 | default: | ||
111 | emit logItem(tr("Unexpected error from chinachippatcher"), LOGERROR); | ||
112 | break; | ||
113 | } | ||
114 | |||
115 | emit done(error); | ||
99 | } | 116 | } |
100 | 117 | ||
101 | bool BootloaderInstallChinaChip::uninstall() | 118 | bool BootloaderInstallChinaChip::uninstall() |
diff --git a/rbutil/rbutilqt/base/bootloaderinstallchinachip.h b/rbutil/rbutilqt/base/bootloaderinstallchinachip.h index baa88e7bc9..d82919a571 100644 --- a/rbutil/rbutilqt/base/bootloaderinstallchinachip.h +++ b/rbutil/rbutilqt/base/bootloaderinstallchinachip.h | |||
@@ -33,7 +33,6 @@ class BootloaderInstallChinaChip : public BootloaderInstallBase | |||
33 | BootloaderInstallBase::BootloaderType installed(void); | 33 | BootloaderInstallBase::BootloaderType installed(void); |
34 | Capabilities capabilities(void); | 34 | Capabilities capabilities(void); |
35 | QString ofHint(); | 35 | QString ofHint(); |
36 | void logString(char* buffer, va_list args, int type); | ||
37 | 36 | ||
38 | private slots: | 37 | private slots: |
39 | void installStage2(void); | 38 | void installStage2(void); |