Skip to content

Games Streaming with Raspberry Pi

Volodymyr Huz edited this page Oct 30, 2020 · 2 revisions

Configure Raspberry Pi for games streaming with using moonlight

Install drivers for Xbox360 game pad

sudo apt-get install xboxdrv

Find the correct device-name for your specific controller.

sudo xboxdrv

My device is called…

Microsoft X-Box 360 pad

IF you get a error similar to…

-- [ ERROR ] ------------------------------------------------------
 Error couldn't claim the USB interface: LIBUSB_ERROR_BUSY
Try to run 'rmmod xpad' and then xboxdrv again or start xboxdrv with the option --detach-kernel-driver.

Just run

sudo rmmod xpad
sudo xboxdrv

sudo nano /home/osmc/xbmc.ini

 XBMC Configuration
# ==================

#X1: 0 Y1: 0 X2: 0 Y2: 0 du:0 dd:0 dl:0 dr:0 start:0 back:0 TL:0 TR:0 A: 0 B: 0 X: 0 Y: 0 black: 0 white: 0 LT: 0 RT: 0

[xboxdrv]
#ui-clear = true
extra-devices = false
extra-events = false
deadzone = 6000
device-name = "Microsoft X-Box 360 pad"

[ui-buttonmap]
# Face buttons
A = KEY_ENTER
B = KEY_BACKSPACE
X = KEY_X
Y = KEY_ESC

# D-Pad
du = KEY_UP
dd = KEY_DOWN
dl = KEY_LEFT
dr = KEY_RIGHT

# Start / Back buttons
start = KEY_SPACE
back = KEY_L

# Bumper Left / Right
white = KEY_C
black = KEY_I

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

# Triggers Right / Left
RT = KEY_EQUAL # Right trigger
LT = KEY_MINUS # Left trigger

[ui-axismap]
#x2=REL_RX:10
#y2=REL_RY:-10

x1=REL_X:10
y1=REL_Y:10


# The resp filter moves the neutral position to zero to work around a
# bug in XBMC, that causes bogus events when neutral position is
# elsewhere. It loses a bit of precision in the trigger as result, but
# that isn't noticeable.
LT^resp:127:255=ABS_Z
RT^resp:127:255=ABS_RZ

# EOF #

Next we need to create .sh script that starts xboxdrv.

sudo nano /home/osmc/start.sh

#!/bin/bash
    rmmod xpad
    modprobe uinput
    modprobe joydev
    
    /usr/bin/xboxdrv --config /home/osmc/xbmc.ini --silent --autofire RT=25 --autofire LT=25 --autofire du=200 --autofire dd=200 --autofire dl=500 --autofire dr=500 &

Give execute permissions for our script

sudo chmod 777 /home/osmc/start.sh
sudo chmod 777 /home/osmc/xbmc.ini

sudo nano /etc/rc.local

Add following record before the exit 0

/home/osmc/start.sh

sudo reboot

Controller Layout in XBMC

Face buttons
A = Select
B = Back
X = Stop
Y = Home screen
Start / Back buttons
start = Pause/Play
back = Next subtitle
Bumper
Right = Info
Left = Contextual menu
Triggers
Right = Volume up
Left = Volume down

Install moonlight-embedded

sudo nano /etc/apt/sources.list
deb http://archive.itimmer.nl/raspbian/moonlight jessie main
wget http://archive.itimmer.nl/itimmer.gpg
sudo apt-key add itimmer.gpg
sudo nano /etc/apt/sources.list
deb http://archive.raspbian.org/raspbian jessie main contrib non-free
wget https://archive.raspbian.org/raspbian.public.key
sudo apt-key add raspbian.public.key
sudo apt-get update
sudo apt-get install moonlight-embedded
rm itimmer.gpg
rm raspbian.public.key

Install Luna Kodi Addon to enable streaming from media center Kodi. You can download addon in .zip file from here

Create map file for your game pad.

moonlight map xbox360.map -input /dev/input/event0

Clone this wiki locally