Help - Search - Members - Calendar
Full Version: USB sleep then wake "Device Removal" problem
InsanelyMac Forum > OSx86 Project > Hardware and Drivers > Other Peripheral Devices
Pages: 1, 2, 3
pcb355
I'm new to this forum, but I have been active in OSX86 development for some time. I'm trying to solve a problem with USB on an otherwise perfect OSX86 system. It involves sleep functionality on the EHCI USB bus. Upon wake from sleep, if a USB drive has been attached, the system displays the "Device Removal" warning dialog. I have tried everything on the internet available for this problem, including Slice's kexts, AnV's kexts, teh EHCISleepEnabler.kext, variois IOPCIFamily.kexts, BIOS settings, all to no avail. USB is working absolutly perfect except for this issue, as is the rest of the system. It seems to me that the problem (at least on this MB, and probably other ICH10R MBs) is related to how the USB drivers initialize the ports, and thus determine their power management (sleep) capabilities. On this system, the EHCI USB ports are seen as PCI devices, rather than as built-in devices. This means that the driver will turn off the port and turn it back on again instead of suspending and resuming the port like it should.

I've written device drivers before and done some XCode development, and I'm currently getting my build environment correct, and starting to test some simple changes in the sleep capability section of AppleUSBEHCI.

Am I heading in the right direction?

If so, any pointers or other suggestions?

Thanks for the feedback.
indraganzo
I'm having the same problem on my GA EP45T DS3 board and Disableing or enabling the wake on usb and keyboard in bios does not have an affect I still get the Device removal error for my usb drives.. This does not happen like this on my mac book
I have been trying to fix this one for weeks looking for any hints on the web with out success. I can not belive only you and me are geting this error upon wake up my board is also ICH10 ,there must be more people getting this one
I think a possible fix might be through editing the usb wake parameters on the DSDT but I'm not quite sure how exactly that works we might have to compare a mac pro DSDT with our ones
pcb355
I would like to coordinate and maybe we can solve this together. I haven't yet gotten into the DSDT patching yet, but after doing some research, it seems that it's superior to the /Extra method for some devices, like audio. I have a few questions for you:

On your ethernet, you are using the DSDT patch instead of any replacement kext in the /Extra folder correct? If so, are you able to get full functionality, in other words, bonjour, AFP, DHCP reconnect after sleep, etc? I had to use the Psystar 1.8.1 extension inside of the IONetworkingFamily.kext in the /Extra folder for complete functionality.

On the audio, do you have full functionality, including front panel headphone switching and mic input working? I have full functionality using the legacy kexts (stickpin ALC889a Beta5) for HDA as well as the HDAEnabler.kext in the /Extra folder. One slight problem I have is that there are a couple of sound assertion errors in the system log on bootup, and there is an additional delay on bootup of about 10 seconds, and this is probably related. My legacy kexts are probably not quite right for my system. Would you mind sharing yours with me?

I've been using the older disabler.kext in the /Extra folder, and it has worked well so far. You are using a patch in the DSDT that doesn't require this. I just ran into another problem, as I'm using the G92 based video card, and there is a problem with AppleUpstreamUserClient.kext, which must be disabled, or use of iTunes results in a jerky system. There is a newer disabler which has just the CPUPM and this kext disabled, which solves this problem for me. So I would probably have to continue using some sort of disabler, at least for this, correct?

I'm also using AnV's AppleSMBIOS.kext, and Psystar's OpenHaltRestart.kext. I'm assuming that with a proper DSDT these aren't needed either?

Thanks so much for any and all feedback.
indraganzo
QUOTE (pcb355 @ Mar 2 2009, 12:00 AM) *
On your ethernet, you are using the DSDT patch instead of any replacement kext in the /Extra folder correct? If so, are you able to get full functionality, in other words, bonjour, AFP, DHCP reconnect after sleep, etc? I had to use the Psystar 1.8.1 extension inside of the IONetworkingFamily.kext in the /Extra folder for complete functionality.


I have not included Ethernet on my DSDT yet. I am using EFI string for it. To be able to work bonjour and stuff I also had to use the Psystar realtek r1000 driver 1.8.1 , this only worked on 10.5.6 not 10.5.5
QUOTE
On the audio, do you have full functionality, including front panel headphone switching and mic input working? I have full functionality using the legacy kexts (stickpin ALC889a Beta5) for HDA as well as the HDAEnabler.kext in the /Extra folder. One slight problem I have is that there are a couple of sound assertion errors in the system log on bootup, and there is an additional delay on bootup of about 10 seconds, and this is probably related. My legacy kexts are probably not quite right for my system. Would you mind sharing yours with me?

I have fully working 7.1 Audio no errors using no front panel legacy kexts as my case does not have a front panel from this thread http://www.insanelymac.com/forum/index.php...st&p=998397
QUOTE
I've been using the older disabler.kext in the /Extra folder, and it has worked well so far. You are using a patch in the DSDT that doesn't require this. I just ran into another problem, as I'm using the G92 based video card, and there is a problem with AppleUpstreamUserClient.kext, which must be disabled, or use of iTunes results in a jerky system. There is a newer disabler which has just the CPUPM and this kext disabled, which solves this problem for me. So I would probably have to continue using some sort of disabler, at least for this, correct?
I'm also using AnV's AppleSMBIOS.kext, and Psystar's OpenHaltRestart.kext. I'm assuming that with a proper DSDT these aren't needed either?

