[HowTo] Moonlight-Embedded (former Limelight) using Luna Launcher

Foreword

Streaming media to the RPI 1 or 2 is always a gamble since there are so many variables included, don’t expect it to run just fine without your configuration.

Prerequisites / Recommendations

  • Backend
    (your computer is the source make sure it can handle the
    games you wanna play)
  • Router/Switch
    (If your router is shit your experience is probably
    gonna be shit make sure it can handle the traffic)
  • Client the Raspberry / Vero
    (i wouldn’t recommend people with RPI1 to
    try this cause its probably gonna be too much for it to handle with
    so many other services running on the RPI but again i could be wrong this is just my opinion.)

Installation

Make sure that the module dtparam=audio=on is loaded in /boot/config.txt too make sure that it is loaded type this command

cat /boot/config.txt

Add the repo to sources.list

sudo -s 
echo "deb http://archive.itimmer.nl/raspbian/moonlight jessie main" > /etc/apt/sources.list.d/moonlight.list

Install moonlight-embedded

sudo apt-get update && sudo apt-get install -y moonlight-embedded

Last but not least you got the addons

Github: Luna
Download: Luna Addon

Install from zip under System > Addons then configure under addon settings.

5 Likes

Wiimote Classic Controller

first install this lib in order to communicate with the remote

sudo apt-get install python-cwiid

next create this config file /usr/local/share/mappings/wii.conf

abs_x = 0
abs_y = 1
abs_z = -1
reverse_x = true
reverse_y = false
abs_rx = 3
abs_ry = 4
abs_rz = -1
reverse_rx = true
reverse_ry = false
abs_deadzone = 0
abs_dpad_x = 16
abs_dpad_y = 17
reverse_dpad_x = true
reverse_dpad_y = true
btn_north = 308
btn_east = 305
btn_south = 304
btn_west = 307
btn_select = 316
btn_start = 315
btn_mode = 314
btn_thumbl = 310
btn_thumbr = 311
btn_tl = 312
btn_tr = 313
btn_tl2 = 312
btn_tr2 = 313
btn_dpad_up = -1
btn_dpad_down = -1
btn_dpad_left = -1
btn_dpad_right = -1

Load these modules to modules.conf if they are not already in your configuration

sudo echo "hid-wiimote" | tee -a /etc/modules-load.d/modules.conf
sudo echo "uinput" | tee -a /etc/modules-load.d/modules.conf
sudo echo "joydev" | tee -a /etc/modules-load.d/modules.con

Then use bluetooth to sync up to the remote via MyOSMC

XBox Controller

First you need to install xboxdrv for linux to be able to communicate with the controller

sudo apt-get install xboxdrv

next create this config file /home/osmc/xbmc.ini

[xboxdrv]

extra-devices = false
extra-events = false
deadzone = 6000
device-name = "Microsoft Xbox 360 Controller"
[ui-buttonmap]

A = KEY_ENTER
B = KEY_BACKSPACE
X = KEY_X
Y = KEY_ESC

 du = KEY_UP
dd = KEY_DOWN
dl = KEY_LEFT
dr = KEY_RIGHT

start = KEY_SPACE
back = KEY_L
white = KEY_C
black = KEY_I

TR = BTN_RIGHT # Left stick buttons
TL = BTN_LEFT # Right stick buttons

RT = KEY_EQUAL # Right trigger
LT = KEY_MINUS # Left trigger
[ui-axismap]

x1=REL_X:10
y1=REL_Y:10

LT^resp:127:255=ABS_Z
RT^resp:127:255=ABS_RZ
# EOF #

make this file executable by typing

sudo chmod +x /home/osmc/xbmc.ini

now edit rc.local
sudo nano /etc/rc.local

append this to the file before exit 0

/home/osmc/xbox.sh

Append modules to modules.conf

sudo echo "uinput" | tee -a /etc/modules-load.d/modules.conf
sudo echo "joydev | tee -a /etc/modules-load.d/modules.conf

Next make a script that binds all this together

create this file /home/osmc/xbox.sh

#!/bin/bash
sudo rmmod xpad
sudo /usr/bin/xboxdrv --config /home/osmc/xbmc.ini --id=0 --led=2 --silent --autofire RT=25 --autofire LT=25 --autofire du=200 --autofire dd=200 --autofire dl=500 --autofire dr=500 &  sleep 2

the default configuration for xbox 360 for moonlight is located at

/usr/local/share/mappings/xbox360.conf
4 Likes

@OSMC Moonlight/Limelight would be a FANTASTIC Pi2/Vero official add-on in your store please

@Toast -> nice work!

3 Likes

I created a github repo with some scripts (Practically identical to yours, we must have used the same source?) for running moonlight from OSMC as well as an automated installer. I also modified irtimmers deb to run on OSMC (I created a pull request to hopefully add OSMC support to his repo in the future).

You seem to have controller support down, so if you want to help me adding this that would be great! Just submit a pull request and I’ll merge it!

I’ve started working on a simple config file. I’ll flesh it out a bit once I get home. I’ll probably compile from source too, for the CEC support mainly, but repackaging was more realistic for now as I only have a crappy laptop and I can’t test against my pi.

CEC was the only thing i didnt apply since it might break the current configuration for kodi (OSMC) rather wait for the devs to update CEC libs on their own

Oh, I’ll do it in an experimental CEC branch then.

