[edk2-devel] OpenProtocol() giving me EFI_INVALID_PARAMETER

Andrew Fish via groups.io afish=apple.com at groups.io
Sat Jul 17 16:55:29 UTC 2021



> On Jul 17, 2021, at 9:41 AM, Ethin Probst <harlydavidsen at gmail.com> wrote:
> 
> Hey all,
> 
> So my UsbAudio.efi app has hit a bit of a roadblock. This code:
> 
> ```C
>    status = st->BootServices->OpenProtocol(handles[i],
> &gEfiUsbIoProtocolGuid, (void**)&UsbIo, imageHandle, NULL,
> EFI_OPEN_PROTOCOL_EXCLUSIVE);
>    if (EFI_ERROR(status)) {
>      Print(L"%r, skipping\n", status);
>      continue;
>    }
> ```

How are you constructing handle[]? Could it have gotten stale? You could print out the value of handle[I] on the failure.

The contents of a handle are not defined, but the current implementation is a pointer to an IHANDLE internal data structure in the DXE Core. If you are at the UEFI Shell and you `dh -v <handleNum> it will show the <handleNum> and the value. 

Shell> dh -v 98
98: 6d5CF18
….

I think you can `dh -p UsbIo’ to get the list of the UsbIo handles. 

So you can poke around and see what is happening on that handle. 

I guess the handle[] array could be getting corrupted? So you could check for that? 

Thanks,

Andrew Fish

> Is giving me EFI_INVALID_PARAMETER and I don’t know why. I don't think
> I'm violating any of its constraints, according to the specification,
> and I haven't touched this code since it was written. It also happens
> irregularly: sometimes it happens on the USB audio streaming device,
> or if I have a device plugged in it might happen on that device, you
> get the idea. But it doesn't consistently fail. Does anybody have any
> idea what's going on?
> 
> -- 
> Signed,
> Ethin D. Probst



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#77851): https://edk2.groups.io/g/devel/message/77851
Mute This Topic: https://groups.io/mt/84272862/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-






More information about the edk2-devel-archive mailing list