There comes the advantages of using the DSDT patcher and the DSDT override method. Once you fix your DSDT you can actually run AppleIntelCPU.kext without Disabler problems also you can get HPET and sleep working too..
I personally use a mix of EFI strings DSDT override and Extra/Extensions.mkext methods to run a totally vanilla Sytem/Library/Extensions and aflexible upgrade hassle free system.
here are my Extra kexts :
AppleDecrypt.kext

SMBios from karaakeha1
AppleSMBIOS.kext

JmicronATA fix from CycloneFr
LegacyJMicronATA.kext

for ICH10 and Yellow drive icon fix from netkas
LegacyAppleAHCIPort.kext
LegacyAppleIntelPIIXATA.kext
LegacyIOAHCIBlockStorage.kext

for Audio from tmongkol
LegacyHDAController.kext
LegacyHDAPlatformDriver.kext

Click to view attachment

Note : the r1000 from psystar I had to put in S/L/E some how it did not work in the extra folder
how did you do yours?



Coming back to our real subject the notorious Device Removal error of USB drives upon wake up .......

I have noticed something in my logs
CODE
Mar  2 12:15:49 localhost kernel[0]: .534    AppleUSBOHCI[0xacf0000]::CheckSleepCapability - controller will be unloaded across sleep


This obviously addresses the issue we have as the controller unloadds across sleep

can we edit something in the AppleUSBOHCI kext?

what do you think
hafnium
I have the exact same problem (USB functions lost during sleep).

I recently switched from a P35 (ICH9R) based board to a P45 (ICH10R) based board. With the P35 board, using IOUSBFamily.kext patched by Slice (see thread), I was able to get full USB functionality, including wake from sleep using a USB keyboard. With the P45 board, USB functionality behaves exactly like the P35 board with the unpatched IOUSBFamily. Using the patched IOUSBFamily.kext from Slice with the P45 board made no difference.

Booting the P45 board with -v gives the following information (regardless of using vanilla or Slice-patched IOUF.kext):

USBF: 0.356 AppleUSBOHCI[0x8945000]::CheckSleepCapability - controller will be unloaded across sleep.

According to Slice in the above thread, he did not correct anything in the kext for ICH10, as it was "added by Apple".

Strangely though, weaksauce12 states that the EP45-UD3P board works OOB with regards to USB (wake from sleep using the keyboard; see thread).

I think we should beg Slice to take another look at the IOUSBFamily.kext with specific focus on the P45 (ICH10) chipset.

QUOTE (indraganzo @ Mar 2 2009, 01:00 PM) *
Coming back to our real subject the notorious Device Removal error of USB drives upon wake up .......

I have noticed something in my logs
CODE
Mar  2 12:15:49 localhost kernel[0]: .534    AppleUSBOHCI[0xacf0000]::CheckSleepCapability - controller will be unloaded across sleep


This obviously addresses the issue we have as the controller unloadds across sleep

can we edit something in the AppleUSBOHCI kext?

what do you think


I don't think the ICH10 chipset contains any USBOHCI controllers. I've installed the Apple Dev program USB Prober, which doesn't find any OHCI controllers. Probably a bug (mistyping?) in the IOUSBFamily.kext because AppleOHCIUSB.kext is not loaded (AppleEHCIUSB and AppleUHCIUSB both are loaded).

Lets beg Slice (see my other reply) to look at his patches for ICH10 once again.
indraganzo
I have done a little research and I have come across these I haven't tested them but feel free to try them out and report
one work arround
http://www.macosxhints.com/article.php?sto...080329201951648
and an other one
http://vocaro.com/trevor/blog/2007/02/11/a...efore-sleeping/

I think this is also a problem with real macs when used with some equipment
TheBogieMan
I'm having the same issue since upgrading to 10.5.6, I'll give the scripts a whirl and report back....or not as the case may be laugh.gif

I've also lost time machine functionality since the upgrade but that's a load of other threads for to trawl to see if there's a fix
indraganzo
when I boot without the usb drive I get this one instead of the one above

CODE
Mar  2 17:47:15 localhost kernel[0]: controller will be unloaded across sleep


any ideas? wacko.gif
hafnium
Sorry, but I don't think this is the solution we are looking for.

The problem seems to be that the USB driver in OS X (in this case the AppleUSBEHCI.kext plugin in the IOUSBFamily.kext) recognizes the ICH10 USB controller as not being sleep capable.

You can download the source code from Apple. If you look inside, you'll find that every USB controller (EHCI) that doesn't contain a specific Apple phrase (AAPL) will be treated as being located on an expansion slot (PCI) and therefore not sleep capable.

