summaryrefslogtreecommitdiffstats
path: root/src/host/osmocon/osmocon.c
diff options
context:
space:
mode:
authorIngo Albrecht <prom@berlin.ccc.de>2010-04-18 08:08:03 +0200
committerIngo Albrecht <prom@berlin.ccc.de>2010-07-20 14:41:19 +0200
commite4ad7b6827acb7529e5a0116ea01126c629d4ede (patch)
treeedf6245bf5088355770b06b62cbd76ecec3953cc /src/host/osmocon/osmocon.c
parent3f998d80ebfc85c86cc28609f35ae1c7ca392a16 (diff)
osmoload: allow running without firmware image
Diffstat (limited to 'src/host/osmocon/osmocon.c')
-rw-r--r--src/host/osmocon/osmocon.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/src/host/osmocon/osmocon.c b/src/host/osmocon/osmocon.c
index fb217b2b..0d5a3861 100644
--- a/src/host/osmocon/osmocon.c
+++ b/src/host/osmocon/osmocon.c
@@ -850,14 +850,16 @@ static int handle_read(void)
printf("Received PROMPT1 from phone, responding with CMD\n");
dnload.print_hdlc = 0;
dnload.state = WAITING_PROMPT2;
- rc = write(dnload.serial_fd.fd, dnload_cmd, sizeof(dnload_cmd));
-
- /* re-read file */
- rc = read_file(dnload.filename);
- if (rc < 0) {
- fprintf(stderr, "read_file(%s) failed with %d\n",
- dnload.filename, rc);
- exit(1);
+ if(dnload.filename) {
+ rc = write(dnload.serial_fd.fd, dnload_cmd, sizeof(dnload_cmd));
+
+ /* re-read file */
+ rc = read_file(dnload.filename);
+ if (rc < 0) {
+ fprintf(stderr, "read_file(%s) failed with %d\n",
+ dnload.filename, rc);
+ exit(1);
+ }
}
} else if (!memcmp(buffer, phone_prompt2, sizeof(phone_prompt2))) {
printf("Received PROMPT2 from phone, starting download\n");
@@ -1438,12 +1440,11 @@ 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.filename = argv[optind];
-
dnload.serial_fd.fd = serial_init(serial_dev);
if (dnload.serial_fd.fd < 0) {
fprintf(stderr, "Cannot open serial device %s\n", serial_dev);