Skip to content
Alberto Fanjul edited this page Oct 29, 2022 · 57 revisions

Does my hardware supports miraclecast requirements:

Check it running res/test-hardware-capabilities.sh

Do I have all needed software installed:

After install miraclecast, you can configure viewer in different ways, see config external player but default basic viewer is a gstreamer python plugin. It needs gstreamer plugins installed. You can check with test-viewer.sh:

./test-viewer.sh 

testing plugins required:

test udpsrc... (passed)
test rtpjitterbuffer... (passed)
test rtpmp2tdepay... (passed)
test tsdemux... (passed)
test h264parse... (passed)
test avdec_h264... (passed)
test autovideosink... (passed)

everything installed

Log for support

$ sudo journalctl -f |& tee journal.log
$ sudo miracle-wifid --log-level trace --log-date-time |& tee wifid.log
$ sudo miracle-sinkctl --log-level trace --log-journal-level trace --log-date-time |& tee sink.log

add wifid.log, sink.log and journal.log to a zip and upload to a new or existing issue. Is handy to include exact command line used miracle-wifid --log-level trace miracle-sinkctl --log-level trace run 3 etc.

Security concerns: If you're afraid to upload your mac address on logs, add this filter before tee

sed 's/..:..:..:..:..:../00:00:00:00:00:00/g'

to hide your mac address.

To provide logs for dbus you can use

$ sudo dbus-monitor --system |& tee dbus.log

Ubuntu requirements

- ubuntu-restricted-extras
- gstreamer1.0
- libglib2.0-dev 
- libreadline-dev
- libudev-dev
- libsystemd-dev
- libusb-dev
- build-essential

optional:

- git
- check
- cmake

Raspberry pi instructions

Choosing an operative system

The only concern when choosing a OS is that miraclecast needs a recent version of systemd (>219) On first tries to install it, raspbians was not recent enough, so I use arch arm

https://archlinuxarm.org/platforms/armv8/broadcom/raspberry-pi-3

which is based in rpi2. These days (2017) raspbian OS (official recommended OS for raspberry pi) is based on debian stretch, and comes now with systemd 232:

https://packages.debian.org/stable/systemd

So you can choose whatever OS you want, just check systemd version with

$ systemctl --version

If it is >219 is ok

Links to raspbian install:

See rp1/2 do not include wifi card so you need to plug one which support Wifi Direct (these days I guess all usb support that). rpi3 comes with wifi card

There's a specific guide for rpi3 and arch arm raspberry pi 3

Bring down wifi interfaces

Failed to create interface p2p-dev-wlan0: -16 (Device or resource busy)

Means that interface used by miraclecast is not ready to use. Normally that means that something (many times miraclecast) left a wireless interface configured without p2p

Check if something restarted normal wifi config. It's easy to detect because wpa_supplicant spawned by miracast has a control interface socket configured by '-C /run/miracle/wifi/...' and wpa_supplicant by network managers normally was a '-u' (dbus interface)

Depending on your system there will be a series of services and target that tries to reconfig wpa_supplicant if you just kill it:

$ sudo systemctl stop NetworkManager
$ sudo systemctl stop wpa_supplicant

one of them should work. You can enable again after use miraclecast with:

$ sudo systemctl start NetworkManager
$ sudo systemctl start wpa_supplicant 

Miracast vs Chromecast

Many people see these technologies as similar but they are far from being the same, although the final result seems pretty similar.

Chromecast and other technologies (like AirPlay9 are based on using all the devices under the same Wifi (i.e using an AP), while miracast is based on Wifi-Direct (No AP). This results in two devices communicating with the security level they decide two provide (maybe none at all), instead of allowing access to a local network to unknown devices. Miracast is too a battery drainer for this reason, as the need to keep communication working all the time

Microsoft OS support

Microsoft extends the miracast protocol. Check extend request protocol, there's a config example too. Is tested against Windows 10, but people report it works with Microsoft wireless display adapter too. Feedback welcome.

Install dbus policy

You need to copy the dbus policy res/org.freedesktop.miracle.conf to /etc/dbus-1/system.d/ to expose miraclecast dbus service.

See all buildsystems will do this for you in the install phase (i.e. sudo make install, sudo ninja install)

after install dbus daemon needs to be reloaded. You can do restarting the system or without restart with this command:

dbus-send --system --type=method_call --dest=org.freedesktop.DBus / org.freedesktop.DBus.ReloadConfig

Using USB dongle

there's a know drawback on miraclecast. It do not allow to run simultaneously wifi and wifi direct (See https://github.com/albfan/miraclecast/issues/75). If you have two wifi network devices you can run both at same time. Supposing you use NetworkManager for network management:

nmcli device set wlan0 managed yes
nmcli device set wlan1 managed no

The interface not managed by your network manager will be used by miraclecast

  • Run miraclecast on lazy manage mode:
sudo miracle-wifid --lazy-managed

then on miracle-*ctl you can choose what link to use:

sudo miracle-sinkctl
list
set-managed 3 yes
run 3