If you go to System Profiler/USB, you'll see that the "Host Controller Location" is "Expansion Slot". We need to have OS X recognize the location as being built in (Built In USB), which is the case for other USB busses listed in the System Profiler (under USB Bus).

Also, inside the AppleUSBEHCI.kext, where the distinction is being made between sleep capable and not sleep capable, there is a reference to USBOHCI (note the O) even though we are dealing with the EHCI controller driver.

We need to ask Slice to look at his patched kexts again or to find a way to make OS X recognize EHCI controllers as being built in and no located on a expansion slot.
pcb355
I agree. The root of the problem is the designation of PCI vs Built-in on the EHCI USB ports. There are two ways to deal with this, IMHO:

1. Work with the DSDT or other method to modify the IORegistry to indicate Built-in for the EHCI USB ports. This is the best method as it should work going forward with the standard Apple vanilla USB drivers.

2. Modify the source code for the EHCI driver to set the correct sleep capability. This is not as clean as it requires putting the entire modified IOUSBFamily.kext in the /Extra folder, which may cause problems with future updates.

On my system, USB is working perfectly, sleep and wake from sleep with KB and mouse, just the "Device Removal" problem on USB storage devices, so I would prefer a vanilla USB driver solution with this problem fixed. I will be working on a DSDT solution first, and I will report back on my progress.
pcb355
On the Psystar 1.8.1 driver, it has to be in the plug-ins folder of the IONetworkingFamily.kext, as it has dependencies there. I took the latest 10.5.6 version of this, added the Psystar kext to it, and then put this in the /Extra folder. It's not the most elegant solution, as a future update to IONetworkingFamily might break this, but it's the best solution I've found so far for full networking functionality on the Realtek 8111C ethernet chipset.
hafnium
Yes, I agree too. Vanilla kexts are preferred. If you are able to find a DSDT or perhaps a EFI string solution, that will be nice. Looking forward to hearing about your progress.

In the meantime I have asked Slice to take another look at his patches for IOUSBFamily.kexts. Let's hope he responds (always a good idea to ride two horses).
indraganzo
QUOTE (hafnium @ Mar 2 2009, 04:04 PM) *
Sorry, but I don't think this is the solution we are looking for.

If you go to System Profiler/USB, you'll see that the "Host Controller Location" is "Expansion Slot". We need to have OS X recognize the location as being built in (Built In USB), which is the case for other USB busses listed in the System Profiler (under USB Bus).


on my mac book I Don't have this problem and USB high speed bus' Host Controller reports as built in where as my GA EP45T DS3 reports it as expansion slot.

But on my GA EP45T DS3 when I insert my USB Drive to any other UHCI USB port which reports as built in still I get the "Device Removal" isn't that weird too.??
My expectation would be that the built in UHCI ports would work with out a problem which is not the case here...
Are we missing something ?

Here is a document about Intel EHCI USB for Developers.
May be we can understand better how EHCI works
INTEL EHCI USB

Yes I would also like to try to report my EHCI ports as Built in and see if we can nail it this way...
pcb355
This is the edit I made to the stock AppleUSBEHCI.kext:

CODE
if (!_hasPCIPwrMgmt)
{
// USBError(1, "AppleUSBOHCI[%p]::CheckSleepCapability - controller will be unloaded across sleep",this);
// _controllerCanSleep = false;
// setProperty("Card Type","PCI");

// My power management fix
_controllerCanSleep = true;
setProperty("Card Type","Built-in");
}



This works on my system, a GA-EP45-Extreme.

I've attached the compiled AppleUSBEHCI.kext to test, which has only the change above from the current vanilla 10.5.6 driver.
indraganzo
pcb355,
you rock man
working on my GA EP45T DS3 smile.gif
TheBogieMan
Out of interest lads, what does your Host & PCi bridge show up as when you run LSPCI ?
As I'm wondering if this will work for GA-G31M-S2L boards as well, that shows up as the following

00:00.0 Host bridge [0600]: Intel Corporation 82G33/G31/P35/P31 Express DRAM Controller [8086:29c0] (rev 10)
00:01.0 PCI bridge [0604]: Intel Corporation 82G33/G31/P35/P31 Express PCI Express Root Port [8086:29c1] (rev 10)
00:1c.0 PCI bridge [0604]: Intel Corporation 82801G (ICH7 Family) PCI Express Port 1 [8086:27d0] (rev 01)
00:1c.1 PCI bridge [0604]: Intel Corporation 82801G (ICH7 Family) PCI Express Port 2 [8086:27d2] (rev 01)
00:1d.0 USB Controller [0c03]: Intel Corporation 82801G (ICH7 Family) USB UHCI Controller #1 [8086:27c8] (rev 01)
00:1d.1 USB Controller [0c03]: Intel Corporation 82801G (ICH7 Family) USB UHCI Controller #2 [8086:27c9] (rev 01)
00:1d.2 USB Controller [0c03]: Intel Corporation 82801G (ICH7 Family) USB UHCI Controller #3 [8086:27ca] (rev 01)
00:1d.3 USB Controller [0c03]: Intel Corporation 82801G (ICH7 Family) USB UHCI Controller #4 [8086:27cb] (rev 01)
00:1d.7 USB Controller [0c03]: Intel Corporation 82801G (ICH7 Family) USB2 EHCI Controller [8086:27cc] (rev 01)
00:1e.0 PCI bridge [0604]: Intel Corporation 82801 PCI Bridge [8086:244e] (rev e1)
00:1f.0 ISA bridge [0601]: Intel Corporation 82801GB/GR (ICH7 Family) LPC Interface Bridge [8086:27b8] (rev 01)
00:1f.1 IDE interface [0101]: Intel Corporation 82801G (ICH7 Family) IDE Controller [8086:27df] (rev 01)
00:1f.2 IDE interface [0101]: Intel Corporation 82801GB/GR/GH (ICH7 Family) SATA IDE Controller [8086:27c0] (rev 01)
00:1f.3 SMBus [0c05]: Intel Corporation 82801G (ICH7 Family) SMBus Controller [8086:27da] (rev 01)
pcb355
Thanks for the feedback.

Alas, I'm having an additional problem: After resume, the attached USB drive has slower read/write speeds until it's ejected and then reinserted. A very handy little utility for checking drive speed is "AJA System Test", google it it's a free download. Could you check to see whether you have this little problem as well?

Thanks so much.
hafnium
QUOTE (TheBogieMan @ Mar 6 2009, 12:26 AM) *
Out of interest lads, what does your Host & PCi bridge show up as when you run LSPCI ?
As I'm wondering if this will work for GA-G31M-S2L boards as well, that shows up as the following

00:00.0 Host bridge [0600]: Intel Corporation 82G33/G31/P35/P31 Express DRAM Controller [8086:29c0] (rev 10)
00:01.0 PCI bridge [0604]: Intel Corporation 82G33/G31/P35/P31 Express PCI Express Root Port [8086:29c1] (rev 10)
00:1c.0 PCI bridge [0604]: Intel Corporation 82801G (ICH7 Family) PCI Express Port 1 [8086:27d0] (rev 01)
00:1c.1 PCI bridge [0604]: Intel Corporation 82801G (ICH7 Family) PCI Express Port 2 [8086:27d2] (rev 01)
00:1d.0 USB Controller [0c03]: Intel Corporation 82801G (ICH7 Family) USB UHCI Controller #1 [8086:27c8] (rev 01)
00:1d.1 USB Controller [0c03]: Intel Corporation 82801G (ICH7 Family) USB UHCI Controller #2 [8086:27c9] (rev 01)
00:1d.2 USB Controller [0c03]: Intel Corporation 82801G (ICH7 Family) USB UHCI Controller #3 [8086:27ca] (rev 01)
00:1d.3 USB Controller [0c03]: Intel Corporation 82801G (ICH7 Family) USB UHCI Controller #4 [8086:27cb] (rev 01)
00:1d.7 USB Controller [0c03]: Intel Corporation 82801G (ICH7 Family) USB2 EHCI Controller [8086:27cc] (rev 01)
00:1e.0 PCI bridge [0604]: Intel Corporation 82801 PCI Bridge [8086:244e] (rev e1)
00:1f.0 ISA bridge [0601]: Intel Corporation 82801GB/GR (ICH7 Family) LPC Interface Bridge [8086:27b8] (rev 01)
00:1f.1 IDE interface [0101]: Intel Corporation 82801G (ICH7 Family) IDE Controller [8086:27df] (rev 01)
00:1f.2 IDE interface [0101]: Intel Corporation 82801GB/GR/GH (ICH7 Family) SATA IDE Controller [8086:27c0] (rev 01)
00:1f.3 SMBus [0c05]: Intel Corporation 82801G (ICH7 Family) SMBus Controller [8086:27da] (rev 01)


Well, try it out. Do you get the "... controller will be unloaded across sleep" message during boot? If so, it should work. ICH7 support was added by Slice in his patches IOUSBFamily.kext (see thread).
TheBogieMan
QUOTE (hafnium @ Mar 6 2009, 09:28 AM) *
Well, try it out. Do you get the "... controller will be unloaded across sleep" message during boot? If so, it should work. ICH7 support was added by Slice in his patches IOUSBFamily.kext (see thread).


Yes I do, I'll give it a try later (when the wife goes out and I can get away from the decorating unsure.gif )
TheBogieMan
Don't panic, I didn't break it.....just spent the best part of the week on the beer biggrin.gif

I'd forgotten to do the "sudo rm -r -v /System/Library/Extensions/PCGenUSB*
sudo rm -r -v /System/Library/Extensions/IOUSBFamily.kext/Contents/PlugIns/PCGenUSB*
" bit

Sleep is all working fine and dandy now smile.gif
eberts
Hi there,
I just read this. Can't say that I ever had that problem, but maybe you'd be interested in a possible dsdt fix. (I copied the AAPL part from a Mac Pro dsdt) - system profiler reports ehci location as built-in:

CODE
            Device (USB7)
            {
                Name (_ADR, 0x001D0007)
                OperationRegion (U7CS, PCI_Config, 0x54, 0x04)
                Field (U7CS, DWordAcc, NoLock, Preserve)
                {
                        ,   15,
                    PMES,   1
                }

                Device (HUB7)
                {
                    Name (_ADR, 0x00)
                    Device (PRT1)
                    {
                        Name (_ADR, 0x01)
                    }

                    Device (PRT2)
                    {
                        Name (_ADR, 0x02)
                    }

                    Device (PRT3)
                    {
                        Name (_ADR, 0x03)
                    }

                    Device (PRT4)
                    {
                        Name (_ADR, 0x04)
                    }

                    Device (PRT5)
                    {
                        Name (_ADR, 0x05)
                    }

                    Device (PRT6)
                    {
                        Name (_ADR, 0x06)
                    }

                    Device (PRT7)
                    {
                        Name (_ADR, 0x07)
                    }

                    Device (PRT8)
                    {
                        Name (_ADR, 0x08)
                    }
                }

                Name (_PRW, Package (0x02)
                {
                    0x0D,
                    0x03
                })
                Method (_S3D, 0, NotSerialized)
                {
                    Return (0x03)
                }

                Method (_S4D, 0, NotSerialized)
                {
                    Return (0x03)
                }

                Method (_DSM, 4, NotSerialized)
                {
                    Store (Package (0x07)
                        {
                            "AAPL,current-available",
                            0x05DC,
                            "AAPL,current-extra",
                            0x03E8,
                            "AAPL,current-in-sleep",
                            0x0BB8,
                            Buffer (0x01)
                            {
                                0x00
                            }
                        }, Local0)
                    DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))
                    Return (Local0)
                }
            }


Maybe this fixes your problems (by having those AAPL entries) smile.gif
pcb355
Thanks for the reply and possible direction for a fix. I have just gotten into the DSDT compiling, and dabbled a little in it. On my system, other than this particular fix (if it works) DSDT patching doesn't result in a better system, as I still need kexts that provide more functionality than what DSDT can do. That being said, I would love to fix this USB problem with a DSDT solution, as it would be much cleaner than patched USB kexts.

As I'm very new to the DSDT and ACPI language, I don't know how this Mac Pro USB info would be added to the current DSDT that I have. In hopes that some other more knowledgeable person can help, I've attached the current stock DSDT dsl file for this motherboard, the Gigabyte EP45-Extreme. If anyone can suggest an edit, I'll be more than happy to give it a try.
chrS
Hi,

I just want to report that I observe this problem exactly as you have described on my system (see below) and I am lucky that i finally found this thread. In addition to the "device removal error" with USB storage devices I lose my sound output via iMic after sleep.
CODE

Apr 8 22:46:24 u2c kernel[0]: System Wake
Apr 8 22:46:24 u2c kernel[0]: USB (UHCI):Port 2 on bus 0x5d connected or disconnected
Apr 8 22:46:24 u2c kernel[0]: USB (UHCI):Port 1 on bus 0x1a connected or disconnected
Apr 8 22:46:24 u2c kernel[0]: USB (UHCI):Port 1 on bus 0x3a connected or disconnected

CODE
USB Bus:

Host Controller Location: Built In USB
Host Controller Driver: AppleUSBUHCI
PCI Device ID: 0x3a37
PCI Revision ID: 0x0000
PCI Vendor ID: 0x8086
Bus Number: 0x1a

iMic USB audio system:

Product ID: 0x07af
Vendor ID: 0x077d
Version: 0.05
Speed: Up to 12 Mb/sec
Manufacturer: Griffin Technology, Inc
Location ID: 0x1a100000
Current Available (mA): 500
Current Required (mA): 100



(I use an iMic because I could not get onboard sound work reliable. The legacy extensions make the sound work but there are hundreds of assertion errors in the system log, which I think is just too much.)

I did not try pcb355's patched kext yet, because I am not sure how to install this. Does "Kext Helper.app" do this reliable?

My approach until now was to avoid messing with S/L/E directly and except for this USB sleep problem it's working well.
chrS
QUOTE (pcb355 @ Mar 3 2009, 11:27 PM) *
This is the edit I made to the stock AppleUSBEHCI.kext:


I tried your kext in S/L/E and as you said it fixed the device removal errors for storage devices and the iMic. So far so great! Big thanks for that.

I did some measurements on throughput before and after sleep and can confirm that there still is a problem.

After fresh reboot: read :35 MB/s write 34,5 MB/s
sleep and wake: read 12 MB/s write 12 MB/s

I believe something with USB is still messed up. Unfortunately I never did anything with dsdt until now and after reading a dsdt primer for Linux I think that's pretty strange stuff, but it could be the way to a real solution. I don't like patched kexts in S/L/E.
konkon
i wanted to download the AJA System test tool. It seems, they have removed the direct download it from the age website.

but i found out a way to get it:
i simply downloaded the first driver i found from the aja website (AJA KONA 2 Software 6.0.3.mpkg).
i displayed the package contend.
i dragged Archive.pax.gz to the desktop and clicked on it to unpack it.
in the resulted folder "Archive" you can find the utility in /Applications/AJA Utilities/
konkon
regarding the loos of speed:

it looks like we don't need to care about this too much. i have made several tests.
some on my G31M-ES2L (which i have fixed with the patch form pcb355) and some on my original macbook3,1.
i found out, also the MacBook have this behavior!

I have used a cheep USB Key drive (which always have a slow write performance):

MACBOOK3,1:
With a fresh booted macbook i got: Write: 7.06 MB/s - Read: 31.58 MB/s
After the first sleep time i only got: Write: 5.93 MB/s - Read: 15.31 MB/s
After ejecting & reconnecting the drive: Write: 7.06 MB/S - Read: 30.82 MB/s

G31M-ES2L:
With the fresh booted fixed G31M-ES2L i got: Write: 7.83 MB/s - Read: 36.56 MB/s
After the first sleep time i only got: Write: 7.10 MB/s - Read: 23.44 MB/s
After ejecting & reconnecting the drive: Write: 7.87 MB/S - Read: 36.00 MB/s

Comments about the G31M-ES2L Tests:
  • When not ejecting & reconnecting the drive, the speed lowered further, after the 2., 3. & 4. sleep time until it reached: Write: 6.35 MB/s - Read: 16.47 MB/s
  • After the 5. & 6. sleep time it still reached the same values
  • After ejecting & reconnecting the drive, sometimes the write speed was very slow (about 1.8MB/s) while the Read speed was 100%. But after repeating the test, it still reaches the full speed also in write. So not really an issue i guess.
Eliade
QUOTE (konkon @ Apr 10 2009, 07:54 AM) *
i wanted to download the AJA System test tool. It seems, they have removed the direct download it from the age website.

but i found out a way to get it:
i simply downloaded the first driver i found from the aja website (AJA KONA 2 Software 6.0.3.mpkg).
i displayed the package contend.
i dragged Archive.pax.gz to the desktop and clicked on it to unpack it.
in the resulted folder "Archive" you can find the utility in /Applications/AJA Utilities/


the AJA system test is there, 3rd one: wink.gif
http://www.aja.com/html/products_macintosh_kona_util.html

QUOTE (konkon @ Apr 10 2009, 09:40 AM) *
regarding the loos of speed:

it looks like we don't need to care about this too much. i have made several tests.
some on my G31M-ES2L (which i have fixed with the patch form pcb355) and some on my original macbook3,1.
i found out, also the MacBook have this behavior!

I have used a cheep USB Key drive (which always have a slow write performance):

G31M-ES2L:
With the fresh booted fixed G31M-ES2L i got: Write: 7.83 MB/s - Read: 36.56 MB/s
After the first sleep time i only got: Write: 7.10 MB/s - Read: 23.44 MB/s
After ejecting & reconnecting the drive: Write: 7.87 MB/S - Read: 36.00 MB/s


On my machine GA-EP45-UD3R with a 250GB western digital passport
the difference is pretty steep (3x slower):
fresh boot: about Write: 34MB/s Read:36MB/s
After the first sleep time i only got: Write: 12.3 MB/s - Read: 12.3 MB/s
After (physically) ejecting & reconnecting the drive: Write: 22.8 MB/S - Read: 24.20 MB/s



Anyway, thanks for the kext, it's better than nothing
TheBogieMan
QUOTE (pcb355 @ Mar 3 2009, 11:27 PM) *
This is the edit I made to the stock AppleUSBEHCI.kext:

CODE
if (!_hasPCIPwrMgmt)
{
// USBError(1, "AppleUSBOHCI[%p]::CheckSleepCapability - controller will be unloaded across sleep",this);
// _controllerCanSleep = false;
// setProperty("Card Type","PCI");

// My power management fix
_controllerCanSleep = true;
setProperty("Card Type","Built-in");
}



This works on my system, a GA-EP45-Extreme.

I've attached the compiled AppleUSBEHCI.kext to test, which has only the change above from the current vanilla 10.5.6 driver.


Famtastic !!!!

Works on the GA-G31M-S2L as well
zhell
Please open IORegistryExplorer and go to the USB devices (probably have "USB" or "UHC" or "EHC" in their name).

Open up all the entries beneath it.

Then, unplug and replug a device and check if you see that there's now a red, stroken through entry and a green, underlined entry. If that is not the case, please surf the menus, there must be an option to enable that.

Then, go to sleep and wake up. You should see the same effect as above.

Compare the properties of the devices. Take a snap and post it here

Check the "Card Type", should be "Built-in", not "PCI". This corresponds to "Physical Location" in System Profiler, where "PCI"="Expansion Slot".

Also, go get the debug enabled USB KEXTs, they might just print the problem right to your system.log.
http://developer.apple.com/hardwaredrivers...d/usbdebug.html

There's also an Uninstaller. Note that you need to start "USB Prober" and isntall "KLog.kext" (will go to /S/L/E) for loggin. In this app you find lots of information, esp. at debug level 7 :-)

Also at boot time, you will find some info which is also saved to system.log

