Viewing 32 posts - 1 through 32 (of 32 total)
  • Author
    Posts
  • KazooZoo
    Participant
    Post count: 4

    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.

    petrockblog
    Keymaster
    Post count: 1828

    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.

    rapolsive
    Participant
    Post count: 5

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

    robertybob
    Participant
    Post count: 219

    Thank you so much for such a thorough walkthrough!

    supernashwan
    Participant
    Post count: 16

    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.

    virus897
    Participant
    Post count: 1

    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!

    ceuse
    Participant
    Post count: 96

    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.

    davejaca
    Participant
    Post count: 42

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

    supernashwan
    Participant
    Post count: 16

    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

    czesiek32
    Participant
    Post count: 22

    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 :)

    a7mag3ddon
    Participant
    Post count: 38

    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?

    herbfargus
    Member
    Post count: 1858

    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.

    a7mag3ddon
    Participant
    Post count: 38

    Kodi 14 is stable ;-)

    herbfargus
    Member
    Post count: 1858

    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.

    a7mag3ddon
    Participant
    Post count: 38

    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.

    a7mag3ddon
    Participant
    Post count: 38

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

    thatguyinfl
    Participant
    Post count: 39

    Good stuff. Thanks for this.

    klenghost
    Participant
    Post count: 1

    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)

    zerojay
    Participant
    Post count: 173

    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.

    sovikos
    Participant
    Post count: 9

    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.

    a7mag3ddon
    Participant
    Post count: 38

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

    sovikos
    Participant
    Post count: 9

    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?

    herbfargus
    Member
    Post count: 1858

    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.

    sovikos
    Participant
    Post count: 9

    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?

    herbfargus
    Member
    Post count: 1858

    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.

    sovikos
    Participant
    Post count: 9

    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

    sovikos
    Participant
    Post count: 9

    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.

    sovikos
    Participant
    Post count: 9

    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?

    herbfargus
    Member
    Post count: 1858

    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.

    sovikos
    Participant
    Post count: 9

    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.

    herbfargus
    Member
    Post count: 1858

    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.

    sovikos
    Participant
    Post count: 9

    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)
  • You must be logged in to reply to this topic.