A guide for adding xbmc with working wireless 360 to RetroPie.

Home Forums RetroPie Project Everything else related to the RetroPie Project A guide for adding xbmc with working wireless 360 to RetroPie.

RetroPie has a new website and forum. Please visit https://retropie.org.uk/ for the new site. The new forum is located at https://retropie.org.uk/forum/. This forum is left here as a read-only archive.

This topic contains 31 replies, has 15 voices, and was last updated by Profile photo of sovikos sovikos 1 year, 1 month ago.

Viewing 32 posts - 1 through 32 (of 32 total)
  • Author
    Posts
  • #85195
    Profile photo of KazooZoo
    KazooZoo
    Participant

    This is gathered from these forums, but I wanted to create a post including everything for you guys/gals. Please note that this should also work for wired controllers but you would need to swap out every instance of “wid” with “id” (the “w” meaning wireless). This guide is for those who already have RetroPie set-up with working xbox 360 controllers for EmulationStation.
    P.S. PUTTY is your friend.

    Step 1. Getting XBMC.

    First off we need to add the update url. Run this:
    sudo nano /etc/apt/sources.list.d/mene.list
    and add this line to the newly created file:
    deb http://archive.mene.za.net/raspbian wheezy contrib
    after which we import the archive signing key:
    sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-key 5243CDED

    Now we get the latest package updates, so we run:
    sudo apt-get update
    *If you get an error, most likely in the last line of the update, indicating a missin key, its because of the font used in these forum. It happened to me. If that is the case check THIS link to the source of all this info.*

    Next we install Xbmc(kodi):
    sudo apt-get install xbmc
    some might need to run this as “kodi” instead of xbmc.

    *For testing purposes you might want to run xbmc at this point with either:
    sudo xbmc or
    sudo kodi
    I, personally, had to use “sudo kodi” to run xbmc and that is the command I will refer to from now on in creating the files needed to run xbmc from emu-station.

    Step 2. Adding XBMC to EmulationStation.

    First off we want to create a new section in EmulationStation. We open this file:
    sudo nano /etc/emulationstation/es_systems.cfg
    We scroll down way to the bottom and we add this to the file, right before </systemList>
    and we keep the syntax of the file(keeping it pretty):

    
    <system>
       <fullname>Apps</fullname>
       <name>apps</name>
       <path>~/RetroPie/roms/apps</path>
       <extension>.sh</extension>
       <command>bash %ROM%</command>
       <platform>apps</platform>
       <theme>appS</theme>
    </system>
    

    Next off we create that folder in the roms list:
    sudo mkdir ~/RetroPie/roms/apps
    and we create the file xbmc.sh:
    sudo nano ~/RetroPie/roms/apps/xbmc.sh

    To start off we are just gonna enable us to start xbmc from es, and worry about the controllers in the next section. We add this to the newly created file:

    
    #!/bin/bash
    sudo kodi
    

    My source for these 2 steps was THIS forum page.

    As a bonus here is a forum post, which I have not tried out yet myself, describing how to make your xmbc listing pretty. Check it HERE. It might need a change in how you set up your xbmc listing, but I’m sure you smarties will figure it out.

    Step 3. Getting controllers to work with XBMC.

    We will begin using the first 3 and a half step of THIS guide for Msoft Wl-360 for xbmc.

    To begin we make sure we are in our home folder:
    cd
    You can use step 1 of the for-mentioned link to check the name of your controller, but I will assume that you are using “Microsoft Xbox 360 Wireless Controller”.

    We create a new configuration file for the controller for xbmc:
    sudo nano xbmc.ini
    In this file we paste this text:

    
    # 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 Xbox 360 Wireless Controller"
    
    [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 #
    

    We also create a new start file for xbmc:
    sudo nano start.sh
    and we use this code:

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

    and we change the permissions for these 2 files:
    sudo chmod 777 start.sh
    sudo chmod 777 xbmc.ini

    Now begins the real magic. We are gonna change our es-to-xbmc file so that it will stop the xbox driver and starts it with the pre-configured xbox”keyboard style” config. Then when you exit xbmc it will stop the driver again and restart it with the normal config.
    So this is the file we will edit:
    sudo nano ~/RetroPie/roms/apps/xbmc.sh
    and we will edit the contents so they will look like this:

    
    #!/bin/bash
    xboxdrv_pwid='pidof xboxdrv'
    sudo kill -SIGTERM $xboxdrv_pwid
    sudo /home/pi/start.sh
    sudo xbmc
    xboxdrv_pwid='pidof xboxdrv'
    sudo kill -SIGTERM $xboxdrv_pwid
    sudo xboxdrv --daemon --wid 0 --led 2 --deadzone 4000 --silent --trigger-as-button --next-controller --wid 1 --led 3 --deadzone 4000 - silent --trigger-as-button --dbus disabled --detach-kernel-driver &
    

    **IMPORTANT. In the two instances of “xboxdrv_pwid=’pidof xboxdrv'” I use the symbol ” ‘ ” instead of the real one. The symbol that should be here is the symbol for “code” on the forums, so as to not screw up with the whole post I will post the REAL symbol at the bottom of this post, as “STEP X”**

    Back to the topic;
    Note that every instance of “xboxdrv_pwid” or “–wid” has that “w”, meaning wireless. Removing the “w” of all these instances will make this code work with wired controllers.
    Also this code is for 2 controllers when returning to emulationstation. If you only have one controller use this:

    
    sudo xboxdrv --daemon --wid 0 --led 2 --deadzone 4000 --silent --trigger-as-button --dbus disabled --detach-kernel-driver &
    

    instead of this:

    
    sudo xboxdrv --daemon --wid 0 --led 2 --deadzone 4000 --silent --trigger-as-button --next-controller --wid 1 --led 3 --deadzone 4000 - silent --trigger-as-button --dbus disabled --detach-kernel-driver &
    

    The source of this great code is HERE.

    Now it’s time to restart and have fun!

    Step X. That annoying Symbol.

    As mentioned the symbol that is to be used for “xboxdrv_pwid=’pidof xboxdrv'” is the symbol for code on the forums. So instead of ” ‘ ” use ” ` ” this symbol.

    Hope this works for you all and have a great day.

    KazooZoo.

    #85501
    Profile photo of petrockblog
    petrockblog
    Keymaster

    What a comprehensive write up! Sou might also consider to add this article to the RetroPie Wiki at https://github.com/retropie/RetroPie-Setup/wiki.

    #87588
    Profile photo of rapolsive
    rapolsive
    Participant

    Does anyone know how to setup a ps2 controller to work in a similar fashion to above?

    #87788
    Profile photo of robertybob
    robertybob
    Participant

    Thank you so much for such a thorough walkthrough!

    #87808
    Profile photo of supernashwan
    supernashwan
    Participant

    This article was very helpful thank you.

    I did some things different though that other people may find useful. I skipped step 1 and 2 by using the “EXPERIMENTAL PACKAGES” from the retropie setup script to install Kodi.

    I also installed the xboxdrv package from the “setup” section of the script

    I used this page

    https://github.com/retropie/RetroPie-Setup/wiki/Setting-up-the-XBox360-controller

    to setup the xboxdrv to run as a demon, but I changed my /etc/default/xboxdrv to the following

    # How many Controllers? (support up to 4 Controllers)
    CONTROLLER_NUM=2
    
    case $CONTROLLER_NUM in
        1) CONTROLLER="-w 0 -l 2 --trigger-as-button --dpad-as-button --mimic-xpad-wireless"
        ;;
        2) CONTROLLER="-w 0 -l 2 --trigger-as-button --dpad-as-button --mimic-xpad-wireless --next-controller -w 1 -l 3 --trigger-as-button --dpad-as-button --mimic-xpad-wireless"
        ;;
        3) CONTROLLER="-w 0 -l 2 --trigger-as-button --dpad-as-button --mimic-xpad-wireless --next-controller -w 1 -l 3 --trigger-as-button --dpad-as-button --mimic-xpad-wireless --next-controller -w 2 -l 4 --trigger-as-button --dpad-as-button --mimic-xpad-wireless"
        ;;
        4) CONTROLLER="-w 0 -l 2 --trigger-as-button --dpad-as-button --mimic-xpad-wireless --next-controller -w 1 -l 3 --trigger-as-button --dpad-as-button --mimic-xpad-wireless --next-controller -w 2 -l 4 --trigger-as-button --dpad-as-button --mimic-xpad-wireless --next-controller -w 3 -l 5 --trigger-as-button --dpad-as-button --mimic-xpad-wireless"
        ;;
        *) CONTROLLER="incorrect amount of controller specified"
        ;;
    esac

    which makes the controller emulate the xpad wireless controller.

    I then used your xbmc.ini (as kodi.ini) as you have it, but i modified my /home/pi/RetroPie/roms/ports/kodi.sh differently to shutdown the demon and restart it after closing kodi like this

    #!/bin/bash
    sudo /etc/init.d/xboxdrv stop
    sudo /usr/bin/xboxdrv --config /home/pi/kodi.ini --silent --autofire RT=25 --autofire LT=25 --autofire du=200 --autofire dd=200 --autofire dl=500 --autofire dr=500 &
    kodi-standalone
    xboxdrv_pwid='pidof xboxdrv'
    sudo kill -SIGTERM $xboxdrv_pwid
    sleep 2
    sudo /etc/init.d/xboxdrv start

    I also installed libCEC using these instructions
    http://www.raspberrypi.org/forums/viewtopic.php?f=29&t=70923
    which enables me to use the TV remote when I am in kodi.

    now it all works beautifully.

    • This reply was modified 2 years, 3 months ago by Profile photo of supernashwan supernashwan.
    • This reply was modified 2 years, 3 months ago by Profile photo of supernashwan supernashwan.
    #87897
    Profile photo of virus897
    virus897
    Participant

    Hey man,

    Great post! Helped me a ton.

    One thing though. You may want to edit your post as the last step has an incorrect step.

    You have it saying “sudo xbmc” in the last bit of code that goes in sudo nano ~/RetroPie/roms/apps/xbmc.sh when it should be “sudo kodi”

    Thanks!

    • This reply was modified 2 years, 3 months ago by Profile photo of virus897 virus897.
    #90045
    Profile photo of ceuse
    ceuse
    Participant

    would need the same thing but with my usb snes controller adapter… isnt there a way/someone able to write a more general guide? i cant wrap my head around how to use other drivers with this.

    #91508
    Profile photo of davejaca
    davejaca
    Participant

    I have a video guide to this if anyone is interested, thanks to KazooZoo and supernashwan for their help above.

    #92367
    Profile photo of supernashwan
    supernashwan
    Participant

    I have since discovered that if you run an executable at the end of the xboxdrv command, it will automatically shut down the driver when you exit that executable.

    here is the new kodi.sh to go in ports

    #!/bin/bash
    sudo /etc/init.d/xboxdrv stop
    sleep 2
    sudo /usr/bin/xboxdrv --config /home/pi/kodi.ini --silent --autofire RT=25 --autofire LT=25 --autofire du=200 --autofire dd=200 --autofire dl=500 --autofire dr=500 kodi-standalone
    sudo /etc/init.d/xboxdrv start

    much cleaner

    #94236
    Profile photo of czesiek32
    czesiek32
    Participant

    Can I use a regular controller (simple Retro Link SNES USB controller) instead of xbox 360 controller? Please could you provide some instructions for other controllers 🙂

    #102908
    Profile photo of a7mag3ddon
    a7mag3ddon
    Participant

    Hi. I followed the instructions in the video above and 360 wireless pad works flawlessly in kodi however it then breaks all the controls in all the emulators and the pad stops working. I then have to wipe and start again.

    Is there another way to get it working?

    #102913
    Profile photo of herbfargus
    herbfargus
    Moderator

    There is a way, but it requires recompiling from source with the joystick flag enabled… I’m hoping once kodi 15 stable is released as an official package we can include joystick and cec support so people don’t run into these sort of issues.

    #102919
    Profile photo of a7mag3ddon
    a7mag3ddon
    Participant

    Kodi 14 is stable 😉

    #102929
    Profile photo of herbfargus
    herbfargus
    Moderator

    Ha well that may be true (minus the glaring black screen bug that isn’t present in kodi 15…) but the package currently in the source code was compiled with the joystick flag disabled. I’m hoping in the next couple months we’ll have something that allows us to provide more convenient options for controls- I know its something I want, and I’m sure many others do as well.

    #102930
    Profile photo of a7mag3ddon
    a7mag3ddon
    Participant

    ahh ok. And im guessing its not something can quickly be turned on with a bit of code or a patch then. I know from alot of forum reading it sure is a thing that a lot of people would like, its a pain having to switch to a keyboard to use the Pi when i move it in my other room and hook it up to the projector.

    #102931
    Profile photo of a7mag3ddon
    a7mag3ddon
    Participant

    herbfargus would you be the right person to ask about the other post i made? lr-pifba doesnt work with any controls?

    #103019
    Profile photo of thatguyinfl
    thatguyinfl
    Participant

    Good stuff. Thanks for this.

    #117729
    Profile photo of klenghost
    klenghost
    Participant

    whenever i try to install kodi i keep getting those message’s

    when i try to install via

    sudo apt-get install xbmc

    i get this result

    sudo apt-get install xbmc
    Reading package lists… Done
    Building dependency tree
    Reading state information… Done
    Some packages could not be installed. This may mean that you have
    requested an impossible situation or if you are using the unstable
    distribution that some required packages have not yet been created
    or been moved out of Incoming.
    The following information may help to resolve the situation:

    The following packages have unmet dependencies:
    xbmc : Depends: kodi but it is not going to be installed
    E: Unable to correct problems, you have held broken packages.

    so i tried :

    pi@retropie:~ $ sudo apt-get install kodi
    Reading package lists… Done
    Building dependency tree
    Reading state information… Done
    Some packages could not be installed. This may mean that you have
    requested an impossible situation or if you are using the unstable
    distribution that some required packages have not yet been created
    or been moved out of Incoming.
    The following information may help to resolve the situation:

    The following packages have unmet dependencies:
    kodi : Depends: kodi-bin (>= 2:15.2-2~wheezy) but it is not going to be installed
    Depends: kodi-bin (< 2:15.2-2~wheezy.1~) but it is not going to be installed
    Recommends: libva-intel-vaapi-driver but it is not installable
    E: Unable to correct problems, you have held broken packages.

    ps it is on a fresh retropie install
    pi2 (model)

    #117743
    Profile photo of zerojay
    zerojay
    Participant

    A fresh install of Retropie 3.5 already should have Kodi installed to my knowledge and it is also based upon Jessie, not Wheezy, so Wheezy packages will not generally work with Jessie.

    #120619
    Profile photo of sovikos
    sovikos
    Participant

    Has anyone with RetroPie 3.5 been able to exit Kodi with the 360 controller and keyboard still working? I am having no luck with getting the driver to start again.

    #120657
    Profile photo of a7mag3ddon
    a7mag3ddon
    Participant

    I skipped 3.5 and went to 3.6 and it exits fine from that version.

    #120729
    Profile photo of sovikos
    sovikos
    Participant

    I skipped 3.5 and went to 3.6 and it exits fine from that version.

    Did you follow the video above or anything else? I’m scared it doesn’t work, because I tried a couple different ones, but the exiting script should be the only problem right?

    #120731
    Profile photo of herbfargus
    herbfargus
    Moderator

    Video is wayyyy outdated. Wouldn’t follow it. Wiki has a module for installing Kodi 16 which has joypad support compiled in along with installing it as its own system.

    #120746
    Profile photo of sovikos
    sovikos
    Participant

    I am a total noob with this right now. I see the wiki page and the module, but where do I begin? Where do I put the code for that module?

    #120749
    Profile photo of herbfargus
    herbfargus
    Moderator

    Make a backup of the current script in

    /home/pi/RetroPie-Setup/scriptmodules/ports/kodi.sh

    And then replace the contents of the file with the module on the wiki. You’ll have to do it through putty or through winscp as root (which you first have to enable: see https://github.com/RetroPie/RetroPie-Setup/wiki/FAQ#why-cant-i-ssh-as-root-anymore)

    Then you can install kodi from the experimental menu of the setup script. Note that directlaunch breaks theme switching and you’ll have to git stash your changes if you ever do an update.

    #121335
    Profile photo of sovikos
    sovikos
    Participant

    Thanks! I am just about to install it again. What do you mean by this:

    Note that directlaunch breaks theme switching and you’ll have to git stash your changes if you ever do an update.

    Haha I don’t know what directlaunch is, theme switching or git stash… lol sorry

    #121338
    Profile photo of sovikos
    sovikos
    Participant

    Hmm that didn’t work at all. I am guessing I am going to have to do a fresh install of everything ain’t I? It seemed to work, but didn’t make the roms/kodi folder or add anything to Ports either.

    #121797
    Profile photo of sovikos
    sovikos
    Participant

    Well did a fresh install with retropie 3.6, changed the kodi.sh to the one from the wiki, and restarted the Pi. But nothing seems to have been installed. There’s no Kodi under ports or in it’s own folder?

    #121801
    Profile photo of herbfargus
    herbfargus
    Moderator

    Some things have changed, I just barely updated the wiki page. From your fresh install: update your setup script first, then replace the kodi file and try installing it again. It will show up in the ports menu after being installed.

    #122144
    Profile photo of sovikos
    sovikos
    Participant

    Thanks, so far so good, now I just need to add a joystick.xml for my 360 controllers. On the wiki it says to add it to:
    /home/pi/.kodi/userdata/keymap/joystick.xml
    but there is no /home/pi/.kodi/ folder, but there is an empty /home/kodi/ folder, so I just want to make sure I add it to right spot.

    #122145
    Profile photo of herbfargus
    herbfargus
    Moderator

    You need to view hidden folders. A folder with a . in front of it means it’s hidden.

    You may need to open kodi once and exit it or you may have to refresh your page if you’re on winscp.

    #122547
    Profile photo of sovikos
    sovikos
    Participant

    Thank you so much! That worked great!

    Just a note, on the wiki it says:
    /home/pi/.kodi/userdata/keymap/joystick.xml
    but it is:
    /home/pi/.kodi/userdata/keymaps/joystick.xml
    I believe.

    Thanks again!

Viewing 32 posts - 1 through 32 (of 32 total)

Forums are currently read only - please visit the new RetroPie forums at https://retropie.org.uk/forums/

Skip to toolbar