yashsingh1/xdaforums huggingface dataset:
[Galaxy S 4 Developer Discussion [Developers-Only]] MohammadAG:
Tried that, didn't work, pretty sure that's for MHL or plain HDMI ports on some devices.

That actually worked (XWUMBG5). I'm no ROM dev, but if I do end up making a patch with Cydia Substrate (if I figure that out), I'll be sure to credit you :)

Thanks!
[Galaxy S 4 Developer Discussion [Developers-Only]] sorg:
I've thought Cydia Substrate gives something special, but after quick look i've found it providing not more than XPosed already provides. You cannot make patch for this using Cydia Substrate because the only thing you can do by this is to hook JNI functions called from Dalvik code (you can do the same in Xposed). You cannot hook internal lib functions where the "magic" happens.

The only way is to replace the whole lib i've provided so far.
[Galaxy S 4 Developer Discussion [Developers-Only]] MohammadAG:
Heh, ironic how iOS devs dissed Xposed as not hooking C++ code, I actually thought Cydia Substrate would hook any C++ code on the system.

Oh well, thanks for saving me hours of going through Cydia's docs.

BTW, you might want to post your solution here, http://xdaforums.com/showthread.php?t=2269150

I don't think a lot of users read this forum.

Sent from my Samsung Galaxy S4 (i9500)
[Galaxy S 4 Developer Discussion [Developers-Only]] sorg:
QA forum is also not so popular ;) Actually the idea for separate QA forum is a big mistake because it's popular for those who ask. Not those who know the answer.

Do you want to throw away the topic? move it to QA forum! :)
[Galaxy S 4 Developer Discussion [Developers-Only]] MohammadAG:
Hahaha, I recall your encounter with the binary counter issue that was pretty much nulled that way :p
[Galaxy S 4 Developer Discussion [Developers-Only]] e-dredon:
Using your lib on other devices.

Dear Sorg,

Thank you for providing this great lib hack. After reading your posts about the AllShare / ScreenCast feature broke by the root, I could fix it on my samsung galaxy S3 and I understoood the problem with my Cube U30GT2 tablet was probably due to the same HDCP issues.

About the SGS3:

I switched from a 4.1.2 official firmware to CyanogenMod 10.1 beta last January on my SGS3. I finally flashed the leaked XXUFME7 two weeks ago to experiment the AllCast feature of my new Samsung Smart TV. So I might have skipped the Samsung update 0f the bootloader / tz. The WFD worked fine until I rooted the phone last week with cf-root/odin.

I finally decided to give it a try with TriangleAway to see if it would be enough to restore the DRM management chain checkup and it worked fine.

However, for many of us whom have probably upgraded their bootloader/tz with the Samsung latest updates, a lib patch is probably less tricky than a push of some bootloader/tz image thru adb :) I just hope Samsung will not update the tv/Allshare cast dongle firmware to restrict the streams with HDCP.

The Cube U30GT2

I have installed the Kasty firmware. It's a custom from the official Cube 2.04 firmware based on Android 4.2.2. It includes the Rockchip tools to enable the ScreenMirroring. But as it's pre-rooted when I try to connect to my Samsung smart TV I experience the same problem than with the SGS3. In that case TriangleAway is not an option and i don't know how to find the original bootloader/tz and if it would even work.

All the other Samsung Allshare features are working properly like the UPNP / DLNA.

Sadly there is no libWFD_ENGINE in /system/lib

Rockchip implementation of the standard is named WIMO and is quite poorly documented.

I can copy a proc/kmsg log if someone would be kind to help.

Can you tell me is the libWFD_ENGINE is a generic android 4.2 part of the widi implementation or a Samsung Allshare proprietary lib ?

Thanks

Best regards,
[Galaxy S 4 Developer Discussion [Developers-Only]] sorg:
I have no idea.. I only have 2 devices capable wireless display and they are both from Samsung.

---------- Post added at 03:09 PM ---------- Previous post was at 03:00 PM ----------

Yeah, i've forgot to tell that you have to reset the counter in TriangleAway to make wireless display working even with old bootloader.

The main difference between old and new bootloader/tz is that new bootloader/tz update counter of customs with every boot - that's why it's impossible to make wireless display working with new bootloader/tz.

The same with SGS4 with only difference - there is no bootloader/tz exist without updating counters on every boot. So, the only way is to hack the lib.

Not for those who(me) hack the lib.

For me it's more simple to skip bootloader and tz update than hack the lib with every new firmware.
[Galaxy S 4 Developer Discussion [Developers-Only]] mrmrmrmr:
Hi,

I need a similar solution on my Note 8.

How can I patch my libWFD_ENGINE.so ?

I'd appreciate if you could help me.

attached is the file from my Note 8.

when I try the patched file here, it causes a reboot. So it's not compatible with my device.
[Galaxy S 4 Developer Discussion [Developers-Only]] sorg:
1) get unmodified libWFD_ENGINE.so from I9500 ROM (XX..MG1)

2) compare with my modified library to find what has been patched. I suggest to use IDAPro to analyze changed parts.

3) apply the same changes to library from Note 8 (or any other device using this library)

That's all i can tell to you. Sorry, i won't provide patches for device i don't own.
[Galaxy S 4 Developer Discussion [Developers-Only]] mrmrmrmr:
Thank you. I'll try to do it myself. That's better for me since I'll need to re-do it when I there is an update.

But can you tell me the tools that I need for comparing and patching ?

---------- Post added at 08:03 PM ---------- Previous post was at 07:52 PM ----------

btw, where can I find the rom you mentioned ?

I can't find a cwm zip for i9500 ending with MG1...
[Galaxy S 4 Developer Discussion [Developers-Only]] mrmrmrmr:
I've got IDA pro installed now.

I've also got libWFD_ENGINE.so from S4 rom UBUBMH1 (I hope the lib is the same as yours)

now how can I compare it in IDA ?

I'd be grateful if you could let me know what steps I need to do.

Thanks.
[Galaxy S 4 Developer Discussion [Developers-Only]] sorg:
you cannot compare it by IDA. IDA is to read the assembler code and understand changes.

According to your questions, you are not familiar with reverse engineering. So, wait for someone who can handle this.
[Galaxy S 4 Developer Discussion [Developers-Only]] mrmrmrmr:
No. I am not familiar but i believe I can do it. Besides there's noone interested in this.

Please help me. Just tell me the steps. Now i am trying to text compare both binary file's disassemled code in ultracompare. Would that help ?

Please. You're my only hope...
[Galaxy S 4 Developer Discussion [Developers-Only]] mrmrmrmr:
Ok; I see 3 differences in the disassemled code:

5423c5423
< .text:00012644 CBNZ R0, loc_12652
---
> .text:00012644 MOVS R0, #0
5433d5432
< .text:00012652 ; sub_11C34+A10j
41793c41792
< .text:00022D50 LDR R3, [R7]
---
> .text:00022D50 MOVS R3, #0
50257c50256
< .text:00026B1C CMP R0, #0
---
> .text:00026B1C CMP R0, #0x10

Now, I will open the lib file from Note8 in IDA and find these subroutines. Edit them as in your patch. Then save. Is that enough ?
[Galaxy S 4 Developer Discussion [Developers-Only]] sorg:
IDAPro cannot patch the files. You need hex editor (WinHex, hiew, etc..) to patch the file manually.

Remember, you need to find the same functions and offsets in Note 8 file. It won't be at the same address!
[Galaxy S 4 Developer Discussion [Developers-Only]] mrmrmrmr:
ok; then I will

1. open the Note8 lib file in WinHex.

2. Find the correct place for the patch (searching text ?)

3. edit as required

4. save file

the hard part is finding the correct place for the patch. How can I do that ? As I will not be able to see the assemly code in WinHex , what shall I search ?
[Galaxy S 4 Developer Discussion [Developers-Only]] sorg:
You need to find offsets in IDAPro, and then apply patches in Winhex.
[Galaxy S 4 Developer Discussion [Developers-Only]] mrmrmrmr:
I am at work now. So I don't have IDA to check and I don't know what you mean by offsets. Is it the number at the beginning of each line.

I know you're disturbed by my continuous questions but once I get it correct, I won't disturb you again.

And I will really be grateful to you. Thank you very much for helping me !
[Galaxy S 4 Developer Discussion [Developers-Only]] mrmrmrmr:
got it. found the correct offsets in note8 lib file:

org_s4:
text:00012644 CBNZ R0, loc_12652
patched_s4:
text:00012644 MOVS R0, #0
note8:
text:0000ED32	CBNZ R0, loc_ED40

org_s4:
text:00022D50 LDR R3, [R7]
patched_s4:
text:00022D50 MOVS R3, #0
note8:
text:000200EC LDR R3, [R7]

org_s4:
text:00026B1C CMP R0, #0
patched_s4:
text:00026B1C CMP R0, #0x10
note8:
text:00023FC4 CMP R0, #0

now I understand that I will open the note8 file in hex editor and edit these 3 offsets just like the 3 offsets in the patched file.

I hope it goes well.
[Galaxy S 4 Developer Discussion [Developers-Only]] mrmrmrmr:
ok; patched for Note 8 and working now.

thanks for all your help sorg.

Iam attaching the patched file for Note8 in case any other user needs it.
[Galaxy S 4 Developer Discussion [Developers-Only]] sorg:
Wonderful! I didn't believe you would do this after those questions you've asked. ;)

Congratulations!
[Galaxy S 4 Developer Discussion [Developers-Only]] mrmrmrmr:
Thx.

Believe in power of teaching. And never give up on your student...
[Galaxy S 4 Developer Discussion [Developers-Only]] CNexus:
There's a difference between not being able to do something, and not knowing how

to do it to begin with.

Would you mind giving a detailed description of exactly how you did this, from decompiling to the final and edited lib? I am trying to patch a lib file myself at the moment. Thanks in advance, feel free to PM me if you feel it may clutter the thread. Just want to know the exact process itself :thumbup:
[Galaxy S 4 Developer Discussion [Developers-Only]] mrmrmrmr:
Are you trying to patch the same file on a different device ?

you have to decompile the patched file on IDA and your device's original file also on IDA.

Then you have to find the offsets of all differences on both file.

IDA is only decompiling the file so that it is understandable code.

to make the changes you have to use WinHex.

on WinHex , you jump to the offsets that you find on the previous steps. And then make the change as in the patched file.
[Galaxy S 4 Developer Discussion [Developers-Only]] CNexus:
Ok, could you post a screenshot of what the offset looks like in Ida? Also, what version of IDA are you using.
[Galaxy S 4 Developer Discussion [Developers-Only]] mrmrmrmr:
the offset is the number on the leftmost side of the code window.

I can't post a screenshot because I am not at home for the next 7 days.

I used IDA pro 6.1 but I believe any version of IDA could handle this simple job of disassembling the file.
[Galaxy S 4 Developer Discussion [Developers-Only]] CNexus:
Figured it out. Thanks :thumbup:
[Galaxy S 4 Developer Discussion [Developers-Only]] esgie:
Wow

This seems to be a holy grail of samsung community - custom kernel AND allshare cast...

Unfortunately, after tons of topics and discussions no one found out the solution.

But now here it is.

Well, unfortunately, I am stuck with 2 samsung devices, quite modern but not yet updated from jb 4.1.2

Ive seeked thru deassembled libwfd_engine.so. Comparing a lot of patched and unpatched library files, I found one "nearby similiar" pattern, the first one - however the byte values in hex differ from those from both 4.2.2 devices; the second one is not even similiar. The third one doesn't seem to fit in any place of the code.

I'm not a pro-dev however i have understood all the technical stuff involved, also I am familiar with BASICS of assembly. Unfortunately, 4.1.2 lib differs from 4.2.2 so much that the problem had to be solved separately for older system.

So...

Can someone share with the basics of methodology used to seek to this assembly thing which may lead us to working 4.1.2 libs?

