Jump to content

DSDT USB Power Management


vol264
 Share

20 posts in this topic

Recommended Posts

Hi,

 

I would like to ask if someone can help me fix the last problem I have with my hack.

 

Sleep is working with no problems but follwoing things do not work when wake up after sleep.

 

- The error "the disk was not ejected properly" appears when USB stick was connected

- Can wake up machine only with power button on the computer (no wake over Mac Alu Keyboard, Mouse)

- When I have connected an external device (let say USB controller for Traktor) and uplugg it when computer is in sleep mode, the computer wakes up.

 

I'm preety sure that somewhere in my DSDT my USB power management settings have to be adjusted.

 

Attached is also my dsdt.

 

Thanks,

post-515577-0-39834200-1362210243_thumb.png

dsdt.dsl.zip

Link to comment
Share on other sites

Hi,

 

- The error "the disk was not ejected properly" appears when USB stick was connected

Well, this is obvious, OS X thinks that the device is still connected when it wakes up, so if it can not be found, it will give the warning. Just remove the drive from finder, then let the device go to sleep.

 

Don't know about point 2.

 

- When I have connected an external device (let say USB controller for Traktor) and uplugg it when computer is in sleep mode, the computer wakes up.

Turn off Wake on USB or something similar in the bios.

Link to comment
Share on other sites

  • 3 weeks later...

Is it possible to hack/trick something in DSDT to prevent all USB device suspending on sleep? There is an option in Windows (" disable usb selective suspend" or it's called something like this) power management settings, and I need that function/behavior in OSX too.

 

Anyone have an idea for this?

Link to comment
Share on other sites

Dsdt Fix For Usb Device Dead After Wake From Sleep Since 10.6.3 - Project OS X Forums

CODE

Device (UHC1)

{

Name (_ADR, 0x001D0000)

OperationRegion (BAR0, PCI_Config, 0xC4, One)

Field (BAR0, ByteAcc, NoLock, Preserve)

{

USBW, 2,

Offset (0x01)

}

------------------------------------------------------------------------------------- delete from here

Method (_S3D, 0, NotSerialized)

{

If (LOr (LEqual (OSFL (), One), LEqual (OSFL (), 0x02)))

{

Return (0x02)

}

Else

{

Return (0x03)

}

}

------------------------------------------------------------------------------------- to here

Method (_PSW, 1, NotSerialized)

{

If (Arg0)

{

Store (0x03, USBW)

}

Else

{

Store (Zero, USBW)

}

}

Method (_PRW, 0, NotSerialized)

{

Return (GPRW (0x03, 0x04))

}

}

"dirty" but it works.....

2.after wake from sleep the device is not working.

this happens for two reasons.

First is that the device is usb 1.1 and the solution is to unplug it and plug it again or see the jumper setting of the motherboard for "5V-DV" , "Wake" for that usb port or Bios setting for APM (PowerOn from usb keyboard-mouse)

Second is that for example in my case...go buy a new keyboard and throw away that "dump_cheap_usb1.1_keyboard_for_2euros" hahahaha

Now in the "case" we have a laptop and can't "buy" a new keyboard or touchpad the solution is to remove the "Wake from Sleep" (the device can wake the computer from sleep) section into DSDT , and we don't mind that cause this usbport connection is internal (no physical port) and the PowerButtom of the laptop is very close to the keyboard and mouse.

Press that , don't need to press a key or touch the trackpad to wake.

CODE

Device (UHC3)

{

Name (_ADR, 0x001D0000)

OperationRegion (BAR0, PCI_Config, 0xC4, One)

Field (BAR0, ByteAcc, NoLock, Preserve)

{

USBW, 2,

Offset (0x01)

}

Method (_S3D, 0, NotSerialized)

{

If (LOr (LEqual (OSFL (), One), LEqual (OSFL (), 0x02)))

{

Return (0x02)

}

Else

{

Return (0x03)

}

}

Method (_PSW, 1, NotSerialized)

{

If (Arg0)

{

Store (0x03, USBW)

}

Else

{

Store (Zero, USBW)

}

}

------------------------------------------------------------------------------------- delete from here

Method (_PRW, 0, NotSerialized)

{

Return (GPRW (0x03, 0x04))

}

}

------------------------------------------------------------------------------------- to here

 

.....

for the EHCI section (this is classical)

CODE

Device (EHC1)

{

Name (_ADR, 0x001D0007)

Method (_DSM, 4, NotSerialized)

{

Store (Package (0x04)

{

"AAPL,clock-id",

Buffer (One)

{

0x02

},

"device_type",

Buffer (0x05)

{

"EHCI"

}

}, Local0)

DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))

Return (Local0)

}

