public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Andrew Fish" <afish@apple.com>
To: Ethin Probst <harlydavidsen@gmail.com>
Cc: devel@edk2.groups.io,
	"Leif Lindholm (Nuvia address)" <leif@nuviainc.com>,
	Ray Ni <ray.ni@intel.com>
Subject: Re: OpenProtocol() giving me EFI_INVALID_PARAMETER
Date: Sat, 17 Jul 2021 09:55:29 -0700	[thread overview]
Message-ID: <88AE4AB4-12BA-433C-9EA4-EDC01B30DAD1@apple.com> (raw)
In-Reply-To: <CAJQtwF3SEZZBDNa6sKHYxZJBKMzgaeBiiTKG0bnJ0Yfrz5iK+w@mail.gmail.com>



> On Jul 17, 2021, at 9:41 AM, Ethin Probst <harlydavidsen@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


  reply	other threads:[~2021-07-17 16:55 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-17 16:41 OpenProtocol() giving me EFI_INVALID_PARAMETER Ethin Probst
2021-07-17 16:55 ` Andrew Fish [this message]
2021-07-17 17:01   ` Ethin Probst
2021-07-17 17:06     ` Ethin Probst
2021-07-17 18:00       ` [edk2-devel] " Andrew Fish
2021-07-17 18:10         ` Ethin Probst
2021-07-17 18:34           ` Andrew Fish
2021-07-17 21:00             ` Ethin Probst

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=88AE4AB4-12BA-433C-9EA4-EDC01B30DAD1@apple.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox