I have been trying to get non-exclusive access to a protocol as an app, but I don't understand the API yet
Use boot::open_protocol with OpenProtocolAttributes::GetProtocol. Here's an example:
|
let block_io = boot::open_protocol::<BlockIO>( |
|
OpenProtocolParams { |
|
handle, |
|
agent: boot::image_handle(), |
|
controller: None, |
|
}, |
|
OpenProtocolAttributes::GetProtocol, |
|
) |
The documentation (and spec) are a little confusing since they say it's for drivers, but it works just as well with applications. (You can see in edk2 that BY_HANDLE_PROTOCOL and GET_PROTOCOL are handled the same way, and you can see example usages in popular UEFI applications such as shim and grub.) We should certainly update our docs to make this less confusing.
Originally posted by @nicholasbishop in #1725
Originally posted by @nicholasbishop in #1725