although compiling it on another computer wouldn’t ruin OSMC itself just not sure if the CEC lib installed on a OSMC would work … again unsure here

Hmm, maybe not. We’ll see I guess.

Hello @Toast
I’m unable to compile and would like to know if it’s because I put the “stretch” in my sources.list ?

When trying to sudo cmake …/ I get an error about Curl

Thanks for the help.

Hello @dodslaser,

Is you .deb only good for Rpi or it’s also good for Rpi2?

Hi,

This is my second attempt. First one ended up with broken OSMC after I added the stretch repo to sources.list and did “apt-get upgrade && apt-get dist-upgrade”. Moonlight compiled fine though.

I did everything according to HowTo (downloaded single packages) with some additional guide from moonlight git but still cmake exited with “No video output available”. It looks like both packages for Broadcom and Freescale weren’t found.

Please help how can I find them manually? Or maybe something else is missing. I’m running latest OSMC.

did u add the submodule etc kinda hard to see what went wrong

Yes I think did that, also I’ve installed all necessary packages which are:

libopus0 libexpat1 libasound2 libudev0 libavahi-client3 libcurl3 libevdev2 libssl-dev libopus-dev libasound2-dev libudev-dev libavahi-client-dev libcurl4-openssl-dev libevdev-dev cmake and build-essential

System couldn’t find libudev0 so I’ve downloaded armhf .deb from jessie repo. I’m at work right now so I don’t have access to my PI I will try to delete the moonlight repo and repeat all steps in HowTo when I’ll be back home.

I’ll post cmake logs if something goes wrong.

Is there something else needed to build apps on PI/OSMC?

Thank you in advance :smile:

OK everything worked fine after installing

rbp-userland-dev-osmc
1 Like

So I got my Pi2 today and fresh installed OSMC on it. I’ve logged into OSMC via SSH using Putty.

Following the guide carefully took some figuring out and I’m now getting errors I don’t know how to properly deal with.

To download the packages, I used the following commands:

wget http://ftp.uk.debian.org/debian/pool/main/c/cmake/cmake_3.2.2-2_armhf.deb

wget http://ftp.uk.debian.org/debian/pool/main/libj/libjsoncpp/libjsoncpp0_0.10.2-4_armhf.deb

wget http://ftp.uk.debian.org/debian/pool/main/c/cmake/cmake-data_3.2.2-2_all.deb

Then I ran the following to install the first downloaded package:

sudo dpkg -i cmake_3.2.2-2_armhf.deb

It seemed to do something but complained of missing dependencies:

cmake depends on libarchive13; however:
Package libarchive13 is not installed.

Then ran the other commands:

sudo dpkg -i libjsoncpp0_0.10.2-4_armhf.deb
sudo dpkg -i cmake-data_3.2.2-2_all.deb

Still errors so then I ran:

sudo apt-get install libarchive13

And then the original commands to install the 3 packages again which seemed to turn up no warnings this time.

So now I ran this command:

sudo apt-get install libexpat1-dev rbp-userland-dev-osmc libopus0 libexpat1 libasound2 libudev0 libavahi-client3 libcurl3 libevdev2 libssl-dev libopus-dev libasound2-dev libudev-dev libavahi-client-dev libcurl4-openssl-dev libevdev-dev cmake build-essential

And I’m getting the message: E: Unable to locate package libudev0

I’ve tried: sudo apt-get update but it’s not making any difference.

I’d normally just google how to install libudev0 on Debian (which I’ve think OSMC runs on top of) but I’d prefer not to just “wing” it since I got all the previous warnings too, maybe I’m just making basic mistakes here? Have I missed something obvious? Please can someone let me know the correct way to proceed or what caused the earlier warnings.

Thanks!

aptitude search libudev0
i   libudev0                                                                  - libudev shared library      

its in the repo if it fails getting it from the repo get it from debian packages then

Thanks. I downloaded it from here: Debian -- Error

and installed with dpkg. Damn I’m new to this stuff… this is a fun learning curve…! Not really sure what “get it from debian packages” means so just guessed…

So for reference, I ran this command to download the package manually:

wget http://ftp.uk.debian.org/debian/pool/main/u/udev/libudev0_175-7.2_armhf.deb

then

sudo dpkg -i libudev0_175-7.2_armhf.deb

to install it.

Your command now seems to work for me (in progress):

sudo apt-get install libexpat1-dev rbp-userland-dev-osmc libopus0 libexpat1 libasound2 libudev0 libavahi-client3 libcurl3 libevdev2 libssl-dev libopus-dev libasound2-dev libudev-dev libavahi-client-dev libcurl4-openssl-dev libevdev-dev cmake build-essential

Update: Running the command: git clone GitHub - moonlight-stream/moonlight-embedded: Gamestream client for embedded systems
returns the error: git: command not found

So I’m going to install git using: sudo apt-get install git-core (Just updating here in case anyone else has these issues)

OK so I’ve run through the whole process successfully (I think)

Just something obvious now… How can I launch Moonlight from within the OSMC interface? Are there shortcuts to the .sh scripts I put in the moonlight folder? Is that what this does? If not how can I set that up. Sorry if this is painfully obvious but it isn’t to me at this stage.

-How do I run this? I’ve tried bash moonlight.sh and ./moonlight.sh and it’s giving me a message saying

you need to add the script to your osmc machine via ssh (consult the wiki for this info on howto)

then its as simple as to make the scripts executable then running em and then they do all the magic stuff