diff options
author | John Klug <john.klug@multitech.com> | 2018-06-29 13:57:45 -0500 |
---|---|---|
committer | John Klug <john.klug@multitech.com> | 2018-06-29 13:57:45 -0500 |
commit | 9ff18ebd7d3a0ebf6ef41eaa1049c6887e45c298 (patch) | |
tree | 6dde70c0ec69bdbd2c03232057179fca595e51b8 /src | |
parent | f9e9a86126118d6a038a797bd22e008ed1ab9f9c (diff) | |
download | u-boot-linux-utils-master.tar.gz u-boot-linux-utils-master.tar.bz2 u-boot-linux-utils-master.zip |
Diffstat (limited to 'src')
-rw-r--r-- | src/u_boot.c | 52 |
1 files changed, 25 insertions, 27 deletions
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 |