InfiniteMac OSx86

InfiniteMac OSx86 (http://infinitemac.com/forum.php)
-   10.X (http://infinitemac.com/forumdisplay.php?f=36)
-   -   Various DSDT mods. (http://infinitemac.com/showthread.php?t=1960)

Thireus 05-13-2009 12:02 PM

Hum... none of you guys can reply to my question?

candykane 05-13-2009 01:04 PM

Fixing sleep and usb after wake up

I finally fixed sleep on my lappie!

The problem was on USB....
The fix is simple, same as for WAK method:

If u look on DSDT under all USB entry u will see:
QUOTE
Method (_PRW, 0, NotSerialized)
{
Return (GPRW (0xYZ, 0xYZ))
}
Now search for Method (GPRW.... and change on the end that: Return (PRWP or whatever u have) to:
CODE
Return (Package (0x02)
{
Zero,
Zero
})

Still i have to use modded kexts for ehci/uhci w/o them my lappie still sleep fine but on wake I lose UHCI devices(BT and fingerprint sensor)

About EHCI kext fixed, I really hate those ownership debug message, dunno why most of the dev's like to add that crap debug on kexts, imo is easy to do 2 ver. normal/debug or to add a bolean in plist to enable/disable that feature...

L.E. Thanks a lot Slice for the edited versions of the kexts me and my system log are very happy
BTW I'm still waiting for some answers about those USB fixes, since your sources are not available dunno what really does your kexts, maybe we can add those fixes on DSDT, or at least we can try...

L.L.E Last night I forgot(tired) to tell about: Device (PWRB)...e.g PoWeRButton I noticed that is missing on my DSDT so I add it b/c on MB DSDT there are also other entry on USB devices that point to it.
So if you don't have it search for : Device (SLPB) and add it over/under it, should look like this:
CODE
Scope (_SB)
{
Device (PWRB)
{
Name (_HID, EisaId ("PNP0C0C"))
}

Device (SLPB)
{
Name (_HID, EisaId ("PNP0C0E"))
Method (_PRW, 0, NotSerialized)
{
Return (Package (0x02)
{
0x0B,
0x04
})
}
}
}
Now search for Method (_Lxy....) you will see all USB devices there, then under each UHCI one add Notify (\_SB.PWRB, 0x02), as for EHCI entry I prted entire entry from MB, should look like this:
CODE
Scope (_GPE)
{
Method (_L03, 0, Serialized)
{
Notify (\_SB.PCI0.UHC1, 0x02)
Notify (\_SB.PWRB, 0x02)
}

Method (_L04, 0, Serialized)
{
Notify (\_SB.PCI0.UHC2, 0x02)
Notify (\_SB.PWRB, 0x02)
}

Method (_L0C, 0, Serialized)
{
Notify (\_SB.PCI0.UHC3, 0x02)
Notify (\_SB.PWRB, 0x02)
}

Method (_L0E, 0, Serialized)
{
Notify (\_SB.PCI0.UHC4, 0x02)
Notify (\_SB.PWRB, 0x02)
}

Method (_L05, 0, Serialized)
{
Notify (\_SB.PCI0.UHC5, 0x02)
Notify (\_SB.PWRB, 0x02)
}

Method (_L0D, 0, Serialized)
{
If (\_SB.PCI0.EHC1.PMES)
{
Store (0x01, \_SB.PCI0.EHC1.PMES)
Notify (\_SB.PCI0.EHC1, 0x02)
Notify (\_SB.PWRB, 0x02)
}

If (\_SB.PCI0.EHC2.PMES)
{
Store (0x01, \_SB.PCI0.EHC2.PMES)
Notify (\_SB.PCI0.EHC2, 0x02)
Notify (\_SB.PWRB, 0x02)
}
}
The entry on EHCI one seems to fix sleep on it so no more need for ehcisleepenabler, at least for me.
BTW if you have HDEF on those methods remove it, or it could broke your sleep!
Another tip, if you like as example to wake your notebook/desktop using mouse or keyboard, identify what USB port it use(from ioreg) and on DSDT change on that USB entry PWRB to SLPB

Enjoy!

candykane 05-13-2009 01:06 PM

I just got my power button to show logout box when pressed:
CODE
Device (PWRB)
{
Name (_HID, EisaId ("PNP0C0C"))
}

I just changed _HID to _CID.

candykane 05-13-2009 01:13 PM

A guide on how to fix audio via dsdt
Audio should not be so complicated, having to use another extension to load information into the system makes no sense when most of you are already using a device-property string for graphics or using a modified DSDT so you may as well save resources.

HDAEnabler.kext and/or ALCinject.kext are not required to make audio work properly.

What is needed is AlainTox714's AppleHDA.kext and the following 3 peices of information:
layout-id
codec-id
PinConfigurations
You can do it through a device-property string or through DSDT (this can yield a better result).

I've tried both methods and they yielded working audio, but the DSDT solution seems to be more ACPI compliant.

You can make the PinConfigurations data if you have the ConfigData in the /System/Library/Extensions/AppleHDA.kext/Contents/PlugIns/AppleHDAController.kext/Contents/Info.plist file.

(you only need the last bite from each segment)
<00a71c1f 00a71d40 00a71e21 00a71f02 00b71c40 00b71d90 00b71ea1 00b71f02 00c71c2e 00c71d30 00c71e81 00c71f01 00d71c10 00d71d40 00d71e11 00d71f01 00e71c20 00e71d90 00e71ea1 00e71f01 00f71c12 00f71d10 00f71e11 00f71f01 01071c11 01071d70 01071e11 01071f01 02171c50 02171d21 02171e45 02171f01>

Another solution is to search the codec file for lines that contain [Jack], take the hex values and reverse the order, order them by their node number.
CODE
Codec: SigmaTel STAC9274D
Address: 2
Vendor Id: 0x83847621
Subsystem Id: 0x80860419
Revision Id: 0x100201
Default PCM: rates 0x7e0, bits 0x0e, types 0x1
Default Amp-In caps: ofs=0x00, nsteps=0x0e, stepsize=0x05, mute=0
Default Amp-Out caps: ofs=0x7f, nsteps=0x7f, stepsize=0x02, mute=1

Node 0x0a [Pin Complex] wcaps 0x400181: Stereo
Pin Default 0x0221401f: [Jack] HP Out at Ext Front
Conn = 1/8, Color = Green
becomes 1f402101
00a71c1f 00a71d40 00a71e21 00a71f02

Node 0x0b [Pin Complex] wcaps 0x400181: Stereo
Pin Default 0x02a19040: [Jack] Mic at Ext Front
Conn = 1/8, Color = Pink
becomes 4090a102
00b71c40 00b71d90 00b71ea1 00b71f02

Node 0x0c [Pin Complex] wcaps 0x400181: Stereo
Pin Default 0x0181302e: [Jack] Line In at Ext Rear
Conn = 1/8, Color = Blue
becomes 2e308101
00c71c2e 00c71d30 00c71e81 00c71f01

Node 0x0d [Pin Complex] wcaps 0x400181: Stereo
Pin Default 0x01114010: [Jack] Speaker at Ext Rear
Conn = 1/8, Color = Green
becomes 10401101
00d71c10 00d71d40 00d71e11 00d71f01

Node 0x0e [Pin Complex] wcaps 0x400181: Stereo
Pin Default 0x01a19020: [Jack] Mic at Ext Rear
Conn = 1/8, Color = Pink
becomes 2090a101
00e71c20 00e71d90 00e71ea1 00e71f01

Node 0x0f [Pin Complex] wcaps 0x400181: Stereo
Pin Default 0x01111012: [Jack] Speaker at Ext Rear
Conn = 1/8, Color = Black
becomes 12101101
00f71c12 00f71d10 00f71e11 00f71f01

Node 0x10 [Pin Complex] wcaps 0x400181: Stereo
Pin Default 0x01117011: [Jack] Speaker at Ext Rear
Conn = 1/8, Color = Yellow
becomes 11701101
01071c11 01071d70 01071e11 01071f01

Node 0x21 [Pin Complex] wcaps 0x400301: Stereo Digital
Pin Default 0x01452150: [Jack] SPDIF Out at Ext Rear
Conn = Optical, Color = Grey
becomes 50214501
02171c50 02171d21 02171e45 02171f01

Using the PinConfigurations data you can convert it for your device-property string XML file using the following command:
CODE
echo "1f4021014090a1022e308101104011012090a101121011011 170110150214501" | xxd -r -p | openssl enc -base64
This gave me
CODE
H0AhAUCQoQIuMIEBEEARASCQoQESEBEBEXARAVAhRQE= for my BadAxe2 (STAC9274D)

Find the slot holding the audio hardware
CODE
gfxutil -f HDEF; # if that fails try AZAL in place of HDEF

For the BadAxe2 that gave me
CODE
DevicePath = PciRoot(0x0)/Pci(0x1b,0x0)

I added the following to my XML file and then regenerated my string using gfxutil: (gfxutil -s -v -n -i xml -o hex in.plist out.hex)
CODE
<key>PciRoot(0x0)/Pci(0x1b,0x0)</key>
<dict>
<key>PinConfigurations</key>
<data>
H0AhAUCQoQIuMIEBEEARASCQoQESEBEBEXARAVAhRQE=
</data>
<key>codec-id</key>
<string>0x83847683</string>
<key>layout-id</key>
<string>0x04000000</string>
</dict>

What would be nice is a script or program that gives you the PinConfigurations data by dropping the codec on it.

In the end I chose to do my BadAxe2 in DSDT only because I'm already doing so much in it that the few extra bytes didn't hurt and saved me loading another kext that isn't really needed.

You can achieve this if you meet the following criteria
you currently use HDAEnabler.kext or ALCinject.kext
you use AppleHDA.kext
you have (or can get) the three pieces of required information about your audio hardware and the modified AppleHDA.kext it needs
You can do it in a device-property string or in DSDT, the DSDT method is by far better, here's the PinConfigurations details for the BadAxe1 which uses the STAC9221D A2 (what I cam currently working on) so I can finish off my DSDT work and release the DSDT's or at least the relevant sections.

BadAxe1:
CODE
| | +-o HDEF@1B <class IOPCIDevice, registered, matched, active, busy 0, retain 8>
| | | | {
| | | | "IOPCIResourced" = Yes
| | | | "IOInterruptControllers" = ("io-apic-0","IOPCIMessagedInterruptController")
| | | | "IOName" = "pci8086,27d8"
| | | | "subsystem-id" = <17040000>
| | | | "IODeviceMemory" = (({"address"=18446744073225109504,"length"=16384}) )
| | | | "class-code" = <00030400>
| | | | "revision-id" = <01000000>
| | | | "assigned-addresses" = <10d8008200000000000020e30000000000400000>
| | | | "built-in" = <00>
| | | | "acpi-device" = "IOACPIPlatformDevice is not serializable"
| | | | "name" = "pci8086,27d8"
| | | | "acpi-path" = "IOACPIPlane:/_SB/PCI0@0/HDEF@1b0000"
| | | | "subsystem-vendor-id" = <86800000>
| | | | "reg" = <00d800000000000000000000000000000000000010d800020 000000000000000000000000040
000>
| | | | "compatible" = <"pci8086,417","pci8086,27d8","pciclass,040300" >
| | | | "PinConfigurations" = <104021021010010120308101104001012190a101116001013 0214501>
| | | | "layout-id" = 2
| | | | "IOPCIExpressLinkCapabilities" = 0
| | | | "IOPowerManagement" = {"ChildrenPowerState"=2,"CurrentPowerState"=2}
| | | | "IOInterruptSpecifiers" = (<1600000007000000>,<0400000000000100>)
| | | | "device-id" = <d8270000>
| | | | "vendor-id" = <86800000>
| | | | "device_type" = <"STAC9221A2">
| | | | "codec-id" = 2206496387
| | | | "IOPCIExpressLinkStatus" = 0
| | | | }

BadAxe2:
CODE
| | +-o HDEF@1B <class IOPCIDevice, registered, matched, active, busy 0, retain 8>
| | | | {
| | | | "IOPCIResourced" = Yes
| | | | "IOInterruptControllers" = ("io-apic-0","IOPCIMessagedInterruptController")
| | | | "IOName" = "pci8086,27d8"
| | | | "layout-id" = <04000000>
| | | | "subsystem-id" = <19040000>
| | | | "IOPCIExpressLinkCapabilities" = 0
| | | | "IODeviceMemory" = (({"address"=18446744073226158080,"length"=16384}) )
| | | | "class-code" = <00030400>
| | | | "IOPowerManagement" = {"ChildrenPowerState"=2,"CurrentPowerState"=2}
| | | | "revision-id" = <01000000>
| | | | "IOInterruptSpecifiers" = (<1600000007000000>,<0200000000000100>)
| | | | "assigned-addresses" = <10d8008200000000000030e30000000000400000>
| | | | "built-in" = <00>
| | | | "acpi-device" = "IOACPIPlatformDevice is not serializable"
| | | | "device-id" = <d8270000>
| | | | "vendor-id" = <86800000>
| | | | "acpi-path" = "IOACPIPlane:/_SB/PCI0@0/HDEF@1b0000"
| | | | "subsystem-vendor-id" = <86800000>
| | | | "name" = "pci8086,27d8"
| | | | "IOPCIExpressLinkStatus" = 0
| | | | "reg" = <00d800000000000000000000000000000000000010d800020 000000000000000000000000040
000>
| | | | "compatible" = <"pci8086,419","pci8086,27d8","pciclass,040300" >
| | | | "PinConfigurations" = <1f4021014090a1022e308101104011012090a101121011011 170110150214501>
| | | | "codec-id" = 2206496289
| | | | }


You don't believe audio can work without HDAEnabler.kext or ALCinject.kext, do it as a device-property string or better, do it in DSDT.

candykane 05-13-2009 01:14 PM

Here's the basic code, I provide two example sections of code, one for the BadAxe1 and the second for the BadAxe2, don't use both sections.
AUDIO IN DSDT:
CODE
__________________________________________________ ____________


// this goes near the beginning of your DSDT (right after Method (_WAK, 1, Serialized)
Method (DTGP, 5, NotSerialized)
{
If (LEqual (Arg0, Buffer (0x10)
{
/* 0000 */ 0xC6, 0xB7, 0xB5, 0xA0, 0x18, 0x13, 0x1C, 0x44,
/* 0008 */ 0xB0, 0xC9, 0xFE, 0x69, 0x5E, 0xAF, 0x94, 0x9B
}))
{
If (LEqual (Arg1, One))
{
If (LEqual (Arg2, Zero))
{
Store (Buffer (One)
{
0x03
}, Arg4)
Return (One)
}

If (LEqual (Arg2, One))
{
Return (One)
}
}
}

Store (Buffer (One)
{
0x00
}, Arg4)
Return (Zero)
}


__________________________________________________ ____________


// change all occurrences of AZAL to HDEF

__________________________________________________ ____________


// example for BadAxe1 (with comments)

__________________________________________________ ____________


// this goes at end of Device (HDEF)
// BadAxe1 (D975XBXLKR)
Method (_DSM, 4, NotSerialized)
{
Store (Package (0x08)
{
"codec-id",
Buffer (0x04)
{
0x83, 0x76, 0x84, 0x83 // the hex codec ID (reverse order)
},
"layout-id",
Buffer (0x04)
{
0x02, 0x00, 0x00, 0x00 // the hex layout ID (reverse order)
},
"device_type",
Buffer (0x16) // the hex count + 1 for null terminated ascii string
{
"SigmaTel STAC9221D A2" // the string identifier
},
"PinConfigurations",
Buffer (0x1C) // the actual hex count
{
/* the PinConfigurations data as it appears.
/* 0000 */ 0x10, 0x40, 0x21, 0x02, 0x10, 0x10, 0x01, 0x01,
/* 0008 */ 0x20, 0x30, 0x81, 0x01, 0x10, 0x40, 0x01, 0x01,
/* 0010 */ 0x21, 0x90, 0xa1, 0x01, 0x11, 0x60, 0x01, 0x01,
/* 0018 */ 0x30, 0x21, 0x45, 0x01 /* one entry seems missing */
}
}, Local0)
DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))
Return (Local0)
}

__________________________________________________ ____________


// example for BadAxe2

__________________________________________________ ____________


// this goes at end of Device (HDEF)
// BadAxe2 (D975XBX2KR)
Method (_DSM, 4, NotSerialized)
{
Store (Package (0x08)
{
"codec-id",
Buffer (0x04)
{
0x21, 0x76, 0x84, 0x83 // the hex codec ID (reverse order)
},
"layout-id",
Buffer (0x02)
{
0x04, 0x00, 0x00, 0x00 // the hex layout ID (reverse order)
},
"device_type",
Buffer (0x13)
{
"SigmaTel STAC9274D"
},
"PinConfigurations",
Buffer (0x20)
{
/* 0000 */ 0x1f, 0x40, 0x21, 0x02, 0x40, 0x90, 0xa1, 0x02,
/* 0008 */ 0x2e, 0x30, 0x81, 0x01, 0x10, 0x40, 0x11, 0x01,
/* 0010 */ 0x20, 0x90, 0xa1, 0x01, 0x12, 0x10, 0x11, 0x01,
/* 0018 */ 0x11, 0x70, 0x11, 0x01, 0x50, 0x21, 0x45, 0x01
}
}, Local0)
DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))
Return (Local0)
}

__________________________________________________ ____________

kizwan 06-01-2009 04:09 AM

Acer hotkey enabler
 
Quote:

Originally Posted by pentiumpc (Post 23191)
FN+F1 don't return any code.. notify SLPB 0x80 will put the system to sleep.
FN+F5,FN+F6 will return between 0x20 to 0x2F = 15 steps of brightness.
FN+F8 return the next display code, LCD, EXT VGA or both spanning.
AC power return 0x50
Batt return 0x51

most of these keys needs a driver to drive it.

I am swamped with my day job, thus have to stop development of the driver I am working on.
I have 1 on beta, feel free to try it.

ASUS hotkey enabler.

this package consist of various solution to enable the hotkeys, removes the need for sleepwatcher, sets FN+F1 to deep sleep and lid to doze.
you can customize most of the Keys to run scripts by changing the values in the plist. have been using it for a while on my system, works reasonably well.

Please backup your "DSDT.aml" before you install it.

Hi pentiumpc,

I need your help. I want to enable a couple of hotkey in OS X. These hot keys require application called "launch manager" in windows & "acer-acpi" in linux to make it operational. It control (on/off) two critical devices; wireless card & bluetooth. Fortunately, wireless card automatically turned on when my laptop boot-up. Unfortunately bluetooth is not turned on making it is not recognized or working in OS X. I hope you can help me porting "acer-acpi" to OS X. I don't have experience in driver or kernel extensions programming but I'm a quick learner.

Thank you in advance. :D

kizwan

uman 06-02-2009 03:17 PM

Acer-acpi
 
Quote:

Originally Posted by kizwan (Post 27355)
Hi pentiumpc,
I hope you can help me porting "acer-acpi" to OS X. I don't have experience in driver or kernel extensions programming but I'm a quick learner.
kizwan

Hi kizwan, nice to see you here instead of just insanelymac. I used to be there until my account got deleted when they changed the board over to the new system...

Re: acer_acpi. My son has an acer laptop-- IIRC, same as yours-- but its hard drive is dying so I can't test it now. Anyways, the best starting place (as pentiumpc found) is superhai's AMW0.kext. But :( superhai has deleted the source from his main download page. I can't find a copy anywhere, so you'll have to PM him.

-u

uman 06-02-2009 03:21 PM

Acer acpi
 
It may be possible to do this in the DSDT. I noticed that on my Gateway, there are a bunch of control registers defined that (I suspect) interface with hotkeys to turn on/off various functions like wireless.

Take a look at the Notify methods and see if you can spot anything that gets notified on resume from sleep. Since bluetooth will be turned off when sleeping, it will need to be turned back on if it was already on. So you miht see some logic to that effect, testing the state of a register.

uman 06-02-2009 06:32 PM

kizwan:

You should see an AMW0 device in your DSDT (see this post by Carlos, the writer of the acer_acpi implementation).

My guess (without looking at your DSDT) is that the device control function keys may be implemented in DSDT block that checks whether the OS is Windows. Does your DSDT have calls that only do things if the OSI is Windows? Mine does.

If so, then it may be *possible* that you can enable the Windows-specific parts, and then call into the AMW0 device defined in the DSDT from a simple kext. Perhaps that is what superhai was doing.

kizwan 06-03-2009 06:08 AM

Hi uman,

Sorry for late reply. I did not get any notification when somebody post a reply. :)

You're right. This is what I found in my dsdt.dsl file:-
Code:

        Device (AMW0)
        {
            Name (_HID, "pnp0c14")
            Name (_UID, Zero)
            Name (WLMP, Zero)
            Name (WMID, Zero)
            Name (B0ED, Buffer (0x04)
            {
                0x00, 0x00, 0x00, 0x00
            })
            CreateDWordField (B0ED, Zero, WLID)
            Name (B1ED, Buffer (0x04)
            {
                0x00, 0x00, 0x00, 0x00
            })
            Name (B2ED, Buffer (0x04)
            {
                0x00, 0x00, 0x00, 0x00
            })
            CreateDWordField (B2ED, Zero, BUID)
            Name (_WDG, Buffer (0x0118)

Also this:-
Code:

    Scope (_SB)
    {
        Method (_INI, 0, NotSerialized)
        {
            Store (0x07D0, OSYS)
            If (CondRefOf (_OSI, Local0))
            {
                If (_OSI ("Linux"))
                {
                    Store (One, LINX)
                }

                If (_OSI ("Windows 2001"))
                {
                    Store (0x07D1, OSYS)
                }

                If (_OSI ("Windows 2001 SP1"))
                {
                    Store (0x07D1, OSYS)
                }

                If (_OSI ("Windows 2001 SP2"))
                {
                    Store (0x07D2, OSYS)
                }

                If (_OSI ("Windows 2006"))
                {
                    Store (0x07D6, OSYS)
                }
            }

I have trying several days looking on how to solve the issue with DSDT modification but no luck. I will try to ask superhai about AMW0.kext. Even in windows (XP & Vista) bluetooth & wireless button is not operational until an application called "Launch Manager" is installed.

I will look to my DSDT & try to modify it if possible.

Thank you for your reply. :)

kizwan