summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Gordon <rockbox@jdgordon.info>2007-09-16 00:30:10 +0000
committerJonathan Gordon <rockbox@jdgordon.info>2007-09-16 00:30:10 +0000
commit7929b03df43057a60e60323164f74fbd79c65512 (patch)
treea04564b9102efa32ac005a76960a7378c88ad22e
parentc720b1bdf0bc6aae513853f46caca3b7b4acd0e2 (diff)
downloadrockbox-7929b03df43057a60e60323164f74fbd79c65512.tar.gz
rockbox-7929b03df43057a60e60323164f74fbd79c65512.zip
Add -s,--silent so it doesnt display the instructions and wait for input before continuing.
-h,--help to get the usage message git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14727 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--rbutil/e200rpatcher/e200rpatcher.c60
1 files changed, 40 insertions, 20 deletions
diff --git a/rbutil/e200rpatcher/e200rpatcher.c b/rbutil/e200rpatcher/e200rpatcher.c
index 8d0c674a5e..e71a771e04 100644
--- a/rbutil/e200rpatcher/e200rpatcher.c
+++ b/rbutil/e200rpatcher/e200rpatcher.c
@@ -28,6 +28,7 @@
28#include <inttypes.h> 28#include <inttypes.h>
29#include <usb.h> 29#include <usb.h>
30#include <string.h> 30#include <string.h>
31#include "stdbool.h"
31 32
32#include "bootimg.h" 33#include "bootimg.h"
33 34
@@ -183,37 +184,56 @@ found:
183 184
184 usb_close(dh); 185 usb_close(dh);
185} 186}
186 187void print_usage(void)
188{
189 fprintf(stderr,"Usage: e200rpatcher [options]\n");
190 fprintf(stderr,"Options:\n");
191 fprintf(stderr," -s, --silent\t\tDont display instructions\n");
192}
187 193
188int main(int argc, char* argv[]) 194int main(int argc, char* argv[])
189{ 195{
190 char input[4]; 196 char input[4];
191 197 int silent = 0;
192 /* We don't use the arguments */ 198 int i;
193 (void)argc; 199
194 (void)argv; 200 /* check args */
201 if ((argc > 1) && ((strcmp(argv[1],"-h")==0) || (strcmp(argv[1],"--help")==0))) {
202 print_usage();
203 return 1;
204 }
205 for (i=1;i<argc;i++)
206 {
207 if (!strcmp(argv[i], "--silent") || !strcmp(argv[i], "-s"))
208 silent = 1;
209 }
195 210
196 printf("e200rpatcher v" VERSION " - (C) 2007 Jonathan Gordon & Dave Chapman\n"); 211 printf("e200rpatcher v" VERSION " - (C) 2007 Jonathan Gordon & Dave Chapman\n");
197 printf("This is free software; see the source for copying conditions. There is NO\n"); 212 printf("This is free software; see the source for copying conditions. There is NO\n");
198 printf("warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n"); 213 printf("warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n");
199 214
200 printf("Attach your E200R in \"manufacturing mode\" as follows:\n"); 215 if (!silent)
201 printf(" 1) Power-off your E200R\n"); 216 {
202 printf(" 2) Turn ON the lock/hold switch\n"); 217 printf("Attach your E200R in \"manufacturing mode\" as follows:\n");
203 printf(" 3) Press and hold the SELECT button and whilst it is held down,\n"); 218 printf(" 1) Power-off your E200R\n");
204 printf(" attach your E200R to your computer via USB\n"); 219 printf(" 2) Turn ON the lock/hold switch\n");
205 printf(" 4) After attaching to USB, keep the SELECT button held for 10 seconds.\n"); 220 printf(" 3) Press and hold the SELECT button and whilst it is held down,\n");
206 printf("\n"); 221 printf(" attach your E200R to your computer via USB\n");
207 printf("NOTE: If your E200R starts in the normal Sansa firmware, you have\n"); 222 printf(" 4) After attaching to USB, keep the SELECT button held for 10 seconds.\n");
208 printf(" failed to enter manufacturing mode and should try again at step 1).\n\n"); 223 printf("\n");
209 224 printf("NOTE: If your E200R starts in the normal Sansa firmware, you have\n");
210 printf("[INFO] Press Enter to continue:"); 225 printf(" failed to enter manufacturing mode and should try again at step 1).\n\n");
211 fgets(input, 4, stdin); 226
212 227 printf("[INFO] Press Enter to continue:");
228 fgets(input, 4, stdin);
229 }
213 do_patching(); 230 do_patching();
214 231
215 printf("[INFO] Press ENTER to exit: "); 232 if (!silent)
216 fgets(input, 4, stdin); 233 {
234 printf("[INFO] Press ENTER to exit: ");
235 fgets(input, 4, stdin);
236 }
217 237
218 return 0; 238 return 0;
219} 239}