DSDT 进阶修改实录:启用电源键 (PWRB)、唤醒黑屏修复、合盖睡眠与 ASUS 热键
通过修改系统 DSDT 表启用机箱电源按钮关机菜单 (PWRB)、解决睡眠唤醒后屏幕黑屏、启用 Clamshell 合盖睡眠及华硕笔记本功能热键的实用修补整理。
- 主笔作者
- @pentiumpc 发表于 2009-01-19
- 所属专区
- OSx86 10.X 核心架构与安装配置
- 典藏规模与记录
- 625,378 次历史阅读 · 101 则精选技术笔记(萃取自 107 则原始回帖) · 2009-01-19 – 2013-01-21
- 参与贡献成员 (32)
- @uman (21)@kizwan (18)@pentiumpc (8)@Slither2008 (6)@candykane (6)@richarda (5)@THeKiNG (4)@breakky (4)@Thireus (3)@Alexaar (2)@The Edge3000 (2)@Gurruwiwi (2)@EnzoFX (2)@Sweaty (2)@ping99 (2)@Nameci (2)+16 more
- 相关硬件参考
- Workstation Coolers & Thermal Gear ↗ Gigabyte Motherboards ↗ Laptop RAM & SSD Upgrades ↗
论坛上有许多关于使用 DSDT Override 安装 OS X 的讨论;一旦系统支持加载自定 dsdt.aml,我们便能直接通过修改 ASL 代码来修复并开启多项原生硬件功能:
已验证可行的 DSDT 修复项目:
- 启用
PWRB(机箱电源按钮): 让按下机箱实体电源键时弹出 Mac OS X 原生关机 / 睡眠确认对话框。 - 修复系统从睡眠唤醒后屏幕黑屏(Blank Display on System Wake): 修补显卡与 `_WAK` 唤醒方法。
- 配合
Clamshell.kext启用合盖睡眠(Clamshell Sleep): 让笔记本合上屏幕时自动进入睡眠。 - 启用华硕(ASUS)笔记本专属 Fn 热键。
部分平台有效的实验性修复:
- USB 睡眠断电与弹出问题: 在我的 ASUS Eee PC 1000H 上完美解决,但在技嘉 EP35-DS3L 主板上仍需额外配合 EHCI/UHCI 注入。
以上是我上周末实测整理的成果,欢迎大家在此讨论串分享更多主板的 DSDT 修改片段,作为社区共同的修补参考库。
社区实测与技术补充笔记
自 107 则原始讨论回帖中萃取 101 则高价值技术回应
启用机箱电源按钮(Power Button)
将 _HID 改为 _CID:
Device (PWRB)
{
Name (_HID, EisaId ("PNP0C0C")) ---> Name (_CID, EisaId ("PNP0C0C"))
Name (_UID, 0xAA)
Name (_STA, 0x0B)
}
这段修改是我在某个网站看到的,一时记不起出处(在此向原作者致谢)。
这样修改后就能启用实体电源键,按下时会弹出 OS X 原生的关机菜单。
修复睡眠唤醒后屏幕黑屏问题
在 Eee PC 1000H 上,系统从睡眠唤醒后屏幕会保持黑屏,必须手动按一下亮度调节键才会点亮背光。目前的权宜做法是通过 SleepWatcher 配合 Reggie 直接写入寄存器来点亮屏幕。
其实只要直接修改 DSDT 在唤醒时设置屏幕亮度,就能彻底解决这个问题:
Method (WAK, 1, NotSerialized) //WAKE up
{
\_SB.PCI0.SBRG.EC0.EC0W (Arg0)
\_SB.PCI0.NWAK (Arg0)
\_SB.PCI0.SBRG.SWAK (Arg0)
LPWK (Arg0)
Store(\_SB.ATKD.PBLG,local0) //---> Get Brightness level from NVS
\_SB.ATKD.PBLS(local0) //---> Set Brightness level.
}
加上最后那两行代码,就能在唤醒时重置屏幕背光亮度。
你主板上的 Method 名称可能略有不同,请在 DSDT 内寻找类似的段落;同时你也得找出负责读取与设置亮度的对应 Method。
这个思路同样可以用来处理其他唤醒后的硬件状态重置问题。
笔记本合盖睡眠(Clamshell Sleep)
大多数笔记本在合上屏幕顶盖(LID)时都不会自动进入睡眠。我试过在网上搜索现成的 DSDT 修复方案但找不到(Google 是我最好的朋友),于是我自己动手写了一段来解决。
如果你有更好或更简洁的写法,欢迎随时指教,谢谢。
Device (LID0)
{
Name (_HID, EisaId ("PNP0C0D")) //LID detection
Method (_PRW, 0, NotSerialized)
{
Return (Package (0x02)
{
0x0B,
0x04
})
}
Name (LIDS, One)
Method (_LID, 0, NotSerialized)
{
Store (^^PCI0.SBRG.EC0.SF13, LIDS) //LID register
XOr (LIDS, One, Local0)
IF (Local0) //if LID is closed
{
Notify (SLPB, 0x80) //Set system to sleep
}
Return (LIDS)
}
LID 设备在 DSDT 中应该很容易找到,只需补上一行代码,在检测到顶盖合上时向睡眠按钮(SLPB)发送睡眠通知即可。
在大多数 PC 笔记本上(据我推测),原本是由操作系统接收 LID 的状态通知后才触发睡眠,但 OS X 并不认识 PC LID 设备发出的默认通知,所以我改为直接在硬件 ACPI 层面触发 SLPB 睡眠信号。
启用 ASUS 功能热键(Hotkeys)
如果你查看 IORegistry 设备树时看得到 "ASUS010" 或 "ATKD",就代表你的系统带有华硕热键控制设备,Fn+Fx 组合键是可以驱动的。
你必须先找出每个按键会发送什么 ACPI Notification 代码。我专门写了一个 Kext 来记录并分析 Notification 代码,接着再去 DSDT 的 _GPE 区段找出对应的中断处理方法(Interrupt Handler)。把这些对应关系全部梳理清楚后,我便在 DSDT 中加入切换各项硬件开关的代码。
现在我可以自由开关屏幕背光、Wi-Fi、蓝牙、读卡器、摄像头以及调节屏幕亮度等。目前还在研究另外几项功能,例如切换外接显示器、调整 FSB 外频等。
示例代码:
Method (CAMS, 1, Serialized) //Camera Set
{
Return (OCMS (Arg0))
}
Method (CAMR, 0, Serialized) //Camera toggle : added
{
Store (OCMG , Local0)
XOr (Local0, One, Local0)
Return (OCMS (Local0))
}
Method (CAMG, 0, Serialized) //Camera Set
{
Return (OCMG )
}
上面这段代码非常直观,就是用来切换摄像头(Camera)开关的。
Method (_Q2A, 0, NotSerialized) //Camera
{
^^^^ATKD.CAMR //Toggle Camera
ATKN (0x1D) //notify ATKD
}
这是负责处理该按键事件的中断服务例程(Interrupt Handler)。
USB 睡眠修复
Device (HPET)
{
Name (_HID, EisaId ("PNP0103"))
Name (_CID, EisaId ("PNP0C01"))
Name (CRS, ResourceTemplate
{
Memory32Fixed (ReadOnly,
0xFED00000, // Address Base
0x00000400, // Address Length
_Y03)
})
OperationRegion (^LPCR, SystemMemory, 0xFED1F404, 0x04)
Field (LPCR, AnyAcc, NoLock, Preserve)
{
HPTS, 2,
, 5,
HPTE, 1,
Offset (0x04)
}
Method (_STA, 0, NotSerialized)
{
Return (0x0F)
}
让 HPET 的 _STA 状态直接返回 0x0F,似乎一并修好了我的 USB 睡眠问题(包括睡眠唤醒后 USB 失效以及无法热插拔的问题)。
这项修复尚未完全严格验证,因为我没有刻意去重现故障(这不在我的优先待办清单上),但我的系统目前以 10.5.6 原生内核(Vanilla)稳定运行,仅搭配 Decrypter、AnV SMBIOS、PS2Nub 与 Controller 以及 OpenHaltRestart。
完全没有安装任何 IOUSB 修补 Kext(那些 Kext 在我机子上反而会导致死机)。
更新 —— 这个问题现在可以直接用 DSDT Patcher 加上 -newHPET 参数自动修复,打好补丁后连 Disabler.kext 都不需要了。
我最近一直在研读我的 Asus EeePC 1000H 的 dsdt.aml,试图更深入理解 _SB 下的各个 Method。
以下我整理的对应表看起来正确吗?
Method - 功能说明
PBL (S/G) = 屏幕背光(BackLight)
CAM (S/G) = 摄像头(Camera)
CRD (S/G)= 读卡器(Card Reader)
WLD (S/G) = 无线网卡设置/读取(Wireless LAN Set / Get)
CFV (S/G) = FSB 外频速度与电压设置/读取
CAM (S/G) = 摄像头设置/读取
BTH (S/G) = 蓝牙设置/读取(Bluetooth Set / Get)
SDSP = 切换显示输出(Switch/Swap Display)
CRD (S/G) = 读卡器设置/读取
HDPS = ?
PBP (S/G) =
M3G (S/G) = 移动 3G 模块(Mobile 3G)
HWCF = ?
GNVS = 读取音量?(我肯定这猜错了,应该是读取及设置内存引用地址?)
SNVS = 设置音量?(我肯定这猜错了,应该是读取及设置内存引用地址?)
我已经成功利用备用的 Fn 键(0x1d)来开关摄像头和蓝牙了。接着我尝试搞定 Wi-Fi 开关,但发现它的 Method 调用逻辑比单纯传入 ATKN(value) 复杂得多。
它内部似乎有一套判断逻辑来决定要传递 0x11 还是 0x10。我目前只能用热键把 Wi-Fi 关掉,关掉后就再也开不回来了(八成是我漏掉了某段状态判断逻辑)。
另外我可以确认,你写的那个 Asus Test Kext 能正确捕捉到所有按键事件,唯独按下关闭 Wi-Fi 的 Fn 键时会提示某个未映射的 Method,接着系统日志就会开始跳出蓝牙或 Wi-Fi 无法进入省电状态(powersave state)的消息;只要再按一次 Wi-Fi Fn 键,这些消息就会停止。
你对这个现象有什么看法?
祝好,
Steve
这是我目前用来作为参考的按键事件代码表(Event Codes):
# 银色快捷键(Silver buttons)
KEY_SILVER1="0000001a" # 空白键
KEY_SILVER2="0000001b" # 切换分辨率
KEY_SILVER3="0000001c" # 自定义键 1 (User 1)
KEY_SILVER4="0000001d" # 自定义键 2 (User 2)
# Fn+F? 组合键
KEY_Fn_F1="00000080" # 睡眠
KEY_Fn_F2=("00000010" "00000011") # Wi-Fi 开关切换
KEY_Fn_F5="0000002*" # 调低亮度
KEY_Fn_F6="0000002*" # 调高亮度
KEY_Fn_F7="00000016" # 关闭背光
KEY_Fn_F8=("00000030" "00000031" "00000032") # XRandR 显示切换
KEY_Fn_F9="00000012" # 任务管理器
KEY_Fn_F10="00000013" # 静音
KEY_Fn_F11="00000014" # 调低音量
KEY_Fn_F12="00000015" # 调高音量
# 其他 ACPI 事件
POWER_AC="00000001"
POWER_BAT="00000000"
如果你想把 F3 和 F4 也改成自定义 Fn 热键,我觉得在 Linux 下跑 acpi_listen 应该是最快找出对应事件代码的方法。
我还在纳闷为什么音量控制键的相关函数在 DSDT 里面这么难找。
Fn+F1 不会返回任何键码……直接执行 Notify (SLPB, 0x80) 就会让系统进入睡眠。Fn+F5、Fn+F6 会返回 0x20 到 0x2F 之间的代码,对应 15 级屏幕亮度调节。Fn+F8 会返回下一个显示输出模式代码:内置 LCD、外接 VGA 或双屏扩展。
插上 AC 电源适配器会返回 0x50。
切换为电池供电会返回 0x51。
以上大部分按键都需要配合专门的驱动程序才能真正工作。
最近我本职工作忙得不可开交,因此不得不暂停手头上这个驱动程序的开发。
我目前有一个 Beta 测试版,欢迎大家下载试用:
ASUS Hotkey Enabler (media fire.com/download.php?4lnemnhjnzt)
这个安装包整合了多项启用热键的解决方案,不再需要依赖 SleepWatcher,并将 Fn+F1 设为深度睡眠(Deep Sleep)、合上屏幕顶盖设为浅层睡眠(Doze)。
此外,你还可以通过修改 plist 内的数值,自定义大部分热键去触发执行你自己的脚本。这套方案在我自己的系统上已经用了一段时间,表现相当稳定。
安装前请务必先备份好你原本的 "DSDT.aml"。
@Slither2008Method - Description CFV (S/G) = FSB Speed & Voltage Set / Get SDSP = Switch/Swap Display HDPS = ? PBP (S/G) = HWCF = ? GNVS = Get Volume (I'm sure this is wrong. Probably gets and sets memory references?) SNVS = Set Volume (I'm sure this is wrong. Probably gets and sets memory references?) .
CFV = 仅用于设置 FSB 外频,与电压无关。HDP/PBP = 设置内置 LCD、外接显示器或双屏同步显示。虽然可以设置,但必须刷新 Mac 的屏幕分辨率才会生效,处理起来非常棘手。HWCF = 用途未知。GNVS / SNVS = 读取或写入 NVS(Non-Volatile SRAM,非易失性内存,我猜是与 BIOS 共用的状态区)。
BIOS 方法会返回当前的 BIOS 版本。INIT 用于初始化 ATKD 设备(必须先执行这个方法,按键才会返回 Keycode)。
我在家上网时连上 IPIS 论坛一直被自动登出,在办公室又没时间处理,所以无法亲自过去发帖。方便的话请帮忙把我的 pkg 安装包转贴到那边,谢谢!
非常感谢你的详细信息,以及大方分享 Beta 版 Fn 热键驱动程序!
我会把这些研究心得整理成一篇教程指南发布到 IPIS 论坛上。
祝好,
Steve
套用你各项 DSDT 修复的讨论串:
ipis-osx.wik idot.com/forum/t-135417/enabling-function-keys-by-modifying-your-dsdt#post-403326
测试你实验性 Kext 驱动的讨论串:
ipis-osx.wik idot.com/forum/t-135405/experimental-asus-hotkey-enabler-kext-driver#post-403338
我很乐意贡献自己的编程开发经验,一起帮忙完善你写的这个 Kext。
请问你方便公开分享这个实验性 Kext 的源代码吗?
祝好,
Steve
我自己写了一个带有基本 WorkLoop 的骨架 Kext(Skeleton Kext)。
这个 Kext 可以正常初始化、探测(probe)、找到并匹配 ATKD device nub,然后顺利进入我的 start 函数。
但我在添加 IOInterruptEventSource 时遇到了问题。
我在 start 里是这样声明的:
interruptSrc = IOInterruptEventSource::interruptEventSource(
(OSObject*)this,
OSMemberFunctionCast( IOInterruptEventAction,
this,
&com_ipis_driver_AsusFNKeys::interruptOccurred ),
(IOService*)provider,
(int)0);
我有写一段检查逻辑,如果无法加入 WorkLoop 就回报错误,但结果只要一加载启动这个 Kext,系统就立刻发生五国死机 / 内核崩溃(Kernel Panic)。
我把上面那段代码注释掉、将 Kext 简化回最基本的空白模板后重新测试,驱动就能正常加载,证明确实是 IOInterruptEventSource 引发的 KP。
如果能指点一下迷津,我会非常感激!
嗨!各位进展如何?
我想进一步改良 Eee PC 1000H 的 DSDT,需要大家帮忙看看几个问题。
第一个问题是关于 PS/2 控制器(同时发帖于 http://www.insanelymac.com/forum/index.php?showtopic=90… ↗):
我们目前都在 DSDT 里使用这段代码:
Device (PS2K)
{
Name (_HID, EisaId ("PNP0303"))
Name (_CID, 0x0B03D041)
Method (_STA, 0, NotSerialized)
{
ShiftLeft (One, 0x0A, Local0)
If (And (IOST, Local0))
{
Return (0x0F)
}
Return (Zero)
}
Name (_CRS, ResourceTemplate ()
{
IO (Decode16, 0x0060, 0x0060, 0x00, 0x01)
IO (Decode16, 0x0064, 0x0064, 0x00, 0x01)
IRQNoFlags () {1}
})
}
Device (PS2M)
{
Name (_HID, EisaId ("SYN0A04"))
Name (_CID, Package (0x03)
{
0x000A2E4F,
0x02002E4F,
0x130FD041
})
Method (_STA, 0, NotSerialized)
{
ShiftLeft (One, 0x0C, Local0)
If (And (IOST, Local0))
{
Return (0x0F)
}
Return (Zero)
}
Name (_CRS, ResourceTemplate ()
{
IRQNoFlags () {12}
})
}
但这样写会导致 IORegistry 里面出现重复的节点(doubling)。
另外提供一段从 OpenBSD 开机日志截取的硬件信息作为参考:
ichpcib0 at pci0 dev 31 function 0 "Intel 82801GBM LPC" rev 0x02: PM disabled
isa0 at ichpcib0
isadma0 at isa0
pckbc0 at isa0 port 0x60/5
pckbc0: using irq 1 for kbd slot
pckbd0 at pckbc0 (kbd slot)
wskbd0 at pckbd0: console keyboard, using wsdisplay0
pmsi0 at pckbc0 (aux slot)
pckbc0: using irq 12 for aux slot
wsmouse0 at pmsi0 mux 0
虽然目前的代码运行正常,但如果能修掉节点重复的问题会更完美。有人有头绪吗?
第二个问题则是关于“掀开屏幕顶盖自动唤醒(Wakeup on Clamshell Open)”的功能,有人尝试实现出来过吗?
还是没有人回复,真可惜。
这段期间我结合了楼上的修改与我自己的修复,编译了一份自用的 DSDT。现在我的系统在 10.5.6 下运行与睡眠都十分完美,唯独 Fn 热键修复对我来说还是有些小 Bug。
我仍在探索更多能强化 1000H DSDT 的改法,例如我梦寐以求的“开盖自动唤醒(Clamshell Wakeup)”功能。大家有任何想法吗?
我想请教一下,该在 DSDT 的哪个位置、用什么方式设置 FSB 外频,才能让系统跑以下参数:
FSB=54
PCIE=176
这样就能让我的 Eee PC 1000H 运行频率达到 1.9GHz,实现跟我在 Windows XP 下用 eeectl 一样的超频效果。
从 InsanelyMac 论坛整理了一些资料过来,我觉得放进这个教程帖里会很有参考价值:
通过修改 _WAK 方法修复睡眠模式
information about the _WAK method.
Arguments:
0 The value of the sleeping state (1 for S1, 2 for S2, and so on).
Result Code (2 DWORD package):
Status Bit field of defined conditions that occurred during sleep.
0x00000000 Wake was signaled and was successful
0x00000001 Wake was signaled but failed due to lack of power.
0x00000002 Wake was signaled but failed due to thermal condition.
Other Reserved
PSS If non-zero, the effective S-state the power supply really entered.
这个数值是用来检测是否因为电源抽载电流过大,导致系统未能进入目标 S-state 睡眠状态。
简言之,_WAK 方法接收一个参数(即请求进入的睡眠状态编号),并以包含 2 个 DWORD 的 Package 形式返回结果。第一个数值代表唤醒是否成功(0 为成功,非 0 为失败及对应原因);第二个数值在成功时同样为 0,失败时则返回实际进入的睡眠状态编号。所以它本质上就是一个成功/失败的状态返回码。
Package 声明的第一个参数指定元素的数量,大括号内则是元素本身。因此上面的声明单纯定义了一个包含两个 0 的双元素 Package。之所以需要这样加,是因为 ACPI 规范强制要求 _WAK 方法必须返回两个数值。
说穿了,这就是补上一个符合 ACPI 规范的虚拟返回值(从而消除编译警告),它本身不做任何额外动作,只是单纯告诉操作系统“唤醒总是成功”。
修复睡眠模式步骤:
搜索:_WAK
CODE
Method (_WAK, 1, NotSerialized)
{
Store (0xFF, DBG1)
If (LEqual (Arg0, 0x03))
{
Store (0x8F, SCP)
}
If (LEqual (Arg0, 0x04))
{
If (LEqual (OSFL, Zero))
{
If (LEqual (OSFX, 0x03))
{
Store (0x59, SMIP)
}
Else
{
Store (0x58, SMIP)
}
}
If (LEqual (OSFL, One))
{
Store (0x56, SMIP)
}
If (LEqual (OSFL, 0x02))
{
Store (0x57, SMIP)
}
If (LEqual (OSFX, 0x03))
{
Store (0x59, SMIP)
}
}
If (LEqual (Arg0, One)) {}
If (OSFL)
{
Notify (\_SB.PWRB, 0x02)
}
Else
{
If (LEqual (RTCW, Zero))
{
Notify (\_SB.PWRB, 0x02)
}
}
Notify (\_SB.PCI0.USB0, Zero)
Notify (\_SB.PCI0.USB1, Zero)
Notify (\_SB.PCI0.USB2, Zero)
Notify (\_SB.PCI0.USB3, Zero)
Notify (\_SB.PCI0.USB4, Zero)
Notify (\_SB.PCI0.USB5, Zero)
Return(Package(0x02){0x00, 0x00}) <------ 加在这里,编译前先编辑 dsdt_fixed.txt
}
屏幕背光控制(Backlight Control)
笔记本 DSDT 另一个很实用的修改项目(加在 _SB 区段下):
CODE
Device (PNLF)
{
Name (_HID, EisaId ("APP0002"))
Name (_CID, "backlight")
Name (_UID, 0x0A)
Name (_STA, 0x0B)
}
这样能帮助系统加载原生的屏幕背光滑块控制。
嗯……各位大佬都没人能回答我的超频问题吗?
修复睡眠以及唤醒后的 USB 设备
我终于修好我笔记本的睡眠功能了!
问题出在 USB 上……
修复方法很简单,概念跟 _WAK 方法类似:
如果你查看 DSDT 里所有 USB 控制器节点,会看到:
QUOTE
Method (_PRW, 0, NotSerialized)
{
Return (GPRW (0xYZ, 0xYZ))
}
接着搜索 Method (GPRW,并将它结尾处的 Return (PRWP)(或你表里对应的变量名称)改为:
CODE
Return (Package (0x02)
{
Zero,
Zero
})
不过我还是得配合修改版的 EHCI/UHCI Kext;如果不装修改版 Kext,虽然笔记本可以正常进入睡眠,但唤醒后会丢失挂在 UHCI 下的设备(如蓝牙与指纹识别器)。
说到修改版 EHCI Kext,我真的很讨厌那些刷屏的 ownership debug 调试消息。真不懂为什么这么多开发者喜欢在发布的 Kext 里留一堆没用的 debug 输出,明明做成 normal / debug 两个版本,或者在 plist 里加个布尔开关让用户自行启用/禁用会干净得多……
补充:非常感谢 Slice 提供移除了调试消息的 Kext 修改版,我和我的系统日志(system.log)都清静多了!
顺带一提,我还在等关于那些 USB 修复原理的解答;因为你的 Kext 没有公开源代码,我实在不清楚里面到底做了什么处理——或许我们可以把那些修复直接移植进 DSDT 里,至少值得一试……
再次补充:昨晚太累忘记提到 Device (PWRB)(即电源按钮 Power Button)。我发现我的 DSDT 里缺少了这个设备,而白果 MacBook 的 DSDT 中许多 USB 设备都会引用到它,所以我把它补了上去。
如果你的 DSDT 也没有 PWRB,请搜索 Device (SLPB) 并在它上方或下方加入,看起来像这样:
CODE
Scope (_SB)
{
Device (PWRB)
{
Name (_HID, EisaId ("PNP0C0C"))
}
Device (SLPB)
{
Name (_HID, EisaId ("PNP0C0E"))
Method (_PRW, 0, NotSerialized)
{
Return (Package (0x02)
{
0x0B,
0x04
})
}
}
}
接着搜索 Method (_Lxy,你会在那里看到所有 USB 设备的 GPE 事件方法。在每个 UHCI 项目下加入 Notify (\_SB.PWRB, 0x02);至于 EHCI 项目,我直接从白果 MacBook 移植了整段代码,看起来如下:
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)
}
}
这段 EHCI 的修改似乎彻底解决了 EHCI 睡眠问题,至少在我的机器上再也不需要 ehcisleepenabler 了。
顺带提醒:如果那些 _Lxy 方法里面原本有 HDEF 的通知,请务必删掉,否则可能会破坏睡眠功能!
最后一个小秘诀:如果你希望用 USB 鼠标或键盘唤醒笔记本/台式机,可以先从 IORegistry 查出该鼠标或键盘插在哪个 USB 口,然后在 DSDT 对应的 USB GPE 项目中把 PWRB 改为 SLPB 即可。
祝大家折腾愉快!
我刚刚也成功让电源按钮在按下时弹出关机/注销对话框了:
CODE
Device (PWRB)
{
Name (_HID, EisaId ("PNP0C0C"))
}
我只不过是把 _HID 改成 _CID 就搞定了。
通过 DSDT 修复声卡指南
驱动声卡不应该搞得这么复杂。既然大家多数都已经在用显卡的 device-property 字符串(EFI String)或是修改版 DSDT,实在没道理为了把硬件信息注入系统而又多加载一个外挂 Kext,直接注入还能节省系统资源。
要让声卡正常工作,其实完全不需要 HDAEnabler.kext 或 ALCinject.kext。
真正需要的只有 AlainTox714 修改的 AppleHDA.kext 以及以下 3 项信息:layout-idcodec-idPinConfigurations
你可以通过 device-property 字符串注入,或者直接写进 DSDT(通过 DSDT 的效果往往更理想)。
两种方法我都实测过,都能成功驱动声卡,但 DSDT 方案显然更符合 ACPI 标准规范。
如果你手头上的 /System/Library/Extensions/AppleHDA.kext/Contents/PlugIns/AppleHDAController.kext/Contents/Info.plist 文件里已经有 ConfigData,你就可以直接从中提取出 PinConfigurations 数据:
(你只需要提取每个 32-bit 区段的最后一个 byte 即可)
<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>
另一个方法是直接打开 Linux 提取出的 Codec Dump 文件,搜索包含 [Jack] 的行,将 Pin Default 的十六进制数值按 byte 反转顺序,并依照 Node 节点编号由小到大排列:
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
取得 PinConfigurations 十六进制数据后,可以用以下终端命令将它转换为 device-property XML 文件所需的 Base64 格式:
CODE
echo "1f4021014090a1022e308101104011012090a101121011011170110150214501" | xxd -r -p | openssl enc -base64
在我的 Intel BadAxe2(STAC9274D)主板上,这会得出:
CODE
H0AhAUCQoQIuMIEBEEARASCQoQESEBEBEXARAVAhRQE= for my BadAxe2 (STAC9274D)
接着找出声卡所在的 PCI 路径:
CODE
gfxutil -f HDEF; # if that fails try AZAL in place of HDEF
在 BadAxe2 上得到的结果是:
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>
如果有人能写个小脚本或工具,把 Codec Dump 拖进去就直接算出 PinConfigurations 数据那就太棒了。
最后我选择在 BadAxe2 上直接用 DSDT 注入,因为我的 DSDT 已经改了这么多东西,多加这几十个 bytes 完全不痛不痒,还能省下加载一个多余的 Kext。
只要符合以下条件,你也可以照做:
1. 你目前正在使用 HDAEnabler.kext 或 ALCinject.kext
2. 你使用 AppleHDA.kext
3. 你已经有(或能提取出)声卡所需的这三项信息,以及对应修改好的 AppleHDA.kext
不论用 device-property 字符串还是 DSDT 都能达成,但 DSDT 方法好得多。以下附上 BadAxe1(采用 STAC9221D A2,我目前正在整理这块主板的 DSDT)与 BadAxe2 在 IORegistry 中的 PinConfigurations 信息,方便大家对照:
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" = <00d800000000000000000000000000000000000010d800020000000000000000000000000040
000>
| | | | "compatible" = <"pci8086,417","pci8086,27d8","pciclass,040300">
| | | | "PinConfigurations" = <104021021010010120308101104001012190a1011160010130214501>
| | | | "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" = <00d800000000000000000000000000000000000010d800020000000000000000000000000040
000>
| | | | "compatible" = <"pci8086,419","pci8086,27d8","pciclass,040300">
| | | | "PinConfigurations" = <1f4021014090a1022e308101104011012090a101121011011170110150214501>
| | | | "codec-id" = 2206496289
| | | | }
如果你不相信不用 HDAEnabler.kext 或 ALCinject.kext 也能驱动声卡,不妨亲自试试 device-property 字符串,或者直接写进 DSDT 体验一下!
以下是 DSDT 声卡注入的基本代码。我提供两个示例区段,一个是 BadAxe1,另一个是 BadAxe2,请勿同时粘贴两组代码。
AUDIO IN DSDT:
CODE
______________________________________________________________
// 这段放在 DSDT 开头附近(紧接在 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)
}
______________________________________________________________
// 将全文所有的 AZAL 替换为 HDEF
______________________________________________________________
// BadAxe1 示例(附注释)
______________________________________________________________
// 这段放在 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)
}
______________________________________________________________
// BadAxe2 示例
______________________________________________________________
// 这段放在 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)
}
______________________________________________________________
Acer 热键启用工具(Hotkey Enabler)
@pentiumpcFN+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…
嗨 pentiumpc,
我想向你请教并寻求协助。我想在 OS X 下启用笔记本的几个功能热键。这些热键在 Windows 下需要安装名为 "Launch Manager" 的实用工具、在 Linux 下则需要加载 "acer-acpi" 模块才能工作,用来控制两个关键硬件设备的开关:无线网卡与蓝牙。幸运的是,无线网卡在笔记本开机时会自动开启;但蓝牙默认却是关闭的,导致进入 OS X 后系统完全认不到蓝牙,也无法使用。希望你能指点我如何将 "acer-acpi" 移植到 OS X 上。虽然我没有编写驱动程序或内核扩展(Kext)的经验,但我学东西很快。
kizwan
Acer-acpi
@kizwanI 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
嗨 kizwan,真高兴在这边也能看到你(而不只是在 InsanelyMac)。我以前也常驻那里,直到他们论坛改版迁移系统时把我的账号弄丢了……
关于 acer_acpi:我儿子也有一台 Acer 笔记本——如果我没记错的话型号跟你那台一样——但它的硬盘快挂了,所以我现在没办法拿来测试。无论如何,最好的起点(正如 pentiumpc 所发现的)是参考 superhai 写的 AMW0.kext。不过 superhai 已经把源代码从他的主下载页面移除了,我在网上到处都找不到备份,你可能需要私信(PM)向他索取。
-u
Acer acpi
这搞不好可以直接在 DSDT 里面搞定。我注意到在我的 Gateway 笔记本上,DSDT 定义了一堆控制寄存器(Control Registers),我怀疑它们就是用来与热键对接、进而切换无线网卡等硬件开关的接口。
你可以仔细翻翻 DSDT 里的 Notify 方法,看看有没有任何东西会在从睡眠唤醒时收到通知。因为进入睡眠时蓝牙会被断电关闭,如果睡眠前蓝牙是开启的,唤醒时系统就必须把它重新打开。所以你应该有机会在里面找到测试某个寄存器状态并据此开关设备的逻辑。
kizwan:
你在 DSDT 里面应该会看到一个名为 AMW0 的设备(可以参考 acer_acpi 作者 Carlos 写的这篇笔记:strang eworlds.co.uk/2007/11/24/amw0-later-models-aka-version-2-notes/)。
在还没看过你 DSDT 的情况下,我猜这些控制硬件开关的功能键,很可能是写在需要先检查操作系统是否为 Windows 的 DSDT 条件区段内。你的 DSDT 里有没有只有在 _OSI 为 Windows 时才会执行的调用?我的电脑就有。
如果是这样,那么你“有可能”可以先在 DSDT 中强制启用这些原本限定 Windows 的区段,接着再写一个简单的 Kext 去调用 DSDT 里定义的 AMW0 设备。说不定 superhai 当初就是这样做的。
抱歉这么晚才回复,有人回帖时我没有收到邮件通知。
你说得没错,这是我从我的 dsdt.dsl 文件里找到的段落:
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)
还有这段:
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)
}
}
我已经花了几天时间研究如何单靠修改 DSDT 来解决这个问题,但还是毫无斩获。我会试着向 superhai 请教关于 AMW0.kext 的事。其实就算在 Windows(XP 与 Vista)下,如果不安装 "Launch Manager" 这个程序,机身自带的蓝牙与无线网卡按键也一样是毫无反应的。
我会再仔细研究我的 DSDT,看看能不能直接改出来。
谢谢你的回复!
kizwan
你可以先忽略 _INI 那段代码,它只是设置操作系统版本变量(OSYS),供后面其他 Method 检查并执行对应的分支逻辑。
你真正需要确保的是在 Device (AMW0) 内部没有任何绑定 Windows 才执行的限制逻辑。这样一来,该设备就能完整初始化并挂载进 IORegistry 里。接着配合 superhai 的 Kext,你应该就能:(a) 将你想要的开关行为直接写死(hard-code)在驱动里,或者 (b) 写一个类似 Launch Manager 的 OS X 图形界面程序(GUI),通过 User-Client 接口与内核内的 Kext 对象通信。
如果 superhai 的 AMW0 是基于 IOKit 编写的,你可以使用标准的 Device Interface 来操作(参考 Apple 开发者文档:gemma.apple.com/documentation/DeviceDrivers/Conceptual/AccessingHardware/AH_IOKitLib_API/AH_IOKitLib_API.html#//apple_ref/doc/uid/TP30000380-BAJDAJDJ)。
我很乐意帮忙,但因为我手头上暂时没有 Acer 机器可以实测,恐怕帮不上太多忙。要是 pentiumpc 愿意公开他的源代码,你就能参考他的写法,因为华硕的 "ASUS010" 或 "ATKD" 设备跟 Acer 的 AMW0 应该非常类似,底层八成都是基于微软的 WMI(Windows Management Instrumentation)接口实现的。
最值得参考的指南还是 Linux 社区 Carlos 对 acer_acpi 的研究成果。祝你顺利!
我是一位既开心又郁闷的 Asus M50SV 笔记本用户。
我也遇到了同样的 Fn 热键问题……
在我的机器上,开箱即用(OOTB)的有:Wi-Fi/蓝牙切换(F2)、睡眠(F1)、亮度调节(F5+F6,但必须先在 Windows 下把环境光传感器关闭)、关闭/开启 LCD 屏幕(F7);而按 F8 切换 LCD/VGA 外接显示器则会导致系统瞬间重启,其余的 Fn 组合键与多媒体键则完全没有反应。
我试过安装 pentiumpc 的 Kext(pkg),但完全没作用。我觉得这很正常,因为我的 DSDT 里面根本没有 ASUS010,而是在 ATKD 设备下定义了 ATK0100。我试着修改 Kext 的 plist 去匹配我的硬件 ID,但依然无效。
后来我找到一个很棒的软件(可惜只有 Windows 版):ASUS Notebook Keys (forum.noteboo kreview.com/showthread.php?t=150016),可以用来重新映射多媒体键与 Fn 热键。我利用它成功捕捉到了那些在 OS X 下失效的多媒体键与 Fn 键的事件代码;而且该软件还公开了源代码 (rapid share.com/files/74365305/AsusNbKeys_v1.3_SRC.zip),如果有人能结合 Linux 的 ACPID(acpid.sourc eforge.net/)移植到 OS X 上,或许就能让所有热键完美工作……
至于触控板的多媒体切换功能,连这个软件也捕捉不到事件,这让我怀疑它完全是由 Synaptics 专有驱动在底层处理的。不过有个很神奇的现象:如果我在 Windows 下把触控板设为“检测到外接鼠标时永远保持多媒体模式”,那么重启进入 OS X 后,触控板上的多媒体背光灯依然会亮着(只是拔掉外接鼠标时不会自动熄灭),看来 Windows 驱动在某处设置了一个 ACPI 标志……这点我还得再深入研究。
以下是我捕捉到的按键事件代码列表:
失效的多媒体播放方向键:
Fn + "":
->:Event: 0x41 - 快进(Fast forward)
<-:Event: 0x40 - 快退(Rewind)
^ :Event: 0x43 - 停止(Stop)
v :Event: 0x45 - 播放/暂停(Play/Pause)
功能键(Fn + F1-F12):
Fn + "":
F1:Event: 正常工作 - 因为一按就进入睡眠所以抓不到代码
F2:Event: 0x5D 正常工作 - Wi-Fi/蓝牙开关切换
F3:Event: 0x50 - 启动邮件程序(Mail App)
F4:Event: 0x51 - 启动浏览器(Launch browser)
F5:Event: 0x2D 正常工作 - 调低屏幕亮度
F6:Event: 0x1E 正常工作 - 调高屏幕亮度
F7:Event: 0x34 正常工作 - 开启/关闭 LCD 背光
F8:Event: 0x61 - LCD/VGA 显示切换(一按就会瞬间重启)
F9:Event: 0x68 - 未知
F10:Event: 0x32 - 静音(Mute)
F11:Event: 0x31 - 调低音量(Volume down)
F12:Event: 0x30 - 调高音量(Volume up)
失效的键盘组合键(+Fn):
Fn + "":
T:Event: 0x99 - 调制解调器开关(Modem on/off)
A:Event: 0x7A - 环境光传感器开关(Ambient light sensor)
C:Event: 0x8A - 未知
V:Event: 0x82 - 屏幕截图(我猜的)
Space:Event: 0x5C - 启动 Power4Gear 省电模式切换
机身独立多媒体键:
Button 1:Event: 0x5C - 功能同 Fn+Space = 启动 Power4Gear
Button 2:Event: 0x6B - 未知
Button 3:Event: 0x5C - 未知
Button 4:Event: 0x95 - 未知
请问各位对于如何修复剩下这些失效的 Fn 热键有什么想法吗?
我会抽空去看看 acpid 的架构。
因为我自己没有华硕笔记本、对它的架构也不熟,除了以下几点外我没办法给出太具体的建议:
1. 多参考 Linux 社区的成果——他们在 ACPI 逆向工程方面领先 OSx86 社区太多了。
2. 我赞同你的方向。要彻底驯服这头怪兽,正确的做法应该是打造一套通用框架(就像 Linux 努力在做的那样),再针对不同笔记本/台式机加载特定的规则库或插件。目前 OSx86 圈子里太多人只针对单一机种写死修改——例如玩 Dell Mini 的玩家把 ApplePS2Keyboard.cpp 改得面目全非,虽然修好了某些通病,但也把它改得只能在 Dell Mini 上用,对其他人毫无帮助。
3. 或许我们可以召集几位手头上拥有不同品牌笔记本/台式机的开发者,一起合作写出一个通用的 ACPI/WMI 基础驱动,并支持通过插件模块(Plugins)或 User-space GUI 来灵活定制。
@umanI will take a look at acpid. Since I don't have and am not familiar with ASUS, I don't have any good advice, other than: 1. Look to Linux-- they're way ahead of the OSX scene. 2. I think you are right. They way to solve this beast is a general solution, like Linux has tried to do, with laptop/desktop-specific code in libraries that…
哇!
回复真快!
我刚才突然想起,superhai 以前跟我提过 ACPID 在 OS X 上派不上用场(因为内核缺少了某些对应接口),所以不用浪费时间看它了……
相信我,我已经翻遍了网上所有关于这台笔记本在 Linux 下的资料,但因为底层机制不同,对 OS X 几乎没有直接帮助。
至于 ApplePS2,你试过 VoodooPS2 吗?我已经用了很长一段时间,没有遇到什么大问题。
我也认为 superhai 的 AMW0 是个很好的起点,而且确实应该做成通用架构,再针对各家厂商的专属实现提供插件。
我自己并不是程序开发者,也不懂任何编程语言,我只是凭着逻辑推理和深入搜索,把手头上能找到的东西拿来拼凑测试而已。
@umanYou can ignore the _INI code. That's just setting the OS version so that other methods can test it and do different logic. All you need to do is ensure that in the Device(ANW0) there isn't any Windows-specific logic going on. That way the device gets fully defined, and will be inserted into the ioreg. Using superhai's kext, you should…
我会好好研读那份开发者文档,应该需要花点时间消化理解。
与此同时,我也试着根据我的 dsdt.dsl 里存在的 Name 与 Method 修改了 AMW0.kext 的源代码。虽然编译加载后 IORegistry 里确实出现了新的 AMW0 节点,但机身自带的热键按钮依然没有反应。
看来 AMW0.kext 还需要大量修改工作。或许我可以从 ACPI4ASUS.kext 的源代码里学到更多实现细节。
你能指点一下该如何在 dsdt.dsl 里找出负责处理热键按钮动作的 Name 或 Method 吗?我试着拿我的 DSDT 跟白果 MacBook3,1 的 DSDT 比对,但还是摸不着头绪。另外,下面这个函数是不是用来指示无线网卡在开机 POST 阶段自动开启的?
Method (LAMN, 1, NotSerialized)
{
If (\_SB.AMW0.WLMP)
{
Store (Arg0, \_SB.AMW0.WLID)
Notify (\_SB.AMW0, 0xB0)
}
Else
{
PHSR (0x1F, Arg0)
}
}
kizwan
很遗憾,我自己也还在摸索学习 DSDT。而且绝大多数厂商根本不会公开任何关于这些 ACPI 设备或内部 Method 的技术文档,恐怕只能靠不断尝试与排查(Trial and Error)来推敲。
方便把 AMW0.kext 发给我吗?等我写完手头上的 SD 读卡器驱动程序后(假设我儿子的 Acer 笔记本能修好),我可以拿来把玩研究看看。
@umanUmm. The source of the AMW0 kext. Thanks.
你可以在这里下载 AMW0.kext 与它的源代码:
supe rhai.com/xdarwin.html
原来你正在开发 SD 读卡器的驱动程序!这太令人期待了。请问你的驱动程序有机会支持德州仪器(Texas Instruments, TI)的 SD 读卡器芯片吗?
另外,你的 GMA950 显卡还有花屏/画面异常(artifacts)的问题吗?你有试过 Natit.kext 或 EFI String 吗?
kizwan
@kizwanYou can download the AMW0.kext & source code here:- supe rhai.com/xdarwin.html
[拍额头]我居然漏看了那个页面!非常感谢你的链接!如果那台 Acer 下周左右能修好拿回来,我就来动手试试。
@kizwanSo, you're working on driver for SD card reader. That is interesting. Is there any chances that Texas Instrument SD card reader supported by your driver?
没错,正是针对 TI 芯片写的——因为我的 Gateway 和 Acer 笔记本里装的都是 TI 读卡器。这主要是为了让我自己练练手、熟悉 IOKit 与内核驱动程序开发。我还有其他想做的项目,所以想先挑个规模较小的项目来入门。
@kizwanYou still have problem with GMA950 (artifacts)? Have you try Natit.kext or EFI string?
我目前直接沿用 iPC 整合盘里附带的那两个 Kext,还没细看它们具体做了什么。因为画面瑕疵非常轻微,所以我还懒得去深究。之后我可能会试试看通过 DSDT 注入来解决,毕竟我也想精进 DSDT 修改技巧——不过你也知道,改 DSDT 实在是非常耗时费神!
-u
@kizwanSo, you're working on driver for SD card reader. That is interesting. Is there any chances that Texas Instrument SD card reader supported by your driver?
看到昨天的新闻说 Apple 在新款 MacBook 上正式内置了 SD 读卡器插槽,我决定先把这个开发计划暂缓。我想先看看 Apple 官方原生驱动是怎么实现的,再决定下一步。
展开其余 64 则社区技术笔记完整历史讨论记录
@umanI've put this on hold with yesterday's news that Apple is including SD card slots on the new macbooks. I'd like to see what they have done before proceeding.
For sure they use USB SD Reader i bet on that...
Wonder where did PentiumPC go...
Maybe he can release the source for ACPI4Asus.kext to help us understand what he did and maybe someone can continue his work, if he has no time for that, for the rest of the custom "OEM" stuff that make our life's so PITA.
@umanI'm using the two? kexts that I found in iPC. I didn't really pay much attention to what they do. The artifacts are minor enough that I haven't bothered to track them down. I may try the DSDT approach, since I want to get better at DSDT mods, but it's so time-consuming, as you've no doubt found out! -u
I was using Natit.kext for GMA950 on Acer Aspire 3680. No artifacts…that I can confirm. Right now I'm using EFI string. Don't forget to restore vanilla AppleIntelIntegratedFramebuffer.kext. Don't get excited yet, dual monitor only works with mirror mode.
I still unable to get display working with DSDT yet except for nVidia Go 7300 on Aspire 9420.
kizwan
@umanI've put this on hold with yesterday's news that Apple is including SD card slots on the new macbooks. I'd like to see what they have done before proceeding.
I only heard new iPhone is coming soon…iPhone 3G S. ^_^
King,
It may be that your DSDT just has functions defined for Windows, especially since Linux guys also had problems.
Have you talked to or contacted the people at OSXCORES? They have patched BIOSes for OSX:
M50SV AS207 (osxcores.sit e50.net/user/image/asus-m50sv-as207.zip)
ASUS
M50V as209 (osxcores.sit e50.net/user/image/m50vas.209.zip)
ASUS
I'm not sure what fixes they have made, but they do custom work too. See:
osxcores.sit e50.net/services.htm
Perhaps they can help.
-u
uman,
Just got a reply from Superhai. Its look like Superhai will not continue AMW0 project. Is there anybody interested continuing his project? :'(
Other topic…
Sleep:-
I found out that by deleting entry for EHCI devices in Acer Aspire 9420 DSDT, it was able to sleep. Now the EHCI devices detected as external/expansion card. Funny thing is external hard disk, which connected to EHCI port, is not turn off when putting laptop to sleep. Is this also happen with real MacBook?
I tried to compare DSDT from MacBook3,1 with mine and I found this:-
Acer Aspire 9420:-
Method (_L03, 0, NotSerialized)
{
Notify (\_SB.PCI0.USB1, 0x02)
}
MacBook3,1:-
Method (_L03, 0, NotSerialized)
{
Notify (\_SB.PCI0.UHC1, 0x02)
Notify (\_SB.PWRB, 0x02)
}
I know that "Notify (\_SB.SLPB, 0x80)" will put computer to sleep but I don't know what "Notify (\_SB.PWRB, 0x02)" do. Do you know what "Notify (\_SB.PWRB, 0x02)" means? In my DSDT, PWRB is handle by SLPB (handle both sleep-button & power-button).
I also found "extra" method in EHCI function (MacBook3,1):-
Method (_DSM, 4, NotSerialized)
{
Store (Package (0x07)
{
"AAPL,current-available",
0x04B0,
"AAPL,current-extra",
0x02BC,
"AAPL,current-in-sleep",
0x03E8,
Buffer (0x01)
{
0x00
}
}, Local0)
DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))
Return (Local0)
}
I think instead of removing EHCI entry from DSDT, maybe I can use this code to set EHCI device as external device. Maybe this can fix sleep issue too.
Clamshell:-
Does real MacBook automatically resume from sleep when lid is open? Or still need to push keyboard button to resume from sleep, just like windows?
kizwan
@kizwanuman, Just got a reply from Superhai. Its look like Superhai will not continue AMW0 project. Is there anybody interested continuing his project? :'(
I wish I could say yes, but my son's Acer has qualified for a replacement. So I won't have a machine that has an AMW0 to test. And that is a huge problem for development. As I understand it, Superhai's AMW0 basically allows you to call into the AMW0 device. The Linux project acer-acpi (and it's successor wmi-acpi) does the same, and supplies some utilities so that you can call/respond to the AMW0 methods.
The IOKit doc is pretty good at showing how to make a user-callable module that calls in-kernel routines. So if you know (or have someone who has an Acer and knows C) it shouldn't be hard to hack. My suggestion is to start a mini-group of Acer users, and see if anyone has any dev experience amongst the group.
Other topic… Sleep:- I found out that by deleting entry for EHCI devices in Acer Aspire 9420 DSDT, it was able to sleep. Now the EHCI devices detected as external/expansion card. Funny thing is external hard disk, which connected to EHCI port, is not turn off when putting laptop to sleep. Is this also happen with real MacBook?
I don't think you want to delete the EHCI devices. I think you need to Notify them like on my MacBook Pro DSDT.
I know that "Notify (\_SB.SLPB, 0x80)" will put computer to sleep but I don't know what "Notify (\_SB.PWRB, 0x02)" do. Do you know what "Notify (\_SB.PWRB, 0x02)" means? In my DSDT, PWRB is handle by SLPB (handle both sleep-button & power-button).
The Mac has 3 devices: PWRB (power button), SLPB (sleep button), and LID0 (the lid switch). Most hackbooks don't have all of these. I believe my gateway only had SLPB (although I am not sure-- my DSDT.dsl does have a PWRB, but I may have added it).
The power button has multiple functions. Normally if you hit it, it brings up a menu to sleep, shutdown, restart or cancel. But when the Mac is already sleeping (not thru lid sleep), it will wake from sleep. there is also some programmatic control of it in the System preferences. When a Mac has slept through the lid switch, then opening the lid switch resumes the Mac.
I also found "extra" method in EHCI function (MacBook3,1):- Method (_DSM, 4, NotSerialized) { Store (Package (0x07) { "AAPL,current-available", 0x04B0, "AAPL,current-extra", 0x02BC, "AAPL,current-in-sleep", 0x03E8, Buffer (0x01) { 0x00 } }, Local0) DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0)) Return (Local0) } I think instead of…
Strange my Macbook dsdt does not have this code AT ALL.
Clamshell:- Does real MacBook automatically resume from sleep when lid is open? Or still need to push keyboard button to resume from sleep, just like windows?
Opening the lid resumes from sleep.
I'm sorry I can't be of much use now. I'm hoping next week that I will find the time to backup and do a retail install of 10.5.7. Only then will I try more DSDT hacking, since right now my machine is a mess of hacked kexts!
-u
Multiple video card mods
Has anyone done any work trying to integrate multiple video cards? I've been searching for weeks. Trying to find info regarding DSDT in general is tough.
Fixing sleep and usb after wake up
I finally fixed sleep on my lappie!
Hi candykane,
did you already update to 10.5.8 and is your sleep fix stillworking?
Apple probably changed something in Powermanagement which is breaking sleep on most installs.
Do you use Openhaltrestart.kext or is sleep working without it?
Thanks Al
@pentiumpcchange _HID to _CID Device (PWRB) { Name (_HID, EisaId ("PNP0C0C")) ---> Name (_CID, EisaId ("PNP0C0C")) Name (_UID, 0xAA) Name (_STA, 0x0B) } This one I got it off some site, cannot remember where. (credit goes to him/her) This will activate your power button to bring up the shutdown menu.
hmm weird, tried doing this on my gigabyte board but the shutdown menu wont show, when i press the power button my hack will just sleep thats it
@sk1nhd33thmm weird, tried doing this on my gigabyte board but the shutdown menu wont show, when i press the power button my hack will just sleep thats it
Uncheck "Allow power button to put the computer to sleep" in energy saver =P.
I dont mean to hijack the thread, but what beeter place for 2 quick DSDT questions for people who actually seem to know what they are talking about !
No one has been able to answer me, well... because no one seems to actually KNOW what they are saying... Please please help!
DSDT is the voodoo of computers for to me loool...
Ok, I've got 2 Acer laptops and 1 Asus laptop. Just for reference. All had OSx, 10.4 to 10.5, many distros, my latest and greatest in my sig.
How on earth do I know if DSDT is doing something or not ?
iAtkos v7 Chameleon 2 RC1 (now RC2) and fassls DSDT script checked. DSDT.aml
is in root, but I tried in Extra folder and felt absolutely no difference.
On first boot I press power, poweroff window comes up (native install) My multimedia controller on my keyboard controls volume and front row funtions! (photos in link in signature) - Video card not detected (but with strings + 2 kext native HD res QE etc)
Out of the box, FN and up down increases/decreases screen brightness. Other fn work, very few dont.
. Audio works OTB, clicks pops etc, no internal or external mic. VoodooHDA is the same,
Ehternet with kext only... didnt try stringing it because I got it to work
So how do I know if DSDT is working? if I remove it I am almost certain my laptop will respond the same.
My previous laptops, NONE used DSDT, I pressed power button, they worked fine! Brightness and other stuff too... etc etc
and I am scared because I read sometimes
"Patch DSDT at you own risk! !
as in flashing the bios or something... can I bick my laptop with DSDT !?! When can DSDT be dangerous?
I want to try decompiling and fixing my dsdt for Snow... but I dont even know if
1) I actually need it
2) If it is working or not
3) it is dangerous, or when is it dangerous?
ok, three questions
"
@Gurruwiwi1) I actually need it 2) If it is working or not 3) it is dangerous, or when is it dangerous? …
1) You don't need it unless you need it. If everything is working properly, so you don't need it. DSDT override just for PC that have problem with CPU alias (only can use one core), sound, graphic card, power management & etc.
2) It is working.
3) No hard evidence that it is dangerous. DSDT override can be applied by 2 ways; i) by using dsdt.aml file. ii) by flashing it to ROM permanently. Of course the second one is dangerous if you do it wrongly.
kizwan
thanks for the reply
Ah, ok, you can actually flash a BIOS to mimic hardware change... ouch! no thanks.
The thing is kizwan, if I remove the DSDT.aml file, my system boots (Leo) and behaves the same! Which is really weird since I have perfect use of my multimedia pad (volume, next song, ff, rw, mute, hold and, believe it or not, and, the "enter" button works the same as Enter key, the arrows next to it like cursor, and the envolving white lines "tabs" stuffs depending on program, firefox, openoffice, folders, etc...) and 75% of bios FN keys etc.
For instance, my webcam, out of the box, reads in profile as "Acer Crystal Eye Webcam" - 100% opertional including ichat, ibooth, etc, which is know to crash with some "working" webcams - this withou dsdt or patching or stringing
That is why I say I have no idea, following logic from what I read, how the DSDT WORKS to help boot or not. even if its not present this laptop boots Leo like if it had.
Now I do have dual boot with dsdt present on both sides, but I guarantee you with single boot I had this behaviour
So the powerbutton fix, will make my power button do either sleep or shutdown/logout/resatart prompt? It depends on the setting in System Prefs is what you guys are saying? (Once enabled through dsdt)
My power button currently does nothing! =P
@EnzoFXSo the powerbutton fix, will make my power button do either sleep or shutdown/logout/resatart prompt? It depends on the setting in System Prefs is what you guys are saying? (Once enabled through dsdt) My power button currently does nothing! =P
For a working power button in Mac OS X, a dialog box will appear if you press the power button. In this dialog box, you have a choice either you want to sleep, restart or shutdown (you will see all of the 3 choices).
If your power button does nothing, it means it have not yet enabled in DSDT (most machine has this enabled by default). If you have tried to enabled it in DSDT, maybe the code is wrong. Try to check it again.
kizwan
I have not tried, but I will.
I was just wondering if what it did (Once working) depended on the setting in Sys Prefs. I.e. whether it just sleeps, or if it gives you the shutdown/etc options.
@EnzoFXI have not tried, but I will. I was just wondering if what it did (Once working) depended on the setting in Sys Prefs. I.e. whether it just sleeps, or if it gives you the shutdown/etc options.
Once it working it will always shows you the options, either sleep, shutdown or restart. There is no setting in System Preferences for power button.
kizwan
I applied the power button fix. However, It only seems to work when I check the box to allow it to sleep the computer. Other than that, it does nothing - no menu or anything.
I applied the power button fix but it doesn't work, when I press it my computer will enter sleep mode without displaying any message just like it did before I applied the fix, I have a gigabyte EP45-DS3LR, anyone knows whats wrong?, this is how the DSDT looks like:
Device (PWRB)
{
Name (_HID, EisaId ("PNP0C0C")) --> Name (_CID, EisaId ("PNP0C0C"))
Method (_STA, 0, NotSerialized)
{
Return (0x0B)
}
}
I have a Thinkpad X300, that whenever I put to sleep, I see the wireless light blink, and the the laptop wakes up. It seems as though the wireless card is waking the system after a second or two every time I sleep it.
Does anyone have any recommendations for this in terms of the DSDT? I've attached mine if it helps.
DSDT advice needed
My system is a Dell D830.
After a lot of tinkering around, I managed to install Snow Leopard on it. Please see my guide ↗.
I did a few DSDT mods to get some basic fixes.
Now, the system sleeps (S3 suspend to ram) but does not deep sleep (S5 suspend to disk), shutdown or reboot. I am using OpenHaltRestart.kext and SleepEnabler.kext. The latter made it possible to even suspend.
I am including my dsdt.dsl (which includes my fixes, by the way).
I see tantalizing references to the sleep button, SBTN, etc., but I have not found any systematic documentation for the code (btw. I am comfortable with coding as I do plenty of numerical coding in my work).
Can anyone take a look and let me know what I need to do to fix my poweroff and hibernate problem ?
The DSDT repository does not contain a fixed DSDT for my laptop.
PS: Microsoft's ASL compiler should be outlawed.
@sk1nhd33tchange _HID to _CID Device (PWRB) { Name (_HID, EisaId ("PNP0C0C")) ---> Name (_CID, EisaId ("PNP0C0C")) Name (_UID, 0xAA) Name (_STA, 0x0B) } This one I got it off some site, cannot remember where. (credit goes to him/her) This will activate your power button to bring up the shutdown menu.
hmm weird, tried doing this on my gigabyte board but the shutdown menu wont show, when i press the power button my hack will just sleep thats it
mine will shut down instantly
edit: well actually it just goes to sleep mode verry fast^^ too bad my system wont wake from sleep...
DSDT shutdown patch
With this and new restart patch chameleon booter from Duvel (strong beer that) I have only fakesmc as an added kext, although I'm about to reinstall voodoohda so I can hopefully have two soundcards working.. anyway this is mm67's work I just found it a pain to find the detail on insane so posting it here.. Thanks to all who put together these fixes. Need to add the two operation region bits and change your method PTS
OperationRegion (DEBG, SystemIO, 0x80, One)
Field (DEBG, ByteAcc, NoLock, Preserve)
{
DBG1, 8
}
OperationRegion (PMRS, SystemIO, 0x0430, 0x13)
Field (PMRS, ByteAcc, NoLock, Preserve)
{
, 4,
SLPE, 1,
Offset (0x08),
GPSE, 16,
GPSS, 16,
Offset (0x12),
, 1,
SWGC, 1
}
Method (_PTS, 1, NotSerialized)
{
Or (Arg0, 0xF0, Local0)
Store (Local0, DBG1)
Store (Zero, \_SB.PCI0.LPCB.AG3E)
If (LEqual (Arg0, 0x05))
{
Store (Zero, SLPE)
Sleep(0x10)
}
}
also your LPCB has to be like so
Device (LPCB)
{
Name (_ADR, 0x001F0000)
OperationRegion (LPC0, PCI_Config, 0xA4, 0x02)
Field (LPC0, ByteAcc, NoLock, Preserve)
{
AG3E, 1
}
I suppose add device ID if you need it, I'm on ICH10 so don't.
Also attaching blackosx's duvel+rekursor version of RC4 here, replace your chameleon boot file with the one from here and add these to boot.plist to get unique UUID and restart fix:
<key>DeviceID</key>
<string>XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX</string>
<key>RestartFix</key>
<string>YES</string>
@SweatyWith this and new restart patch chameleon booter from Duvel (strong beer that) I have only fakesmc as an added kext, although I'm about to reinstall voodoohda so I can hopefully have two soundcards working.. anyway this is mm67's work I just found it a pain to find the detail on insane so posting it here.. Thanks to all who put…
It's only this :
OperationRegion (PMRS, SystemIO, 0x0430, 0x13)
Field (PMRS, ByteAcc, NoLock, Preserve)
{
, 4,
SLPE, 1,
and this:
If (LEqual (Arg0, 0x05))
{
Store (Zero, SLPE)
Sleep(0x10)
}
that make the shutdown work, rest of the code is Gigabyte specific. This address 0x0430 is also motherboard specific, it is PMBASE+30h. Address of PMBASE is defined in FACP, on most boards it can also be checked from processor definitions. For example I have this in my dsdt:
Processor (CPU0, 0x00, 0x00000410, 0x06)
Here 0x00000410 is referring to PMBASE+10h so I use 0x430 on my Gigabyte board. On my MSI board's dsdt I have this:
Processor (P001, 0x01, 0x00000810, 0x06) {}
So in MSI shutdown code I use this:
OperationRegion (PMRS, SystemIO, 0x0830, 0x13)
Ok cheers mate, had to add the other bits on my board (asus p5ql/epu) to get it to compile, I'll try the simpler way later.. At least it did work the way I bodged it
EDIT: OK fixed code as you suggested I needed to use 0x830, also got rid of unnecessary bits, sometimes I needed to turn PSU off with 0x430 (before I could restart, shutdown was complete), that seems fixed now. Thanks a lot.
Im in a fix.. Everywhere there is a DSDT Fix for getting the USB port to be displayed as Built-in but i need the opposite..
USB - 3 shows as built-in, but it has bluetooth. hence on sleep i loose bluetooth.. if i remove the entry altogether, i have it as external but my sleep fails..
Am having Lenovo T60p. with ICH7-M chipset.
Thanks,
Xavier
Shutdown & Restart with sleep fix-Thanks to Sweaty & mm67
Many thanks to Sweaty and mm67. You are really nice. This resolve the problem I thought it would never be resloved.
I just made a small change to Method (_PTS, 1, NotSerialized) in order to resolve sleep issue on my notebook CQ60-202TX. Now let me put all together step by step as a guide. This might help newbie.
1 Add OperationRegion below before Method (_PTS, 1, NotSerialized)
OperationRegion (DEBG, SystemIO, 0x80, One)
Field (DEBG, ByteAcc, NoLock, Preserve)
{
DBG1, 8
}
OperationRegion (PMRS, SystemIO, 0x0430, 0x13)
Field (PMRS, ByteAcc, NoLock, Preserve)
{
, 4,
SLPE, 1,
Offset (0x08),
GPSE, 16,
GPSS, 16,
Offset (0x12),
, 1,
SWGC, 1
}
2 Check Device (LPC) if there is a similar Operation Region "LPC" like below. If you don't have LPC device, just search Name (_ADR, 0x001F0000), sometimes the device name is different.
Device (LPC)
{
Name (_ADR, 0x001F0000)
OperationRegion (LPC0, PCI_Config, 0xA4, 0x02)
Field (LPC0, ByteAcc, NoLock, Preserve)
{
AG3E, 1
}
If there is no OperationRegion LPC, please add code above. In my dsdt's OperationRegion LPC0, there is an EXPE instead of AG3E. So I did not modify it, but had to change a bit in Method (_PTS, 1, NotSerialized) . See mine below:
OperationRegion (LPC0, PCI_Config, 0x40, 0xC0)
Field (LPC0, AnyAcc, NoLock, Preserve)
{
Offset (0x60),
, 10,
EXPE, 1
}
3 Add code below in Method (_PTS, 1, NotSerialized) like this
Method (_PTS, 1, NotSerialized)
{
Or (Arg0, 0xF0, Local0)
Store (Local0, DBG1)
Store (Zero, \_SB.PCI0.LPC.EXPE) //Please change to \_SB.PCI0.LPC.AG3E if you don't have the EXPE, but add AG3E.
If (LEqual (Arg0, 0x05))
{
Store (Zero, SLPE)
Sleep(0x10)
}
Else
{
//**Original Code, this resolved my sleep issue.
}
}
//This is written by mm67. You are really nice.
This address 0x0430 is also motherboard specific, it is PMBASE+30h. Address of PMBASE is defined in FACP, on most boards it can also be checked from processor definitions. For example I have this in my dsdt:
Processor (CPU0, 0x00, 0x00000410, 0x06)
Here 0x00000410 is referring to PMBASE+10h so I use 0x430 on my Gigabyte board. On my MSI board's dsdt I have this:
Processor (P001, 0x01, 0x00000810, 0x06) {}
So in MSI shutdown code I use this:
OperationRegion (PMRS, SystemIO, 0x0830, 0x13)
4 Add these in your com.apple.Boot.plist and then put "boot_RC4_Duvelv2.1_Rekursor" under your boot partition.
<key>DeviceID</key>
<string>******XX-***X-***X-***X-************</string>
<key>RestartFix</key>
<string>YES</string>
Now you can remove OpenHaltRestart.kext and PlatformUUID.kext or other similar kexts.
@pentiumpcMost portable system don't sleep on closing the LID, I tried to find a DSDT fix for it but cannot find it. (google is my best friend.) so I wrote 1 to fix my own. If you have a better or alternative method, please let me know. Thanks. Device (LID0) { Name (_HID, EisaId ("PNP0C0D")) //LID detection Method (_PRW, 0, NotSerialized) {…
Noob here.
Never did work on my dsdt, I have errors after compiling on which it cannot find the registers. After much of googling, I have edited one value on my dsdt, on the LID0, instead of 0x03 I have made it to 0x04. I have sleep on lid close now, but I still don't have wake on lid open or wake on keyboard press after sleep via Fn+F1.
Here is my DSDT.dsl if somebody care to point me to the right direction.
I have repatched the dsdt once again with a fresh one. I delete all dsdt and did the patching once again, i still have sleep on lid close, Fn+F1, on the power button. I can wake thru power button with no problems, I can wake buy plugging or unplugging a usb device. But no wake on lid open or keyboard.
With this dsdt, clamshelldisplay.kext is not necessary anymore, so I have removed this kext.
Btw I have modded my dsdt on LID as almost the same on earlier post by pentiumpc.
Any ideas on how to enabel wake on lid open?
What you need to find is the method that is called upon a lid switch event, which means it is under EC0, the embedded controller device. On a MacBook, it's typically _Q20, which looks like this:
Method (_Q20, 0, NotSerialized)
{
Store (LSTE, LIDS)
Notify (\_SB.LID0, 0x80)
}
On my Gateway, it's _Q8A:
Method (_Q8A, 0, NotSerialized)
{
If (LIDE)
{
Store ("_Q8A : LID Switch Event", Debug)
Store (0x01, LIDE)
If (IGDS)
{
Store (0x90, SMIF)
Store (0x00, TRP0)
}
Notify (\_SB.LID0, 0x80)
}
on many other notebooks, it's _Q09. So you'll need to find where it is, and add the appropriate Notify call, to inform the OS that the laptop should be woken up. (I've modified my DSDT to use LID0, to better match the MacBook DSDT).
Enabled bluetooth on Acer Aspire 9420
Do you remember, not a long time a go, I'm pursuing to enable bluetooth in Mac OS X? I'm still unable to get the bluetooth button working but I'm able to make the bluetooth device working via DSDT hacking. I'm still however unable to trigger the bluetooth ON/OFF button. I even trying to re-map the bluetooth ON/OFF button to another button (Fn+..) but unsuccessful. Therefore, I modify System Wake (_WAK) to enable bluetooth. This is for temporary solution. When hot booting the computer, it need to be put to sleep one time only & waking up the computer will turning ON the bluetooth device. To make it working cleanly, I modify both System Wake (_WAK) and Prepare to Sleep (_PTS). In the process, I also fixed the wireless device won't turn ON after waking from sleep.
_WAK code:-
Method (_WAK, 1, NotSerialized)
{
Store (Arg0, P80H)
If (LEqual (Arg0, 0x03))
{
Store (CIRT, \_SB.PCI0.LPCB.EC0.CIRE)
}
If (LOr (LEqual (Arg0, 0x03), LEqual (Arg0, 0x04)))
{
Store (EEPM, \_SB.PCI0.LPCB.EC0.WEPM)
Store (CAST, \_SB.PCI0.LPCB.EC0.CAME)
Store (WLPW, \_SB.PCI0.LPCB.EC0.WLEN)
Store (BTPW, \_SB.PCI0.LPCB.EC0.BTEN)
Store (WLLE, \_SB.PCI0.LPCB.EC0.WLLD)
Store (BTLE, \_SB.PCI0.LPCB.EC0.BTLD)
}
Store (0x00, \_SB.PCI0.LPCB.EC0.MUTE)
Store (0x00, \_SB.PCI0.LPCB.EC0.KTAF)
Store (0x01, \_SB.PCI0.LPCB.EC0.KTEE)
// start
// Add support for Wireless & Bluetooth devices (power & LED).
// Turned ON Wireless & Bluetooth devices after resume from Sleep.
Store (0x01, \_SB.PCI0.LPCB.EC0.WLEN)
Store (0x01, \_SB.PCI0.LPCB.EC0.WLLD)
Store (0x01, \_SB.PCI0.LPCB.EC0.BTEN)
Store (0x01, \_SB.PCI0.LPCB.EC0.BTLD)
// end
..................
_PTS code:-
- Preventing the wireless device from turn OFF before goes to sleep. Therefore, the wireless device can be turn ON after waking from sleep.
Method (_PTS, 1, NotSerialized)
{
Store (Arg0, P80H)
Store (0x01, \_SB.PCI0.LPCB.EC0.MUTE)
If (LEqual (Arg0, 0x03))
{
Store (\_SB.PCI0.LPCB.EC0.CIRE, CIRT)
}
If (LEqual (Arg0, 0x04))
{
Store (0x01, \_SB.PCI0.LPCB.EC0.BLNK)
Store (0x00, \_SB.PCI0.LPCB.EC0.CIRE)
}
If (LOr (LEqual (Arg0, 0x03), LEqual (Arg0, 0x04)))
{
Store (\_SB.PCI0.LPCB.EC0.WEPM, EEPM)
Store (\_SB.PCI0.LPCB.EC0.CAME, CAST)
Store (\_SB.PCI0.LPCB.EC0.WLEN, WLPW)
Store (\_SB.PCI0.LPCB.EC0.BTEN, BTPW)
Store (\_SB.PCI0.LPCB.EC0.WLLD, WLLE)
Store (\_SB.PCI0.LPCB.EC0.BTLD, BTLE)
}
Store (0x00, \_SB.PCI0.LPCB.EC0.CAME)
Store (0x00, \_SB.PCI0.LPCB.EC0.CIRE)
// Preventing Wireless device from turning OFF when system going to Sleep.
// Store (0x00, \_SB.PCI0.LPCB.EC0.WLEN)
// start
// Add support for Wireless (LED) & Bluetooth (power & LED) devices.
// Turned OFF Wireless (LED) & Bluetooth (power & LED) devices before going to Sleep.
Store (0x00, \_SB.PCI0.LPCB.EC0.WLLD)
Store (0x00, \_SB.PCI0.LPCB.EC0.BTEN)
Store (0x00, \_SB.PCI0.LPCB.EC0.BTLD)
// end
If (LEqual (Arg0, 0x05))
{
PHSR (0x28, 0x00)
}
}
Applying this fix causing the computer unable to sleep anymore because USB4 device (where the bluetooth device attached to) causing the system wake immediately. I remember that according to ACPI Specification revision 4 documentation; in addition to the _PRW control method, _PSW control method can be used to enable or disable the device’s ability to wake a sleeping system.
Arguments: (1) Arg0 – An Integer containing a wake capability control 0 – Disable the device’s wake capabilities 1 – Enable the device’s wake capabilities
By looking at USB4 device in DSDT, there is _PSW entry that can be manipulate. This is the entry for USB4 device in DSDT after modifying the argument (set to 0):-
Device (USB4)
{
Name (_ADR, 0x001D0003)
OperationRegion (U4CS, PCI_Config, 0xC4, 0x04)
Field (U4CS, DWordAcc, NoLock, Preserve)
{
U4EN, 2
}
Name (_PRW, Package (0x02)
{
0x0E,
0x03
})
Method (_PSW, 1, NotSerialized)
{
If (Arg0)
{
// Store (0x03, U4EN)
// Disable USB4 capability to wake a sleeping system
Store (0x00, U4EN)
}
Else
{
Store (0x00, U4EN)
}
}
Method (_S3D, 0, NotSerialized)
{
Return (0x02)
}
Method (_S4D, 0, NotSerialized)
{
Return (0x02)
}
}
The last FIX enable the computer to sleep again.
kizwan
Nice work! Too bad I don't have bluetooth!
I've come to the conclusion that getting access to keyboard events is impossible in DSDT. I think you have three choices: construct an AMW0 device kext to bind to the AMW0 (which I presume is in your DSDT). This would be a challenge, but might allow you to be straight retail. Two, hack at ApplePS2Keyboard (if PS2) or something else if USB. Or three, do the same with VoodooPS2 (again if PS2).
If you have USB, your job may be easier, since you might be able to do it outside kernel space.
Battery indicator
I'm successfully compiled AMW0.kext for SL but got kernel panic while initializing some MethodTerm at boot. Since AMW0.kext project is not finished, I think I'm going to try ACPI4ASUS.kext instead. If ACPI4ASUS.kext developed to works with AMW0 v2 interface (AMW0 and WMID), it should works with other laptop model too.
I'm trying to enable battery icon by patching DSDT. It is being done by adjusting ADP1 & BAT0 code according to DSDT from MBP4,1. Not successful yet, but the battery indicator did show up. It said battery is not detected & current power source is power adapter. Do you think it is possible to make it working by just patching the DSDT?
EDIT: I have found the right "query method" to automatically turn ON Bluetooth device during boot-up. I just tried all of the "query method" in the DSDT until I found the right one.
Method (_Q3F, 0, NotSerialized)
{
// start
// auto turn ON Bluetooth device during computer startup
Store (0x01, \_SB.PCI0.LPCB.EC0.BTEN)
Store (0x01, \_SB.PCI0.LPCB.EC0.BTLD)
// end
HKEY (0x3F)
}
kizwan
Can you somebody help me to enable my audio on Snow Leopard?My audio chip is Realtek ALC662:
I make a codec dump:You can download and see it.
hot file.com/dl/32500771/8b28fa6/Realtek_ALC662_dump.txt.rar.html
I want to fix my audio in DSDT, so I read your tutorial and convert the Default pinconfig on each "[JACK]" device:
Mic (colour:Pink) 01a19830 ---> reversed 3098a101
Mic which is not a jack 99a3093f ---> 3f09a399
HP - 0121401f ---> 1f402101
SPDIF -01441120 ---> 20114401
This is my audio configuration on my laptop.
I don't know how to generate values which I haveto enter in my DSDT.This is my DSDT (HDEF):
Device (HDEF)
{
Name (_ADR, 0x001B0000)
OperationRegion (HDAR, PCI_Config, 0x4C, 0x10)
Field (HDAR, WordAcc, NoLock, Preserve)
{
DCKA, 1,
Offset (0x01),
DCKM, 1,
, 6,
DCKS, 1,
Offset (0x08),
, 15,
PMES, 1
}
Name (_PRW, Package (0x02)
{
0x0D,
0x03
})
}
@kizwanEDIT: I have found the right "query method" to automatically turn ON Bluetooth device during boot-up. I just tried all of the "query method" in the DSDT until I found the right one. Method (_Q3F, 0, NotSerialized) { // start // auto turn ON Bluetooth device during computer startup Store (0x01, \_SB.PCI0.LPCB.EC0.BTEN) Store (0x01,…
Where you put this code?
I searched in my DSDT for
Method (_Q3F, 0, NotSerialized)
, But didn't find it.I have a laptop with Bluetooth, where to put this code?
@kizwanI'm successfully compiled AMW0.kext for SL but got kernel panic while initializing some MethodTerm at boot. Since AMW0.kext project is not finished, I think I'm going to try ACPI4ASUS.kext instead. If ACPI4ASUS.kext developed to works with AMW0 v2 interface (AMW0 and WMID), it should works with other laptop model too.
So does Asus use AMW0, or do you need to add that code from AMW0. A WMID kext would be useful as many PC vendors use that interface. uninc's DSDT was hideously intertwined with WMID.
I'm trying to enable battery icon by patching DSDT. It is being done by adjusting ADP1 & BAT0 code according to DSDT from MBP4,1. Not successful yet, but the battery indicator did show up. It said battery is not detected & current power source is power adapter. Do you think it is possible to make it working by just patching the DSDT?
I'm not sure, but given that the ACPI 4.0 spec devotes pages and pages to battery and power issues, I think it is at least possible. I also intend to try to solve this (but it's a lower priority for me because my laptop battery is toast anyway). I tried VoodooBattery, which worked great (it told me my battery was toast, lol), but then it kernel panic'ed HARD and I had to repair my disk, so I won't be using that again.
EDIT: I have found the right "query method" to automatically turn ON Bluetooth device during boot-up. I just tried all of the "query method" in the DSDT until I found the right one. Method (_Q3F, 0, NotSerialized) { // start // auto turn ON Bluetooth device during computer startup Store (0x01, \_SB.PCI0.LPCB.EC0.BTEN) Store (0x01,…
I still don't understand how query methods are executed, nor how they are bound to some device. ACPI says:
"For an embedded controller event, OSPM will queue the control method of the name _QXX, where XX is the hex format of the query code. Notice that each embedded controller device can have query event control methods. Similarly, for an SMBus driver, if no driver registers for SMBus alarms, the SMBus driver will queue control methods to…
And then they discuss it more with a completely unhelpful example. Oh wait, the acpi implementers guide is more helpful:
What’s the trap? Using decimal instead of hexadecimal numbers in _Lxx, _Exx, and _Qxx names in your ASL code. When the number (xx) in the _Lxx, _Exx, or _Qxx event handler object name in the ASL code does not match the number of the bit in the GPE register block (or match the number of the embedded controller query number in the case…
DSDT is fun but time consuming!
@breakkyWhere you put this code? I searched in my DSDT for Method (_Q3F, 0, NotSerialized) , But didn't find it.I have a laptop with Bluetooth, where to put this code?
Each laptop model is going to be different. That's why you have to be prepared to do some work to get DSDT going. You will first need to determine what symbols, events, and queries correspond to your bluetooth device. Then kizwan's code can act as a guide.
@breakkyWhere you put this code? I searched in my DSDT for Method (_Q3F, 0, NotSerialized) , But didn't find it.I have a laptop with Bluetooth, where to put this code?
It is hardware & BIOS specific. You may have different query method. I'm afraid, you need to try & error every query method in your DSDT.
EDIT: You may want to follow uman suggestion (next post) to get your audio working. It is much easier.
As for your sound, you need to do a lot of work to get your sound working. You already have HDEF entry in DSDT, so you just missing legacy/patched kext. You need to put your ConfigData & Pin Config in legacy/patched kext. Use this legacy kext as a template:-
media fire.com/?vkzyzmtzozo
If you like to put ConfigData & PinConfigurations in DSDT, this is how HDEF entry will look like (between "// start" & "// end"):-
Device (HDEF)
{
Name (_ADR, 0x001B0000)
Name (HDWA, 0x00)
Name (_PRW, Package (0x02)
{
0x05,
0x03
})
Method (_PS0, 0, Serialized)
{
If (LEqual (HDWA, 0x00))
{
Store (0x01, HDWA)
HKEY (0x8F)
}
}
Method (_PS3, 0, Serialized)
{
Store (0x00, HDWA)
}
// start - required code
Method (_DSM, 4, NotSerialized)
{
Store (Package (0x0C)
{
"built-in",
Buffer (One)
{
0x00
},
"codec-id",
Buffer (0x04)
{
0x83, 0x08, 0xEC, 0x10
},
"ConfigData",
Buffer (0x40)
{
/* 0000 */ 0x01, 0x47, 0x1C, 0x30, 0x01, 0x47, 0x1D, 0x11,
/* 0008 */ 0x01, 0x47, 0x1E, 0x0B, 0x01, 0x47, 0x1F, 0x01,
/* 0010 */ 0x01, 0x87, 0x1C, 0x10, 0x01, 0x87, 0x1D, 0x01,
/* 0018 */ 0x01, 0x87, 0x1E, 0xA0, 0x01, 0x87, 0x1F, 0x90,
/* 0020 */ 0x01, 0xA7, 0x1C, 0x20, 0x01, 0xA7, 0x1D, 0x31,
/* 0028 */ 0x01, 0xA7, 0x1E, 0x81, 0x01, 0xA7, 0x1F, 0x01,
/* 0030 */ 0x01, 0xE7, 0x1C, 0x40, 0x01, 0xE7, 0x1D, 0xE1,
/* 0038 */ 0x01, 0xE7, 0x1E, 0x45, 0x01, 0xE7, 0x1F, 0x01
},
"layout-id",
Buffer (0x04)
{
0x0C, 0x00, 0x00, 0x00
},
"device-type",
Buffer (0x11)
{
"Mobile ALC883 S/T"
},
"PinConfigurations",
Buffer (0x10)
{
/* 0000 */ 0x30, 0x11, 0x0B, 0x01, 0x10, 0x91, 0xAB, 0x01,
/* 0008 */ 0x20, 0x31, 0x81, 0x01, 0x40, 0xE1, 0x45, 0x01
}
}, Local0)
DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))
Return (Local0)
}
// end - required code
}
I'll try to construct ConfigData & PinConfigurations for you but I can't promise.
kizwan
Are you planning to use VoodooHDA, or AppleHDA? If Voodoo, first rename all references to HDEF to ALC6 (or whatever turns you on :)) Doing so will prevent AppleHDA from loading and matching your HDA device. If AppleHDA is loaded, then VoodooHDA doesn't load.
Next, and this is common for both Apple and Voodoo. Add this to your HDEF or ALC6 device:
Method (_DSM, 4, NotSerialized) { Store (Package (0x04) { "layout-id", Buffer (0x04) { 0x0C, 0x00, 0x00, 0x00 }, "PinConfigurations", Buffer (Zero) {} }, Local0) DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0)) Return (Local0) }
You can then add your pin configs in there or in the plist depending on how you want to get sound going. See the great guide on infinitemac, or the one on projectosx.
Search my posts and look for my question on pinconfigs to find the links. I'm still trying to find out how to get my pinconfigs without Windows, since I don't run that anymore!
@kizwanBy looking at USB4 device in DSDT, there is _PSW entry that can be manipulate. This is the entry for USB4 device in DSDT after modifying the argument (set to 0):- Device (USB4) { Name (_ADR, 0x001D0003) OperationRegion (U4CS, PCI_Config, 0xC4, 0x04) Field (U4CS, DWordAcc, NoLock, Preserve) { U4EN, 2 } Name (_PRW, Package (0x02) {…
can you tell me what modification should I apply to this code to disable sleep for a device in usb2 ?
regards,
Vincent
@umanSo does Asus use AMW0, or do you need to add that code from AMW0. A WMID kext would be useful as many PC vendors use that interface. uninc's DSDT was hideously intertwined with WMID.
Looks like I still need to go through WMI and ACPI documentation to have better understanding. Then I can make this successful.
@umanI'm not sure, but given that the ACPI 4.0 spec devotes pages and pages to battery and power issues, I think it is at least possible. I also intend to try to solve this (but it's a lower priority for me because my laptop battery is toast anyway). I tried VoodooBattery, which worked great (it told me my battery was toast, lol), but then…
Yeah, it's a low priority for me too. Just playing around.
I guess to make it working, maybe need to determine which query method it use. I said that because I found that there are query method that called ADP1 & BAT0 device. Just don't know what it do & what it contribute to battery detection.
@umanI still don't understand how query methods are executed, nor how they are bound to some device. ACPI says: And then they discuss it more with a completely unhelpful example. Oh wait, the acpi implementers guide is more helpful:
I'm going to grab the acpi implementers guide.
@umanDSDT is fun but time consuming!
I agree.
@barnum… can you tell me what modification should I apply to this code to disable sleep for a device in usb2 ? …
Do you mean you want to disable USB2 capability to wake a sleeping system, don't you? If in "Device (USB2)" entry it have _PSW (Power State Wake) method, you will need to change it according to my modification.
Method (_PSW, 1, NotSerialized)
{
If (Arg0)
{
// Store (0x03, U4EN)
// Disable USB4 capability to wake a sleeping system
Store (0x00, U4EN)
}
Else
{
Store (0x00, U4EN)
}
}
Refer to arguments for _PSW:
Arguments: (1) Arg0 – An Integer containing a wake capability control 0 – Disable the device’s wake capabilities 1 – Enable the device’s wake capabilities
That is why I change both condition to execute the same thing. So that it always execute the same "Store" operation as if it is Arg0=0.
kizwan
@umanAre you planning to use VoodooHDA, or AppleHDA? If Voodoo, first rename all references to HDEF to ALC6 (or whatever turns you on :)) Doing so will prevent AppleHDA from loading and matching your HDA device. If AppleHDA is loaded, then VoodooHDA doesn't load. Next, and this is common for both Apple and Voodoo. Add this to your HDEF or…
I planed to use AppleHDA with DSDT.aml fix.This is my original DSDT.aml
hot file.com/dl/32576445/45eb3b8/DSDT.dsl.zip.html
By the way I use AsereBLN booter 1.1.9.
@breakkyI planed to use AppleHDA with DSDT.aml fix.This is my original DSDT.aml
Try this legacy kext for ALC662 (Snow Leopard):-
media fire.com/?kmnykkqmy5m
Make sure AppleHDA.kext in /System/Library/Extensions/ folder is original kext. Remember to put _DSM method in Device (HDEF) (please refer to uman's post #81 →).
You also need to put DTGP code in DSDT. Put it afterMethod (_WAK) function.
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)
}
kizwan
When I try to compile my dsdt.dsl I get one error:
4644: DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))
Error 4067 - ^ Object is not accessible from this scope (DTGP)
Nevermind I found where is the error and fix it!
@breakkyWhen I try to compile my dsdt.dsl I get one error: 4644: DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0)) Error 4067 - ^ Object is not accessible from this scope (DTGP) Nevermind I found where is the error and fix it!
How about the sound? Is it working?
This thread has been very useful for me. I now just miss one last step to have the "perfect" install.
I'm running Snow Leopard on an ASUS eeePC 901 from the SD card. It's a bit slow but this is OK.
My problem: whenever I go to sleep and wake-up from sleep, I guess the SD card (my "boot drive") gets brutally ejected and…well, it's bad.
My question: is there any DSDT mod that would allow my SD card to stay mounted (powered maybe) during all the cycle wake-sleep-wake ?
I found a lot of approaching stuff on the thread but nothing exactly like that. this would make may day.
Any idea anyone ?
Thanks, Richard.
@richardaThis thread has been very useful for me. I now just miss one last step to have the "perfect" install. I'm running Snow Leopard on an ASUS eeePC 901 from the SD card. It's a bit slow but this is OK. My problem: whenever I go to sleep and wake-up from sleep, I guess the SD card (my "boot drive") gets brutally ejected and…well, it's bad.…
Yes, but it depends on the underlying hardware. I've found los of good info about my own laptop in my chipset doc (ICH7), and there is lots of good info on the SATA part of the device control. I assume the SSD is controled through SATA?
Thanks for the info. Not sure I was clear enough tough. I'm having the problem with the SD card (I believe it's using an internal USB port) and the machine is an eeePC 901.
I need help on this one…please.
@richardaThanks for the info. Not sure I was clear enough tough. I'm having the problem with the SD card (I believe it's using an internal USB port) and the machine is an eeePC 901. I need help on this one…please.
My bad. I'm so used to SD cards not working, that I assumed you meant SSD.
You could try the following:
1. Determine what USB slot your SD card is occupying. Easiest is to highlight he drive in disk utility and right-click Information. You should see something like: IODeviceTree:/PCI0@0/USB7@1D,7. That tells me that it's using USB7.
2. Edit your DSDT to replace the _PRW for the indicated USB slot with:
Device (USB7)
{
...
// package (argnum) {GPEbit, Wakelevel, PowerResource}
Name(_PRW, Package()
{
<xx>, // Bit number in GPEx_EN to enable USB resume
0x01 // Reference to lowest sleeping state which can be
// entered while still providing wake functionality
// no relative power resource specified
})
where I have <xx> above, keep your DSDT's existing value, as that's the handler in the GPE for USB7. What I've highlighted in red is the change. Your existing DSDT likely has 0x03, which is effectively powered off.
What the 0x01 does is says that the drive still needs power. That *might* be enough to keep it from being ejected. But it might also prevent the computer from sleeping.
Take a look at the ACPI spec (4.0 rev) Chapter 7.2 for some of the things you can do with power management.
ive been lurking around on this thread for a week or two now, and i'm more interested in getting my laptop fully working. ive been running osx for about a year now and i'm pretty familiar with everything except DSDT.
basically what i'm trying to get working:
- GMA X3100: was working with leo, but with 10.6.2 i lost the ability to make the
screen turn off.(although i still have QE/CI)
- Backlight: has never worked, "invalid firmware max backlight" problem. i was
hoping DSDT would be able to fix this
- Sleep: although i'm not too worried about it, it would be nice.
I have a Gateway M6841. I don't think it's a too popular system to be using for a hackintosh, so there's not much help that i've found in the forums.
here is my patched DSDT. its patched for sleep, backlight, and gmax3100 but it hasnt changed any of the problems. thanks to anyone that can help or at least point me in the right direction, i do have programming experience if it helps.
@umanMy bad. I'm so used to SD cards not working, that I assumed you meant SSD. You could try the following: 1. Determine what USB slot your SD card is occupying. Easiest is to highlight he drive in disk utility and right-click Information. You should see something like: IODeviceTree:/PCI0@0/USB7@1D,7. That tells me that it's using USB7.…
Hello,
Thanks a lot. In the disk utility I got: /PCI0@0/EUSB@1D,7
And in the DSDT file, at Device(EUSB) I don't have a lot of things. Just
{
Name (_ADR, 0x001D0007)
}
nothing else. Any idea what else I can add to make it working in that case ?
@richardaThanks a lot. In the disk utility I got: /PCI0@0/EUSB@1D,7 And in the DSDT file, at Device(EUSB) I don't have a lot of things. Just { Name (_ADR, 0x001D0007) } nothing else. Any idea what else I can add to make it working in that case ?
You're allowed to add what it don't have.
kizwan
Allright, I got that but in this case I guess I have to pute something like
Name(_PRW, Package
{
<xx>, // Bit number in GPEx_EN to enable USB resume
0x01 // Reference to lowest sleeping state which can be
// entered while still providing wake functionality
// no relative power resource specified
})
But how to determine the <xx> value then ?
@richardaAllright, I got that but in this case I guess I have to pute something like Name(_PRW, Package { <xx>, // Bit number in GPEx_EN to enable USB resume 0x01 // Reference to lowest sleeping state which can be // entered while still providing wake functionality // no relative power resource specified }) But how to determine the <xx> value…
That's the problem then. You really need to have some of the resources specified for your USB (UHCI) and EHCI ports. Since you don't have anything, you can add the GPE handlers, and things should work. The best way to proceed, is to first identify which Mac model your machine is closest to, and then take the requisite parts, carefully excising out the problematic parts.
For my hack, I looked at the list of mac models on wikipedia, and then chose MacBook 2,1 as the closest. I then edited my smbios.plist to reflect those values. I then compared my DSDT to the MacBook 2,1 DSDT and ioreg, and found they were surprisingly close. I've included below, some pieces for you to try from a MacBook 2,1 DSDT:
Scope (\_GPE)
{
...
Method (_L03, 0, NotSerialized)
{
Notify (\_SB.PCI0.USB1, 0x02)
Notify (\_SB.PWRB, 0x02)
}
Method (_L04, 0, NotSerialized)
{
Notify (\_SB.PCI0.USB2, 0x02)
Notify (\_SB.PWRB, 0x02)
}
...
Method (_L0C, 0, NotSerialized)
{
Notify (\_SB.PCI0.USB3, 0x02)
Notify (\_SB.PWRB, 0x02)
}
Method (_L0D, 0, NotSerialized)
{
Notify (\_SB.PCI0.USB7, 0x02)
Notify (\_SB.PWRB, 0x02)
}
Method (_L0E, 0, NotSerialized)
{
Notify (\_SB.PCI0.USB4, 0x02)
Notify (\_SB.PWRB, 0x02)
}
...
Note the parts in red. If you already have level handlers in your GPE scope that use these numbers (so say you already have _L03), you will have to change them, and change the part in the USB1 declaration for, say, _L03. Don't put really large numbers, because there's a part in the DSDT that says the handlers go only up to 0xXX (I've forgotten where that is). Just make sure you use unused numbers. For example, in my DSDT I added one for _L11 for my firewire.
Device (USB1)
{
Name (_ADR, 0x001D0000) // keep your existing ADDR lines!!!
Device (HUB1) // will become HUB2 for USB2
{
Name (_ADR, 0x00)
Device (PRT1)
{
Name (_ADR, 0x01)
}
Device (PRT2)
{
Name (_ADR, 0x02)
}
}
OperationRegion (U1CS, PCI_Config, 0xC4, 0x04)
Field (U1CS, DWordAcc, NoLock, Preserve)
{
U1EN, 2
}
Name (_PRW, Package (0x02)
{
0x03, // must match number you use in _Lxx handler
0x03
})
Method (_PSW, 1, NotSerialized)
{
If (Arg0)
{
Store (0x03, U1EN)
}
Else
{
Store (0x00, U1EN)
}
}
Method (_S3D, 0, NotSerialized) // note: I don't have these
{
Return (0x03)
}
Method (_S4D, 0, NotSerialized) // note: I don't have these
{
Return (0x03)
}
}
The parts in red will change to match each USB port, so U1CS, U1EN becomes U2CS and U2EN for USB2, along with changing HUB1 to HUB2. I don't have the _S3D and _S4D methods in my DSDT and from reading the spec, I don't think they are needed.
So USB2, looks like:
Device (USB2)
{
Name (_ADR, 0x001D0001)
Device (HUB2)
{
Name (_ADR, 0x00)
Device (PRT1)
{
Name (_ADR, 0x01)
}
Device (PRT2)
{
Name (_ADR, 0x02)
}
}
OperationRegion (U2CS, PCI_Config, 0xC4, 0x04)
Field (U2CS, DWordAcc, NoLock, Preserve)
{
U2EN, 2
}
Name (_PRW, Package (0x02)
{
0x04, // A different _L04 is a different _LXX handler than USB1!
0x03
})
Method (_PSW, 1, NotSerialized)
{
If (Arg0)
{
Store (0x03, U2EN)
}
Else
{
Store (0x00, U2EN)
}
}
Method (_S3D, 0, NotSerialized)
{
Return (0x03)
}
Method (_S4D, 0, NotSerialized)
{
Return (0x03)
}
}
Do the same edits for USB3 and USB4 (if you have USB4) and even USB5, and USB6 if you have a desktop with lots of USB ports (although I suspect you will need another EHCI hub there, but I don't know).
USB7 is quite different:
Device (USB7)
{
Name (_ADR, 0x001D0007)
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, // yet another different handler
0x03 // I suggested you change this to 0x1
})
Method (_S3D, 0, NotSerialized)
{
Return (0x03)
}
Method (_S4D, 0, NotSerialized)
{
Return (0x03)
}
}
Remove the parts in yellow for the USB7, since they don't match the change from 0x03 -> 0x01. Plus I suspect they really aren't needed.
Oh, and if this doesn't work, there are bits you can set that essentially control power settings, ejectability, etc. But that is hugely dependent on your chipset. I have an ICH7, and most of that is the same in ICH9, and ICH10, but if you have an nvidia chipset, that's *totally* different.
OK, I'm 200% lost now. This is way too complex for me. I guess I have to find somebody litterate enough who solved the problem on the eee901 and just copy his settings.
Thanks anyway.
Device (HUB1) // will become HUB2 for USB2
{
Name (_ADR, 0x00)
Device (PRT1)
{
Name (_ADR, 0x01)
}
Device (PRT2)
{
Name (_ADR, 0x02)
}
}
Hi,
Can You explain me what the "utility" of this part of the usb declaration"
In my dsdt, I doesn't have that.
Thank,
Barnum
You won't need it, then. It's because on my gateway, the ports have integrated hubs. See ACPI spec, section 9.13 for full details.
Sorry of reviving this and cutting in
@ping99
I have an ASRock x58 Extreme (similar to ASUS boards), and sleep doesn't work OTB. I've been looking around, and it seems I would need to modify Method (_PTS, 1, NotSerialized).
I read your post, and it seems that the edits you did are somewhat similar to what I should do in my DSDT, whoever I have a few doubts:
@ping99... 1 Add OperationRegion below before Method (_PTS, 1, NotSerialized) OperationRegion (DEBG, SystemIO, 0x80, One) Field (DEBG, ByteAcc, NoLock, Preserve) { DBG1, 8 } OperationRegion (PMRS, SystemIO, 0x0430, 0x13) Field (PMRS, ByteAcc, NoLock, Preserve) { , 4, SLPE, 1, Offset (0x08), GPSE, 16, GPSS, 16, Offset (0x12), , 1, SWGC, 1 }
Is
OperationRegion (DEBG, SystemIO, 0x80, One)
Field (DEBG, ByteAcc, NoLock, Preserve)
{
DBG1, 8
}
really necessary? mm67 seems to think not (or is that for shutdown only?)
@ping99...2 Check Device (LPC) if there is a similar Operation Region "LPC" like below. If you don't have LPC device, just search Name (_ADR, 0x001F0000), sometimes the device name is different. Device (LPC) { Name (_ADR, 0x001F0000) OperationRegion (LPC0, PCI_Config, 0xA4, 0x02) Field (LPC0, ByteAcc, NoLock, Preserve) { AG3E, 1 } If there…
Here is my LPCB:
Device (LPCB)
{
Name (_ADR, 0x001F0000)
Device (IELK)
{
Name (_HID, "AWY0001")
OperationRegion (RXA0, PCI_Config, 0xA0, 0x20)
Field (RXA0, ByteAcc, NoLock, Preserve)
{
, 9,
PBLV, 1,
Offset (0x10),
, 1,
PBMS, 1,
, 1,
PMCS, 1,
ECNS, 1,
Offset (0x11),
ECT1, 16,
ELEN, 1,
Offset (0x14)
}
Method (\_GPE._L0A, 0, NotSerialized)....
Where should I put OperationRegion (LPC0...? Before Device (IELK)? After Name (_HID, "AWY0001")? Inside OperationRegion (RXA0, PCI_Config, 0xA0, 0x20) somehow?
@ping993 Add code below in Method (_PTS, 1, NotSerialized) like this Method (_PTS, 1, NotSerialized) { Or (Arg0, 0xF0, Local0) Store (Local0, DBG1) Store (Zero, \_SB.PCI0.LPC.EXPE) //Please change to \_SB.PCI0.LPC.AG3E if you don't have the EXPE, but add AG3E. If (LEqual (Arg0, 0x05)) { Store (Zero, SLPE) Sleep(0x10) } Else { //**Original…
Here is my current -disastrous- Method (_PTS, 1, NotSerialized):
Method (_PTS, 1, NotSerialized)
{
Or (Arg0, 0xF0, Local0)
Store (Arg0, DBG8)
PTS (Arg0)
Store (Zero, Index (WAKP, Zero))
Store (Zero, Index (WAKP, One))
If (LAnd (LEqual (Arg0, 0x04), LEqual (OSFL (), 0x02)))
{
Sleep (0x0BB8)
}
If (LEqual (Arg0, 0x05))
{
Store (0x99, SMIP)
Store (One, \_SB.PCI0.LPCB.IELK.AG3E)
Store (Zero, SLPE)
Sleep (0x10)
}
Else
{
Store (Zero, \_SB.PCI0.LPCB.IELK.AG3E)
}
Store (ASSB, WSSB)
OSYS ()
Store (AOTB, WOTB)
Store (AAXB, WAXB)
Store (Arg0, ASSB)
Store (OSFL (), AOTB)
Store (OSYS (), OSTP)
Store (Zero, AAXB)
}
The original is:
Method (_PTS, 1, NotSerialized)
{
Store (Arg0, DBG8)
PTS (Arg0)
Store (Zero, Index (WAKP, Zero))
Store (Zero, Index (WAKP, One))
If (LAnd (LEqual (Arg0, 0x04), LEqual (OSFL (), 0x02)))
{
Sleep (0x0BB8)
}
Store (ASSB, WSSB)
Store (AOTB, WOTB)
Store (AAXB, WAXB)
Store (Arg0, ASSB)
Store (OSFL (), AOTB)
Store (OSYS (), OSTP)
Store (Zero, AAXB)
}
, Adrian
Post Scriptum (P.S.): I attached my DSDT's, CST and IST tables, so if someone could lok at them and tell me if I -for example- managed to insert the C-States, P-States, etc-States into the DSDT correctly, I would be eternally grateful.
First all, you just need to add OperationRegion PMRS below.
OperationRegion (PMRS, SystemIO, 0x0430, 0x13)
Field (PMRS, ByteAcc, NoLock, Preserve)
{
, 4,
SLPE, 1
}
* Pay attention to 0x0430 in red. It depends your motherboard. You have Processor (CPU0, 0x00, 0x00000410, 0x06) in your dsdt, you can use 0x0430. If you have Processor (P001, 0x01, 0x00000810, 0x06) then use 0x0830. It is PMBASE+30h.
Secondly, look into Method (_PTS, 1, NotSerialized) to see whether "If (LEqual (Arg0, 0x05))" there. If not, add code as below. If already there, just insert.
If (LEqual (Arg0, 0x05))
{
Store (0x01, \_SB.PCI0.LPC.EXPE) // hibernate fix. Will return to S5 after power back
Store (Zero, SLPE) // zero SLP_SMI_EN, else won't shutdown
Sleep (0x10) // wait for bit to set
}
Yours is modified as below:
Method (_PTS, 1, NotSerialized)
{
Store (Zero, \_SB.PCI0.LPC.EXPE) //Check Device (LPC) or LPCB if you have this EXPE or something like this. change it to match yours.
If (LEqual (Arg0, 0x05))
{
Store (0x01, \_SB.PCI0.LPC.EXPE) // hibernate fix. Will return to S5 after power back
Store (Zero, SLPE) // zero SLP_SMI_EN, else won't shutdown
Sleep (0x10) // wait for bit to set
}
Store (Arg0, DBG8)
PTS (Arg0)
Store (Zero, Index (WAKP, Zero))
Store (Zero, Index (WAKP, One))
If (LAnd (LEqual (Arg0, 0x04), LEqual (OSFL , 0x02)))
{
Sleep (0x0BB8)
}
Store (ASSB, WSSB)
Store (AOTB, WOTB)
Store (AAXB, WAXB)
Store (Arg0, ASSB)
Store (OSFL , AOTB)
Store (OSYS , OSTP)
Store (Zero, AAXB)
}
i tried the sleep fix, but i can't get it to work, sleep in general doesn't work, when i press the sleep button, my screen freezes and that's all, when i press the powerbutton i get the restart/shutdown popup and all works again.
Lidsleep also does the same, screen freezes but stays on.
i wanna ask you if you plz wanna look at it?
really nice job!
Here is my problem... I have a Compal Ifl90 with intel 7300 @ 2GHz and 8600m gt 512mb with Snow Leopard 10.6.3 .
The problem i have is that my screen brightness slider at setting wasn't there! But with some dsdt editing i managed to show up but when i move the slider nothing happen and returns to it's original position! Any help please below is my code from Device (LCD)
Device (LCD)
{
Method (_ADR, 0, NotSerialized)
{
Return (0x0110)
}
Method (_DCS, 0, NotSerialized)
{
^^^^LPCB.PHSS (0x0C)
Store (CADL, Local0)
Store (CSTE, Local1)
And (Local0, One, Local0)
And (Local1, One, Local1)
If (Local0)
{
Store (One, LCDA)
}
Else
{
Store (Zero, LCDA)
}
If (LCDA)
{
If (LEqual (Local1, One))
{
Return (0x1F)
}
Else
{
Return (0x1D)
}
}
Else
{
If (LEqual (Local1, One))
{
Return (0x0F)
}
Else
{
Return (0x0D)
}
}
}
Method (_DGS, 0, NotSerialized)
{
If (LCDA)
{
Return (One)
}
Else
{
Return (Zero)
}
}
Method (_DSS, 1, NotSerialized)
{
}
Method (_BCL, 0, NotSerialized)
{
If (^^^^LPCB.ECOK ())
{
If (LEqual (OSYS, 0x07D6))
{
If (LEqual (^^^^LPCB.EC0.OSTY, Zero))
{
Store (One, ^^^^LPCB.EC0.OSTY)
}
}
Else
{
If (LEqual (^^^^LPCB.EC0.OSTY, One))
{
Store (Zero, ^^^^LPCB.EC0.OSTY)
}
}
}
Return (Package (0x0A)
{
0x46,
0x28,
Zero,
0x0A,
0x14,
0x1E,
0x28,
0x32,
0x3C,
0x46
})
}
Method (_BCM, 1, NotSerialized)
{
Divide (Arg0, 0x0A, Local0, Local1)
Store (Local1, ^^^^LPCB.EC0.BRTS)
}
Method (_BQC, 0, NotSerialized)
{
Multiply (^^^^LPCB.EC0.BRTS, 0x0A, Local0)
Return (Local0)
}
}
In my try to make it show up i also added
Name (_HID, EisaId ("LCD1234"))
in Device (LCD)
And
Device (PNLF)
{
Name (_HID, EisaId ("APP0002"))
Name (_CID, "backlight")
Name (_UID, 0x0A)
Name (_STA, 0x0B)
}
right above Device (LCD)
Also i am able to change brightness from my Fn Buttons but no notification is shows as the sound changing does!
Please any ideas?
Led Wireless
How I can turn on wireless led with code in DSDT?
文献来源与贡献者溯源名录(共 32 位具名成员 · 原始讨论串 #1960)
| 成员用户名 | 本卷贡献角色 | 发帖数 | 活跃时间窗 |
|---|---|---|---|
| @uman | 核心贡献者 | 21 | 2009-06-02 → 2010-03-29 |
| @kizwan | 核心贡献者 | 18 | 2009-06-01 → 2010-03-20 |
| @pentiumpc | 主笔作者 | 8 | 2009-01-19 → 2009-03-03 |
| @Slither2008 | 核心贡献者 | 6 | 2009-03-03 → 2009-03-05 |
| @candykane | 核心贡献者 | 6 | 2009-05-13 |
| @richarda | 核心贡献者 | 5 | 2010-03-16 → 2010-03-21 |
| @THeKiNG | 核心贡献者 | 4 | 2009-06-03 → 2009-06-18 |
| @breakky | 核心贡献者 | 4 | 2010-03-13 → 2010-03-14 |
| @Thireus | 核心贡献者 | 3 | 2009-05-07 → 2009-05-13 |
| @Alexaar | 协作成员 | 2 | 2009-04-13 → 2009-04-29 |
| @The Edge3000 | 协作成员 | 2 | 2009-08-11 → 2009-09-07 |
| @Gurruwiwi | 协作成员 | 2 | 2009-08-17 |
| @EnzoFX | 协作成员 | 2 | 2009-09-03 |
| @Sweaty | 协作成员 | 2 | 2009-12-21 |
| @ping99 | 协作成员 | 2 | 2010-01-18 → 2010-07-04 |
| @Nameci | 协作成员 | 2 | 2010-01-31 |
| @barnum | 协作成员 | 2 | 2010-03-13 → 2010-03-26 |
| @adriangb | 协作成员 | 2 | 2010-04-01 |
| @kDawg | 协作成员 | 1 | 2009-07-15 |
| @aschar1 | 协作成员 | 1 | 2009-08-07 |
| @sk1nhd33t | 协作成员 | 1 | 2009-08-09 |
| @Common_Sense | 协作成员 | 1 | 2009-09-08 |
| @gnychis | 协作成员 | 1 | 2009-09-25 |
| @msingh | 协作成员 | 1 | 2009-10-05 |
| @2nerd4u | 协作成员 | 1 | 2009-10-20 |
| @mm67 | 协作成员 | 1 | 2009-12-21 |
| @adityaxavier | 协作成员 | 1 | 2010-01-09 |
| @pocenk | 协作成员 | 1 | 2010-01-29 |
| @saul1d | 协作成员 | 1 | 2010-03-20 |
| @SaGaR | 协作成员 | 1 | 2010-12-20 |
| @ribben89 | 协作成员 | 1 | 2011-02-05 |
| @Marchrius | 协作成员 | 1 | 2013-01-21 |