[PATCH 4/4] commands/miitool: Allow specifying PHY by their full path

Andrey Smirnov andrew.smirnov at gmail.com
Mon Dec 4 07:37:26 PST 2017


Make -s option to be a bit more consistent with how it is used in
other commands by allowing PHY device to be specified by either its
name of full path in /dev. This change also allows us to leverage
autocompletion since it will work as expected for paths in /dev.

Signed-off-by: Andrey Smirnov <andrew.smirnov at gmail.com>
---
 commands/miitool.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/commands/miitool.c b/commands/miitool.c
index 1a46037f2..dea4f853c 100644
--- a/commands/miitool.c
+++ b/commands/miitool.c
@@ -338,7 +338,9 @@ static int do_miitool(int argc, char *argv[])
 	case MIITOOL_SHOW:
 		for_each_mii_bus(mii) {
 			mdiobus_detect(&mii->dev);
-			mdiobus_show(&mii->dev, phydevname, verbose);
+			mdiobus_show(&mii->dev,
+				     devpath_to_name(phydevname),
+				     verbose);
 		}
 		break;
 	}
@@ -358,7 +360,7 @@ BAREBOX_CMD_HELP_TEXT("adapters use an MII to autonegotiate link speed and duple
 BAREBOX_CMD_HELP_TEXT("")
 BAREBOX_CMD_HELP_TEXT("Options:")
 BAREBOX_CMD_HELP_OPT("-v", "increase verbosity")
-BAREBOX_CMD_HELP_OPT("-s <devname>", "show PHY status (not providing PHY prints status of all)")
+BAREBOX_CMD_HELP_OPT("-s <devpath/devname>", "show PHY status (not providing PHY prints status of all)")
 BAREBOX_CMD_HELP_OPT("-r <busno>:<adr>", "register a PHY")
 BAREBOX_CMD_HELP_END
 
-- 
2.14.3




More information about the barebox mailing list