Phần 1: Chuẩn bị

B1: Tải ProperTree.

B2: Tải Platforms.xml.

B3: Tải layout11.xml (Realtek) hoặc layout26.xml (Conexant và IDT).

B4: Tải Hackintool.

B5: Tải ISO Linux (mình khuyến khích dùng Ubuntu).

B6: Tải AppleALC Repo và Lilu sau đó giải nén.

B7: Tải Xcode.

Phần 2: Dump Codec

B1: Các bạn cần quan tâm loại Linux để có thể Dump Codec (bạn có thể dùng WSL hoặc là chạy Live trên USB).

B2: Các bạn mở terminal lên và gõ:

cat /proc/asound/card0/codec#0 > ~/Desktop/codec_dump_0.txt 
hoặc
cat /proc/asound/card0/codec1 > ~/Desktop/codec_dump_1.txt 
hoặc
cat /proc/asound/card0/codec#2 > ~/Desktop/codec_dump_2.txt
Do ở đây mình Custom giao diện cho giống macOS nha bắt buộc các bạn phải dùng Linux nhé.

Các bạn giải nén file CodecDump.zip để lấy file Codec nhé.

Ở đây ta cần chú ý

  • Codec
  • Address
  • Vendor
  • Codec verb

Phần 3: Patch Vendor ID

B1: Các bạn tiến hành chuyển vendor sang Decimal (số thập phân).

Ở đây mình khuyến khích dùng Hackintool.

