Is Bug of DriverKit SetPowerState?

I am working on SCSIControllerDriverKit IOUserSCSIParallelInterfaceController

When the MacOS system restarts or shuts down, Why DriverKit SetPowerState is not called? But when the MacOS system sleeps and wakes up, SetPowerState is called.

kern_return_t IMPL (MyUserSpaceDriver, SetPowerState) { ....... }

Hi Erich. Please file a feedback for issues like these so we can help debug them.

arcmsr_debug_print("ArcMSRUserSpaceDriver %d: ********************************************************************** \n", ivars->adapter_index);
arcmsr_debug_print("ArcMSRUserSpaceDriver %d: **        【Get system status notification service】                                  \n", ivars->adapter_index);
arcmsr_debug_print("ArcMSRUserSpaceDriver %d: ** Call this function to get system "shutdown or restart" notification  \n", ivars->adapter_index);
arcmsr_debug_print("ArcMSRUserSpaceDriver %d: **             If our driver gets this service                                                   \n", ivars->adapter_index);
arcmsr_debug_print("ArcMSRUserSpaceDriver %d: **      It will cause our IMPL (ArcMSRUserSpaceDriver, Stop)               \n", ivars->adapter_index);
arcmsr_debug_print("ArcMSRUserSpaceDriver %d: **     to be called during the system "shutdown or restart" phase        \n", ivars->adapter_index);
arcmsr_debug_print("ArcMSRUserSpaceDriver %d: ********************************************************************** \n", ivars->adapter_index);
/* 
**************************************************************************************************************
**
**     If your system is MacOS11.52  .
**     This Function would cause IOSerrvice::ClientCrashed(IOService * client, uint64_t options);
**     This Function could supported from MacOS12.03 , ready for shutdown and restart notification from MacOS12.60
**
**     ===========================================================================================      
**                           Obtain the system state notification service
**
**                       To Let our Stop() is called when the system shuts down or restarts.
**
**              IOServiceStateNotificationDispatchSource for got "System Shutdown or Restart Notify"
** 
**                        this function "StateNotificationItemCopy" should be call
**
**  values for OSNumber kIOSystemStateHaltDescriptionKey:kIOSystemStateHaltDescriptionHaltStateKey
**
**  enum 
**  {
**      kIOServiceHaltStatePowerOff = 0x00000001,
**      kIOServiceHaltStateRestart  = 0x00000002,
**  };
**
**  virtual kern_return_t	        StateNotificationItemCopy(OSString * itemName, OSDictionary ** value);
**
**************************************************************************************************************
*/
if(IOService::CopySystemStateNotificationService(&ivars->ArcmsrSystemStateNotificationService) != kIOReturnSuccess)/* Register the service with the system. Obtain the system state notification service */
{
	goto initialize_fail;
}
Is Bug of DriverKit SetPowerState?
 
 
Q