summaryrefslogtreecommitdiff
path: root/OptionRomPkg/Bus/Usb/UsbNetworking/Ax88772b/DriverBinding.c
diff options
context:
space:
mode:
Diffstat (limited to 'OptionRomPkg/Bus/Usb/UsbNetworking/Ax88772b/DriverBinding.c')
-rw-r--r--OptionRomPkg/Bus/Usb/UsbNetworking/Ax88772b/DriverBinding.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/OptionRomPkg/Bus/Usb/UsbNetworking/Ax88772b/DriverBinding.c b/OptionRomPkg/Bus/Usb/UsbNetworking/Ax88772b/DriverBinding.c
index d64bc739c1..bf05c74217 100644
--- a/OptionRomPkg/Bus/Usb/UsbNetworking/Ax88772b/DriverBinding.c
+++ b/OptionRomPkg/Bus/Usb/UsbNetworking/Ax88772b/DriverBinding.c
@@ -124,6 +124,8 @@ DriverStart (
UINTN LengthInBytes;
EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath = NULL;
MAC_ADDR_DEVICE_PATH MacDeviceNode;
+ EFI_USB_DEVICE_DESCRIPTOR Device;
+ UINT32 Index;
//
// Allocate the device structure
@@ -178,6 +180,41 @@ DriverStart (
goto EXIT;
}
+ Status = pNicDevice->pUsbIo->UsbGetDeviceDescriptor ( pNicDevice->pUsbIo, &Device );
+ if (EFI_ERROR ( Status )) {
+ gBS->CloseProtocol (
+ Controller,
+ &gEfiUsbIoProtocolGuid,
+ pThis->DriverBindingHandle,
+ Controller
+ );
+ gBS->FreePool ( pNicDevice );
+ goto EXIT;
+ } else {
+ //
+ // Validate the adapter
+ //
+ for (Index = 0; ASIX_DONGLES[Index].VendorId != 0; Index++) {
+ if (ASIX_DONGLES[Index].VendorId == Device.IdVendor &&
+ ASIX_DONGLES[Index].ProductId == Device.IdProduct) {
+ break;
+ }
+ }
+
+ if (ASIX_DONGLES[Index].VendorId == 0) {
+ gBS->CloseProtocol (
+ Controller,
+ &gEfiUsbIoProtocolGuid,
+ pThis->DriverBindingHandle,
+ Controller
+ );
+ gBS->FreePool ( pNicDevice );
+ goto EXIT;
+ }
+
+ pNicDevice->Flags = ASIX_DONGLES[Index].Flags;
+ }
+
//
// Set Device Path
//