2002-08-27 05:55:31 +00:00
|
|
|
/*
|
|
|
|
* (C) Copyright 2000
|
|
|
|
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
|
|
|
*
|
|
|
|
* See file CREDITS for list of people who contributed to this
|
|
|
|
* project.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License as
|
|
|
|
* published by the Free Software Foundation; either version 2 of
|
|
|
|
* the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2007-11-08 11:01:52 +00:00
|
|
|
/**
|
|
|
|
* @file
|
|
|
|
* @brief tftp, rarpboot, dhcp, nfs, cdp - Boot support
|
|
|
|
*/
|
|
|
|
|
2002-08-27 05:55:31 +00:00
|
|
|
#include <common.h>
|
|
|
|
#include <command.h>
|
2011-06-08 16:03:53 +00:00
|
|
|
#include <complete.h>
|
2007-07-05 16:01:44 +00:00
|
|
|
#include <environment.h>
|
2007-07-05 16:01:32 +00:00
|
|
|
#include <driver.h>
|
2002-08-27 05:55:31 +00:00
|
|
|
#include <net.h>
|
2007-07-05 16:01:38 +00:00
|
|
|
#include <fs.h>
|
|
|
|
#include <errno.h>
|
2007-09-28 08:47:19 +00:00
|
|
|
#include <libbb.h>
|
2002-08-27 05:55:31 +00:00
|
|
|
|
2011-12-21 13:18:57 +00:00
|
|
|
static int do_ethact(int argc, char *argv[])
|
2009-02-27 00:09:26 +00:00
|
|
|
{
|
|
|
|
struct eth_device *edev;
|
|
|
|
|
2009-09-09 09:44:35 +00:00
|
|
|
if (argc == 1) {
|
|
|
|
edev = eth_get_current();
|
|
|
|
if (edev)
|
|
|
|
printf("%s%d\n", edev->dev.name, edev->dev.id);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2009-10-17 10:44:19 +00:00
|
|
|
if (argc != 2)
|
|
|
|
return COMMAND_ERROR_USAGE;
|
2009-02-27 00:09:26 +00:00
|
|
|
|
2009-06-10 17:44:14 +00:00
|
|
|
edev = eth_get_byname(argv[1]);
|
|
|
|
if (edev)
|
|
|
|
eth_set_current(edev);
|
|
|
|
else {
|
|
|
|
printf("no such net device: %s\n", argv[1]);
|
2009-02-27 00:09:26 +00:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const __maybe_unused char cmd_ethact_help[] =
|
2009-09-09 09:44:35 +00:00
|
|
|
"Usage: ethact [ethx]\n";
|
2009-02-27 00:09:26 +00:00
|
|
|
|
2009-12-15 08:11:09 +00:00
|
|
|
BAREBOX_CMD_START(ethact)
|
2009-02-27 00:09:26 +00:00
|
|
|
.cmd = do_ethact,
|
|
|
|
.usage = "set current ethernet device",
|
2009-12-15 08:11:09 +00:00
|
|
|
BAREBOX_CMD_HELP(cmd_ethact_help)
|
2011-06-08 16:03:53 +00:00
|
|
|
BAREBOX_CMD_COMPLETE(eth_complete)
|
2009-12-15 08:11:09 +00:00
|
|
|
BAREBOX_CMD_END
|
2009-02-27 00:09:26 +00:00
|
|
|
|