Method (_PRW, 0, NotSerialized)

{

Return (GPRW (0x0D, 0x04))

}

}

Link to comment
Share on other sites

Thanks, but my UHC1 looks like this:

Device (UHC1)
	 {
		 Name (_ADR, 0x001D0000)
		 Method (_S3D, 0, NotSerialized)
		 {
			 If (LEqual (OSFL, 0x02))
			 {
				 Return (0x02)
			 }
			 Return (0x03)
		 }
		 Name (_PRW, Package (0x02)
		 {
			 0x03,
			 0x03
		 })
	 }

If I delete the S3D section as suggested, my UHC1 (and other UHCX) will be almost empty :lol:

Or should I put those other thing in there and then remove the S3D section?

Link to comment
Share on other sites

I tried the above suggestions, I even tried another one which adds a _PSW method which should prevent the device from waking up the system.

Only this solution made something:

------------------------------------------------------------------------------------- delete from here
Method (_PRW, 0, NotSerialized)
{
Return (GPRW (0x03, 0x04))
}
}
-------------------------------------------------------------------------------------  to here

 

This made my machine stay in sleep mode nicely, but on wake the system hangs or something because the machine itself powering up, it's loading something (hdd led blinking), but display stays turned off for about ~30 sec, then it turns on, and the usb device disconnects. So it's still buggy.

Link to comment
Share on other sites

if its the G31m-es2l rev 1 try my dsdt in signature.

compare the memory line and change to yours if needed.

 

 

Edit:i just updated that post in my sig with a mediafire link with latest Dsdt/ smbios boot.com.

dsdt has hdef fix for Es2L rev1 audio

AppleHda for Lion 10.7.5 and Snow 10.6.8

Link to comment
Share on other sites

if its the G31m-es2l rev 1 try my dsdt in signature.

compare the memory line and change to yours if needed.

Your DSDT filesize is the third of mine lol. I think my dsdt is not really optimized... :D I added my ethernet, gfx0 to your dsdt, and now testing yours :)

 

edit: everything works, but the same sleep problem exists:

- bluetooth module plugged in - sleep wakes up immidiatelly (console says bluetooth module usb port "UHC3" was the reason)

- bluetooth module not plugged in - perfect sleeping, perfect waking with mouse.

  • Like 1
Link to comment
Share on other sites

I checked the console many times, the wake happens because the bluetooth dongle gets disconnected on sleep. And osx thinks that I disconnected it so it wakes up.

 

I tried different plug location...

Oh and an important note: the same thing happens on Windows too!

But on windows there is an option called "USB Selective Suspend", which prevents some usb devices from sleep to fix these kind of problems. With that, the problem dissapears on windows. So I thought maybe there is a dsdt tweak or something to make the usb bluetooth device to not enter sleep mode on OSX.

Link to comment
Share on other sites

I tried to inject ClassMustNotSeize (and other properties) in many different methods... but no change.

 

I even tried to modify the IOBluetoothFamily.kext to use broadcom driver, but then (obviously) it couldn't turn on the bluetooth radio, but the device was still recognized. (sleep worked then lol)

 

IORegistryExplorer image:

post-150972-0-03036400-1364301180_thumb.png

 

 

So there is no way to prevent a specific USB port from sleep?

Link to comment
Share on other sites

there is but its not easy 1.2.3 thing.

have to find which port it is on address with ioregexplorer then in there remove some code in dsdt for that usb

 

try turning off USB legacy in bios.

I already did that, its on the UHC3 port where the bluetooth dongle is. The UHC3 only have "_PRW" in the DSDT, tried to remove it, no change.

The last hope is that apply that "_PSW" thing (you can specify the wake capability or something with that) in the DSDT file you suggested for me.

Link to comment
Share on other sites

 Share

×
×
  • Create New...