forked from tluck/Lenovo-T460-Clover
-
-
Notifications
You must be signed in to change notification settings - Fork 12
/
SSDT-KBRD.dsl
354 lines (324 loc) · 11.6 KB
/
SSDT-KBRD.dsl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
// SSDT for T460 Keyboard Map & Configuration.
DefinitionBlock("", "SSDT", 2, "T460", "KBRD", 0)
{
// External references to EC, keyboard, and original methods.
External (\_SB.PCI0.LPC.EC, DeviceObj)
External (\_SB.PCI0.LPC.KBD, DeviceObj)
External (\_SB.PCI0.LPC.EC.XQ6A, MethodObj)
External (\_SB.PCI0.LPC.EC.XQ15, MethodObj)
External (\_SB.PCI0.LPC.EC.XQ14, MethodObj)
External (\_SB.PCI0.LPC.EC.XQ16, MethodObj)
External (\_SB.PCI0.LPC.EC.XQ64, MethodObj)
External (\_SB.PCI0.LPC.EC.XQ66, MethodObj)
External (\_SB.PCI0.LPC.EC.XQ67, MethodObj)
External (\_SB.PCI0.LPC.EC.XQ68, MethodObj)
External (\_SB.PCI0.LPC.EC.XQ69, MethodObj)
External (\_SB.PCI0.LPC.EC.XQ1F, MethodObj)
External (\_SB.PCI0.LPC.EC.XQ74, MethodObj)
External (\_SB.PCI0.LPC.EC.HKEY.MMTS, MethodObj)
External (\_SB.PCI0.LPC.EC.HKEY.MLCS, MethodObj)
External (\_SB.PCI0.LPC.EC.HKEY.MHKQ, MethodObj)
External (_SI._SST, MethodObj)
Scope (\)
{
// This ACPI reserved method is run once before sleep and once after awakened
Method (_TTS, 1, NotSerialized)
{
If (_OSI ("Darwin"))
{
// Arg0 contains the system state of transition
// for wake state it is Zero.
If (Arg0 == Zero & \_SB.PCI0.LPC.EC.LED1 == One)
{
\_SB.PCI0.LPC.EC.HKEY.MMTS (0x02)
}
}
}
}
Scope (\_SB.PCI0.LPC.EC)
{
Name (LED1, Zero)
// _Q6A - (Fn+F4) microphone mute key.
Method(_Q6A, 0, NotSerialized)
{
If (_OSI ("Darwin"))
{
// Toggle Mute Microphone LED
If ((LED1 == Zero))
{
// Right Shift + F20
Notify (\_SB.PCI0.LPC.KBD, 0x0136)
Notify (\_SB.PCI0.LPC.KBD, 0x036b)
Notify (\_SB.PCI0.LPC.KBD, 0x01b6)
// 0x02 = Enable LED
\_SB.PCI0.LPC_.EC.HKEY.MMTS (0x02)
LED1 = One
}
Else
{
// Left Shift + F20
Notify (\_SB.PCI0.LPC.KBD, 0x012a)
Notify (\_SB.PCI0.LPC.KBD, 0x036b)
Notify (\_SB.PCI0.LPC.KBD, 0x01aa)
// 0x00 = Disable LED
\_SB.PCI0.LPC_.EC.HKEY.MMTS (Zero)
LED1 = Zero
}
}
Else
{
// Call original _Q6A method.
\_SB.PCI0.LPC_.EC.XQ6A()
}
}
// _Q15 - (Fn+F5) brightness down key.
Method (_Q15, 0, NotSerialized)
{
If (_OSI ("Darwin"))
{
// Send a one-shot event (down then up) for scancode e0 05 to keyboard device. This
// is picked up by VoodooPS2 and sent to macOS as the F14 (brightness down) key.
Notify (\_SB.PCI0.LPC.KBD, 0x0405)
}
Else
{
// Call original _Q15 method.
\_SB.PCI0.LPC.EC.XQ15 ()
}
}
// _Q14 - (Fn+F6) brightness up key.
Method (_Q14, 0, NotSerialized)
{
If (_OSI ("Darwin"))
{
// Send a one-shot event (down then up) for scancode e0 06 to keyboard device. This
// is picked up by VoodooPS2 and sent to macOS as the F15 (brightness up) key.
Notify (\_SB.PCI0.LPC.KBD, 0x0406)
}
Else
{
// Call original _Q14 method.
\_SB.PCI0.LPC.EC.XQ14 ()
}
}
// _Q16 - (Fn+F7) projector key.
Method(_Q16, 0, NotSerialized)
{
If (_OSI ("Darwin"))
{
// Send a one-shot event (down then up) for scancode 67 to keyboard device. This
// is picked up by VoodooPS2 and sent to macOS as the F16 key.
Notify (\_SB.PCI0.LPC.KBD, 0x0367)
}
Else
{
// Call original _Q16 method.
\_SB.PCI0.LPC.EC.XQ16 ()
}
}
// _Q64 - (Fn+F8) Wireless disable key.
Method(_Q64, 0, NotSerialized)
{
If (_OSI ("Darwin"))
{
// Send a one-shot event (down then up) for scancode 68 to keyboard device. This
// is picked up by VoodooPS2 and sent to macOS as the F17 key.
Notify (\_SB.PCI0.LPC.KBD, 0x0368)
}
Else
{
// Call original _Q64 method.
\_SB.PCI0.LPC.EC.XQ64 ()
}
}
// _Q66 - (Fn+F9) Settings key.
Method(_Q66, 0, NotSerialized)
{
If (_OSI ("Darwin"))
{
// Send a one-shot event (down then up) for scancode 69 to keyboard device. This
// is picked up by VoodooPS2 and sent to macOS as the F18 key.
Notify (\_SB.PCI0.LPC.KBD, 0x0369)
}
Else
{
// Call original _Q66 method.
\_SB.PCI0.LPC.EC.XQ66 ()
}
}
// _Q67 - (Fn+F10) Search key.
Method(_Q67, 0, NotSerialized)
{
If (_OSI ("Darwin"))
{
// Send a down event for the Alt key (scancode e0 5b), then a one-shot event (down then up) for
// the spacebar (scancode 39), and finally an up event for the Alt key (break scancode e0 db).
// This is picked up by VoodooPS2 and sent to macOS as the Command+Space key combo for Spotlight.
Notify (\_SB.PCI0.LPC.KBD, 0x0138)
Notify (\_SB.PCI0.LPC.KBD, 0x0339)
Notify (\_SB.PCI0.LPC.KBD, 0x01b8)
}
Else
{
// Call original _Q67 method.
\_SB.PCI0.LPC.EC.XQ67 ()
}
}
// _Q68 - (Fn+F11) App switcher key.
Method(_Q68, 0, NotSerialized)
{
If (_OSI ("Darwin"))
{
// Send a down event for the Control key (scancode 1d), then a one-shot event (down then up) for
// the up arrow key (scancode 0e 48), and finally an up event for the Control key (break scancode 9d).
// This is picked up by VoodooPS2 and sent to macOS as the Control+Up key combo for Mission Control.
Notify (\_SB.PCI0.LPC.KBD, 0x011d)
Notify (\_SB.PCI0.LPC.KBD, 0x0448)
Notify (\_SB.PCI0.LPC.KBD, 0x019d)
}
Else
{
// Call original _Q68 method.
\_SB.PCI0.LPC.EC.XQ68 ()
}
}
// _Q69 - (Fn+F12) Start screen key.
Method(_Q69, 0, NotSerialized)
{
If (_OSI ("Darwin"))
{
// Send a one-shot event (down then up) for scancode 6a to keyboard device. This
// is picked up by VoodooPS2 and sent to macOS as the F19 key.
Notify (\_SB.PCI0.LPC.KBD, 0x036a)
}
Else
{
// Call original _Q69 method.
\_SB.PCI0.LPC.EC.XQ69 ()
}
}
Name (LED2, Zero)
// _Q1F - (Fn+Space) Toggle Keyboard Backlight.
Method (_Q1F, 0, NotSerialized) // cycle keyboard backlight
{
If (_OSI ("Darwin"))
{
// Cycle keyboard backlight states
If ((LED2 == Zero))
{
// Right Shift + F16.
Notify (\_SB.PCI0.LPC.KBD, 0x0136)
Notify (\_SB.PCI0.LPC.KBD, 0x0367)
Notify (\_SB.PCI0.LPC.KBD, 0x01b6)
// Off to dim
\_SB.PCI0.LPC.EC.HKEY.MLCS (One)
LED2 = One
}
Else
{
If ((LED2 == One))
{
// Left Shift + F19.
Notify (\_SB.PCI0.LPC.KBD, 0x012a)
Notify (\_SB.PCI0.LPC.KBD, 0x036a)
Notify (\_SB.PCI0.LPC.KBD, 0x01aa)
// dim to bright
\_SB.PCI0.LPC.EC.HKEY.MLCS (0x02)
LED2 = 2
}
Else
{
If ((LED2 == 2))
{
// Left Shift + F16.
Notify (\_SB.PCI0.LPC.KBD, 0x012a)
Notify (\_SB.PCI0.LPC.KBD, 0x0367)
Notify (\_SB.PCI0.LPC.KBD, 0x01aa)
// bright to off
\_SB.PCI0.LPC.EC.HKEY.MLCS (Zero)
LED2 = Zero
}
Else
{
// Call original _Q6A method.
\_SB.PCI0.LPC.EC.XQ1F()
}
}
}
}
}
Name (LED3, Zero)
Method (_Q74, 0, NotSerialized) // FnLock (Fn + Esc)
{
If (_OSI ("Darwin"))
{
// Toggle FnLock LED
If ((LED3 == Zero))
{
// Right Shift + F18
Notify (\_SB.PCI0.LPC.KBD, 0x012A)
Notify (\_SB.PCI0.LPC.KBD, 0x0369)
Notify (\_SB.PCI0.LPC.KBD, 0x01aa)
// 0x02 = Enable LED
\_SB.PCI0.LPC.EC.HKEY.MHKQ (0x02)
LED3 = One
}
Else
{
// Left Shift + F18
Notify (\_SB.PCI0.LPC.KBD, 0x0136)
Notify (\_SB.PCI0.LPC.KBD, 0x0369)
Notify (\_SB.PCI0.LPC.KBD, 0x01b6)
// 0x00 = Disable LED
\_SB.PCI0.LPC.EC.HKEY.MHKQ (Zero)
LED3 = Zero
}
}
Else
{
// Call original _Q74 method.
\_SB.PCI0.LPC.EC.XQ74()
}
}
}
Scope (\_SB.PCI0.LPC.KBD)
{
If (_OSI ("Darwin"))
{
// Lenovo ThinkPad T460 Configuration Load
// Select specific items in VoodooPS2Controller
Method(_DSM, 4, NotSerialized)
{
If (!Arg2)
{
Return (Buffer ()
{
0x03
})
}
Return (Package ()
{
"RM,oem-id", "LENOVO",
"RM,oem-table-id", "T460",
})
}
// Overrides for settings in the Info.plist files
Name(RMCF, Package()
{
"Keyboard", Package ()
{
"ActionSwipeLeft", "37 d, 21 d, 21 u, 37 u",
"ActionSwipeRight", "37 d, 1e d, 1e u, 37 u",
"SleepPressTime", "1500",
"Swap command and option", ">y",
"Custom PS2 Map", Package()
{
Package(Zero) { },
"e038=e05b", //AltGr=Left Windows
"e037=64", // PrtSc=F13,via SysPrefs->Keyboard->Shortcuts
},
},
})
}
}
}