Date:2009-07-20 17:43:05 (10 years 10 months ago)
Author:Xiangfu Liu
Commit:2679195988beaa20bb3987c475f4e798c6129d4b
Message:add configure file path option

Signed-off-by: Xiangfu Liu <xiangfu.z@gmail.com>
Files: usbboot/src/ingenic_cfg.h (1 diff)
usbboot/src/main.c (7 diffs)

Change Details

usbboot/src/ingenic_cfg.h
2121
2222#include "usb_boot_defines.h"
2323
24#define CONFIG_FILE_PATH "/usr/share/xburst-tools/usbboot.cfg"
25
2624int hand_init_def(struct hand *hand);
2725int check_dump_cfg(struct hand *hand);
2826int parse_configure(struct hand *hand, char * file_path);
usbboot/src/main.c
2626#include "ingenic_usb.h"
2727#include "ingenic_cfg.h"
2828
29#define CONFIG_FILE_PATH "/usr/share/xburst-tools/usbboot.cfg"
30
2931extern struct ingenic_dev ingenic_dev;
3032extern struct hand hand;
3133
...... 
3537           " -h --help\t\t\tPrint this help message\n"
3638           " -v --version\t\t\tPrint the version number\n"
3739           " -c --command\t\t\tDirect run the commands, split by ';'\n"
40           " -f --configure\t\t\tconfigure file path\n"
3841           " <run without options to enter commands via usbboot prompt>\n\n"
3942           "Report bugs to <xiangfu@qi-hardware.com>.\n"
4043        );
...... 
4952    { "help", 0, 0, 'h' },
5053    { "version", 0, 0, 'v' },
5154    { "command", 1, 0, 'c' },
55    { "configure", 1, 0, 'f' },
5256    { 0, 0, 0, 0 }
5357};
5458
...... 
5862    char *cptr;
5963    char com_buf[256] = {0};
6064    char *cmdpt;
65    char *cfgpath = CONFIG_FILE_PATH;
6166
6267    printf("usbboot - Ingenic XBurst USB Boot Utility\n"
6368           "(c) 2009 Ingenic Semiconductor Inc., Qi Hardware Inc., Xiangfu Liu, Marek Lindner\n"
...... 
6570
6671    while(1) {
6772        int c, option_index = 0;
68        c = getopt_long(argc, argv, "hvc:", opts,
73        c = getopt_long(argc, argv, "hvc:f:", opts,
6974                &option_index);
7075        if (c == -1)
7176            break;
...... 
8186            command = 1;
8287            cmdpt = optarg;
8388            break;
89        case 'f':
90            cfgpath = optarg;
91            break;
8492        default:
8593            help();
8694            exit(2);
...... 
95103    if (usb_ingenic_init(&ingenic_dev) < 1)
96104         return EXIT_FAILURE;
97105
98    if (parse_configure(&hand, CONFIG_FILE_PATH) < 1)
106    if (parse_configure(&hand, cfgpath) < 1)
99107        return EXIT_FAILURE;
100108
101109    if (command) { /* direct run command */

Archive Download the corresponding diff file



interactive