Use the windows monitor as an extended screen for linux

Write custom directory title here

foreword

  • The tested linux system is ubuntu 18.04
  • The tested windows system is win10
  • To use the windows display as an extended screen of linux, you need to use Microsoft's Miracast technology. Windows comes with no more to say, linux uses this open source software albfan/miraclecast
  • The operation is divided into two parts, which must be configured on both linux and windows

Win

  • Turn on Bluetooth and connect to WiFi
  • Go to Settings, find System => Project to this computer
  • If the options are all gray and cannot be set, it may be that the corresponding function is not installed, then search for optional functions in the settings, and then find "Wireless Display" and install it
  • If the option can be set, set it according to your own needs
  • Then open the software "Connection" (you can search directly in the menu bar)

Linux

It is strongly recommended to refer to the official README settings, the following method is just to make a record,The operation uses root privileges by default

Requirements

  • First download the code

    git clone --depth=1 https://github.com/albfan/miraclecast.git
    
  • systemd: requires version >=221, view as follows

    dpkg -l|grep systemd
    

    insert image description here

  • glib: A utility library. Used by the current DHCP implementation. Will be removed once sd-dns gains DHCP-server capabilities. required: ~=glib2-2.38 (might work with older releases, untested…)

  • gstreamer: Run the source code res/test-viewer.sh, if it is not installed completely, it will prompt something like
    insert image description here

    Try to install “gst-plugins-bad, gst-plugins-base, gst-plugins-base-libs, gst-plugins-good, gst-plugins-ugly, gst-libav, gstreamer”
    

    But you may not be able to find these package names directly apt search(maybe the ubuntu18.04 I use is too old), so I searched for the packages that were not installed one by one

    apt search gst | grep gst | grep plugin | grep -v installed | grep base
    apt search gst | grep gst | grep plugin | grep -v installed | grep bad
    apt search gst | grep gst | grep plugin | grep -v installed | grep good
    apt search gst | grep gst | grep plugin | grep -v installed | grep ugly
    apt search gst | grep gst | grep libav | grep -v installed
    

    According to the output of the above command to select the package to be installed, I finally installed the following

    apt install libgstreamer-plugins-base1.0-dev gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly gstreamer1.0-libav
    

    Note: Do not install the one ending with dbg

    Then run the source code again res/test-viewer.sh, if all pass, it is successful, otherwise check again what is not installed

  • wpa_supplicant: MiracleCast spawns wpa_supplicant with a custom config.

    apt install wpasupplicant
    
  • resCheck whether the wireless network card supports P2P: enter the folder in the source code , runtest-hardware-capabilities.sh
    insert image description here

  • (Optional) check: The version tested by the author is 0.9.11

    apt install check
    

Build and install

Refer to the official documentation

  • Installation dependencies, ubuntu18.04 are as follows

    apt install cmake libglib2.0-dev libudev-dev libsystemd-dev libreadline-dev check libtool autoconf
    
  • Then I choose to use cmake to build

    mkdir build
    cd build
    cmake -DCMAKE_INSTALL_PREFIX=/usr .. 
    make -j6
    make install
    

    If the following error
    insert image description here
    is reported, according to the issue , src/shared/CMakeLists.txtadd a line after the source codetarget_link_libraries(miracle-shared m)

run

Regarding sink and peer, the author explained in this issue
: "in miracast protocol your device can act as source (share a video stream (normally from its screen)) or as sink (receives and shows a video streaming). Both are peers for miracast”

  1. shutdown wpa_supplicant and NetworkManager

    systemctl stop NetworkManager.service
    systemctl stop wpa_supplicant.service 
    
  2. launch wifi control

    miracle-wifictl
    
  3. Enable visibility for other devices

  4. Locate them using scanning

    p2p-scan
    

Guess you like

Origin blog.csdn.net/OTZ_2333/article/details/127995968