diff options
-rw-r--r-- | configure.in | 2 | ||||
-rw-r--r-- | src/u_boot.c | 52 |
2 files changed, 26 insertions, 28 deletions
diff --git a/configure.in b/configure.in index d023d38..0468c62 100644 --- a/configure.in +++ b/configure.in @@ -1,5 +1,5 @@ AC_INIT([src/u_boot.c]) -AM_INIT_AUTOMAKE([u-boot], [0.0.2]) +AM_INIT_AUTOMAKE([u-boot], [0.2.1]) AM_CONFIG_HEADER([config.h]) AC_PROG_CC diff --git a/src/u_boot.c b/src/u_boot.c index 9480471..b7cc065 100644 --- a/src/u_boot.c +++ b/src/u_boot.c @@ -243,7 +243,7 @@ static int cmd_setenv(struct environment *env, int argc, char **argv, int do_wri static void print_version(const char *name) { printf("%s (" PACKAGE ") " VERSION " (" __DATE__ " " __TIME__ ")\n", name); - printf("Copyright (C) 2010 by Multi-Tech Systems\n"); + printf("Copyright (C) 2010, 2018 by Multi-Tech Systems\n"); printf( "This program is free software; you may redistribute it under the terms of\n" "the GNU General Public License version 2 or (at your option) any later version.\n" @@ -362,34 +362,32 @@ int main(int argc, char *argv[]) { env = env1; env->flags = 0; memcpy(env->data, DEFAULT_ENV, sizeof(DEFAULT_ENV)); + /* MTHS has no ethernet */ /* Now need to find the MAC address */ - if (mp_fd == -1) { - perror("Cannot open: " MAC_PATH); - exit(1); + if (mp_fd != -1) { + len = sizeof DUMMY_MAC - 1; /* remove null from count */ + p = malloc(len+1); + retval = read(mp_fd,p,len); + dbg("Mac read of %d returned %d",len,retval); + if(retval != len) { + if(retval == -1) { + perror("Failed to read: " MAC_PATH); + exit(1); + } + if (retval != len) { + fprintf(stderr,"%s: Only read %d characters of %d for the MAC address\n", + MAC_PATH,retval,len); + fprintf(stderr,"%s: Read %*.*s\n",MAC_PATH,retval,retval,p); + exit(1); + } + } + p[len] = 0; + genarg[0] = "ethaddr"; + genarg[1] = p; + if (cmd_setenv(env,2,genarg,SKIP_WRITE_ENV) == false) + exit(1); + free(p); } - - len = sizeof DUMMY_MAC - 1; /* remove null from count */ - p = malloc(len+1); - retval = read(mp_fd,p,len); - dbg("Mac read of %d returned %d",len,retval); - if(retval != len) { - if(retval == -1) { - perror("Failed to read: " MAC_PATH); - exit(1); - } - if (retval != len) { - fprintf(stderr,"%s: Only read %d characters of %d for the MAC address\n", - MAC_PATH,retval,len); - fprintf(stderr,"%s: Read %*.*s\n",MAC_PATH,retval,retval,p); - exit(1); - } - } - p[len] = 0; - genarg[0] = "ethaddr"; - genarg[1] = p; - if (cmd_setenv(env,2,genarg,SKIP_WRITE_ENV) == false) - exit(1); - free(p); genarg[1] = number; #ifdef CONFIG_BAUDRATE |