Jump to content

USB sleep then wake "Device Removal" problem


  • Please log in to reply
150 replies to this topic

#21
eberts

eberts

    InsanelyMac Geek

  • Members
  • PipPipPip
  • 138 posts
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:

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

#22
pcb355

pcb355

    InsanelyMac Protégé

  • Members
  • Pip
  • 13 posts
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.

Attached Files



#23
chrS

chrS

    InsanelyMac Protégé

  • Members
  • Pip
  • 9 posts
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.
Apr  8 22:46:24 u2c kernel[0]: System WakeApr  8 22:46:24 u2c kernel[0]: USB (UHCI):Port 2 on bus 0x5d connected or disconnectedApr  8 22:46:24 u2c kernel[0]: USB (UHCI):Port 1 on bus 0x1a connected or disconnectedApr  8 22:46:24 u2c kernel[0]: USB (UHCI):Port 1 on bus 0x3a connected or disconnected
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:    0x1aiMic 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.

#24
chrS

chrS

    InsanelyMac Protégé

  • Members
  • Pip
  • 9 posts

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.

#25
konkon

konkon

    InsanelyMac Protégé

  • Members
  • Pip
  • 12 posts
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/

#26
konkon

konkon

    InsanelyMac Protégé

  • Members
  • Pip
  • 12 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.


#27
Eliade

Eliade

    InsanelyMac Legend

  • Members
  • PipPipPipPipPipPipPip
  • 730 posts
  • Gender:Male

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/h..._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

#28
TheBogieMan

TheBogieMan

    InsanelyMac Geek

  • Members
  • PipPipPip
  • 112 posts
  • Gender:Male
  • Location:Ireland

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

#29
zhell

zhell

    InsanelyMac Geek

  • Members
  • PipPipPip
  • 125 posts
  • Gender:Male
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.app...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

#30
LatinMcG

LatinMcG

    Insanely digesting DSDT

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

#31
konkon

konkon

    InsanelyMac Protégé

  • Members
  • Pip
  • 12 posts
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.

#32
zhell

zhell

    InsanelyMac Geek

  • Members
  • PipPipPip
  • 125 posts
  • Gender:Male
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 :-)

#33
hafnium

hafnium

    InsanelyMac Protégé

  • Members
  • Pip
  • 20 posts
Do you guys have waking from USB keyboards/mice working, or do you have to wake the Hack using the power button?

#34
Farx

Farx

    InsanelyMac Protégé

  • Members
  • Pip
  • 35 posts
USB K/M can wake Leopard up.

#35
chrS

chrS

    InsanelyMac Protégé

  • Members
  • Pip
  • 9 posts

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:
Attached File  Picture_2.png   141.26KB   248 downloads

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.app...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!

#36
zhell

zhell

    InsanelyMac Geek

  • Members
  • PipPipPip
  • 125 posts
  • Gender:Male

OK, I try this with EP45-UD3 and pcb355's patched USB kext installed after fresh reboot.
Yes I can see this:
Attached File  Picture_2.png   141.26KB   248 downloads
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.

#37
chrS

chrS

    InsanelyMac Protégé

  • Members
  • Pip
  • 9 posts

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.

#38
mr-pink

mr-pink

    InsanelyMac Protégé

  • Members
  • Pip
  • 28 posts
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.insanelym...howtopic=141324 Has anyone tried this method?

#39
IntelMacGuy

IntelMacGuy

    InsanelyMac Protégé

  • Members
  • PipPip
  • 66 posts
The USB sleep kext works, but the sound won't work after wake. got any solutions?

#40
zhell

zhell

    InsanelyMac Geek

  • Members
  • PipPipPip
  • 125 posts
  • Gender:Male

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.





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