Jump to content

Script to patch AppleHDA binary for osx10.7/10.8/10.9

AppleHDA binary patch

  • Please log in to reply
136 replies to this topic

#121
RehabMan

RehabMan

    InsanelyMac Legend

  • Coders
  • 1,107 posts
  • Gender:Male
  • Location:Bellingham, WA
  • Interests:skiing, software, classic cars

1. That sounds like a bug in clover configurator that should be fixed there, not here.
The hex output is actually readable since the patches are just for hex codec ids. Converting the patches to data strings makes the patches unreadable.
2. I don't like your change as having perl convert the numbers to hex strings and then externally forking xxd to convert them back makes no real sense.

The XML I'm generating works as is if you aren't using clover configurator.


The xxd converts the hex "text" to binary as required by base64.

The wiki for config.plist states the patches should be data: http://clover-wiki.z...es#KextsToPatch

#122
bcc9

bcc9

    InsanelyMac Legend

  • Coders
  • 1,277 posts
  • Gender:Male
Yes, I know xxd does, but it's rather senseless to convert from integer to hex string, back to binary, then to base64. My patch_codec routine already converts to binary, no xxd required. Perl even has base64 conversions functions available, though I haven't checked whether osx ships with these.

The wiki page you list is one of the ones I checked before making my xml code, and it includes an example that uses find/replace with hex as a string. The example doesn't work for kext binary patching though, as the example prefixes the hex strings with 0x, but that doesn't parse. Since the wiki is wrong, I had to check the code to see what is really supported, and that's how I knew how to format the hex strings correctly.
Per clover's GetDataSetting() routine:

"data can be specified in <data></data> base64 encoded
or in <string></string> hex encoded "

#123
RehabMan

RehabMan

    InsanelyMac Legend

  • Coders
  • 1,107 posts
  • Gender:Male
  • Location:Bellingham, WA
  • Interests:skiing, software, classic cars

Yes, I know xxd does, but it's rather senseless to convert from integer to hex string, back to binary, then to base64. My patch_codec routine already converts to binary, no xxd required. Perl even has base64 conversions functions available, though I haven't checked whether osx ships with these.


I never claimed to be an expert in perl. I was just fixing it for my purpose...
 

The wiki page you list is one of the ones I checked before making my xml code, and it includes an example that uses find/replace with hex as a string. The example doesn't work for kext binary patching though, as the example prefixes the hex strings with 0x, but that doesn't parse. Since the wiki is wrong, I had to check the code to see what is really supported, and that's how I knew how to format the hex strings correctly.


No. The example you refer to is an Info.plist patch not a binary patch (the 0x is thus perfectly valid).
 

Per clover's GetDataSetting() routine:

"data can be specified in <data></data> base64 encoded
or in <string></string> hex encoded "


Yes, I know both work, but one causes issues with CC, which I was pointing out. I haven't found a thread to report bugs on CC yet...

Maybe an option to output data/base64 is appropriate?

#124
bcc9

bcc9

    InsanelyMac Legend

  • Coders
  • 1,277 posts
  • Gender:Male
The wiki under-specifies the syntax for find/replace, and includes examples of both hex and base64. The code clarifies that both are in fact legal formats, and there are several commands that take find/replace strings with hex, not just the one in question (the ati driver patch commands come to mind, though the keyword is different). So this other configuration program must be able to handle hex strings, and it's simply a bug that it is failing to do so in this case.

As for perl, sure, I'm not an expert either, but clearly converting in&out of a format needlessly is not great and isn't something I'd integrate.

Certainly an option to output base64 directly would be easy, though I still maintain that the result is unreadable whereas the current output is readable...

#125
rosendo

rosendo

    InsanelyMac Protégé

  • Members
  • Pip
  • 6 posts

How about vt1802?

i search binary patch for vt1802 so long time ago. I did with version 1.1 but it didn't work

somebody can help me please!

thanks

 

Hi iazzy

 

 

did you make it work, im struggling with that and can't find the solution

 

Mirone, that advice of yours for this codec where is it that i should find and replace?

 

thank you

bye



#126
Mirone

Mirone

    InsanelyMac Legend

  • Local Moderators
  • 1,385 posts
  • Gender:Male
  • Location:Brazil

This codec was added to new script But if you seek a kext working for this codec Please take a look here: ViaVT1802  why this is a discussion on this subject and Bin Patch Script, would be outside this topic.



#127
futurexiong

futurexiong

    InsanelyMac Protégé

  • Members
  • Pip
  • 3 posts
Thanks for your script, it works well for ALC269VB on OS X 10.9.3. But on 10.10, I use the script to patch the binary AppleHDA and modified configdata and xml files, it seems not work at all...Any ideas?

#128
Rockey12

Rockey12

    InsanelyMac Protégé

  • Members
  • PipPip
  • 56 posts
  • Gender:Male
  • Location:Earth
  • Interests:no comi

Hi.bcc9 can you please add this dell codec  to your script 

 

Codec: SigmaTel STAC9200 - 83847690

Vendor Id: 2206496400
Revision Id: 1057281


#129
pokenguyen

pokenguyen

    InsanelyMac Sage

  • Members
  • PipPipPipPipPipPip
  • 427 posts
  • Gender:Male

bcc9, it breaks again:

./patch-hda
OSX version 10.10 detected
Default target codec: 111d7605
 detected.
Enter codec-id or codec-name for AppleHDA patch.  Eg. 111d7675 or IDT 7675
Press enter for default, or ? for help (Default: 111d7605
)
? 
Couldn't get target codec id for 111d7605

