Skip to content

uefi: update open protocol doc #1733

@phip1611

Description

@phip1611

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions