Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,786,341 Members 48,351 Now Online
XDA Developers Android and Mobile Development Forum

[HOW TO] WORKING screen mirroring ON ROOTED DEVICES, bypass HDCP and ALL of allshare

Tip us?
 
xxjomamaxx
Old
(Last edited by xxjomamaxx; 25th February 2014 at 04:32 PM.)
#1  
Junior Member - OP
Thanks Meter 11
Posts: 25
Join Date: Mar 2011
Default [HOW TO] WORKING screen mirroring ON ROOTED DEVICES, bypass HDCP and ALL of allshare

so here's the deal. trying to start screen mirroring on a rooted device in most cases HDCP will fail to initialize, when this happens screen mirroring will connect then disconnect with an error.

after a lot of research, logging and testing on my device I have found a way to bypass HDCP and also bypass Samsung restriction on allowing screen mirroring without HDCP.

HDCP is not a requirement for screen mirroring but Samsung has programmed the s4 to fail if the HDCP connection is not initialized. I have found that when the phone speaks to the miracast dongle the phone is programmed to force the setting of "Display service Type = HDMI" instead of allowing it to connect as Type = Wifi.
when the phone forces type = HDMI it makes screen mirroring fail if HDCP fails, this is a basic and enforced protocol of HDMI, this results in screen mirroring shutting off if HDCP fails, I believe this is Samsung's attempt to stop people from rooting their phones and also to stop people from using non Samsung dongles.

some people have found ways around this by hacking the HDCP lib files, but in my case this was not possible because I own a Sgh-i337 on mf3 with a locked bootloader.
unfortunately I can't post pictures so I can post my screen mirroring logs, but heres an explanation as to how this was accomplished.

First was to quarantine all Samsung Apps & services that were related to screen mirroring, this was an attempt to get the system to fall back to the native screen mirroring services and not use samsung's implementation.

I locked up:
Com.sec.allsharecastplayer
Com.samsung.shareshot
Samsung watch on
Samsung briefing
Allshare.controlShareService
Allshare.fileShareService
Samsung context provider
All Knox
Samsung MDM app
Allshare.service.mediaShare
Samsung apps
Samsung apps UNA2
Samsung apps widget
Samsung link
Samsung push



next I tried to find out a way to edit the DisplayManagerService's forced type of HDMI to change it to Type = Wifi, unfortunately because I was on Mf3, this couldn't be done.
but I was able to force this option with a build prop edit and last download and enable

https://play.google.com/store/apps/d...HOm-sQSyqoCgCA

Even if multi window plus doesnt work. Keep it for now untill I can trace down a setting change.

surprisingly after all this was done screen mirroring now works.

below I will post copies of my build prop and also the WFDConfig files from /system/ect

---- Build prop :
debug.sf.hw=0
debug.composition.7x27A.type=mdp
debug.composition.7x25A.type=mdp
dalvik.vm.heapsize=24m
debug.composition.type=dyn
persist.hwc.mdpcomp.enable=false
service.camera.gpu.enable=0
Debug.Disable.HWC=1
debug.sf.disablehwc=1
ro.display.switch=0


#dyn
# system props for the cne module
#
persist.cne.feature=0

#
# system props for the MM modules
#
media.stagefright.enable-player=true
media.stagefright.enable-meta=true
media.stagefright.enable-scan=true
media.stagefright.enable-http=false
media.stagefright.enable-fma2dp=true
media.stagefright.enable-aac=true
media.stagefright.enable-qcp=true
media.enable-commonsource=true
media.stagefright.enable-rtsp=true

#
# system props for the LPA/TUNNEL
#
lpa.decode=true
tunnel.decode=true
lpa.use-stagefright=true
tunnel.audiovideo.decode=true
#
# system prop for opengles version
#
ro.opengles.version=131072

#
# system props for the data modules
#
ro.use_data_netmgrd=true
persist.data.ds_fmc_app.mode=0

#
# system props for IMS module
#
persist.ims.regmanager.mode=0


#
# System prop to disable strict mode flash on display
#
persist.sys.strictmode.visual=false

#
# System prop to enable/disable OMH. Enabled by default
#
persist.omh.enabled=1

#System prop to enable ehrpd capability
ro.config.ehrpd=true

# System property for cabl
ro.qualcomm.cabl=0

#
#
# Turn off tiled rendering
#
debug.enabletr=false
#
#property to enable user to access Google WFD settings.
#
persist.debug.wfd.enable=1
debug.wfd.enable=1
ext_only.debug=1
persist.sys.ext_only.debug=1
persist.sys.hwc.ext_only.debug=1
persist.sys.hwc.disable=1

#property to choose between virtual/external wfd display
#
persist.sys.wfd.virtual=0


#
# System prop for Tvout/HDMI
#
persist.sys.camera.transform=0
persist.sys.camera.connect=0
persist.sys.videomode=1
ro.hdmi.enable=false



------- WFDConfig. Xml

<WFDConfig>
<Capability>
<AudioLPCM>
<Name>LPCM</Name>
<Valid>1</Valid>
<Channels>2</Channels>
<SamplingFreq>48000</SamplingFreq>
<Latency>33</Latency>
</AudioLPCM>
<AudioAAC>
<Name>AAC</Name>
<Valid>1</Valid>
<Channels>2</Channels>
<SamplingFreq>48000</SamplingFreq>
<Latency>0</Latency>
</AudioAAC>
<AudioAC3>
<Name>AC3</Name>
<Valid>0</Valid>
<Channels>0</Channels>
<SamplingFreq>0</SamplingFreq>
<Latency>0</Latency>
</AudioAC3>
<VideoHeader>
<VideoMethod>1</VideoMethod>
<PreferredDisplaySupport>0</PreferredDisplaySupport>
<H264Profiles>1</H264Profiles>
<Valid>1</Valid>
</VideoHeader>

<CBP>
<VideoCodec>
<Profile>1</Profile>
<Level>1</Level>
<HorizontalResolution>1280</HorizontalResolution>
<VerticalResolution>720</VerticalResolution>
<Latency>0</Latency>
<MinimumSliceSize>0</MinimumSliceSize>
<SliceEncodingParams>0</SliceEncodingParams>
<FrameRateControlSupp>1</FrameRateControlSupp>
<VideoFps>30</VideoFps>
</VideoCodec>
</CBP>

<StandbyResumeCapability>
<Valid>1</Valid>
</StandbyResumeCapability>
<!--
IDR interval is to trigger an IDR request from sink.
This can be applcable only to sink. IDRInterval is in msec
-->
<IDRRequest>
<Valid>0</Valid>
<IDRInterval>0</IDRInterval>
</IDRRequest>
<AVFormatChange>
<Valid>0</Valid>
<AVInterval>0</AVInterval>
</AVFormatChange>
<!--
Frame skipping interval is in the scale of 500 msec/half second.
FrameInterval can be between 1 to 7, according to the WFD spec.
-->
<FrameSkipping>
<Valid>0</Valid>
<FrameInterval>0</FrameInterval>
</FrameSkipping>
<ContentProtection>
<HDCPValid>0</HDCPValid>
<Version>WFD_HDCP_2_1</Version> <!-- Valid values WFD_HDCP_2_0 and WFD_HDCP_2_1 -->
<CPPort>6789</CPPort>
<EncryptAudio>0</EncryptAudio> <!-- Valid values 0 / 1 to indicate Audio encryption or not -->
</ContentProtection>
<RTPDumpEnable>
<Valid>0</Valid>
</RTPDumpEnable>

<BufferCtrlEnable>
<Valid>1</Valid>
</BufferCtrlEnable>

<UIBC>
<UIBCValid>1</UIBCValid> <!-- 0/1 UIBC supported or not -->
<InputCategory>
<Generic>1</Generic> <!-- 0/1 - support generic or not -->
</InputCategory>
<InputEvents>
<GenericInputEvents>
<Mouse>1</Mouse> <!-- 0/1 for all Input Event Types -->
<Keyboard>1</Keyboard>
<SingleTouch>1</SingleTouch>
<MultiTouch>1</MultiTouch>
<JoyStick>0</JoyStick>
<Camera>0</Camera>
<Gesture>0</Gesture>
<RemoteControl>1</RemoteControl>
</GenericInputEvents>
</InputEvents>
<TcpPort>4321</TcpPort>
</UIBC>
</Capability>

---- Capability. Xml

<Capability>
<AudioLPCM>
<Name>LPCM</Name>
<Valid>1</Valid>
<Channels>2</Channels>
<SamplingFreq>48000</SamplingFreq>
<Latency>33</Latency>
</AudioLPCM>
<AudioAAC>
<Name>AAC</Name>
<Valid>1</Valid>
<Channels>2</Channels>
<SamplingFreq>48000</SamplingFreq>
<Latency>0</Latency>
</AudioAAC>
<AudioAC3>
<Name>AC3</Name>
<Valid>0</Valid>
<Channels>0</Channels>
<SamplingFreq>0</SamplingFreq>
<Latency>0</Latency>
</AudioAC3>
<VideoHeader>
<VideoMethod>1</VideoMethod>
<PreferredDisplaySupport>0</PreferredDisplaySupport>
<H264Profiles>1</H264Profiles>
<Valid>1</Valid>
</VideoHeader>

<CBP>
<VideoCodec>
<Profile>1</Profile>
<Level>1</Level>
<HorizontalResolution>1280</HorizontalResolution>
<VerticalResolution>720</VerticalResolution>
<Latency>0</Latency>
<MinimumSliceSize>0</MinimumSliceSize>
<SliceEncodingParams>0</SliceEncodingParams>
<FrameRateControlSupp>1</FrameRateControlSupp>
<VideoFps>30</VideoFps>
</VideoCodec>
</CBP>
<CHP>
<VideoCodec>
<Profile>2</Profile>
<Level>1</Level>
<HorizontalResolution>800</HorizontalResolution>
<VerticalResolution>480</VerticalResolution>
<Latency>0</Latency>
<MinimumSliceSize>0</MinimumSliceSize>
<SliceEncodingParams>0</SliceEncodingParams>
<FrameRateControlSupp>1</FrameRateControlSupp>
<VideoFps>30</VideoFps>
</VideoCodec>
</CHP>

<StandbyResumeCapability>
<Valid>1</Valid>
</StandbyResumeCapability>
<!--
IDR interval is to trigger an IDR request from sink.
This can be applcable only to sink. IDRInterval is in msec
-->
<IDRRequest>
<Valid>0</Valid>
<IDRInterval>0</IDRInterval>
</IDRRequest>
<AVFormatChange>
<Valid>0</Valid>
<AVInterval>0</AVInterval>
</AVFormatChange>
<!--
Frame skipping interval is in the scale of 500 msec/half second.
FrameInterval can be between 1 to 7, according to the WFD spec.
-->
<FrameSkipping>
<Valid>0</Valid>
<FrameInterval>0</FrameInterval>
</FrameSkipping>
<ContentProtection>
<HDCPValid>0</HDCPValid>
<Version>WFD_HDCP_2_1</Version> <!-- Valid values WFD_HDCP_2_0 and WFD_HDCP_2_1 -->
<CPPort>6789</CPPort>
</ContentProtection>
<RTPPortType>
<ConnectionType>0</ConnectionType> <!-- 0 - UDP ,1 - TCP -->
</RTPPortType>
<RTPDumpEnable>
<Valid>0</Valid> <!-- Enable RTP Dump Valid = 1 or Valid = 0-->
</RTPDumpEnable>
<UIBC>
<UIBCValid>0</UIBCValid> <!-- 0/1 UIBC supported or not -->
<InputCategory>
<Generic>1</Generic> <!-- 0/1 - support generic or not -->
</InputCategory>
<InputEvents>
<GenericInputEvents>
<Mouse>1</Mouse> <!-- 0/1 for all Input Event Types -->
<Keyboard>1</Keyboard>
<SingleTouch>1</SingleTouch>
<MultiTouch>1</MultiTouch>
<JoyStick>1</JoyStick>
<Camera>0</Camera>
<Gesture>0</Gesture>
<RemoteControl>1</RemoteControl>
</GenericInputEvents>
</InputEvents>
<TcpPort>4321</TcpPort>
</UIBC>
</Capability>

I claim no responsibility for you changing files on your own phone, this fixed took me about a month of constant work and if you change the wrong files it may brick your phone.

I have had a 90% success rate with connecting when I connect Right after restarting the phone.
Restart, and as soon as your lock screen comes up. Unlock your phone and connect to your dongle. Then you will have clean connects.


If ive helped you fix screen mirroring
And you would like to thank me.... buy me a coffee
PayPal: mreger444@gmail.com
The Following 5 Users Say Thank You to xxjomamaxx For This Useful Post: [ Click to Expand ]
 
sternem
Old
#2  
Junior Member
Thanks Meter 3
Posts: 2
Join Date: Dec 2010
Thumbs up Working for i747 S3

I was about to try the library edit technique for my S3 (i747) when I stumbled upon your post. I modified one line in the wfdconfig.xml after I compared my file to yours. I updated it through the file manager in TWRP recovery, rebooted and it worked!


Code:
<HDCPValid>0</HDCPValid>
Thanks!
The Following 3 Users Say Thank You to sternem For This Useful Post: [ Click to Expand ]
 
hahansen3
Old
#3  
Member
Thanks Meter 10
Posts: 77
Join Date: Dec 2010
Quote:
Originally Posted by sternem View Post
I was about to try the library edit technique for my S3 (i747) when I stumbled upon your post. I modified one line in the wfdconfig.xml after I compared my file to yours. I updated it through the file manager in TWRP recovery, rebooted and it worked!


Code:
<HDCPValid>0</HDCPValid>
Thanks!
I have a Sprint Samsung Galaxy S4 (SPH-L720) and made the one change to HDCPValid, and my screen mirroring started working again. Thank you!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
asn1
Old
#4  
Junior Member
Thanks Meter 0
Posts: 14
Join Date: Jun 2009
Default Cannot find wfdconfig.xml on my i9500

Quote:
Originally Posted by hahansen3 View Post
I have a Sprint Samsung Galaxy S4 (SPH-L720) and made the one change to HDCPValid, and my screen mirroring started working again. Thank you!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
I searched a lot and am not able to find wfdconfig.xml on my i9500 s4 rooted with cfautoroot on official 4.4.2

Does anyone know if the above works for kitkat or are the filesddifferent for kitkat?
Thanks in advance!
HTC Desire running NikeZ P10
 
Gage_Hero
Old
#5  
Senior Member
Thanks Meter 191
Posts: 1,144
Join Date: Jul 2010
Default Device not HDCP compilant

Hi Guys,

Any setting I can make to the xml file that will allow me to use my TV which as it seems is not HDCP compliant? I am using the measy a2w and for mirror I get as far as connecting then it goes downhill.... unable to enable mirroring device connected is not HDCP supported. I have a HDCP compliant monitor that I can hook up but wanted to use the TV.....
Telus Galaxy S4 - Stock 4.3 to
[ROM] Maple leaf iBASTiD if ya aint tried it.... you should... Go Canada... Go iBASTiD......
 
exxocism
Old
#6  
Junior Member
Thanks Meter 0
Posts: 2
Join Date: Nov 2010
Default Patch for SHV-E210S (Galaxy S3, SGS3)

Quote:
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..
Here's my modified libWFD_ENGINE.so for Samsung Galaxy S3 (SHV-E210S).
I got it working on E210SKSUGNA2.. I recommend not to try on other version cause it may brick your system ( I did )
and here are some differencies for you, in case you need some modifying job..
 
iAndroidTH
Old
#7  
Junior Member
Thanks Meter 4
Posts: 21
Join Date: Feb 2014
Location: Bangkok
Quote:
Originally Posted by exxocism View Post
Here's my modified libWFD_ENGINE.so for Samsung Galaxy S3 (SHV-E210S).
I got it working on E210SKSUGNA2.. I recommend not to try on other version cause it may brick your system ( I did )
and here are some differencies for you, in case you need some modifying job..
There's NO libWFD_ENGINE.so in system/lib. Any idea ?

S4 i9500 OzcanROM
 
GaganK
Old
#8  
Junior Member
Thanks Meter 0
Posts: 1
Join Date: Jul 2014
Default Unable to use Screen Mirrioring On rooted S3 SHWM440S SKT

Quote:
Originally Posted by iAndroidTH View Post
There's NO libWFD_ENGINE.so in system/lib. Any idea ?

S4 i9500 OzcanROM
Hi i have read though your post but am unable to understand how to activate Screen Mirroring on rooted S3 SHWM440S 3G SKT. The screen mirroring feature used to work just fine when my device was not rooted but after rooting this feature on activation shows a message as some hardware issue.
I would request to develop some app or a simpler process by which i can activate screen mirroring on my device once again.
Please reply on this and resolve this problem.
I am not an Android developer so would request for help here from several android enthusiasts who would try to develop an app which can modify HDCP and start screen mirroring once again.
I suppose the app would be in high demand even if a price has to be paid for it.
Awaiting reply.

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes