Jump to content

USB sleep then wake "Device Removal" problem


pcb355
 Share

151 posts in this topic

Recommended Posts

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.

Link to comment
Share on other sites

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: :D

http://www.aja.com/html/products_macintosh_kona_util.html

 

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

Link to comment
Share on other sites

This is the edit I made to the stock AppleUSBEHCI.kext:

 

        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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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 :-)

Link to comment
Share on other sites

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.

 

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:

post-371246-1239738187_thumb.png

 

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.

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

If I understood correctly this is not possible.

 

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.

 

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!

Link to comment
Share on other sites

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

Yes I can see this:

post-371246-1239738187_thumb.png

No. I just get the same list as before sleep. There are no new entries in the list.

Well, that's good.

 

If I understood correctly this is not possible.

Done. The CardType is Built-in.

Good.

 

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • 2 weeks later...

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?

Link to comment
Share on other sites

  • 4 weeks later...
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.

Link to comment
Share on other sites

  • 2 months later...

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.

Link to comment
Share on other sites

  • 2 weeks later...

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:

 

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:

 

 

			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)
					}

		}

Link to comment
Share on other sites

Hi ApexDE,

 

Very nice finding. I don't have this message in my log file:-

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. :P

 

kizwan

Link to comment
Share on other sites

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 :)

 

i also noticed that my usb1 (uhci) port are still not built-in

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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 :D

dsdt.dsl.zip

Link to comment
Share on other sites

 Share

×
×
  • Create New...