mirror of
git://projects.qi-hardware.com/xburst-tools.git
synced 2024-11-26 12:02:50 +02:00
add file check for usb_boot.cfg
This commit is contained in:
parent
e0c61da4fd
commit
3095ac1f98
@ -19,7 +19,9 @@
|
|||||||
* Boston, MA 02110-1301, USA
|
* Boston, MA 02110-1301, USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <errno.h>
|
||||||
#include <confuse.h>
|
#include <confuse.h>
|
||||||
|
#include <unistd.h>
|
||||||
#include "ingenic_cfg.h"
|
#include "ingenic_cfg.h"
|
||||||
#include "usb_boot_defines.h"
|
#include "usb_boot_defines.h"
|
||||||
|
|
||||||
@ -33,6 +35,7 @@ int hand_init_def(struct hand *hand)
|
|||||||
hand->nand_bw = 8;
|
hand->nand_bw = 8;
|
||||||
hand->nand_rc = 3;
|
hand->nand_rc = 3;
|
||||||
hand->nand_ps = 2048;
|
hand->nand_ps = 2048;
|
||||||
|
hand->nand_os = 64;
|
||||||
hand->nand_ppb = 64;
|
hand->nand_ppb = 64;
|
||||||
hand->nand_eccpos = 6;
|
hand->nand_eccpos = 6;
|
||||||
hand->nand_bbpage = 0;
|
hand->nand_bbpage = 0;
|
||||||
@ -138,6 +141,12 @@ 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)
|
||||||
{
|
{
|
||||||
|
if (access(file_path, F_OK)) {
|
||||||
|
fprintf(stderr, "Error - can't read file: %s\n",
|
||||||
|
file_path, strerror(errno));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
hand_init_def(hand);
|
hand_init_def(hand);
|
||||||
|
|
||||||
cfg_opt_t opts[] = {
|
cfg_opt_t opts[] = {
|
||||||
@ -178,8 +187,12 @@ int parse_configure(struct hand *hand, char * file_path)
|
|||||||
|
|
||||||
cfg_t *cfg;
|
cfg_t *cfg;
|
||||||
cfg = cfg_init(opts, 0);
|
cfg = cfg_init(opts, 0);
|
||||||
if (cfg_parse(cfg, file_path) == CFG_PARSE_ERROR)
|
if (cfg_parse(cfg, file_path) == CFG_PARSE_ERROR) {
|
||||||
|
fprintf(stderr, "Error - can't read file: %s\n",
|
||||||
|
file_path, strerror(errno));
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
cfg_free(cfg);
|
cfg_free(cfg);
|
||||||
|
|
||||||
hand->fw_args.cpu_id = 0x4740;
|
hand->fw_args.cpu_id = 0x4740;
|
||||||
|
@ -36,7 +36,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 command\n"
|
" -c --command\t\t\tDirect run the command\n"
|
||||||
"Report bugs to <xiangfu.z@gmail.com>."
|
"Report bugs to <xiangfu.z@gmail.com>.\n"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user