Supported codecs:
Target		Target		Patch
Codec ID	Name		Codec Name
-------------------------------------------
10ec0662	Realtek ALC662	ALC 885
10ec0272	Realtek ALC272	ADI 1984
10ec0282	Realtek ALC282	ADI 1984
10ec0889	Realtek ALC889	Choice 1: ALC 885
				Choice 2: ADI 1984
111d76df	IDT 76df	ADI 1984B
10ec0892	Realtek ALC892	Choice 1: ALC 885
				Choice 2: ADI 1984B
10ec0883	Realtek ALC883	ALC 885
10ec0270	Realtek ALC270	ADI 1984
11068446	VIA VT1802	ADI 1984
10ec0887	Realtek ALC887	ADI 1984B
14f1510f	Conexant CX20752	ADI 1984
10ec0898	Realtek ALC898	ADI 1984B
10ec0888	Realtek ALC888	ALC 885
111d76d9	IDT 76d9	ADI 1984B
10ec0268	Realtek ALC268	ADI 1984
111d7605	IDT 7605	ADI 1984B
111d7603	IDT 7603	ADI 1984
10ec0663	Realtek ALC663	ADI 1984
14f1506e	Conexant CX20590	ADI 1984
14f15115	Conexant CX20757	ADI 1984
111d76e0	IDT 76e0	ADI 1984B
14f15067	Conexant CX20583	ADI 1984
111d7675	IDT 7675	ADI 1984
10ec0275	Realtek ALC275	ADI 1984
10ec0670	Realtek ALC670	ADI 1984
11060441	VIA VT2021	ADI 1984
14f15069	Conexant CX20585	ADI 1984
11d4989b	ADI AD2000B	ADI 1984B
10ec0283	Realtek ALC283	ADI 1984
10ec0269	Realtek ALC269	ADI 1984
111d76d1	IDT 76d1	ADI 1984
10ec0882	Realtek ALC882	ALC 885
10ec0900	Realtek ALC1150	ADI 1984B
14f1506e	Conexant CX20672	ADI 1984B

The problem is when it gets default codec, the new line is not trimmed. This will work:

chomp($default_codec = `ioreg -rxn IOHDACodecDevice | grep VendorID | awk '{print \$4}' | tr -d '\040\011\012\015'`);


#130
pokenguyen

pokenguyen

    InsanelyMac Sage

  • Members
  • PipPipPipPipPipPip
  • 427 posts
  • Gender:Male

Some problems in 10.10:

sudo ./patch-hda.pl 0x10134213
OSX version 10.10 detected
Default target codec: 111d7605 detected.
Patching AppleHDA codec 11d41984 with 10134213
9 codec range comparison(s) to patch
Patching range comparison 10de0006
Patching range comparison 11d41983
Patching range comparison 10ec0884
Patching range comparison 10ec0261
Patching range comparison 10de003f
Patching range comparison 10de0013
Patching range comparison 10de0007
Patching range comparison 10de000a
Patching range comparison 10de000c
Quantifier follows nothing in regex; marked by <-- HERE in m/? <-- HERE / at ./patch-hda.pl line 227, <$IN> line 1.
sudo ./patch-hda.pl "IDT 7605"
OSX version 10.10 detected
Default target codec: 111d7605
 detected.
Patching AppleHDA codec 11d4198b with 111d7605
2 codec range comparison(s) to patch
Patching range comparison 11d41983
Patching range comparison 11d41984
Unexpected codec match count: 2 (4 expected)
Aborting with AppleHDA NOT patched



#131
Mirone

Mirone

    InsanelyMac Legend

  • Local Moderators
  • 1,385 posts
  • Gender:Male
  • Location:Brazil
what codec is this? 
stac9200?


#132
pokenguyen

pokenguyen

    InsanelyMac Sage

  • Members
  • PipPipPipPipPipPip
  • 427 posts
  • Gender:Male

 

what codec is this? 
stac9200?

 

0x10134213 is Cirrus Logic CS4213



#133
pokenguyen

pokenguyen

    InsanelyMac Sage

  • Members
  • PipPipPipPipPipPip
  • 427 posts
  • Gender:Male

Here is the 3.4 script modified to work with 10.10, have fun:

 

https://www.dropbox....o/patch-hda.zip

 

I still can't fix error with 0x10134213



#134
Mirone

Mirone

    InsanelyMac Legend

  • Local Moderators
  • 1,385 posts
  • Gender:Male
  • Location:Brazil

I used to fix cirrus logic 4210 

no error here.


#135
pokenguyen

pokenguyen

    InsanelyMac Sage

  • Members
  • PipPipPipPipPipPip
  • 427 posts
  • Gender:Male

 

I used to fix cirrus logic 4210 

no error here.

 

Did you patch binary manually or use the patch-hda script?



#136
lightskreen

lightskreen

    InsanelyMac Protégé

  • Members
  • PipPip
  • 90 posts
  • Gender:Male

 

I used to fix cirrus logic 4210 

no error here.

 

Hi, I have this same codec on my vizio laptop. Would you care to share your patched applehda? Or at least your platform and layout12? I can't seem to ever edit layout12 and Platforms correctly. :P



#137
Mirone

Mirone

    InsanelyMac Legend

  • Local Moderators
  • 1,385 posts
  • Gender:Male
  • Location:Brazil

Did you patch binary manually or use the patch-hda script?

Both methods work.







0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

© 2014 InsanelyMac  |   News  |   Forum  |   Downloads  |   OSx86 Wiki  |   Mac Netbook  |   PHP hosting by CatN  |   Designed by Ed Gain  |   Logo by irfan  |   Privacy Policy