Good luck
LatinMcGyver75
so the usb is reconnecting as usb 1.1 instead of 2.0 after sleep? i wonder if the chameleon2RC1 ehciaaquire or uhcireset options could help this issue?.. testing.
konkon
no,no. it is not changing to usb1.1. this would be much slower!!
also the EHCI driver (which is needed for usb2.0) is still loaded.

before i tried this kext, i also gave a try to ehciaaquire & uhcireset in chameleon 2 . but this had not helped for my G31M-ES2L.
zhell
I have verified this on a Macmini1,1 (Intel chipset) and Macbook5,1 (nVidia chipset). On the Mac mini, the transfer rate decreases by about 35%. On the MacBook, though, it does not change at all.

On my DP35DP (Intel P35 chipset), I unfortunately get the Intel behavior.

Way to go, nVidia, and shame on you, Intel, or Apple, or both :-)
hafnium
Do you guys have waking from USB keyboards/mice working, or do you have to wake the Hack using the power button?
Farx
USB K/M can wake Leopard up.
chrS
QUOTE (zhell @ Apr 11 2009, 12:24 AM) *
Please open IORegistryExplorer and go to the USB devices (probably have "USB" or "UHC" or "EHC" in their name).

Open up all the entries beneath it.

OK, I try this with EP45-UD3 and pcb355's patched USB kext installed after fresh reboot.

QUOTE
Then, unplug and replug a device and check if you see that there's now a red, stroken through entry and a green, underlined entry. If that is not the case, please surf the menus, there must be an option to enable that.

Yes I can see this:
Click to view attachment

QUOTE
Then, go to sleep and wake up. You should see the same effect as above.

No. I just get the same list as before sleep. There are no new entries in the list.
QUOTE
Compare the properties of the devices. Take a snap and post it here

If I understood correctly this is not possible.

QUOTE
Check the "Card Type", should be "Built-in", not "PCI". This corresponds to "Physical Location" in System Profiler, where "PCI"="Expansion Slot".

Done. The CardType is Built-in.

QUOTE
Also, go get the debug enabled USB KEXTs, they might just print the problem right to your system.log.
http://developer.apple.com/hardwaredrivers...d/usbdebug.html

I did not try this yet, because I am not sure how this will interfere with the patched kext from bcp355.

Anyway thanks for your suggestions!
zhell
QUOTE (chrS @ Apr 14 2009, 08:51 PM) *
OK, I try this with EP45-UD3 and pcb355's patched USB kext installed after fresh reboot.
Yes I can see this:
Click to view attachment
No. I just get the same list as before sleep. There are no new entries in the list.

Well, that's good.

QUOTE (chrS @ Apr 14 2009, 08:51 PM) *
If I understood correctly this is not possible.
Done. The CardType is Built-in.

Good.

QUOTE (chrS @ Apr 14 2009, 08:51 PM) *
I did not try this yet, because I am not sure how this will interfere with the patched kext from bcp355.

You should use either the debug or the patched ones. Do not mix them. But the debug ones might help with the diagnose.
chrS
QUOTE (zhell @ Apr 15 2009, 02:06 PM) *
You should use either the debug or the patched ones. Do not mix them. But the debug ones might help with the diagnose.


I see a problem here. Only with the patched AppleUSBEHCI the USB connection "survives" sleeping.
If unpatched the device is disconnected after sleep because OSX sees the builtin USB (ICH10) as card type: PCI with no power management enabled. I think a patched debug kext is needed for further investigation but building such a thing is beyond my abilities at the moment, sorry.
mr-pink
Hi all,

I was thinking to pick the ga-g31m-es2l but I'm trying to build a system using the minimum amount of modified kexts. So I wouldn't like adding a modified kext also for USB.

I've red this topic and - I'm not sure and I know its a different issue - but I've found something that could be connected with this here http://www.insanelymac.com/forum/index.php?showtopic=141324 Has anyone tried this method?
IntelMacGuy
The USB sleep kext works, but the sound won't work after wake. got any solutions?
zhell
QUOTE (hafnium @ Mar 2 2009, 05:04 PM) *
Sorry, but I don't think this is the solution we are looking for.

The problem seems to be that the USB driver in OS X (in this case the AppleUSBEHCI.kext plugin in the IOUSBFamily.kext) recognizes the ICH10 USB controller as not being sleep capable.

You can download the source code from Apple. If you look inside, you'll find that every USB controller (EHCI) that doesn't contain a specific Apple phrase (AAPL) will be treated as being located on an expansion slot (PCI) and therefore not sleep capable.

If you go to System Profiler/USB, you'll see that the "Host Controller Location" is "Expansion Slot". We need to have OS X recognize the location as being built in (Built In USB), which is the case for other USB busses listed in the System Profiler (under USB Bus).

Also, inside the AppleUSBEHCI.kext, where the distinction is being made between sleep capable and not sleep capable, there is a reference to USBOHCI (note the O) even though we are dealing with the EHCI controller driver.

We need to ask Slice to look at his patched kexts again or to find a way to make OS X recognize EHCI controllers as being built in and no located on a expansion slot.