How did you figured out the instructions essential to skip the HDCP check?

Any help would be great. Thanks
[Galaxy S 4 Developer Discussion [Developers-Only]] koko115:
Hi. I have rom Omega v12, with custom kernel. I reset counters for 0 in triangle Away, and when i connect to mirroring i have this " Screen mirroring has been disabled" i dont have file libWFD_ENGINE in /sysrem/lib so i copy this file and add chmod 777. And still mirroring dont work. Any idea ?

Sorry for English
[Galaxy S 4 Developer Discussion [Developers-Only]] MohammadAG:
This is for the I9500, no efforts to patch the lib have been made for the I9505. As a workaround, use Mobile ODIN to switch between stock and custom kernel. A reset isn't enough when you're running a custom kernel since that trips the bootloader.

Sent from my Samsung Galaxy S4 (i9500)
[Galaxy S 4 Developer Discussion [Developers-Only]] ashshaidk:
Where can i find libWFD_ENGINE.os in my Note8

I have just received an auto upgrade for my Galaxy Note 8 to Android 4.2.2, and I have noticed that AllShare Cast / Screen Mirror is no longer working (it starts ok and the dongle showing that it is trying to connect, but after few seconds. for some reason, the Screen Mirror turns itself off in my device).

Now I'm trying to fix this issue and i believe i have to follow your steps to do so, but I'm not able to find "libWFD_ENGINE.so" in my device . . . so can you please let me know where i can find this file.

Thank you
[Galaxy S 4 Developer Discussion [Developers-Only]] sassorock:
Could someone kindly make a patched libWFD_ENGINE.so file for S3 (i9300)?
[Galaxy S 4 Developer Discussion [Developers-Only]] sassorock:
I don't think I am as capable as mrmrmrmr. But it seems that nobody is interested to patch libWFD_ENGINE.so file for S3 (i9300),

mrmrmrmr pointed out the difference between the i9500 original libWFD_ENGINE.so and the patched. But I don't know how he determined the Offset for his Note8.

Attempt to make a comparison and see if I could figure out something more, I downloaded the S4 libWFD_ENGINE.so patch version (#7) but so far cannot get the original libWFD_ENGINE.so file I don't have a S4 so had to download a full S4 stock ROM and tried to extract it from there...

Unfortunately, exhausted with all solutions (for Windows) I could find, cannot successfully extract files from S4 Rom (ok on S3, Samsung changed the way they pack S4). So I cannot get an unmodified libWFD_ENGINE.so.

Could someone kindly:

1. Patch the S3 (i9300) libWFD_ENGINE.so file; or

2. Post unmodified libWFD_ENGINE.so from I9500 ROM (XX..MG1); or

3. Point out what to look for in the IDA to get the three Offsets in the S3 (i9300) ROM (...MF1)

Thanks. Any hints appreciated.
[Galaxy S 4 Developer Discussion [Developers-Only]] TheCyber:
My tv use Miracast and my S4 not work with this patch... please help me :(
[Galaxy S 4 Developer Discussion [Developers-Only]] mrmrmrmr:
Hi,

I had made the patch for Note8 successfully but with the recent update to the S3 (4.3) , my S3 had the same issue.

Unfortunately I can't find the pattern for the 3rd patch in the lib file.

Can anyone help with this ?
[Galaxy S 4 Developer Discussion [Developers-Only]] 4shared:
I need a solution on my Note 2.

I found a patched one, and it works like a charm on my rom N7100.XXUEMI6

I'm happy to share it

[MOD][Android 4.3] Getting AllShareCast (Screen Mirroring) working on rooted devices
[Galaxy S 4 Developer Discussion [Developers-Only]] mrmrmrmr:
If I can get the instructions (or patched lib for S4) from Sorg, I will do it both for S3 and Note2 (Android 4.3)

I promise :)
[Galaxy S 4 Developer Discussion [Developers-Only]] 4shared:
thank you very much,

I found a patched one, and it works like a charm on my rom N7100.XXUEMI6

I'm happy to share it:

[MOD][Android 4.3] Getting AllShareCast (Screen Mirroring) working on rooted devices
[Galaxy S 4 Developer Discussion [Developers-Only]] mrmrmrmr:
is this for Android 4.3 ?

thx.
[Galaxy S 4 Developer Discussion [Developers-Only]] 4shared:
yes its for android 4.3
[Galaxy S 4 Developer Discussion [Developers-Only]] mrmrmrmr:
ok; thank you very much.

I've done it for S3 _I9300XXUGMJ9 (attached)

Can you please share where you've found this ?
[Galaxy S 4 Developer Discussion [Developers-Only]] mrmrmrmr:
Samsung can not beat us if we continue helping eachother like this :)
[Galaxy S 4 Developer Discussion [Developers-Only]] 4shared:
yes agree with u, nothing can stop us...

