XBMC - mdeguzis/RetroRig GitHub Wiki
Table of Contents
- About XBMC
- How RetroRig treats XBMC
- Changes to /etc/sudoers
- The XBMC binaries
- Changes to XBMC source code
- Patch files and changes
About XBMC
XBMC is a free and open source media player developed by the XBMC Foundation, a non-profit technology consortium. XBMC is available for multiple operating systems and hardware platforms, with a software 10-foot user interface for use with televisions and remote controls. It allows users to play and view most videos, music, such as podcasts from the internet, and all common digital media files from local and network storage media
How RetroRig treats XBMC
This section will expand greatly in due time, as it is the most involved and complex piece of RetroRig. I will briefly go over these pieces in summary for now, with code examples and more detailed information to follow when we are less busy with development (at a high pace right now).
The General process
The general overview of how RetroRig functions is laid out as so:
- A patched/custom versin of XBMC is built and placed
- A desktop launcher contains an execution of
/usr/share/applications/startXBMC.sh
, the main script startXBMC.sh
startsxbmc-retroig
as well as monitors our XBMC version for status changes and debug informationxbmc-retrorig
kicks off as our main XBMC piece, settings custom code for our own dotfile and handling debug information for RetroRig by way of the built-in XBMC logging functions- While our patched version of XBMC is running, a helper script called
gp_autodetect
sits in the background, interfacing with XBMC when a controller is connected/disconnected, so that users can still use XBMC if their controller "goes to sleep."
Changes to /etc/sudoers
In order to allow hotplugging of controllers that make use of the xboxdrv userland module, RetroRig allows the xboxdrv service only to be restarted without prompting for a user password. The inserted lines are as follows:
# RetroRig specific allowances
%sudo ALL=NOPASSWD: /usr/sbin/service xboxdrv restart
This code is in use in /usr/share/applications/gp_autodetect_xbmc.sh
. You can reference this example for the Xbox 360 wireless controller:
if [ "$controllertype" = "xbox360_wireless" ]; then
# check for Xbox360 USB Hub (wireless) Controller
oldControllerAvailable=$controllerAvailable
controllerAvailable=`lsusb | grep Xbox 360 Wireless`
if [ "$controllerAvailable" != "$oldControllerAvailable" ]; then
echo "Restarting xboxdrv services"
sudo /usr/sbin/service xboxdrv restart
killall xbmc.bin -SIGUSR1
fi
fi
The alternative is making users reboot if they unplug USB devices, and plug them back in. However, if more than one player wants to play a game, and the controller is connected, this allows a more console-like experience. Grievances and issues with this method can be addressed via an issues ticket.
The XBMC binaries
A lot of work has and is being put into modifying XBMC for the needs of RetroRig (a log of credit must go to JC, a fellow contributor). In the beginning, XBMC was used in a plain since, but since then, patching has brought in the following features by way of repacking the Deb packages:
- Patch level 1
This initial patchset brought in gamepad hotplugging support , plus some version outputs. - Patch level 2
This patch brought changes from the github repo xbmc/fernetMenta, with the same changes as in patch level 1. - Patch level 3
This was a bit more complex, but in summary for now, brings dual-head support, SDL2 changes, fixes for exiting/starting XBMC and more. - Patch level 4
Patch level 4 brings in start/exit/RCB start fixes, fixes for the Unity Launcher icon, dual-head fixes, and a brand new dotfile to house RetroRig, rather than invade the user's current .xbmc dotfile.
In due time, more will be explained here, but you can checkout some of the XBMC build scripts in the supplimental/
folder of the repository.
Changes to XBMC source code
The RetroRig project makes several code changes to XBMC to avoid a few scenarios
- Hanging on startup/exit
- Hanging on starting RCB
- Hotplugging support for controllers
- Dual-Screen support
Hanging on start/exit, RCB Launch hangs
One reason why XBMC did not launch the RCB Pyhton script before we corrected it, and why it is later on it could not be reliably terminated , was an interference with a different python thread named service xbmc.versioncheck
. In general, XBMC implements one Pyhton interpreter, that handles multiple threads. To perform an action on one of its threads, such as starting or stopping them, XBMC needs to get a global lock on the Pyhton interpreter. If this lock is not released by one of the python threads, all other threads will be blocked.
The actual hanging on exit occurred on PyEval_ReleaseLock. The broken play button was caused by PyEval_AcquireLock. The XBMC version check was interferring with RCB, likely due to us changing thing internally in XBMC itself.
RCB Home Screen Theme (maximinimalism)
To avoid the skin reverting and locking up, the add-on updater service had to be stopped. Like above with XBMC, RetroRig assumes the risk and responsibility for updating and upgrading XBMC and RCB themselves. This was a necessary move to enable a lot of the custom features we use.
Path files and changes
Much of what is currently done can be found the current Debugging file-set. In the future, this and more may be subject to change.