This diagnosis is more or less correct. Note that to implement both USB 1.1 and USB 2.0, manufacturers either provide one OHCI device or both an UHCI and an EHCI device. Intel does the latter, hence a lack of OHCI devices is not a problem.

I have discovered a DSDT fix that works for both Intel and other boards based on ICH9/-R. Probably it also works for ICH10 boards, check it out here.
It should allow you to make your machine sleep using the stock USB drivers from Apple (10.5.7).

It will also ensure the UHCI devices are built-in and enable power management.
ApexDE
Anyone found a DSDT Patch Solution for the "missing" powermanagement-ability-info on the EHCI Devices?
Fine Vision
Hello.

I have iATKOS v7 10.5.7 on Asus P5N32-E. All works fine. All my USB devices mounting correctly, but it's only until machine go to sleep. After it's wakes up and I trying to mounting flash-drive or external USB HDD i have a kernel panic.

Anyone can halp me?

Sorry for my english.
Thanks.
ApexDE
OK guys, i managed to patch my DSDT to get the EHCI USB Ports sleeping.

Unloading the Controller during Sleep results in USB Drives being removed by force without unmounting, which might result in data-loss:

CODE
kernel    USBF:    0.392    AppleUSBEHCI[0x6838800]::CheckSleepCapability - controller will be unloaded across sleep


The Apple USB Drivers search for a device property "AAPL,clock-id", if it is found the ports are flagged built-in, if not, they will be unloaded during sleep. I renamed my EHCI Devices to EHC1 and EHC2. This is just cosmetical, search for your EHCI Devices by the adresses (e.g 0x001D0007 , 0x001A0007 for Gigabyte)


Here is my EHCI DSDT Part:


CODE
            Device (EHC1)
            {
                Name (_ADR, 0x001D0007)
                Method (_S3D, 0, NotSerialized)
                {
                    If (LEqual (OSFL, 0x02))
                    {
                        Return (0x02)
                    }

                    Return (0x03)
                }

                Name (_PRW, Package (0x02)
                {
                    0x0D,
                    0x03
                })
                        Method (_DSM, 4, NotSerialized)
                        {
                           Store (Package (0x04)
                               {
                                 "AAPL,clock-id",
                                 Buffer (0x01)
                                 {
                                     0x01
                                 },
                                 "device_type",
                                 Buffer (0x05)
                                 {
                                    "EHCI"
                                 }
                                }, Local0)
                            DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))
                            Return (Local0)
                        }
            

            }

            Device (EHC2)
            {
                Name (_ADR, 0x001A0007)
                Method (_S3D, 0, NotSerialized)
                {
                    If (LEqual (OSFL, 0x02))
                    {
                        Return (0x02)
                    }

                    Return (0x03)
                }

                Name (_PRW, Package (0x02)
                {
                    0x0D,
                    0x03
                })
                        Method (_DSM, 4, NotSerialized)
                        {
                           Store (Package (0x04)
                               {
                                 "AAPL,clock-id",
                                 Buffer (0x01)
                                 {
                                     0x02
                                 },
                                 "device_type",
                                 Buffer (0x05)
                                 {
                                    "EHCI"
                                 }
                                }, Local0)
                            DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))
                            Return (Local0)
                        }

            }
kizwan
Hi ApexDE,

Very nice finding. I don't have this message in my log file:-
QUOTE
kernel USBF: 0.392 AppleUSBEHCI[0x6838800]::CheckSleepCapability - controller will be unloaded across sleep

but I'm too experiencing the same problem where USB drives violently ejected without properly unmounted during sleep.

This may fix the problem. Thank you for sharing. smile.gif

kizwan
kmare
Apex - great patch confirmed working in 10.6 on my ep45 ud3p -- i wish i could say the same for the other guides floating around
mm67
Works for me as well. Using ep45 ud3
cparm
my usb2 (ehci) port are now reported as built-in, no "controller will be unloaded across sleep" error anymore, but my system refuse to sleep with this patch happy.gif

i also noticed that my usb1 (uhci) port are still not built-in
mm67
For me this works on both Leopard and SL, now if it was only possible to wake up with keyboard or mouse or Apple remote, on my old MSI P43-Neo I was able to use all those for waking up.
hernando
Guys, please help a noob. I have been looking for a solution to this problem for weeks and weeks.

How exactly do I use Apex's code in my dsdt? I know how to do the patching and all; I have partched my file for Audio, network, and video.

But exactly WHERE do I put this code in my dsdt.dsl, before reassembling? Do I paste these 2 devices at the end of the file, or am I supposed to replace an existing section with these sections. I could not locate any EHC devices in my current patched dsdt.

I do have the EP45-UD3P board that you guys have, with an nVidia 9800 GTX.... I am attaching my dsdt.dsl file.

EDIT: NEVER MIND I figured it out.... I works perfectly for me in SL.


Thanks guys!! APEX yoji.gif
stellarola
Apex,

Added the fix to my blog, http://stellarola.tumblr.com/

Thanks a lot for this, it's sure to help out a lot of folks. smile.gif

-Stell
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.