I found it in TINHTE forum with strange language, i just got the context with google translation:D
[Galaxy S 4 Developer Discussion [Developers-Only]] yrv_13:
Is it flashable and does It works on GTN 7100?

Edit: im sorry. What i meant to ask was if it works on GT-N7100 stock 4.1. But i already tried and it does not.

Sent from my GT-N7100
[Galaxy S 4 Developer Discussion [Developers-Only]] mrmrmrmr:
[MENTION=2011359]MohammadAG[/MENTION] , you've done a great job by updating the first post. Thanks.

I believe we should refer to this thread from device specific threads because there are many users who are using modified roms and have no solution for Allshare Cast dongle issues...
[Galaxy S 4 Developer Discussion [Developers-Only]] monkeydrufy:
Sorry guys to disturb you

any hope to see the all share cast work on I9505?

thanks
[Galaxy S 4 Developer Discussion [Developers-Only]] daciangeorge:
It s working.thanks
[Galaxy S 4 Developer Discussion [Developers-Only]] yrv_13:
Hello again, I have this mod installed On Ditto Rom V3 hoping It would work but it didnt. now im getting an error msg telling me TV does not support screen mirroring. Is there Any work around? tv is a Samsung Smart C5 Series
[Galaxy S 4 Developer Discussion [Developers-Only]] Ricky Divjakovski:
thats pretty obvious no offence to anyone who thought different,if you read the cydia substrate is basically xposed in a different form, if you read up on xposed it modifies app_processes file file to allow you to modify code through the dalvik(thats how i added xposed with preinstalled modules in one of my roms), cydia substrate works somewhat the same as i understand? but patching C++ in no easy task at all :( im not sure if we will ever be able to do that without actually touching the actual file itself..
[Galaxy S 4 Developer Discussion [Developers-Only]] da.trute:
Hi, I am wondering what it would take to extend this to other devices and maybe even make an app. I have a tesco HUDL which I bought as a present for someone for xmas, they have a brand new samaung TV, it would be great to get this working. After enabling screen mirroring on the HUDL it tried to connected and exhibited identical problems as my S3 did before this fix, it connected then dropped reporting a hardware problem. This suggests to me this fix could work for any device with wifi direct screen mirroring.

What is required to write a fix for the HUDL, what changes need to be made to the S3 fix?
[Galaxy S 4 Developer Discussion [Developers-Only]] studentjunk:
I don't know about the hudl. This method circumvents the security checks the app uses. So it needs to initially work on the unrooted device. Decompiling the lib files and searching for the modifications mentioned might be enough to extend to other Samsung devices. All of the details are above my head. Otherwise I would have tackled it already.
[Galaxy S 4 Developer Discussion [Developers-Only]] madmike593:
Hi all,

Im having a similar issue with allshare cast myself and was wandering if anyone can help.

Firstly when i select the screen mirroring quick toggle my settings immediately FC. I can however access the screen mirroring options direct from the settings menu, i am able to connect to the dongle for about 3-4 seconds then it disconnects itself.

Im running 4.3 rooted but on stock kernel, the logcat for the toggle error is below:

D/STATUSBAR-AllShareCastQuickSettingButton( 2781): onClick() - state : true

D/STATUSBAR-AllShareCastQuickSettingButton( 2781): WFD activate

E/AndroidRuntime(15827): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.android.settings/com.android.settings.wfd.WfdPickerDialog}: android.content.res.Resources$NotFoundException: File res/raw/allshare_confirm.ogg from drawable resource ID #0x7f080000

