[PATCH] usb: eth: add print of device name on usb_ether registration

Marek Vasut marex at denx.de
Thu Mar 25 18:40:37 CET 2021


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.

>> 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.

> by the way, here are a few other devices I have on hand showing the
> vid:pid, ethact name, driver Kconfig, and device:
> // vid:pid ethact uboot-driver device-name
> 0bda:8153 r8152_eth USB_ETHER_RTL8152 CableCreation CD0026: USB3 GbE
> 0b95:1790 ax88179_eth USB_ETHER_ASIX88179 plugable USB3-E1000: USB 3.0
> 10/100/1000mbps
> 0b95:7720 asix_eth USB_ETHER_ASIX plugable USB2-E100: USB2.0 10/100
> ASIX AX88772A


More information about the U-Boot mailing list