1
0
mirror of git://projects.qi-hardware.com/xburst-tools.git synced 2024-11-29 09:15:21 +02:00

add configure file path option

Signed-off-by: Xiangfu Liu <xiangfu.z@gmail.com>
This commit is contained in:
Xiangfu Liu 2009-07-20 23:43:05 +08:00
parent 6ba5757cd5
commit 2679195988
2 changed files with 10 additions and 4 deletions

View File

@ -21,8 +21,6 @@
#include "usb_boot_defines.h" #include "usb_boot_defines.h"
#define CONFIG_FILE_PATH "/usr/share/xburst-tools/usbboot.cfg"
int hand_init_def(struct hand *hand); int hand_init_def(struct hand *hand);
int check_dump_cfg(struct hand *hand); int check_dump_cfg(struct hand *hand);
int parse_configure(struct hand *hand, char * file_path); int parse_configure(struct hand *hand, char * file_path);

View File

@ -26,6 +26,8 @@
#include "ingenic_usb.h" #include "ingenic_usb.h"
#include "ingenic_cfg.h" #include "ingenic_cfg.h"
#define CONFIG_FILE_PATH "/usr/share/xburst-tools/usbboot.cfg"
extern struct ingenic_dev ingenic_dev; extern struct ingenic_dev ingenic_dev;
extern struct hand hand; extern struct hand hand;
@ -35,6 +37,7 @@ static void help(void)
" -h --help\t\t\tPrint this help message\n" " -h --help\t\t\tPrint this help message\n"
" -v --version\t\t\tPrint the version number\n" " -v --version\t\t\tPrint the version number\n"
" -c --command\t\t\tDirect run the commands, split by ';'\n" " -c --command\t\t\tDirect run the commands, split by ';'\n"
" -f --configure\t\t\tconfigure file path\n"
" <run without options to enter commands via usbboot prompt>\n\n" " <run without options to enter commands via usbboot prompt>\n\n"
"Report bugs to <xiangfu@qi-hardware.com>.\n" "Report bugs to <xiangfu@qi-hardware.com>.\n"
); );
@ -49,6 +52,7 @@ static struct option opts[] = {
{ "help", 0, 0, 'h' }, { "help", 0, 0, 'h' },
{ "version", 0, 0, 'v' }, { "version", 0, 0, 'v' },
{ "command", 1, 0, 'c' }, { "command", 1, 0, 'c' },
{ "configure", 1, 0, 'f' },
{ 0, 0, 0, 0 } { 0, 0, 0, 0 }
}; };
@ -58,6 +62,7 @@ int main(int argc, char **argv)
char *cptr; char *cptr;
char com_buf[256] = {0}; char com_buf[256] = {0};
char *cmdpt; char *cmdpt;
char *cfgpath = CONFIG_FILE_PATH;
printf("usbboot - Ingenic XBurst USB Boot Utility\n" printf("usbboot - Ingenic XBurst USB Boot Utility\n"
"(c) 2009 Ingenic Semiconductor Inc., Qi Hardware Inc., Xiangfu Liu, Marek Lindner\n" "(c) 2009 Ingenic Semiconductor Inc., Qi Hardware Inc., Xiangfu Liu, Marek Lindner\n"
@ -65,7 +70,7 @@ int main(int argc, char **argv)
while(1) { while(1) {
int c, option_index = 0; int c, option_index = 0;
c = getopt_long(argc, argv, "hvc:", opts, c = getopt_long(argc, argv, "hvc:f:", opts,
&option_index); &option_index);
if (c == -1) if (c == -1)
break; break;
@ -81,6 +86,9 @@ int main(int argc, char **argv)
command = 1; command = 1;
cmdpt = optarg; cmdpt = optarg;
break; break;
case 'f':
cfgpath = optarg;
break;
default: default:
help(); help();
exit(2); exit(2);
@ -95,7 +103,7 @@ int main(int argc, char **argv)
if (usb_ingenic_init(&ingenic_dev) < 1) if (usb_ingenic_init(&ingenic_dev) < 1)
return EXIT_FAILURE; return EXIT_FAILURE;
if (parse_configure(&hand, CONFIG_FILE_PATH) < 1) if (parse_configure(&hand, cfgpath) < 1)
return EXIT_FAILURE; return EXIT_FAILURE;
if (command) { /* direct run command */ if (command) { /* direct run command */