Patch to have _SB.PCI0.CNVW._PRW return (GPRW (0x6D, Zero))

While debugging my hack waking from sleep immediately I found that my wake reason was "XDCI CNVW". When looking at my system DSDT I can find CNVW at _SB.PCI0.CNVW (cut down for brevity):

``` DefinitionBlock ("", "DSDT", 2, "ALASKA", "A M I", 0x01072009) { Scope (_SB.PCI0) { Device (CNVW) { Name (_ADR, 0x00140003) // _ADR: Address OperationRegion (CWAR, PCI_Config, Zero, 0x0100) Field (CWAR, WordAcc, NoLock, Preserve) { VDID, 32, , 1, WMSE, 1, WBME, 1, Offset (0x10), WBR0, 64, Offset (0x44), , 28, WFLR, 1, Offset (0x48), , 15, WIFR, 1, Offset (0xCC), WPMS, 32 }

 Method (_S0W, 0, NotSerialized) // _S0W: S0 Device Wake State { Return (0x03) } Method (_PRW, 0, NotSerialized) // _PRW: Power Resources for Wake { Return (GPRW (0x6D, 0x04)) } Method (_DSW, 3, NotSerialized) // _DSW: Device Sleep Wake { } PowerResource (WRST, 0x05, 0x0000) { Method (_STA, 0, NotSerialized) // _STA: Status { Return (One) } Method (_ON, 0, NotSerialized) // _ON_: Power On { } Method (_OFF, 0, NotSerialized) // _OFF: Power Off { } Method (_RST, 0, NotSerialized) // _RST: Device Reset { If ((WFLR == One)) { WBR0 = Zero WPMS = Zero WBME = Zero WMSE = Zero WIFR = One } } } Name (_PRR, Package (0x01) // _PRR: Power Resource for Reset { WRST }) } } 

} ```

So I tried to find a patch to have the _PRW method return (GPRW (0x6D, Zero)), but the best I could find was a post on InsanelyMac (see 2.2.2) that patches all _PRW to return (GPRW (0x6D, Zero)). When I apply this patch via Clover my hack will stay asleep (yay!).

However, there are a couple of issues with this: - I want to use this with OpenCore (ACPI patching only; no DSDT patching on config) - All USB ports lose power during sleep, so no wake via mouse/keyboard and no device charging

How can I make a patch that will only update _SB.PCI0.CNVW? I've tried the following but it would appear I'm still far off:

``` /* * Fix CNVW causing immediate wake from sleep. */ DefinitionBlock ("", "SSDT", 2, "hack", "CNVW", 0x00000000) { External(_SB.PCI0.CNVW, DeviceObj) External(_SB.PCI0.CNVW.GPRW, MethodObj) Scope (_SB.PCI0) { Device (CNVW) {

 Method (_PRW, 0, NotSerialized) // _PRW: Power Resources for Wake { Return (GPRW (0x6D, Zero)) } } } 

}

```

Honestly I'm not sure: - What the values of DefinitionBlock should be - If I need the External calls

When compiled I get the following:

Error: 8, 6117, Existing object has invalid type for Scope operator (_SB.PCI0 [Untyped]) Warning: 10, 3141, Missing dependency (Device object requires a _HID or _ADR in same scope)

I have a rough idea what these mean, but no idea where to start to fix it.

Can anyone point me to a good guide for this, or help me fix my existing patch?

For anyone having similar issues (if this gets fixed and comes up on Google) my motherboard is Z390 Aorus Pro WiFi and I've created a USBMap to disable the onboard WiFi/BT and set the motherboard USB headers type to 255.

Author: @Psyvire