[PATCH] usb: eth: add print of device name on usb_ether registration
Tim Harvey
tharvey at gateworks.com
Thu Mar 25 23:38:37 CET 2021
On Thu, Mar 25, 2021 at 10:40 AM Marek Vasut <marex at denx.de> wrote:
>
> On 3/25/21 6:38 PM, Tim Harvey wrote:
> > On Thu, Mar 25, 2021 at 10:06 AM Marek Vasut <marex at denx.de> wrote:
> >>
> >> On 3/25/21 5:56 PM, Tim Harvey wrote:
> >>> When a USB Ethernet device is detected and registered there is no
> >>> way to know the device-name in order to use it with the ethact
> >>> env variable.
> >>>
> >>> Add a print to display the device name that is registered.
> >>>
> >>> Example using an AX88x72A USB Ethernet device:
> >>>
> >>> GW6404-B> usb start
> >>> starting USB...
> >>> Bus xhci_pci: Register 2000140 NbrPorts 2
> >>> Starting the controller
> >>> USB XHCI 1.00
> >>> Bus xhci_pci: Register 2000140 NbrPorts 2
> >>> Starting the controller
> >>> USB XHCI 1.00
> >>> scanning bus xhci_pci for devices...
> >>> found ethernet device: asix_eth
> >>>
> >>> GW6404-B> setenv ethact asix_eth # select usb ethernet
> >>>
> >>> Signed-off-by: Tim Harvey <tharvey at gateworks.com>
> >>> ---
> >>> drivers/usb/eth/usb_ether.c | 1 +
> >>> 1 file changed, 1 insertion(+)
> >>>
> >>> diff --git a/drivers/usb/eth/usb_ether.c b/drivers/usb/eth/usb_ether.c
> >>> index e368ecda0d..916c4e1c85 100644
> >>> --- a/drivers/usb/eth/usb_ether.c
> >>> +++ b/drivers/usb/eth/usb_ether.c
> >>> @@ -86,6 +86,7 @@ int usb_ether_register(struct udevice *dev, struct ueth_data *ueth, int rxsize)
> >>> return ret;
> >>> }
> >>> ueth->pusb_dev = udev;
> >>> + printf("\n found ethernet device: %s\n", dev->name);
> >>
> >> What if I have 2 asix_eth plugged in ? Do I get two identical prints ?
> >
> > Marek,
> >
> > Yes, two identical prints in this case which is not good.
> >
> > Which makes me wonder why 'setenv asix_eth' even works here as
> > drivers/usb/eth/asix.c's get_info function creates a unique instance
> > name.
>
> Seems a bit further investigation into this might be necessary.
It looks to me like the eth dev names are uniquely indexed for the non
DM_ETH case where each driver has a 'get_info' function that returns
an indexed name but for the DM_ETH case the eth_dev name is simply the
udevice name which is not unique.
>
> >> btw. it might be useful to have some "net list" command, like "mmc list"
> >> which would list all ethernet devices in the system.
> >
> > That's what I was wondering as well. There are the following
> > subcommands in the usb cmd:
> > usb storage - show details of USB storage devices
> > usb dev [dev] - show or set current USB storage device
> > usb part [dev] - print partition table of one or all USB storage devices
> >
> > So I was wondering if we should add a:
> > usb net - show details of USB network devices
>
> I don't think such a command should be limited to USB network devices,
> it should be something applicable to all network devices.
>
Yes, I agree.
I'll look into adding this in the near future.
Thanks,
Tim
More information about the U-Boot
mailing list