rtang
Posts: 49
Joined: Mon Oct 08, 2012 6:27 am

Re: Piracast (Miracast on Pi) Beta Release

Wed Jan 01, 2014 6:05 am

I've uploaded release 0.2 which contains a re-compiled version of the dongle driver which works for Raspbian 2013-12-20.

rtang
Posts: 49
Joined: Mon Oct 08, 2012 6:27 am

Re: Piracast (Miracast on Pi) Beta Release

Wed Jan 01, 2014 6:17 am

Exand_0 wrote:It had been a few week, since i installed piracast and i did not test it since that time. Yesterday i wanted to start it and i stuck at the "read_all_sta" error.
I still use the same Nexus 10 with CM.10.2 and i think it could only happen because of the updates, because i see no other reasons for this error. However it's strange
I also reinstalled the whole system on the pi and tried the 0.1 version, but nothing changed.

UPD:
I tested with Nexus 7 with android 4.4 and stuck by the same "read_all_sta"
Please give release 0.2 a try.

rtang
Posts: 49
Joined: Mon Oct 08, 2012 6:27 am

Re: Piracast (Miracast on Pi) Beta Release

Wed Jan 01, 2014 6:21 am

craigbeat wrote:Working on Nexus 5 4.4. Audio and video are out of sync, though. Plus, you need to be close to device or video breaks up.

Sometimes gets stuck at various points when connecting as per video, but keeping on trying gets a connection.
Please give release 0.2 a try - it improved video/audio sync issue for 4.4.

Miracast is an UDP based protocol (doesn't have retransmit). If the sink and source are far apart the connection will suffer unrecoverable packet loss. I didn't implement any elegant slice loss handling algorithm - hence the artifacts.

padde
Posts: 1
Joined: Fri Jan 03, 2014 1:11 am

Re: Piracast (Miracast on Pi) Beta Release

Fri Jan 03, 2014 1:15 am

Hey Richard,
first off, thank you so much for developing Piracast!
I have installed Piracast 0.2 on 2013-12-20-wheezy-raspbian with TL-WN725N V2 but I’m still get the same error with both devices. It get stuck at read_all_sta to infinity.

“read_all_sta:
Selected interface 'wlan0'

read_all_sta:
Selected interface 'wlan0'

read_all_sta:
Select interface ….
…”

Complete Log:http://pastebin.com/X63BJiry

Device 1: LG Nexus 5 (Android 4.4.2)
Device 2: Samsung Galaxy Nexus (Android 4.3)

I have also modified the /etc/network/interfaces file and added the following line “allow-hotplug wlan0”.

Am I doing something wrong? Someone else in this thread get this working by using the same phone and wifi dongle.

Any ideas what I could try to do to get it work?

chris007
Posts: 3
Joined: Thu Dec 26, 2013 9:04 pm

Re: Piracast (Miracast on Pi) Beta Release

Fri Jan 03, 2014 11:40 pm

Hi rtang,

I have a generic question: as to my understanding, wifi direct does not require a static network configuration of the wlan interface to be used, right? I mean, the point is that the wlan interface can act in "multi-mode". I would expect that the wifi interface is connected to a real access point, while still being able to act as P2P go in case of wifi direct.

According to your installation guide, this is not envisioned in your current setup right?

Cheers
Christoph

caraar12345
Posts: 1
Joined: Sat Jan 04, 2014 12:20 pm

Re: Piracast (Miracast on Pi) Beta Release

Sat Jan 04, 2014 12:26 pm

Hi there,
Yesterday I set Piracast up for use with my LG G2 and my Nexus 7 (2013). With the Nexus 7, it connects first time and I have no issues. However, with the LG G2, it gets to "wps passed!", then it just says:

Code: Select all

read_all_sta:
Selected interface 'wlan0'
This is then repeated over and over infinitely (as far as I can see). "Piracast" then ceases to show up in the Miracast list on my Nexus 7 and the phone. As you'd expect, the only way to get out of the infinite loop is by doing Ctrl+C. Please can you assist me in this?

Thanks,
Aaron

rtang
Posts: 49
Joined: Mon Oct 08, 2012 6:27 am

Re: Piracast (Miracast on Pi) Beta Release

Sat Jan 04, 2014 10:38 pm

chris007 wrote:Hi,

I tested piracast today with my Samsung Galaxy S4 Mini:
- installation worked according to the hint with auto up of wlan0
- display is visible on the S4 Mini
- when trying to connect, negotiation between both devices seems to start, and piracast informs periodically with "read_all_sta:"
- after a while, S4 Mini informs that the display sharing has not been established

Anyway, thanks for your work! It would be very cool if you find the time to go ahead with piracast.

Two additional questions:
- Is it possible to get access to the sources of your work, e.g. at github?. This way it might be possible that people can support your work. To be honest, I'm not (yet) familiar with the Miracast protocol and don't think that I can be of any short term help.
- General question to the Miracast protocol: is it possible to have the Raspberry PI connected to the same WiFi Router as my CE devices, but still act as the "virtual display" and being detectable by the CE devices as display? I could imagine that at least the dhpc daemon on the Rasperry PI creates conflicts here...

Regards
Chris
1. Source code released under GPL now.
2. I don't think so. Miracast sink advertises 'beacon frames' to indicate that its capable as a wifi-display. Beacon frame I think is in layer 2.

rtang
Posts: 49
Joined: Mon Oct 08, 2012 6:27 am

Re: Piracast (Miracast on Pi) Beta Release

Sat Jan 04, 2014 10:40 pm

thommythekid wrote:Hi,

in the youtube video you are referring to a special version of the OS of the raspberry PI
and you say, it only works with that special version. So two questions:

1. is this still the case (that it only works with one specific nightly build)
2. can anyone provide a download link for the OS version it should work for ?

thanks
Kind regards
ThommyTheKid
I re-compiled the driver for the latest Rapsbian image. See release 0.2.

rtang
Posts: 49
Joined: Mon Oct 08, 2012 6:27 am

Re: Piracast (Miracast on Pi) Beta Release

Sat Jan 04, 2014 10:43 pm

chris007 wrote:Hi rtang,

I have a generic question: as to my understanding, wifi direct does not require a static network configuration of the wlan interface to be used, right? I mean, the point is that the wlan interface can act in "multi-mode". I would expect that the wifi interface is connected to a real access point, while still being able to act as P2P go in case of wifi direct.

According to your installation guide, this is not envisioned in your current setup right?

Cheers
Christoph
You could be right - this configuration was mostly me being lazy and attempting to quickly bring the project up. I forced static IP configuration because the DHCP server requires an IP address during server bring up (so I don't need to know configure it dynamically).

I've open sourced the code under GPL - feel free to poke at it! :)

Mini-Me
Posts: 4
Joined: Tue Jan 07, 2014 7:03 pm

Re: Piracast (Miracast on Pi) Beta Release

Tue Jan 07, 2014 8:05 pm

Hey Richard,

I just found your project. It sounds awesome!
I'm tempted to try it, only I don't have the correct WiFi dongle yet. I checked Amazon and found the one you mentioned for quite cheap. Only the reviews sound like I'd get a v3 or v3.1. What's your expectation, could one get those to work, too?

My next hurdle after that might be that I want to get it to work with my Samsung Galaxy S4 (with Android 4.3) and previous posts suggest its HDCP "enforcement" makes it fail :D.

Cheers, Sebastian

Edit: Actually, nevermind. I ordered one and it read V2.0 on the box, so all is good :).
Last edited by Mini-Me on Wed Jan 15, 2014 3:32 pm, edited 1 time in total.

fsp-tomcat
Posts: 1
Joined: Wed Jan 08, 2014 10:50 am

Re: Piracast (Miracast on Pi) Beta Release

Wed Jan 08, 2014 10:57 am

we have installed the whole software and it works with our pad, os version 4.2. connection is working proberly but after 10 seconds the link will be disconnected. is there a setting to fix this ? has anybody an idea ?

dejant_9
Posts: 4
Joined: Fri Jan 10, 2014 1:54 pm

Re: Piracast (Miracast on Pi) Beta Release

Fri Jan 10, 2014 3:31 pm

but which version of the driver? 2 there are:
one for the V1 dongle
one for the V2: https://dl.dropboxusercontent.com/u/802 ... 219.tar.gz

with the V2 dongle, once installed piracast, my DHCP fail to start, and it is for this reason that we get an “read_all_sta:" error I think

afarnaus
Posts: 4
Joined: Wed Jan 08, 2014 11:26 pm

Re: Piracast (Miracast on Pi) Beta Release

Fri Jan 10, 2014 10:28 pm

Hi, rtang
First off, thanks for developing piracast. It was just what I was looking for in terms of mirroring my phone screen.
I have one question though. I am using a Moto X android 4.4 and I keep getting the following.

Code: Select all

pi@raspberrypi ~/piracast/application $ sudo ./main
Bring up wlan0 just in case...
Increase rmem_default...
Kill running application...
app: no process found

RTNETLINK answers: File exists
Starting ISC DHCP server: dhcpd.

wpa_supplicant: no process found
hostapd: no process found
Waiting for incoming connection...
peer_status:  2
peer_status:  2
peer_status:  2
peer_status:  2
peer_status:  2
peer_status:  2
peer_status:  2
peer_status:  2
peer_status:  2
peer_status:  2
peer_status:  2
peer_status:  2
peer_status:  2
peer_status:  2
peer_status:  2
peer_status:  2
peer_status:  2
peer_status:  2
peer_status:  2
peer_status:  2
peer_status:  2
peer_status:  2
peer_status:  2
peer_status:  2
peer_status:  2
peer_status:  2
peer_status:  2
peer_status:  2
peer_status:  2
peer_status:  2
peer_status:  2
peer_status:  2
peer_status:  2
peer_status:  2
peer_status:  2
peer_status:  2
peer_status:  2
peer_status:  2
peer_status:  2
peer_status:  2
peer_status:  2
peer_status:  2
peer_status:  2
peer_status:  11
peer_status:  11
peer_status:  11
peer_status:  11
peer_status:  11
peer_status:  8
Discovery request received!
wlan0     No scan results


wlan0     Scan completed :
          Cell 01 - Address: F8:F1:B6:53:BF:E2
                    ESSID:"DIRECT-"
                    Protocol:IEEE 802.11g
                    Frequency:2.437 GHz (Channel 6)
                    Encryption key:on
                    Bit Rates:54 Mb/s
                    IE: Unknown: DD870050F204104A0001101044000101101200020004103B00010010470010841820AF64E35FC58004B77D4E5090C4102100086D6F746F726F6C6110230006585431303536102400065854313035361042000A5430363332303058585610540008000A0050F20400051011000C416C657827732050686F6E651008000243881049000600372A000120
                    Quality=101/100  Signal level=76/100


Getting peer device address...
p2p_peer_devaddr_get:
peer_devaddr:  F8:F1:B6:53:BF:E2
p2p_wpsinfo:
Getting peer authentication type...
p2p_req_cm_get:
wlan0     p2p_get:

CM=pbc


Confirming peer authentication...
p2p_set_nego:
mac:  F8:F1:B6:53:BF:E2
peer_status:  9
peer_status:  10
Negotiation suceeded!
p2p_role_get:
Role:  2
p2p_opch_get:
---------------------------
wlan0     p2p_get:

---------------------------
Configuration file: p2p_hostapd.conf
drv->ifindex=3
l2_sock_recv==l2_sock_xmit=0x0x6cc630
Failed to request a scan of neighboring BSSes
+rtl871x_sta_deauth_ops, ff:ff:ff:ff:ff:ff is deauth, reason=2
rtl871x_set_key_ops
rtl871x_set_key_ops
rtl871x_set_key_ops
rtl871x_set_key_ops
Using interface wlan0 with hwaddr 10:fe:ed:12:97:40 and ssid 'DIRECT-RT'
rtl871x_set_beacon_ops
rtl871x_set_hidden_ssid_ops
rtl871x_set_wps_assoc_resp_ie
rtl871x_set_wps_beacon_ie
rtl871x_set_wps_probe_resp_ie
rtl871x_set_key_ops
rtl871x_set_beacon_ops
rtl871x_set_hidden_ssid_ops
do_wps
Selected interface 'wlan0'
OK

wps passed!
read_all_sta:
Selected interface 'wlan0'

read_all_sta:
Selected interface 'wlan0'

read_all_sta:
Selected interface 'wlan0'

read_all_sta:
Selected interface 'wlan0'

read_all_sta:
Selected interface 'wlan0'

read_all_sta:
Selected interface 'wlan0'

read_all_sta:
Selected interface 'wlan0'

read_all_sta:
Selected interface 'wlan0'

read_all_sta:
Selected interface 'wlan0'

read_all_sta:
Selected interface 'wlan0'

read_all_sta:
Selected interface 'wlan0'

read_all_sta:
Selected interface 'wlan0'

read_all_sta:
Selected interface 'wlan0'

read_all_sta:
Selected interface 'wlan0'

read_all_sta:
Selected interface 'wlan0'

read_all_sta:
Selected interface 'wlan0'

read_all_sta:
Selected interface 'wlan0'

read_all_sta:
Selected interface 'wlan0'

read_all_sta:
Selected interface 'wlan0'

read_all_sta:
Selected interface 'wlan0'

read_all_sta:
Selected interface 'wlan0'

read_all_sta:
Selected interface 'wlan0'
Is there something I am doing wrong? or is the Moto X just not supported?

Thanks, afarnaus

weli
Posts: 1
Joined: Fri Jan 10, 2014 6:48 am

Re: Piracast (Miracast on Pi) Beta Release

Sat Jan 11, 2014 3:53 am

Dear all,
these day,I'm try to using nexus 4 connect to raspberry pi+ 2013/12/20 raspberry pi image and Version 0.2 piracast,
but always fail,
log always print
read_all_sta:
Selected interface 'wlan0'
------------------------------------------------
today, I'm try to another method
i using Piracast source code(https://github.com/codemonkeyricky/piracast) and follow Readme.md to build code and execute run code.
finally, It can be successfully executed.

sorry,i come form Taiwan
so English not my first language,
hoped you can forgive

doctor_robert
Posts: 1
Joined: Sat Jan 11, 2014 10:39 am

Re: Piracast (Miracast on Pi) Beta Release

Sat Jan 11, 2014 11:00 am

Thanks a lot for developing this. I work in the AV department of a London University, naturally we are interested in this kind of development, not least because our cables regularly go missing ;)

Anyway, as a test we set up a Pi with Piracast with some success. We managed to connect a Nexus 7 2013 first time with no issues. We also tried connecting a Dell E5430 laptop with WiDi. The WiDi software on the laptop was able to see the Piracast device but we could not connect the two. The output of the pi reads "peer_status: 12".

Not sure if this information is useful to you, but thought I'd share.

gizi
Posts: 5
Joined: Thu Mar 14, 2013 10:24 am

Re: Piracast (Miracast on Pi) Beta Release

Sat Jan 11, 2014 4:11 pm

Is this working with Windows 8.1? Win8.1 has Miracast implemented.....

jackwuwei
Posts: 1
Joined: Sun Jan 12, 2014 4:20 am

Re: Piracast (Miracast on Pi) Beta Release

Sun Jan 12, 2014 4:30 am

I can not see the Miracast Device on Cast Screen Settings, but show a deivce named "Piracast" on Wi-Fi Direct setting. My phone is Nexus 5 with Android 4.4.2. Please help me, thanks.

baumi
Posts: 1
Joined: Wed Jan 15, 2014 2:24 am

Re: Piracast (Miracast on Pi) Beta Release

Thu Jan 16, 2014 1:44 pm

Thanks Richard for your efforts in building Piracast.

I've tried to get it working with my Samsung S4 mini and have found a few things you might be interested in:

1. For everyone that gets "Role: 2" and then continued "read_all_sta" Messages:
"Role: 2" means that the mobile device wants to be the access point (called group owner in wifi direct) and the pi should be the client. This configuration isn't supported. But the devices decide which configuration to used based on the "intent" to be a growner. This intent is send during the connection. So changing
call(["iwpriv", "wlan0", "p2p_set", "intent=1"])
in wfd.py to
call(["iwpriv", "wlan0", "p2p_set", "intent=15"])
sets the highest possible intent (15) and thus forces the pi to be the access point. You should then get the Message "Role: 3" and the wps setup should work.

2. My S4 Mini uses the UPD Port for RTP that is given in the M3 response. At the moment this is (in sink.py):
'wfd_client_rtp_ports: RTP/AVP/UDP;unicast 19000 0 mode=play\r\n'
but later in the M6 request port number 50000 is given (the core-application is also listening on that port). To get my device to use the port 50000 I had to change the above line to:
'wfd_client_rtp_ports: RTP/AVP/UDP;unicast 50000 0 mode=play\r\n'

3. Now I get RTP packets from my S4 mini, but the core application crashes due to an assertion. Samsung is using some different transport stream settings. Since there is already a player using the hardware acceleration for the raspberry, I've used this OMXPlayer
https://github.com/popcornmix/omxplayer
and just added "m_filename.substr(0,6) == "rtp://" || " to OMXReader.cpp to also get it to open RTP Streams.

And it kind of works. At least I can prove that content protection (HDCP) is not activated by default. The video is still full of artifacts and the lag can reach more than 10sec, but I suppose that this is the case, because I'm using the 2,4GHz band that is kind of crowded.

Baumi

gizi
Posts: 5
Joined: Thu Mar 14, 2013 10:24 am

Re: Piracast (Miracast on Pi) Beta Release

Fri Jan 17, 2014 1:21 pm

I have this error, i dont see any Piracast device at my devices

Code: Select all

Bring up wlan0 just in case...
Increase rmem_default...
Kill running application...

RTNETLINK answers: File exists
Starting ISC DHCP server: dhcpd.

wpa_supplicant: no process found
hostapd: no process found
Waiting for incoming connection...
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/cx_Freeze/initscripts/Console.py", line 27, in <module>
  File "main.py", line 63, in <module>
  File "wfd.py", line 273, in wfd_connection_wait
  File "wfd.py", line 38, in p2p_status_get
AttributeError: 'NoneType' object has no attribute 'group'

tabriis
Posts: 2
Joined: Sat Jan 18, 2014 3:42 am

Re: Piracast (Miracast on Pi) Beta Release

Sat Jan 18, 2014 3:59 am

Thank you so much for building this, I just tried immediately when I bought the right dongle.

But it didn't work very well for me,
I have a Rpi rev B running the raspbian 12-30 image and nexus 4 very latest stock rom,
at the beginning I got a infinite reading_sta output and thanks for szobabicikli's tip that I added the "allow hot-plug wlan0" in interfaces then it looks like working fine.

but at the end the phone show me that it has connected but the TV screen just didn't show me the screen of my phone,
instead there is still the terminal screen and some codes output with the

Code: Select all

sent keep alive!
at the end of the screen every half or one minute.

Is there something setup of configuration I missed?

rtang
Posts: 49
Joined: Mon Oct 08, 2012 6:27 am

Re: Piracast (Miracast on Pi) Beta Release

Sun Jan 19, 2014 6:57 pm

tabriis wrote:Thank you so much for building this, I just tried immediately when I bought the right dongle.

But it didn't work very well for me,
I have a Rpi rev B running the raspbian 12-30 image and nexus 4 very latest stock rom,
at the beginning I got a infinite reading_sta output and thanks for szobabicikli's tip that I added the "allow hot-plug wlan0" in interfaces then it looks like working fine.

but at the end the phone show me that it has connected but the TV screen just didn't show me the screen of my phone,
instead there is still the terminal screen and some codes output with the

Code: Select all

sent keep alive!
at the end of the screen every half or one minute.

Is there something setup of configuration I missed?
Which video port are you using, hdmi or component?

rtang
Posts: 49
Joined: Mon Oct 08, 2012 6:27 am

Re: Piracast (Miracast on Pi) Beta Release

Sun Jan 19, 2014 6:59 pm

baumi wrote:Thanks Richard for your efforts in building Piracast.

I've tried to get it working with my Samsung S4 mini and have found a few things you might be interested in:

1. For everyone that gets "Role: 2" and then continued "read_all_sta" Messages:
"Role: 2" means that the mobile device wants to be the access point (called group owner in wifi direct) and the pi should be the client. This configuration isn't supported. But the devices decide which configuration to used based on the "intent" to be a growner. This intent is send during the connection. So changing
call(["iwpriv", "wlan0", "p2p_set", "intent=1"])
in wfd.py to
call(["iwpriv", "wlan0", "p2p_set", "intent=15"])
sets the highest possible intent (15) and thus forces the pi to be the access point. You should then get the Message "Role: 3" and the wps setup should work.

2. My S4 Mini uses the UPD Port for RTP that is given in the M3 response. At the moment this is (in sink.py):
'wfd_client_rtp_ports: RTP/AVP/UDP;unicast 19000 0 mode=play\r\n'
but later in the M6 request port number 50000 is given (the core-application is also listening on that port). To get my device to use the port 50000 I had to change the above line to:
'wfd_client_rtp_ports: RTP/AVP/UDP;unicast 50000 0 mode=play\r\n'

3. Now I get RTP packets from my S4 mini, but the core application crashes due to an assertion. Samsung is using some different transport stream settings. Since there is already a player using the hardware acceleration for the raspberry, I've used this OMXPlayer
https://github.com/popcornmix/omxplayer
and just added "m_filename.substr(0,6) == "rtp://" || " to OMXReader.cpp to also get it to open RTP Streams.

And it kind of works. At least I can prove that content protection (HDCP) is not activated by default. The video is still full of artifacts and the lag can reach more than 10sec, but I suppose that this is the case, because I'm using the 2,4GHz band that is kind of crowded.

Baumi
Thanks. This is really really good stuff. I can easily incorporate the first 2 items into the project, but the third item requires me to get my hands on an actual galaxy device. I'll see if I could get my hands on one.

tabriis
Posts: 2
Joined: Sat Jan 18, 2014 3:42 am

Re: Piracast (Miracast on Pi) Beta Release

Mon Jan 20, 2014 7:37 pm

rtang wrote:
tabriis wrote:Thank you so much for building this, I just tried immediately when I bought the right dongle.

But it didn't work very well for me,
I have a Rpi rev B running the raspbian 12-30 image and nexus 4 very latest stock rom,
at the beginning I got a infinite reading_sta output and thanks for szobabicikli's tip that I added the "allow hot-plug wlan0" in interfaces then it looks like working fine.

but at the end the phone show me that it has connected but the TV screen just didn't show me the screen of my phone,
instead there is still the terminal screen and some codes output with the

Code: Select all

sent keep alive!
at the end of the screen every half or one minute.

Is there something setup of configuration I missed?
Which video port are you using, hdmi or component?
It's HDMI, never mind, it was one of the VPN-like apps that interrupt the signal, the piracast is working perfectly now.

Thank you for this great project, it is quite better than using XBMC on pi for video streaming.

hansmeier1981
Posts: 2
Joined: Wed Jan 29, 2014 10:05 pm

Re: Piracast (Miracast on Pi) Beta Release

Wed Jan 29, 2014 10:08 pm

Is there any solution for the following error, which was already described by some users?

Code: Select all

read_all_sta:
Selected interface 'wlan0'
I get this error with my HTC One and Samsung S3!

rtang
Posts: 49
Joined: Mon Oct 08, 2012 6:27 am

Re: Piracast (Miracast on Pi) Beta Release

Sun Feb 02, 2014 7:46 am

hansmeier1981 wrote:Is there any solution for the following error, which was already described by some users?

Code: Select all

read_all_sta:
Selected interface 'wlan0'
I get this error with my HTC One and Samsung S3!
I've made some fixes based on feedback from user baumi. Please give the latest release a try.

Return to “Media centres”