EVT_URS_SET_ROLE callback function (ursdevice.h)

The URS class extension invokes this event callback when it requires the client driver to change the role of the controller.

Syntax

EVT_URS_SET_ROLE EvtUrsSetRole;

NTSTATUS EvtUrsSetRole(
  [in] WDFDEVICE Device,
  [in] URS_ROLE Role
)
{...}

Parameters

[in] Device

A handle to the framework device object that the client driver retrieved in the previous call to WdfDeviceCreate.

[in] Role

A URS_ROLE type value that indicates the role to set for the controller device.

Return value

If the operation is successful, the callback function must return STATUS_SUCCESS, or another status value for which NT_SUCCESS(status) equals TRUE. Otherwise it must return a status value for which NT_SUCCESS(status) equals FALSE.

Remarks

To register the client driver's implementation of the event callback the driver must set the EvtUrsSetRole member of URS_CONFIG to a function pointer of the implementation method and then call the UrsDeviceInitialize method by passing the populated structure. The driver must call the method after it creates the framework device object for the controller.

Examples



NTSTATUS
EvtUrsSetRole (
    _In_ WDFDEVICE Device,
    _In_ URS_ROLE Role
    )
{
    NTSTATUS status;
    PFDO_CONTEXT fdoContext;

    TRACE_FUNC_ENTRY(TRACE_FLAG);
    TRY {


           // Change the current role of the controller to the specified role.
           // The driver might have stored the control registers in the device context. 
           // Read and write the register to get and set the current role. 

        }


        TRACE_INFO(TRACE_FLAG, "[Device: 0x%p] Successfully set role to %!URS_ROLE!", Device, Role);

        status = STATUS_SUCCESS;

    } FINALLY {

    }

    TRACE_FUNC_EXIT(TRACE_FLAG);

    return status;
}

Requirements

Requirement Value
Minimum supported client Windows 10
Minimum supported server Windows Server 2016
Target Platform Windows
Minimum KMDF version 1.15
Header ursdevice.h (include Urscx.h)
IRQL PASSIVE_LEVEL

See also

UrsDeviceInitialize