osmoload: allow running without firmware image

This commit is contained in:
Ingo Albrecht 2010-04-18 08:08:03 +02:00
parent 3f998d80eb
commit e4ad7b6827
1 changed files with 12 additions and 11 deletions

View File

@ -850,6 +850,7 @@ static int handle_read(void)
printf("Received PROMPT1 from phone, responding with CMD\n");
dnload.print_hdlc = 0;
dnload.state = WAITING_PROMPT2;
if(dnload.filename) {
rc = write(dnload.serial_fd.fd, dnload_cmd, sizeof(dnload_cmd));
/* re-read file */
@ -859,6 +860,7 @@ static int handle_read(void)
dnload.filename, rc);
exit(1);
}
}
} else if (!memcmp(buffer, phone_prompt2, sizeof(phone_prompt2))) {
printf("Received PROMPT2 from phone, starting download\n");
dnload.serial_fd.when = BSC_FD_READ | BSC_FD_WRITE;
@ -1438,11 +1440,10 @@ int main(int argc, char **argv)
}
if (argc <= optind) {
fprintf(stderr, "You have to specify the filename\n");
usage(argv[0]);
}
dnload.filename = NULL;
} else {
dnload.filename = argv[optind];
}
dnload.serial_fd.fd = serial_init(serial_dev);
if (dnload.serial_fd.fd < 0) {