Montag, 13. Juli 2009

19.) USB "Device Removal" problem upon wakeup from sleep

Another switcher discovered a problem with USB devices connected to the EHCI bus (aka USB2.0). Upon wakeup from sleep Mac OS X will display a "Device Removal" warning dialog if a USB device has been attached, for instance the Chameleon USB-stick. This is a real problem and can even destroy the filesystem on the device.

This bug exists at least for motherboards with the ICH10R southbridge as my Gigabyte GA-EP45-DS3 (F9). The Apple USB driver sees the onboard USB-ports as external (PCI-Card) and not as built-in and thus applies the wrong powermanagement capabilities. On sleep/wakeup the USB driver issues a "power off"/"power on" to the external ports, instead of suspend/resume as it should for internal ports. You can check whether your ports are internal or external in System Profiler or IORegistryExplorer.

External in System Profiler:

External in IORegistryExplorer:


There already exists a solution. A patched IOUSBFamily.kext kernel extension. Download a already compiled IOUSBFamily-343.4.4.kext or compile it by yourself using the source from the InsanelyMac Forum thread. Put this kext into your Chameleon Extra/Extensions folder, set permissions and ownership and rebuild the Extensions.mkext. After a reboot the EHCI USB ports are shown as internal.

Internal in System Profiler:

Internal in IORegistryExplorer:


You will find the interessting part of the patch in AppleUSBEHCI/Classes/AppleUSBEHCI_PwrMgmt.cpp. As you can see the port will be forced as internal with normal sleep capabilities, but this could break external PCI-USB Cards.
if (!_hasPCIPwrMgmt) {
// USBError(1, "AppleUSBEHCI[%p]::CheckSleepCapability - controller will be unloaded across sleep",this);
// _controllerCanSleep = false;
// setProperty("Card Type","PCI");
_controllerCanSleep = true;
setProperty("Card Type","Built-in");
}

The best solution is clearly to patch the DSDT. But this is still real magic for me and I have to dive into the DSDT stuff first to learn about it.

1 Kommentar:

  1. That is a direct reponse to my question - thank you very much, great!!! :) Best regards, Doc

    AntwortenLöschen