Jump to content

DSDT USB Power Management


  • Please log in to reply
19 replies to this topic

#1
vol264

vol264

    InsanelyMac Protégé

  • Members
  • Pip
  • 39 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,

Attached Files



#2
Lejenk

Lejenk

    InsanelyMac Legend

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 1,381 posts
  • Gender:Male
  • Location:Netherlands
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.



#3
nyolc8

nyolc8

    InsanelyMac Legend

  • Members
  • PipPipPipPipPipPipPip
  • 802 posts
  • Gender:Male
  • Location:Budapest, Hungary
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?

#4
iFIRE

iFIRE

    InsanelyMacaholic

  • Moderators
  • 3,769 posts
  • Gender:Male
  • Location:Bcn-Spain

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" webkit-fake-url://7CC522CD-428B-45B0-866F-224D4AA2524A/blink.gif 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))

}

}


#5
nyolc8

nyolc8

    InsanelyMac Legend

  • Members
  • PipPipPipPipPipPipPip
  • 802 posts
  • Gender:Male
  • Location:Budapest, Hungary
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?

#6
nyolc8

nyolc8

    InsanelyMac Legend

  • Members
  • PipPipPipPipPipPipPip
  • 802 posts
  • Gender:Male
  • Location:Budapest, Hungary
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.

#7
LatinMcG

LatinMcG

    Insanely digesting DSDT

  • Members
  • PipPipPipPipPipPipPipPipPipPipPip
  • 2,509 posts
  • Gender:Male
  • Location:Tampa, Florida
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

#8
nyolc8

nyolc8

    InsanelyMac Legend

  • Members
  • PipPipPipPipPipPipPip
  • 802 posts
  • Gender:Male
  • Location:Budapest, Hungary

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.

#9
LatinMcG

LatinMcG

    Insanely digesting DSDT

  • Members
  • PipPipPipPipPipPipPipPipPipPipPip
  • 2,509 posts
  • Gender:Male
  • Location:Tampa, Florida
i think u are having the bluetooth isue of "ClassMustNotSeize"
or missing id in the proper kext plist.
seen somethign about that before..

what bluetooth device is it exact. .Pid Vid ?

#10
nyolc8

nyolc8

    InsanelyMac Legend

  • Members
  • PipPipPipPipPipPipPip
  • 802 posts
  • Gender:Male
  • Location:Budapest, Hungary
It's a BTech dongle
Product Id: 0x1 (yes, only a "1")
Vendor Id: 0xa12

Cambridge Silicon Radio Chip
Firmware version: 1593

#11
LatinMcG

LatinMcG

    Insanely digesting DSDT

  • Members
  • PipPipPipPipPipPipPipPipPipPipPip
  • 2,509 posts
  • Gender:Male
  • Location:Tampa, Florida
hmm i would check to see if theres any reports of sleep wake issue.
also try a different plug location.
optionally ive seen reports of working cheapos.. maybe buy a different one ?

#12
nyolc8

nyolc8

    InsanelyMac Legend

  • Members
  • PipPipPipPipPipPipPip
  • 802 posts
  • Gender:Male
  • Location:Budapest, Hungary
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.

#13
iFIRE

iFIRE

    InsanelyMacaholic

  • Moderators
  • 3,769 posts
  • Gender:Male
  • Location:Bcn-Spain
you have wifi in your PC? or only Ethernet

#14
nyolc8

nyolc8

    InsanelyMac Legend

  • Members
  • PipPipPipPipPipPipPip
  • 802 posts
  • Gender:Male
  • Location:Budapest, Hungary
only ethernet

#15
LatinMcG

LatinMcG

    Insanely digesting DSDT

  • Members
  • PipPipPipPipPipPipPipPipPipPipPip
  • 2,509 posts
  • Gender:Male
  • Location:Tampa, Florida
yeah u need to find the "ClassMustNotSeize" fix to add id in proper kext for chipset.. or find a different dongle

#16
nyolc8

nyolc8

    InsanelyMac Legend

  • Members
  • PipPipPipPipPipPipPip
  • 802 posts
  • Gender:Male
  • Location:Budapest, Hungary
Proper kext? What kext do you mean? Some legacy stuff? Btw the dongle works perfectly, just disconnects on sleep.

#17
nyolc8

nyolc8

    InsanelyMac Legend

  • Members
  • PipPipPipPipPipPipPip
  • 802 posts
  • Gender:Male
  • Location:Budapest, Hungary
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:
Attached File  scr.png   70.09KB   15 downloads


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

#18
LatinMcG

LatinMcG

    Insanely digesting DSDT

  • Members
  • PipPipPipPipPipPipPipPipPipPipPip
  • 2,509 posts
  • Gender:Male
  • Location:Tampa, Florida
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.

#19
iFIRE

iFIRE

    InsanelyMacaholic

  • Moderators
  • 3,769 posts
  • Gender:Male
  • Location:Bcn-Spain
if you want zero problems with bluetooth, buy a Belkin Mini this work O.O.B in Mac OS X, too wake from sleep Magic Mouse, AppleTrackpad, or any bluetooth hardware

#20
nyolc8

nyolc8

    InsanelyMac Legend

  • Members
  • PipPipPipPipPipPipPip
  • 802 posts
  • Gender:Male
  • Location:Budapest, Hungary

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.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

© 2014 InsanelyMac  |   News  |   Forum  |   Downloads  |   OSx86 Wiki  |   Mac Netbook  |   PHP hosting by CatN  |   Designed by Ed Gain  |   Logo by irfan  |   Privacy Policy