B2: Các bạn tiến hành Add Vendor ID (vào file layout# vừa tải ở trên | add vào dòng codec).

Phần 4: Xác định Codec Verb

B1: Mở file vừa Dump Codec ở trên ra và Search Pin Complex sau đó Copy ra 1 file riêng mình tạm đặt tên là file Pin Complex tiếp đó các bạn Search trong file Pin Complex [N/A] dòng nào có thì xóa Node đó đi cuối cùng ta được:

Node 0x12 [Pin Complex] wcaps 0x40040b: Stereo Amp-In
   Control: name="Internal Mic Boost Volume", index=0, device=0
     ControlAmp: chs=3, dir=In, idx=0, ofs=0
   Amp-In caps: ofs=0x00, nsteps=0x03, stepsize=0x27, mute=0
   Amp-In vals:  [0x00 0x00]
   Pincap 0x00000020: IN
   Pin Default 0x90a60160: [Fixed] Mic at Int N/A
     Conn = Digital, Color = Unknown
     DefAssociation = 0x6, Sequence = 0x0
     Misc = NO_PRESENCE
   Pin-ctls: 0x20: IN
   Power states:  D0 D1 D2 D3 EPSS
   Power: setting=D0, actual=D0

 Node 0x14 [Pin Complex] wcaps 0x40058d: Stereo Amp-Out
   Control: name="Speaker Playback Switch", index=0, device=0
     ControlAmp: chs=3, dir=Out, idx=0, ofs=0
   Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
   Amp-Out vals:  [0x00 0x00]
   Pincap 0x00010014: OUT EAPD Detect
   EAPD 0x2: EAPD
   Pin Default 0x90170120: [Fixed] Speaker at Int N/A
     Conn = Analog, Color = Unknown
     DefAssociation = 0x2, Sequence = 0x0
     Misc = NO_PRESENCE
   Pin-ctls: 0x40: OUT
   Unsolicited: tag=00, enabled=0
   Power states:  D0 D1 D2 D3 EPSS
   Power: setting=D0, actual=D0
   Connection: 1
      0x0c

 Node 0x21 [Pin Complex] wcaps 0x40058d: Stereo Amp-Out
   Control: name="Headphone Playback Switch", index=0, device=0
     ControlAmp: chs=3, dir=Out, idx=0, ofs=0
   Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
   Amp-Out vals:  [0x80 0x80]
   Pincap 0x0001001c: OUT HP EAPD Detect
   EAPD 0x2: EAPD
   Pin Default 0x02211030: [Jack] HP Out at Ext Front
     Conn = 1/8, Color = Black
     DefAssociation = 0x3, Sequence = 0x0
   Pin-ctls: 0xc0: OUT HP
   Unsolicited: tag=01, enabled=1
   Power states:  D0 D1 D2 D3 EPSS
   Power: setting=D0, actual=D0
   Connection: 2
      0x0c 0x0d*

Node 0x19 [Pin Complex] wcaps 0x40048b: Stereo Amp-In
   Control: name="Headset Mic Boost Volume", index=0, device=0
     ControlAmp: chs=3, dir=In, idx=0, ofs=0
   Amp-In caps: ofs=0x00, nsteps=0x03, stepsize=0x27, mute=0
   Amp-In vals:  [0x00 0x00]
   Pincap 0x00003724: IN Detect
     Vref caps: HIZ 50 GRD 80 100
   Pin Default 0x411111f0: [N/A] Speaker at Ext Rear
     Conn = 1/8, Color = Black
     DefAssociation = 0xf, Sequence = 0x0
     Misc = NO_PRESENCE
   Pin-ctls: 0x24: IN VREF_80
   Unsolicited: tag=00, enabled=0
   Power states:  D0 D1 D2 D3 EPSS
   Power: setting=D0, actual=D0

 Node 0x1a [Pin Complex] wcaps 0x40048b: Stereo Amp-In
   Control: name="Headphone Mic Boost Volume", index=0, device=0
     ControlAmp: chs=3, dir=In, idx=0, ofs=0
   Amp-In caps: ofs=0x00, nsteps=0x03, stepsize=0x27, mute=0
   Amp-In vals:  [0x00 0x00]
   Pincap 0x00003724: IN Detect
     Vref caps: HIZ 50 GRD 80 100
   Pin Default 0x411111f0: [N/A] Speaker at Ext Rear
     Conn = 1/8, Color = Black
     DefAssociation = 0xf, Sequence = 0x0
     Misc = NO_PRESENCE
   Pin-ctls: 0x20: IN VREF_HIZ
   Unsolicited: tag=00, enabled=0
   Power states:  D0 D1 D2 D3 EPSS
   Power: setting=D0, actual=D0

B2: Các bạn xuất verb data + pin default + node.

  • Để xuất verb data các bạn sẽ chia pin default thành các cặp và đọc ngược từ phải sang trái.
0x90170120 --> 90170120 ( xóa 0x )
90170120 --> 90 17 01 20 ( tách thành từng cặp )
90 17 01 20 --> 20 01 17 90 ( đọc ngược )
20 01 17 90 --> 20011790 ( ta được verb data )

B3: Các bạn tìm từ khóa Headset Mic Boost VolumeHeadphone Mic Boost Volume trong file Pin Complex và copy nó ra 1 file mới mình tạm gọi là file Jack Combo.

Ta có các Codec Verb được chia như sau:

// các  codec verb thông thường

Node 14 : Pin Default 0x90170120 Verb data: 20 01 17 90 

Node 21 : Pin Default 0x02211030 Verb data: 30 10 21 02

Node 12 : Pin Default 0x90a60160 Verb data: 60 01 a6 90

// jack combo ( gòm mic và tai nghe ngoài )

Node 19 : Pin Default 0x411111f0 Verb data: f0 11 11 41 

Node 1a : Pin Default 0x411111f0 Verb data: f0 11 11 41 

Phần 5: Chỉnh sửa Codec Verb

B1: Ta sẽ nhìn vào cặp đầu tiên của các Node đã xác định ở trên:

// các  codec verb thông thường

Node 14 Verb data: 20 01 17 90 

Node 21 Verb data: 30 10 21 02

Node 12 Verb data: 60 01 a6 90

// jack combo ( gòm mic và tai nghe ngoài )

Node 19 Verb data: f0 11 11 41 

Node 1a Verb data: f0 11 11 41 

B2: Ở đây mình tạm gọi giá trị đầu tiên trong các cặp đã xác định ở bước 1 là x (2, 3, 6, f, f) và giá trị thứ 2 của các cặp đã xác định ở trên là y (0, 0, 0, 0, 0)

Vậy X và Y có ý nghĩa gì ?

  • X: Là thông tin port ( ở đây các thông tin port không được trùng nhau vd như 50, 50, 20 ta có 2 lần giá trị 5 xuất hiện ở X thì các bạn phải đổi 1 giá trị thành 1 giá trị khác bất kì miễn là không trùng lặp vd ở đây ta có 50, 30, 20 )
  • Y: Là thông tin kênh ( các bạn chỉnh hết về 0 )

Tổng kết lại ta có:

// các  codec verb thông thường

Node 14 Verb data: 20 01 17 90 

Node 21 Verb data: 30 10 21 02

Node 12 Verb data: 60 01 a6 90

// jack combo ( gòm mic và tai nghe ngoài )

Node 19 Verb data: 70 11 11 41 ( do 2 giá trị f trùng nhau nên mình đổi 1 giá trị thành 7 )

Node 1a Verb data: f0 11 11 41 

B3: Ta tiếp tục làm việc với cặp giá trị thứ 2:

// các  codec verb thông thường

Node 14 Verb data: 20 01 17 90 

Node 21 Verb data: 30 10 21 02

Node 12 Verb data: 60 01 a6 90

// jack combo ( gòm mic và tai nghe ngoài )

Node 19 Verb data: f0 11 11 41 

Node 1a Verb data: f0 11 11 41 

Mình cũng sẽ tiếp tục gọi là X ( 0, 1, 0, 1, 1 ) và Y ( 1, 0, 1, 1, 1)

Ta có:

  • X là màu của jack ( dựa vào bảng dưới để xác định màu )
Unknown 0 
Black 1 
Grey 2
Blue 3 
Green 4
Red 5
Orange 6
Yellow 7
Purple 8
Pink 9
Reserved A-D
White E
Other F
  • Y là thông tin jack cắm ( external là 0 và internal là 1 )

Tổng kết:

// các  codec verb thông thường

Node 14 Verb data: 20 01 17 90 

Node 21 Verb data: 30 10 21 02

Node 12 Verb data: 60 01 a6 90

// jack combo ( gòm mic và tai nghe ngoài )

Node 19 Verb data: f0 10 11 41 ( ta chuyển y về 0 vì đây là external )

Node 1a Verb data: f0 00 11 41 ( ta chuyển x về 0 để ngăn chặn rè, hú,.... Y chuyển về 0 vì đây là external )

B4: Tiếp tục làm việc với cặp giá trị thứ 3:

// các  codec verb thông thường

Node 14 Verb data: 20 01 17 90 

Node 21 Verb data: 30 10 21 02

Node 12 Verb data: 60 01 a6 90

// jack combo ( gồm mic và tai nghe ngoài )

Node 19 Verb data: f0 10 11 41

Node 1a Verb data: f0 00 11 41

Ta vẫn sẽ gọi X và Y

  • X là thiết bị âm thanh ( xem bảng dưới để xác định )
Line Out: 0 
Speaker:  1 
HP Out: 2 
CD: 3 
SPDIF Out: 4 
Digital Other Out: 5 
Modem Line Side: 6 
Modem Handset Side: 7 
Line In: 8 
AUX: 9 
Mic In: A 
Telephony: B 
SPDIF In: C 
Digital Other In: D 
Reserved: E 
Other: F
  • Y là cổng kết nối âm thanh ( xem bảng dưới để xác định )
Unknown: 0  
1/8" stereo/mono: 1 
1/4" stereo/mono: 2 
ATAPI internal: 3 
RCA: 4 
Optical: 5 
Other Digital: 6 
Other Analog: 7 
Multichannel Analog (DIN): 8 
XLR/Professional: 9 
RJ-11 (Modem): A 
Combination: B  
Other: F

Tổng kết:

// các  codec verb thông thường

Node 14 Verb data: 20 01 17 90 

Node 21 Verb data: 30 10 21 02

Node 12 Verb data: 60 01 a6 90

// jack combo ( gồm mic và tai nghe ngoài )

Node 19 Verb data: f0 10 ab 41 ( X ở đây mình cho a để nó nhận mic còn Y cho B để nó liên kết với node 21 )

Node 1a Verb data: f0 00 00 41 ( X ở đây mình cho là 0 để nó nhận là line out va Y ở đây cũng cho là 0 )

B5: Ta tiếp tục làm việc với cặp giá trị cuối cùng:

  • X là Port Connectivity ( giúp ứng dụng biết đang kết nói vói speaker, hp hay line in )
  • Y là vị trí port
//*
ta lấy xy chuyển về dạng nhị phân ( dùng hackintool )

sau đó thêm các số 0 vào trước dãy số đến khi nào đủ 8 chữ số trong dãy số
tiếp theo bạn tách dãy số từ trái sang phải theo quy tắt 2-2-4 
Sau đó thay X và Y lần lượt theo bảng sau 
Ví dụ:
01011001 --> 01 01 1001
*//

Port Connectivity bits 7:6 
-----------------------------------------------------------
00 - Port is connected to a Jack
01 - No External Port -or- No physical connection for Port  
10 - Fixed Function/Built In Device (integrated speaker, mic, etc)
11 - Jack and Internal device are attached 

Location Part 1 - bits 5:4
-----------------------------------------------------------
00 - External on primary chassis
01 - Internal
10 - Separate chassis
11 - Other

Location Part 2 - bits 3:0
-----------------------------------------------------------
The meaning depends on Location Part 1 

00 0000	N/A
00 0001   Rear
00 0010   Front
00 0011   Left
00 0100   Right
00 0101   Top
00 0110   Bottom
00 0111   Special (Rear panel)
00 1000   Special (Drive bay)

01 0000   N/A
01 0111   Special (Riser)
01 1000   HDMI
01 1001   ATAPI

10 0000	N/A
10 0001   Rear
10 0010   Front
10 0011   Left
10 0100   Right
10 0101   Top
10 0110   Bottom

11 0000   N/A
11 0110   ?
11 0111   Inside Mobile Lid (example: mic)
11 1000   Outside Mobile Lid

		Bits
Hex	  76 54 3210
-------------------
71cf01 = 00 00 0001 - Port has a jack - It is External - Rear Location
71cf02 = 00 00 0010 - Port has a jack - It is External - Front Panel Location 
71cf59 = 01 01 1001 - No External Port - ATAPI 
71cf18 = 00 01 1000 - Port has a jack - External - HDMI
71cf90 = 10 01 0000 - Built In Device - Internal - N/A 
	   |  |  ||||
	   |  |  |--------- Location part 2
	   |  |------------ Location part 1  
	   |--------------- Port Connectivity

Tổng kết cuối cùng ta được:

Node 14 : Verb data: 20 01 17 90 
Node 21 : Verb data: 30 10 21 02
Node 12 : Verb data: 60 01 a0 90
Node 19 : Verb data: 70 10 ab 02 
Node 1a : Verb data: f0 00 00 40 

Phần 6: Patch Codec Verb

Cách tính Codec Verb:

Codec Verb = Codec Address + NodeID + Verb Commands + Verb data.

  • Codec address: đã xác định ở trên.
  • Node ID: đã xác định ở trên.
  • Verb command: sẽ là luôn phiên theo thứ tự 71c, 71d, 71e, 71f và 70c dành cho EAPD (tự động chuyển giữa speaker và headphone).
  • Verb data: đã xác định ở trên.

Tiến hành thôi:

  • Node 14:
0 + 14 + 71c + 20 = 01471c20

0 + 14 + 71d + 01 = 01471d01

0 + 14 + 71e + 17 = 01471e17

0 + 14 + 71f + 90 = 01471f90

0 + 14 + 70c + 02 = 01470c02
 

// ở đây mình thêm dòng 01470c02 nhầm kích hoạt EAPD các bạn có thể đổi node id thành node id card âm thanh của các bạn
  • Node 21:
0 + 21 + 71c + 30 = 02171c30

0 + 21 + 71d + 10 = 02171d10

0 + 21 + 71e + 21 = 02171e21

0 + 21 + 71f + 02 = 02171f02
  • Node 12:
0 + 12 + 71c + 60 = 01271c60

0 + 12 + 71d + 01 = 01271d01

0 + 12 + 71e + a0 = 01271ea0

0 + 12 + 71f + 90 = 01271f90
  • Node 19:
0 + 19 + 71c + 70 = 01971c70

0 + 19 + 71d + 10 = 01971d10

0 + 19 + 71e + ab = 01971eab

0 + 19 + 71f + 02 = 01971f02
  • Node 1a:
0 + 1a + 71c + f0 = 01a71cf0

0 + 1a + 71d + 00 = 01a71d00

0 + 1a + 71e + 00 = 01a71e00

0 + 1a + 71f + 40 = 01a71f40

Bây giờ ta tiến hành sắp xếp lại chúng:

01471c20 01471d01 01471e17 01471f90 01470c02 02171c30 02171d10 02171e21 02171f02 01271c60 01271d01 01271ea0 01271f90 01971c70 01971d10 01971eab 01971f02 01a71cf0 01a71d00 01a71e00 01a71f40

Phần 7: Xác định Path Map

Ta có công thức:

  • Speaker và HP: Pin Complex --> ( Audio Mixer ) --> Audio Output ( Audio Mixer có thể có hoặc không )
  • Mic, LineIn và jack combo:  Audio Input --> ( Audio Selector/Mixer ) --> Pin Complex ( Audio selector/mixer có thể có hoặc không )

Xác định Node:

B1: Các bạn sẽ tận dụng lại file Pin Complex xác định ở Phần 4:

Node 0x12 [Pin Complex] wcaps 0x40040b: Stereo Amp-In
   Control: name="Internal Mic Boost Volume", index=0, device=0
     ControlAmp: chs=3, dir=In, idx=0, ofs=0
   Amp-In caps: ofs=0x00, nsteps=0x03, stepsize=0x27, mute=0
   Amp-In vals:  [0x00 0x00]
   Pincap 0x00000020: IN
   Pin Default 0x90a60160: [Fixed] Mic at Int N/A
     Conn = Digital, Color = Unknown
     DefAssociation = 0x6, Sequence = 0x0
     Misc = NO_PRESENCE
   Pin-ctls: 0x20: IN
   Power states:  D0 D1 D2 D3 EPSS
   Power: setting=D0, actual=D0

 Node 0x14 [Pin Complex] wcaps 0x40058d: Stereo Amp-Out
   Control: name="Speaker Playback Switch", index=0, device=0
     ControlAmp: chs=3, dir=Out, idx=0, ofs=0
   Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
   Amp-Out vals:  [0x00 0x00]
   Pincap 0x00010014: OUT EAPD Detect
   EAPD 0x2: EAPD
   Pin Default 0x90170120: [Fixed] Speaker at Int N/A
     Conn = Analog, Color = Unknown
     DefAssociation = 0x2, Sequence = 0x0
     Misc = NO_PRESENCE
   Pin-ctls: 0x40: OUT
   Unsolicited: tag=00, enabled=0
   Power states:  D0 D1 D2 D3 EPSS
   Power: setting=D0, actual=D0
   Connection: 1
      0x0c

 Node 0x21 [Pin Complex] wcaps 0x40058d: Stereo Amp-Out
   Control: name="Headphone Playback Switch", index=0, device=0
     ControlAmp: chs=3, dir=Out, idx=0, ofs=0
   Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
   Amp-Out vals:  [0x80 0x80]
   Pincap 0x0001001c: OUT HP EAPD Detect
   EAPD 0x2: EAPD
   Pin Default 0x02211030: [Jack] HP Out at Ext Front
     Conn = 1/8, Color = Black
     DefAssociation = 0x3, Sequence = 0x0
   Pin-ctls: 0xc0: OUT HP
   Unsolicited: tag=01, enabled=1
   Power states:  D0 D1 D2 D3 EPSS
   Power: setting=D0, actual=D0
   Connection: 2
      0x0c 0x0d*

Node 0x19 [Pin Complex] wcaps 0x40048b: Stereo Amp-In
   Control: name="Headset Mic Boost Volume", index=0, device=0
     ControlAmp: chs=3, dir=In, idx=0, ofs=0
   Amp-In caps: ofs=0x00, nsteps=0x03, stepsize=0x27, mute=0
   Amp-In vals:  [0x00 0x00]
   Pincap 0x00003724: IN Detect
     Vref caps: HIZ 50 GRD 80 100
   Pin Default 0x411111f0: [N/A] Speaker at Ext Rear
     Conn = 1/8, Color = Black
     DefAssociation = 0xf, Sequence = 0x0
     Misc = NO_PRESENCE
   Pin-ctls: 0x24: IN VREF_80
   Unsolicited: tag=00, enabled=0
   Power states:  D0 D1 D2 D3 EPSS
   Power: setting=D0, actual=D0

 Node 0x1a [Pin Complex] wcaps 0x40048b: Stereo Amp-In
   Control: name="Headphone Mic Boost Volume", index=0, device=0
     ControlAmp: chs=3, dir=In, idx=0, ofs=0
   Amp-In caps: ofs=0x00, nsteps=0x03, stepsize=0x27, mute=0
   Amp-In vals:  [0x00 0x00]
   Pincap 0x00003724: IN Detect
     Vref caps: HIZ 50 GRD 80 100
   Pin Default 0x411111f0: [N/A] Speaker at Ext Rear
     Conn = 1/8, Color = Black
     DefAssociation = 0xf, Sequence = 0x0
     Misc = NO_PRESENCE
   Pin-ctls: 0x20: IN VREF_HIZ
   Unsolicited: tag=00, enabled=0
   Power states:  D0 D1 D2 D3 EPSS
   Power: setting=D0, actual=D0

B2: Các bạn tìm từ khóa Audio MixerAudio Selector trong file codec được dump ở Phần 1:

Node 0x0b [Audio Mixer] wcaps 0x20010b: Stereo Amp-In
   Control: name="Headset Mic Playback Volume", index=0, device=0
     ControlAmp: chs=3, dir=In, idx=1, ofs=0
   Control: name="Headset Mic Playback Switch", index=0, device=0
     ControlAmp: chs=3, dir=In, idx=1, ofs=0
   Control: name="Headphone Mic Playback Volume", index=0, device=0
     ControlAmp: chs=3, dir=In, idx=2, ofs=0
   Control: name="Headphone Mic Playback Switch", index=0, device=0
     ControlAmp: chs=3, dir=In, idx=2, ofs=0
   Control: name="Beep Playback Volume", index=0, device=0
     ControlAmp: chs=3, dir=In, idx=4, ofs=0
   Control: name="Beep Playback Switch", index=0, device=0
     ControlAmp: chs=3, dir=In, idx=4, ofs=0
   Amp-In caps: ofs=0x17, nsteps=0x1f, stepsize=0x05, mute=1
   Amp-In vals:  [0x80 0x80] [0x80 0x80] [0x80 0x80] [0x80 0x80] [0x80 0x80]
   Connection: 5
      0x18 0x19 0x1a 0x1b 0x1d
 Node 0x0c [Audio Mixer] wcaps 0x20010b: Stereo Amp-In
   Amp-In caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
   Amp-In vals:  [0x00 0x00] [0x80 0x80]
   Connection: 2
      0x02 0x0b
 Node 0x0d [Audio Mixer] wcaps 0x20010b: Stereo Amp-In
   Amp-In caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
   Amp-In vals:  [0x00 0x00] [0x80 0x80]
   Connection: 2
      0x03 0x0b
 Node 0x0f [Audio Mixer] wcaps 0x20010a: Mono Amp-In
   Amp-In caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
   Amp-In vals:  [0x00 0x00]
   Connection: 1
      0x0d
Node 0x22 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In
   Amp-In caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
   Amp-In vals:  [0x80 0x80] [0x80 0x80] [0x80 0x80] [0x80 0x80] [0x80 0x80] [0x80 0x80]
   Connection: 6
      0x18 0x19 0x1a 0x1b 0x1d 0x0b
 Node 0x23 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In
   Amp-In caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
   Amp-In vals:  [0x80 0x80] [0x80 0x80] [0x80 0x80] [0x80 0x80] [0x80 0x80] [0x80 0x80] [0x00 0x00]
   Connection: 7
      0x18 0x19 0x1a 0x1b 0x1d 0x0b 0x12

B3: Các bạn tìm từ khóa Audio input trong file Codec Dump ở Phần 1:

Node 0x02 [Audio Output] wcaps 0x41d: Stereo Amp-Out
   Control: name="Speaker Playback Volume", index=0, device=0
     ControlAmp: chs=3, dir=Out, idx=0, ofs=0
   Amp-Out caps: ofs=0x57, nsteps=0x57, stepsize=0x02, mute=0
   Amp-Out vals:  [0x3c 0x3c]
   Converter: stream=1, channel=0
   PCM:
     rates [0x60]: 44100 48000
     bits [0xe]: 16 20 24
     formats [0x1]: PCM
   Power states:  D0 D1 D2 D3 EPSS
   Power: setting=D0, actual=D0
 Node 0x03 [Audio Output] wcaps 0x41d: Stereo Amp-Out
   Control: name="Headphone Playback Volume", index=0, device=0
     ControlAmp: chs=3, dir=Out, idx=0, ofs=0
   Device: name="ALC3234 Analog", type="Audio", device=0
   Amp-Out caps: ofs=0x57, nsteps=0x57, stepsize=0x02, mute=0
   Amp-Out vals:  [0x00 0x00]
   Converter: stream=1, channel=0
   PCM:
     rates [0x60]: 44100 48000
     bits [0xe]: 16 20 24
     formats [0x1]: PCM
   Power states:  D0 D1 D2 D3 EPSS
   Power: setting=D0, actual=D0
 Node 0x06 [Audio Output] wcaps 0x611: Stereo Digital
   Converter: stream=0, channel=0
   Digital:
   Digital category: 0x0
   IEC Coding Type: 0x0
   PCM:
     rates [0x5e0]: 44100 48000 88200 96000 192000
     bits [0xe]: 16 20 24
     formats [0x1]: PCM
   Power states:  D0 D1 D2 D3 EPSS
   Power: setting=D0, actual=D0

Tiến hành thôi:

  • Speaker:

B1: Mở file pin complex và search Speaker:

Node 0x14 [Pin Complex] wcaps 0x40058d: Stereo Amp-Out
   Control: name="Speaker Playback Switch", index=0, device=0
     ControlAmp: chs=3, dir=Out, idx=0, ofs=0
   Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
   Amp-Out vals:  [0x00 0x00]
   Pincap 0x00010014: OUT EAPD Detect
   EAPD 0x2: EAPD
   Pin Default 0x90170120: [Fixed] Speaker at Int N/A
     Conn = Analog, Color = Unknown
     DefAssociation = 0x2, Sequence = 0x0
     Misc = NO_PRESENCE
   Pin-ctls: 0x40: OUT
   Unsolicited: tag=00, enabled=0
   Power states:  D0 D1 D2 D3 EPSS
   Power: setting=D0, actual=D0
   Connection: 1
      0x0c

Ta có node đầu tiên là của pin comlex tiếp tục các bạn nhìn xuống phầnConnection ta thấy nó được két nối trực tiếp đến node 0x0c

B2: Tiếp tục tìm node 0x0c trong file Audio Mixer.

Node 0x0c [Audio Mixer] wcaps 0x20010b: Stereo Amp-In
   Amp-In caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
   Amp-In vals:  [0x00 0x00] [0x80 0x80]
   Connection: 2
      0x02 0x0b

Ta có thể thấy node 0x0c là của audio mixer và nó được kết nối trực tiếp đến 0x020x0b ta tiếp tục tìm lần lượt 0x020x0b trong file audio out put để xác định đâu là node cần dùng.

Node 0x02 [Audio Output] wcaps 0x41d: Stereo Amp-Out
   Control: name="Speaker Playback Volume", index=0, device=0
     ControlAmp: chs=3, dir=Out, idx=0, ofs=0
   Amp-Out caps: ofs=0x57, nsteps=0x57, stepsize=0x02, mute=0
   Amp-Out vals:  [0x3c 0x3c]
   Converter: stream=1, channel=0
   PCM:
     rates [0x60]: 44100 48000
     bits [0xe]: 16 20 24
     formats [0x1]: PCM
   Power states:  D0 D1 D2 D3 EPSS
   Power: setting=D0, actual=D0

Ta có thể thấy chỉ có node 0x02 được tìm thấy vậy node thứ 3 sẽ là 0x02.

B3: Ta kết nối các dữ kiện lại ta có 0x14 --> 0x0c --> 0x02 chuyển chúng về decimal ta được 20 --> 12 --> 2 (theo quy tắt Pin Complex –> (Audio Mixer) –> Audio Output)

  • HP

B1: Mở file Pin Complex và Search HP

Node 0x21 [Pin Complex] wcaps 0x40058d: Stereo Amp-Out
   Control: name="Headphone Playback Switch", index=0, device=0
     ControlAmp: chs=3, dir=Out, idx=0, ofs=0
   Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
   Amp-Out vals:  [0x80 0x80]
   Pincap 0x0001001c: OUT HP EAPD Detect
   EAPD 0x2: EAPD
   Pin Default 0x02211030: [Jack] HP Out at Ext Front
     Conn = 1/8, Color = Black
     DefAssociation = 0x3, Sequence = 0x0
   Pin-ctls: 0xc0: OUT HP
   Unsolicited: tag=01, enabled=1
   Power states:  D0 D1 D2 D3 EPSS
   Power: setting=D0, actual=D0
   Connection: 2
      0x0c 0x0d*

// dấu hiệu ưu tiên là dấu * vậy node 0x0d sẽ được ưu tiên kết nối

B2: Mở file audio mixer và search 0x0d.

Node 0x0d [Audio Mixer] wcaps 0x20010b: Stereo Amp-In
   Amp-In caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
   Amp-In vals:  [0x00 0x00] [0x80 0x80]
   Connection: 2
      0x03 0x0b

Ta làm tương tự như ở mục speaker ta được 0x03 là node cuối cùng.

B3: Ta hệ thống lại các dữ liệu ta được  0x21 --> 0x0d --> 0x03 chuyển sang Decimal (các chuyển như mục speaker) ta được 33 --> 13 --> 3

  • Mic in

B1: Mở file Complex ra và Search mic ta được:

Node 0x12 [Pin Complex] wcaps 0x40040b: Stereo Amp-In
   Control: name="Internal Mic Boost Volume", index=0, device=0
     ControlAmp: chs=3, dir=In, idx=0, ofs=0
   Amp-In caps: ofs=0x00, nsteps=0x03, stepsize=0x27, mute=0
   Amp-In vals:  [0x00 0x00]
   Pincap 0x00000020: IN
   Pin Default 0x90a60160: [Fixed] Mic at Int N/A
     Conn = Digital, Color = Unknown
     DefAssociation = 0x6, Sequence = 0x0
     Misc = NO_PRESENCE
   Pin-ctls: 0x20: IN
   Power states:  D0 D1 D2 D3 EPSS
   Power: setting=D0, actual=D0

B2: Nhưng ở đây 1 điều kì lạ đã xuất hiện không hề có mục connection vì vậy ta sẽ phải tìm ngược lại tức ta sẽ tìm 0x12 tại audio mixer ta được

Node 0x23 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In
   Amp-In caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
   Amp-In vals:  [0x80 0x80] [0x80 0x80] [0x80 0x80] [0x80 0x80] [0x80 0x80] [0x80 0x80] [0x00 0x00]
   Connection: 7
      0x18 0x19 0x1a 0x1b 0x1d 0x0b 0x12

B3: như vậy node kế tiếp là 0x23 ta tiếp tục tìm 0x23 trong audio in put

Node 0x08 [Audio Input] wcaps 0x10051b: Stereo Amp-In
   Control: name="Capture Volume", index=0, device=0
     ControlAmp: chs=3, dir=In, idx=0, ofs=0
   Control: name="Capture Switch", index=0, device=0
     ControlAmp: chs=3, dir=In, idx=0, ofs=0
   Device: name="ALC3234 Analog", type="Audio", device=0
   Amp-In caps: ofs=0x17, nsteps=0x3f, stepsize=0x02, mute=1
   Amp-In vals:  [0x27 0x27]
   Converter: stream=0, channel=0
   SDI-Select: 0
   PCM:
     rates [0x560]: 44100 48000 96000 192000
     bits [0xe]: 16 20 24
     formats [0x1]: PCM
   Power states:  D0 D1 D2 D3 EPSS
   Power: setting=D0, actual=D0
   Connection: 1
      0x23

Ta có node cuối là 0x08.

B4: Ta tiến hành lắp ghép các dữ kiện 0x08 --> 0x23 --> 0x12 chuyển sang decimal ta được 8 --> 35 --> 18.

  • HeadSet

B1: Mở file jack combo (tạo ở phần 4) ra và search Headset.

Node 0x19 [Pin Complex] wcaps 0x40048b: Stereo Amp-In
   Control: name="Headset Mic Boost Volume", index=0, device=0
     ControlAmp: chs=3, dir=In, idx=0, ofs=0
   Amp-In caps: ofs=0x00, nsteps=0x03, stepsize=0x27, mute=0
   Amp-In vals:  [0x00 0x00]
   Pincap 0x00003724: IN Detect
     Vref caps: HIZ 50 GRD 80 100
   Pin Default 0x411111f0: [N/A] Speaker at Ext Rear
     Conn = 1/8, Color = Black
     DefAssociation = 0xf, Sequence = 0x0
     Misc = NO_PRESENCE
   Pin-ctls: 0x24: IN VREF_80
   Unsolicited: tag=00, enabled=0
   Power states:  D0 D1 D2 D3 EPSS
   Power: setting=D0, actual=D0

B2: Như ở đây ta không thấy connection thì tiếp tục làm như phần mic in ta được:

Node 0x0b [Audio Mixer] wcaps 0x20010b: Stereo Amp-In
   Control: name="Headset Mic Playback Volume", index=0, device=0
     ControlAmp: chs=3, dir=In, idx=1, ofs=0
   Control: name="Headset Mic Playback Switch", index=0, device=0
     ControlAmp: chs=3, dir=In, idx=1, ofs=0
   Control: name="Headphone Mic Playback Volume", index=0, device=0
     ControlAmp: chs=3, dir=In, idx=2, ofs=0
   Control: name="Headphone Mic Playback Switch", index=0, device=0
     ControlAmp: chs=3, dir=In, idx=2, ofs=0
   Control: name="Beep Playback Volume", index=0, device=0
     ControlAmp: chs=3, dir=In, idx=4, ofs=0
   Control: name="Beep Playback Switch", index=0, device=0
     ControlAmp: chs=3, dir=In, idx=4, ofs=0
   Amp-In caps: ofs=0x17, nsteps=0x1f, stepsize=0x05, mute=1
   Amp-In vals:  [0x80 0x80] [0x80 0x80] [0x80 0x80] [0x80 0x80] [0x80 0x80]
   Connection: 5
      0x18 0x19 0x1a 0x1b 0x1d

 Node 0x22 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In
   Amp-In caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
   Amp-In vals:  [0x80 0x80] [0x80 0x80] [0x80 0x80] [0x80 0x80] [0x80 0x80] [0x80 0x80]
   Connection: 6
      0x18 0x19 0x1a 0x1b 0x1d 0x0b

 Node 0x23 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In
   Amp-In caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
   Amp-In vals:  [0x80 0x80] [0x80 0x80] [0x80 0x80] [0x80 0x80] [0x80 0x80] [0x80 0x80] [0x00 0x00]
   Connection: 7
      0x18 0x19 0x1a 0x1b 0x1d 0x0b 0x12

B3: Ta thấy có tới 3 node được kết nối với node 0x19 nhưng nếu để ý thật kỹ thì bạn sẽ thấy node 0x0b sẽ được kết nối tới 2 node là 0x22 và 0x23. Vì vậy ta sẽ loại bỏ nó đi và tìm tiếp 2 node là node 0x22 à node 0x23 trong audio in put ta được.

Node 0x08 [Audio Input] wcaps 0x10051b: Stereo Amp-In
   Control: name="Capture Volume", index=0, device=0
     ControlAmp: chs=3, dir=In, idx=0, ofs=0
   Control: name="Capture Switch", index=0, device=0
     ControlAmp: chs=3, dir=In, idx=0, ofs=0
   Device: name="ALC3234 Analog", type="Audio", device=0
   Amp-In caps: ofs=0x17, nsteps=0x3f, stepsize=0x02, mute=1
   Amp-In vals:  [0x27 0x27]
   Converter: stream=0, channel=0
   SDI-Select: 0
   PCM:
     rates [0x560]: 44100 48000 96000 192000
     bits [0xe]: 16 20 24
     formats [0x1]: PCM
   Power states:  D0 D1 D2 D3 EPSS
   Power: setting=D0, actual=D0
   Connection: 1
      0x23

 Node 0x09 [Audio Input] wcaps 0x10051b: Stereo Amp-In
   Amp-In caps: ofs=0x17, nsteps=0x3f, stepsize=0x02, mute=1
   Amp-In vals:  [0x97 0x97]
   Converter: stream=0, channel=0
   SDI-Select: 0
   PCM:
     rates [0x560]: 44100 48000 96000 192000
     bits [0xe]: 16 20 24
     formats [0x1]: PCM
   Power states:  D0 D1 D2 D3 EPSS
   Power: setting=D0, actual=D0
   Connection: 1
      0x22

B4: Gắn kết dữ liệu ta được 0x08 --> 0x23 --> 0x19 chuyển sang decimal ta có 8 --> 35 --> 25 0x09 --> 0x22 --> 0x19 chuyển sang decimal ta được 9 --> 34 --> 25.

  • Headphone

B1: Mở file jack combo ( tạo ở phần 4 ) lên và Search Headphone ta được:


 Node 0x1a [Pin Complex] wcaps 0x40048b: Stereo Amp-In
   Control: name="Headphone Mic Boost Volume", index=0, device=0
     ControlAmp: chs=3, dir=In, idx=0, ofs=0
   Amp-In caps: ofs=0x00, nsteps=0x03, stepsize=0x27, mute=0
   Amp-In vals:  [0x00 0x00]
   Pincap 0x00003724: IN Detect
     Vref caps: HIZ 50 GRD 80 100
   Pin Default 0x411111f0: [N/A] Speaker at Ext Rear
     Conn = 1/8, Color = Black
     DefAssociation = 0xf, Sequence = 0x0
     Misc = NO_PRESENCE
   Pin-ctls: 0x20: IN VREF_HIZ
   Unsolicited: tag=00, enabled=0
   Power states:  D0 D1 D2 D3 EPSS
   Power: setting=D0, actual=D0

B2: Làm tương tự như Headset vì ở đây cũng không thấy phần connection ta được:

Node 0x0b [Audio Mixer] wcaps 0x20010b: Stereo Amp-In
   Control: name="Headset Mic Playback Volume", index=0, device=0
     ControlAmp: chs=3, dir=In, idx=1, ofs=0
   Control: name="Headset Mic Playback Switch", index=0, device=0
     ControlAmp: chs=3, dir=In, idx=1, ofs=0
   Control: name="Headphone Mic Playback Volume", index=0, device=0
     ControlAmp: chs=3, dir=In, idx=2, ofs=0
   Control: name="Headphone Mic Playback Switch", index=0, device=0
     ControlAmp: chs=3, dir=In, idx=2, ofs=0
   Control: name="Beep Playback Volume", index=0, device=0
     ControlAmp: chs=3, dir=In, idx=4, ofs=0
   Control: name="Beep Playback Switch", index=0, device=0
     ControlAmp: chs=3, dir=In, idx=4, ofs=0
   Amp-In caps: ofs=0x17, nsteps=0x1f, stepsize=0x05, mute=1
   Amp-In vals:  [0x80 0x80] [0x80 0x80] [0x80 0x80] [0x80 0x80] [0x80 0x80]
   Connection: 5
      0x18 0x19 0x1a 0x1b 0x1d

Node 0x22 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In
   Amp-In caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
   Amp-In vals:  [0x80 0x80] [0x80 0x80] [0x80 0x80] [0x80 0x80] [0x80 0x80] [0x80 0x80]
   Connection: 6
      0x18 0x19 0x1a 0x1b 0x1d 0x0b

Node 0x23 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In
   Amp-In caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
   Amp-In vals:  [0x80 0x80] [0x80 0x80] [0x80 0x80] [0x80 0x80] [0x80 0x80] [0x80 0x80] [0x00 0x00]
   Connection: 7
      0x18 0x19 0x1a 0x1b 0x1d 0x0b 0x12

B3: Cũng như phần Headset ta cũng nhận thấy 0x0b được liên kết với 0x22 và 0x23 nên ta sẽ loại bỏ 0x0b đi ta tiếp tục tìm 0x22 và 0x23 trong phần audio in put.

Node 0x08 [Audio Input] wcaps 0x10051b: Stereo Amp-In
   Control: name="Capture Volume", index=0, device=0
     ControlAmp: chs=3, dir=In, idx=0, ofs=0
   Control: name="Capture Switch", index=0, device=0
     ControlAmp: chs=3, dir=In, idx=0, ofs=0
   Device: name="ALC3234 Analog", type="Audio", device=0
   Amp-In caps: ofs=0x17, nsteps=0x3f, stepsize=0x02, mute=1
   Amp-In vals:  [0x27 0x27]
   Converter: stream=0, channel=0
   SDI-Select: 0
   PCM:
     rates [0x560]: 44100 48000 96000 192000
     bits [0xe]: 16 20 24
     formats [0x1]: PCM
   Power states:  D0 D1 D2 D3 EPSS
   Power: setting=D0, actual=D0
   Connection: 1
      0x23

 Node 0x09 [Audio Input] wcaps 0x10051b: Stereo Amp-In
   Amp-In caps: ofs=0x17, nsteps=0x3f, stepsize=0x02, mute=1
   Amp-In vals:  [0x97 0x97]
   Converter: stream=0, channel=0
   SDI-Select: 0
   PCM:
     rates [0x560]: 44100 48000 96000 192000
     bits [0xe]: 16 20 24
     formats [0x1]: PCM
   Power states:  D0 D1 D2 D3 EPSS
   Power: setting=D0, actual=D0
   Connection: 1
      0x22

B4: Gắn kết dữ kiện ta được 0x08 --> 0x23 --> 0x1a chuyển sang decimal ta được 8 --> 35 --> 260x09 --> 0x22 --> 0x1 chuyển sang decimal ta được 9 --> 34 --> 26

Sau khi có được tất cả dữ kiện từ các phần trên ta được:

Speaker: 20 -> 12 -> 2

HP: 33 -> 13 -> 3

Mic: 8 -> 35 -> 18

Headset: 

8 -> 35 -> 25 

9 -> 34 -> 25

Headphone: 

8 -> 35 -> 26 

9 -> 34 -> 26

Phần 8: Patch Platforms.xml và layout#.xml

B1: Mở file layout#.xml đã tải ở Phần 1.

Và chỉnh những nội dung sau:

  • LayoutID: Bạn thay đổi hoặc giữ nguyên hoặc đổi đây mình sẽ thay thành 15.
  • CodecID: Phần này các bạn đã sửa ở Phần 3.
  • Inputs: Tuỳ vào codec của bạn có LineIn hay không, nếu không có thì xoá đi.
  • PatchMapID: Bạn cho vào đây 1 số ngẫu nhiên.

B2: Mở file Platforms.xml lên:

Bạn điền path map đã xác định Phần 7 vào đây:

  • PathMaps -> 0 -> PathMap -> 0 -> 0 là Mic
  • PathMaps -> 0 -> PathMap -> 0 -> 1 là LineIn (mic gắn ngoài do macOS không hỗ trợ nên phải khai báo là linein).
  • PathMaps -> 0 -> PathMap -> 1 -> 0 là HP (headphone).
  • PathMaps -> 0 -> PathMap -> 1 -> 1 là Speaker.
  • PathMaps -> 0 -> PathMap -> PathMapID: ở đây bạn cần điền số giống với PathMapID ở layout#.xml

Nếu trường hợp không có Audio Mixer/Selector thì bạn xoá đi key 1, chỉ điền vào key 0 và key 2 thôi nhé!

Phần 9: Build Kext

B1: Bỏ Kext Lilu vào Folder AppleALC.

B2: Vào Resource xóa hết Codec thừa và chừa lại Codec của bạn.

B3: Bỏ 2 file layoutid# và platformid# và Folder tên Codec (nên Rename lại theo layout-id bạn đã set).

B4: Mở AppleALC.xcodeproj –> PinConfigs –> Info.plist –> IOKitPersonalities –> HDA Hardware Config Resource –> HDAConfigDefault bằng Xcode bạn có thể tự tạo hoặc Edit 1 cái có sẵn.

Các bạn sửa lại như sau:

  • Codec: thay đổi tuỳ thích.
  • CodecID: thay bằng Vendor Id của codec ở hệ decimal đã chuẩn bị trên.
  • ConfigData: bạn copy codec verb đã chuẩn bị đưa vào đây.
  • LayoutID: nhập layout-id bạn đã chọn để patch ở trên.

B5: Mở AppleALC.xcodeproj –> Resources –> (tên codec bạn đang patch) –> Info.plist –> Information Property List –> Files.

Và chỉnh những thứ sau:

  • Codec id: id codec của các bạn.
  • Codec name: tên codec của các bạn.
  • layout -> 0 -> comment: điền tên bạn muốn đặt.
  • layout -> 0 -> id: điền id của bạn đã đặt ở Phần 8.
  • layout -> 0 -> path: điền path của file layout#.xml vào đây.
  • platforms -> 0 -> comment: điền tên bạn muốn đặt.
  • platforms -> 0 -> id: điền id của bạn đã đặt ở phần 8.
  • platforms -> 0 -> path: điền path của file layout#.xml vào đây.

B6: Các bạn ấn Build Kext.

Phần 10: Load Kext AppleALC

B1: Bỏ kext vừa build vào EFI–> Oc –> Kext và Snapshot lại hoặc bỏ vào EFI –> Clover –> kext –> Other.

B2: Add vào boot-arg alcid=# (thay # thành layout id bạn đã đặt ở trên như của mình là alcid=15).

Lưu ý: Source tham khảo Patch AppleHDA cho các laptop chạy Hackintosh – Hackintosh Vietnam – Chuyên trang cung cấp hướng dẫn cài hackintosh | How to patch AppleHDA – Guides and Tutorials – Olarila | [Hướng dẫn] Patch AppleHDA cho các laptop chạy Hackintosh – Sharing Is Caring (trungnguyenblogs.blogspot.com)

Leave a Reply