E/AndroidRuntime(15827): Caused by: android.content.res.Resources$NotFoundException: File res/raw/allshare_confirm.ogg from drawable resource ID #0x7f080000

I would really appreciate it if anyone can help me out.

Thanks

Mike
[Galaxy S 4 Developer Discussion [Developers-Only]] mrmrmrmr:
Hi,

I keep receiving PMs saying "how did you do it?" about the patch.

First of all, I am not the developer who made this patch. I am just copying modifications made by him.

Here is a short description of steps to follow if you want to do the same for other devices:

1. download and install IDA Pro

2. download and install WinHEx

3. download and install any text compare util

4. Open patched and unpatched version lib file of the same device (any device) with IDA

5. get text output of both files to the text compare utility

6. find the 3 differences. analyze where they are in the file (look for seacrhable text patterns)

7. open YOUR device's unpacthed lib file with IDA pro

8. find the correspondances found on step 6 in your own file.

9. note the line number (hex address) of each 3 correspondances

10. now open all 3 files on Winhex

11. jump to the noted hex addresses and change the bytes according to the difference of 2 files of the same device.

12. make the change on your own file and save.

I hope it helps some of you..
[Galaxy S 4 Developer Discussion [Developers-Only]] harishdhandev:
Can someone pls prepare a patched file for note 3 ? Mk2 version ?here is the original file.
[Galaxy S 4 Developer Discussion [Developers-Only]] studentjunk:
I'll try it this weekend. My Sprint gs3 doesn't use this file, but I would like to confirm that I understand all those steps.
[Galaxy S 4 Developer Discussion [Developers-Only]] adroidgalaxy:
If you can figure it out maybe toss a couple pointers my way to enable it for the i747 model for AT&T that would be great haha, I really can't figure this out
[Galaxy S 4 Developer Discussion [Developers-Only]] studentjunk:
Upload the file and see. Now if your device does not have the file, then you are like me - you need someone who knows what he's doing. I feel like I've learned enough to follow the instructions, but my Sprint gs3 doesn't use the file. So I'd like to test it out on someone else's.
[Galaxy S 4 Developer Discussion [Developers-Only]] MohammadAG:
This file is specific to Exynos versions of the device. You have the Snapdragon ones. That's why the file isn't used. Check the second/third post for what file yours uses.

Patching it won't be the same as this file, I'd suggest you have someone experienced in patching C libs to look at it.

Sent from my Sony Xperia Z1 using Taptalk
[Galaxy S 4 Developer Discussion [Developers-Only]] studentjunk:
wife got sick, so less play time for me this weekend. so i doubt i'll find the time to try it as soon as I expected.
[Galaxy S 4 Developer Discussion [Developers-Only]] k1ng617:
Any chance we could get an update for 4.1.2 Note 2?
[Galaxy S 4 Developer Discussion [Developers-Only]] garwynn:
Please... Let's keep discussion in this thread related to the S4 only as that's where this is.

If you want to discuss a new device I recommend creating a new thread on your device-specific forum and asking if OP if they can include as well.
[Galaxy S 4 Developer Discussion [Developers-Only]] studentjunk:
I'm sorry to annoy you. I thought the op listing solutions for 4 devices implied that discussion about other devices was appropriate
[Galaxy S 4 Developer Discussion [Developers-Only]] k0928999:
Can someone pls prepare a patched file for note 2 JB 4.1.2 ? ZSDMF2 version ? attachment is the original file..below is the ROM download URL..thanks very much..

http://pan.baidu.com/s/1gUKhS
[Galaxy S 4 Developer Discussion [Developers-Only]] kefallo:
Hi,

Could somebody patch for Exynos Note 3. This limitation is so much annoying. I could hate Samsung because of this. I paid for this phone, and Samsung doesn't let me use my phone.