Call SetPowerState, the system crashed and restarted

How to set the power state of the usb device based on DriverKit?
I am developing a USB NCM network card driver based on DriverKit, and now I want to modify the power state of the device in response to the PC power change. I saw that DriverKit has two functions: SetPowerState and ChangePowerState.
I overried them separately. However, it seems that "ChangePowerState" can only be executed through display calls. The system will freeze and restart after 20s, regardless of whether SetPowerState is successful or not.

Error log:

MyDriverClass: setPower State(Oxffffff80507dba4
0: OXffffff7f9f1b218a, 1-> 4)timed out after 231852
ms"@/ BuildRoot/Library/Caches/com. apple xbs/Sources/
xnu/xnu-61531126/iokit/Kernel/IOService PM. cpp: 5382

You can try
Code Block
return SetPowerState(powerFlags, SUPERDISPATCH);
at the end of this method.

Call SetPowerState, the system crashed and restarted
 
 
Q