Posts Tagged XBMC

Pre-Eden XBMC-live on Ubuntu 10.04 Lucid

I wanted to try out some of the new features in the upcoming XBMC Eden release.

The problem is that I am running XMBC-live on Ubuntu 10.04 Lucid and the Eden xbmc-live package requires the uxlaunch package which is only available in newer versions of Ubuntu. However, it is still possible to get a working xbmc-live setup by manually configuring the system startup.

NOTICE: This guide describes how I was able to upgrade my existing Ubuntu 10.04 XMBC-live system to work with Eden nightlies. I have no idea if this process works on fresh installs or different versions of Ubuntu. If you are running Ubuntu 10.04, I would recommend installing the stable version of XBMC-live prior to attempting this guide.

First, add the XBMC nightly PPA. The official PPA is provided by Team-XBMC and can be found here: ppa:team-xbmc/unstable.
However, at time of writing, the official PPA was having some problems with the build servers, so I ended up using a ppa recommended on XBMCFreak located here: ppa:nathan-renniewaldock/xbmc-nightly.

The first step is to install the new PPA and update your sources.

sudo add-apt-repository ppa:nathan-renniewaldock/xbmc-nightly
sudo apt-get update

Next, upgrade the xbmc packages:

apt-get upgrade xbmc xbmc-bin

During this process, some of the old xbmc packages will be removed, including xbmc-data and xbmc-standalone.

Now we should have the new version of xbmc installed, however, when we boot the system, X will not start automatically and we will be left with a login prompt.

The final step is to edit the startup script. This script is located at /etc/init/xbmc-live.conf and probably already exists if you already had a previous version of XMBC-live installed. There is a simple change to make to the script to point it at the new executable.

Open the script:

sudo nano /etc/init/xbmc-live.conf

Scroll down to the script section and change the exec from /usr/bin/runXBMC to /usr/bin/xbmc-standalone:

script
        if ! grep -i -q autostart /tmp/xbmcliveParams ; then
                exit
        fi
 
        exec /bin/su xbmc -c "/usr/bin/startx /etc/X11/Xsession /usr/bin/xbmc-standalone"
end script

Restart your system and XMBC should come up. Switch to the confluence skin to see the new features.

Here is the full script for completeness:

# xbmc-live
#
# init XBMC environment and starts XBMC in fullscreen (if asked to do so)
 
#      Copyright (C) 2005-2008 Team XBMC
#      http://www.xbmc.org
#
#  This Program is free software; you can redistribute it and/or modify
#  it under the terms of the GNU General Public License as published by
#  the Free Software Foundation; either version 2, or (at your option)
#  any later version.
#
#  This Program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with XBMC; see the file COPYING.  If not, write to
#  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
#  http://www.gnu.org/copyleft/gpl.html
 
description     "XBMCLive"
author          "Luigi Capriotti"
 
start on (filesystem and stopped udevtrigger)
 
stop on runlevel [06]
 
emits starting-x
 
pre-start script
	get_opt() {
		echo "$@" | cut -d "=" -f 2
	}
 
	clear >/dev/tty7 || true
 
	CMDLINE=$(cat /proc/cmdline)
 
	#Process command line options
	XBMC_PARAMS=""
	for i in ${CMDLINE}; do
		case "${i}" in
		xbmc\=*)
		      XBMC_PARAMS=$(get_opt $i)
		      ;;
		esac
	done
	echo $XBMC_PARAMS > /tmp/xbmcliveParams
 
	if grep "boot=live" /proc/cmdline ; then
		# Relies on init scripts to mount boot device on a specified directory
		BOOTMEDIAMOUNTPOINT="/live/image"
	fi
 
	BOOTHOOKSDIRECTORY="/etc/xbmc"
 
	xbmcUser=xbmc
	# Read configuration variable file if it is present
	[ -r /etc/default/xbmc-live ] && . /etc/default/xbmc-live
	if ! getent passwd $xbmcUser >/dev/null; then
		xbmcUser=$(getent passwd 1000 | sed -e 's/\:.*//')
	fi
 
	# Executes pre-hooks (if any) in the System "Hooks" directory
	if [ -d $BOOTHOOKSDIRECTORY/live.d ]; then
	  for hook in $(find $BOOTHOOKSDIRECTORY/live.d -type f -perm /u=x,g=x,o=x | sort)
	  do
	        $hook $BOOTMEDIAMOUNTPOINT $XBMC_PARAMS  || true
	  done
	fi
 
	# Executes pre-hooks (if any) in the user "Hooks" directory
	if [ -d /home/$xbmcUser/.xbmc/live.d ]; then
	  for hook in $(find /home/$xbmcUser/.xbmc/live.d -type f -perm /u=x,g=x,o=x | sort)
	  do
	        $hook $BOOTMEDIAMOUNTPOINT $XBMC_PARAMS  || true
	  done
	fi
 
	if [ -f /home/$xbmcUser/.xsession ] ; then
		rm /home/$xbmcUser/.xsession
	fi
	if [ -f /tmp/noRestartXBMC ] ; then
		rm /tmp/noRestartXBMC
	fi
end script
 
script
	if ! grep -i -q autostart /tmp/xbmcliveParams ; then
		exit
	fi
 
	exec /bin/su xbmc -c "/usr/bin/startx /etc/X11/Xsession /usr/bin/xbmc-standalone"
end script
 
pre-stop script
	touch /tmp/noRestartXBMC
	rm /tmp/xbmcliveParams
 
	# Clean up the console before we switch to it, to avoid text flicker
	if [ -x /usr/bin/tput ] ; then
		tput -Tlinux reset > /dev/tty1 || true
		tput -Tlinux reset > /dev/tty8 || true
	fi
 
	# Clear VT 1 & 8 of any console messages
	clear >/dev/tty1 || true
	clear >/dev/tty8 || true
end script

, , ,

No Comments

XBMCbuntu ATI Remote Wonder Howto

I recently re-discovered my ATI Remote Wonder and decided to get it working under my Ubuntu Linux XBMC install.

First, install lirc. I selected the option to use the “ATI/NVidia/X10 I II RF Remote” with the kernel (Not userspace) driver, with no transmitter.

sudo apt-get install lirc

My /etc/lirc/lirc.conf file looks like:

include "/usr/share/lirc/extras/more_remotes/atiusb/lircd.conf.atiusb"

My /etc/lirc/hardware.conf was generated automatically by debconf during the lirc install. However, for reference it is:

# /etc/lirc/hardware.conf
#
#Chosen Remote Control
REMOTE="ATI/NVidia/X10 I REMOTE="None" II RF Remote"
REMOTE_MODULES="lirc_dev lirc_atiusb"
REMOTE_DRIVER=""
REMOTE_DEVICE="/dev/lirc0"
REMOTE_SOCKET=""
REMOTE_LIRCD_CONF="atiusb/lircd.conf.atiusb"
REMOTE_LIRCD_ARGS=""
 
#Chosen IR Transmitter
TRANSMITTER="None"
TRANSMITTER_MODULES=""
TRANSMITTER_DRIVER=""
TRANSMITTER_DEVICE=""
TRANSMITTER_SOCKET=""
TRANSMITTER_LIRCD_CONF=""
TRANSMITTER_LIRCD_ARGS=""
 
#Enable lircd
START_LIRCD="true"
 
#Don't start lircmd even if there seems to be a good config file
START_LIRCMD="false"
 
#Try to load appropriate kernel modules
LOAD_MODULES="true"
 
# Default configuration files for your hardware if any
LIRCMD_CONF=""
 
#Forcing noninteractive reconfiguration
#If lirc is to be reconfigured by an external application
#that doesn't have a debconf frontend available, the noninteractive
#frontend can be invoked and set to parse REMOTE and TRANSMITTER
#It will then populate all other variables without any user input
#If you would like to configure lirc via standard methods, be sure
#to leave this set to "false"
FORCE_NONINTERACTIVE_RECONFIGURATION="false"

Restart the lirc daemon and run irw and ensure there is output produced:

sudo /etc/init.d/lirc restart
# * Starting remote control daemon(s) : LIRC
irw
# 000000144b760000 00 mouse-right_down SAPPHIRE_ATIUSB_5000023600
# 0000001446710000 00 mouse-right SAPPHIRE_ATIUSB_5000023600

Copy lirc & keymap configuration files into the user XBMC folder (If they do not exist).

#copy Lirc configuration file
cd ~/.xbmc/userdata
cp cp /usr/share/xbmc/system/Lircmap.xml .
 
#copy remote.xml keymap
cd ~/.xbmc/userdata/keymaps/
cp /usr/share/xbmc/system/keymaps/remote.xml .

Edit the XBMC LIRC Configuration File (Lircmap.xml) to contain the following key mappings, ensuring that the device matches the device output by irw.

<lircmap>
        <remote device="SAPPHIRE_ATIUSB_5000023600">
                <play>play</play>
                <pause>pause</pause>
                <stop>stop</stop>
                <forward>forward</forward>
                <reverse>rewind</reverse>
                <left>left</left>
                <left>mouse-left</left>
                <right>right</right>
                <right>mouse-right</right>
                <up>up</up>
                <up>mouse-up</up>
                <down>down</down>
                <down>mouse-down</down>
                <select>ok</select>
                <select>mouse_button_left</select>
                <pageplus>chan-up</pageplus>
                <pageminus>chan-down</pageminus>
                <back>mouse_button_right</back>
                <menu>dvd-root_menu</menu>
                <title>a</title>
                <info>launch_setup</info>
                <skipplus>Skip</skipplus>
                <skipminus>Replay</skipminus>
                <display>max-window</display>
                <start>Start</start>
                <record>record</record>
                <volumeplus>vol-up</volumeplus>
                <volumeminus>vol-down</volumeminus>
                <mute>mute</mute>
                <power>power</power>
                <myvideo>dvd</myvideo>
                <mymusic>media_library</mymusic>
                <mypictures>Pictures</mypictures>
                <mytv>tv</mytv>
                <one>1</one>
                <two>2</two>
                <three>3</three>
                <four>4</four>
                <five>5</five>
                <six>6</six>
                <seven>7</seven>
                <eight>8</eight>
                <nine>9</nine>
                <zero>0</zero>
                <star>Star</star>
                <hash>Hash</hash>
                <clear>Clear</clear>
                <enter>Enter</enter>
                <red>Red</red>
                <green>Green</green>
                <yellow>Yellow</yellow>
                <blue>Blue</blue>
                <teletext>c</teletext>
 
        </remote>
</lircmap>

Restart XBMC and you should now have ATI Remote support.

I spent considerable effort attempting to get The Lirc Mouse support working. However, I had no success. I found that X would recognize the LIRC mouse, but wouldn’t find an appropriate driver for it. In the end, I assigned the mouse buttons to the navigation keys via Lircmap.xml.

For the curious I will post the process that I used to get X to the point where it would detect the remote (according to the Xorg log).

The default settings for the lircm daemon wern’t creating the appropriate /dev/lircm which, I believe, prevents X from locating the mouse, so I had to take an alternative approach using the uinput module. It seems that this method has had limited success with others so perhaps it is a system configuration issue with me.

First I configured my /etc/lirc/lircm.conf file with the following contents (the button presses determined from examining the output of irw):

# To find out how to get a proper configuration file please read:
#
#       /usr/share/doc/lirc/README.Debian
PROTOCOL IntelliMouse
ACCELERATOR 2 30 5
ACTIVATE * ATI
 
MOVE_N * mouse-up
MOVE_S * mouse-down
MOVE_W * mouse-left
MOVE_E * mouse-right
MOVE_NW * mouse-up-left
MOVE_NE * mouse-up-right
MOVE_SW * mouse-down-left
MOVE_SE * mouse-down-right

Next I ensured that the START_LIRCMD value is FALSE in /etc/lirc/hardware.conf:

START_LIRCMD="false"
 
#Make sure there isn't a trailing START_LIRCMD in your hardware.conf as there was in mine.

While experimenting I would load the uinput module manually, then start lircmd by hand – however, a working implementation would have uinput in /etc/modprobe.d so it loads automatically, and lircmd in something like rc.conf so it runs automatically.

#Make sure lircd is already running (see above)
#load the module and start lircmd for testing:
sudo modprobe uinput
sudo lircmd --uinput

At this point you’re able to restart X and have it detect the lircm mouse. However, I never got it to properly load the drivers. If anyone knows what I’m missing it would be great if you could post in the comments.

, , , ,

4 Comments

XBMC Disable Windowed Mode Shortcut

The greatest annoyance with my XBMC setup is when I accidentally press the backslash key. When this happens, XBMC loses focus making it so I cannot get back into full screen mode.

After some Googling I found this snippit that will disable the backslash shortcut and replace it with a stern warning:

Edit $home/.xbmc/userdata/keymaps and add:

<keymap>
	<global>
		<keyboard>
			<backslash>Notification(Backslash, Don't press backslash, 3)</backslash>
		</keyboard>
	</global>
</keymap>

2 Comments

XBMCbuntu Ubuntu 10.04 Howto

For the past couple of years I have been experimenting with a variety of different Media Center distributions for my media PC. I’ve played with Boxee, Moovidia, MythTV, XBMC and LinuxMCE. Since I’m from Canada, Boxee wouldn’t work to its full extent, I don’t have a tuner card, so most of MythTV’s power was lost on me and LinuxMCE seemed like it was dieing at the time. After struggling with the performance (or lack there of) of Moovidia on my old hardware, I eventually settled on XBMC.

I’ve been happy using XMBC for the past year or so and its made some good steps, especially with the release of v. 10 (code name Dharma). It was almost getting to the point where it could play 1080p video without skipping half the frames. Unfortunately I made the mistake of trying to upgrade my distribution to Ubuntu 10.10 (Maverick Meerkat), which apparently breaks my legacy embedded Intel graphics.

Despite several hours of googling I couldn’t get past the errors with the intel driver, namely:

(EE) intel(0): [drm] failed to set drm interface version.
(EE) intel(0): Failed to become DRM master.
DRM_IOCTL_I915_GEM_APERTURE failed: Bad file descriptor
(EE) intel(0): failed to get resources: Bad file descriptor
(EE) intel(0): Kernel modesetting setup failed

So I’ve decided to roll back (AKA: Wipe and re-install) Ubuntu 10.04.

This time around, rather than doing a desktop install of Ubuntu, I’ve decided to do a stream-lined XBMC-Live installation, but with a few changes to use 10.04, and pull in updated drivers for my intel chipset.

System Hardware

First Thing’s First, this is what my system hardware looks like. Basically a low-end machine from around 2004/2005

lspci
00:00.0 Host bridge: Intel Corporation 82845G/GL[Brookdale-G]/GE/PE DRAM Controller/Host-Hub Interface (rev 01)
00:02.0 VGA compatible controller: Intel Corporation 82845G/GL[Brookdale-G]/GE Chipset Integrated Graphics Device (rev 01)
00:1d.0 USB Controller: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) USB UHCI Controller #1 (rev 01)
00:1d.1 USB Controller: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) USB UHCI Controller #2 (rev 01)
00:1d.2 USB Controller: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) USB UHCI Controller #3 (rev 01)
00:1d.7 USB Controller: Intel Corporation 82801DB/DBM (ICH4/ICH4-M) USB2 EHCI Controller (rev 01)
00:1e.0 PCI bridge: Intel Corporation 82801 PCI Bridge (rev 81)
00:1f.0 ISA bridge: Intel Corporation 82801DB/DBL (ICH4/ICH4-L) LPC Interface Bridge (rev 01)
00:1f.1 IDE interface: Intel Corporation 82801DB (ICH4) IDE Controller (rev 01)
00:1f.3 SMBus: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) SMBus Controller (rev 01)
00:1f.5 Multimedia audio controller: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) AC'97 Audio Controller (rev 01)
01:00.0 Mass storage controller: Promise Technology, Inc. PDC40775 (SATA 300 TX2plus) (rev 02)
01:08.0 Ethernet controller: Intel Corporation 82801DB PRO/100 VE (LOM) Ethernet Controller (rev 81)

According to the guide, I was going to start with an Ubuntu Server distribution then install X, followed by XBMC. I wanted to save time on the download, so i opted for the Ubuntu Minimal Install CD and downloaded the 32 bit Ubuntu 10.04 “Lucid Lynx” Minimal CD. I then created a bootable USB Key using unetbootin.

Installing Ubuntu Base System

Booting from USB is a challenge for my system – for some reason it just wont do it. Fortunately, since I still have GRUB installed from my broken version of Ubuntu, I can tell grub to boot off of usb:

  1. Plug the USB key into the computer after loading Ubuntu Minimal on it using unetbootin, and reboot the system
  2. Press Escape when Grub first loads to enter into the grub boot loader
  3. Press “c” to enter the Grub Command Line
  4. Now its a matter of determining what root the USB key is. The easiest way to do this is to type
    root

    then hit tab. This will list the available roots. I had something like fd0 fd1 hd1 hd2 hd3

  5. Unplug the USB key, and hit tab again. One of the devices should have disappeared. This device is the USB key (Mine was fd0)
  6. Enter the following, substituting fd0 for your device name.
    root (fd0)
    chainloader +1
    boot
  7. You should now be presented with the Ubuntu Minimal Install Menu

I allowed for many of the default options when installing Ubuntu. I created a username (that wasnt xbmc – that comes later), as the default user for the system. When it came time to select the software I wanted installed, I selected:

  • Basic Ubuntu Server
  • OpenSSH Server
  • Samba File Server

Xorg Setup

Taken partially from here

sudo add-apt-repository ppa:ubuntu-x-swat/x-updates
sudo apt-get update
sudo apt-get install xinit x11-xserver-utils

Enable modesetting for the i915 driver (You will need to reboot for this to take effect)

echo "options i915 modeset=1" >> /etc/modprobe.d/i915-kms.conf

Edit the Xorg configuration file at /etc/X11/xorg.conf.
Note that your BusID may differ. Comment it out to have it automatically detected.

Section "Device"
	Identifier	"Configured Video Device"
	Driver		"intel"
	Option		"AccelMethod"			"uxa"
	Option		"EXAOptimizeMigration"		"true"
	Option		"MigrationHeuristic"		"greedy"
	Option		"Tiling"			"false"
	BusID       	"PCI:00:02:00"
EndSection
 
Section "Monitor"
	Identifier	"Configured Monitor"
EndSection
 
Section "Screen"
	Identifier	"Default Screen"
	Monitor		"Configured Monitor"
	Device		"Configured Video Device"
EndSection

XBMC Setup

I will be using the stable XMBC PPA’s on my system. Don’t forget to install the add-apt-repository tool by installing pkg-config.

For me, the multiverse repos were enabled by default (XMBC needs libfaad0 from them). If this isn’t the case for you, modify /etc/apt/sources.lst to enable multiverse.

sudo apt-get install python-software-properties pkg-config
sudo add-apt-repository ppa:team-xbmc
sudo apt-get update
sudo apt-get install xbmc

Add the XBMC User, and add it to the groups

sudo adduser xbmc --gecos XBMC
sudo usermod --group audio,video,fuse,cdrom,plugdev xbmc

Install XBMC-live for automated startup

sudo apt-get install xbmc-live

Logout, then login using the XBMC account, and test start xbmc by running:

xinit xbmc-standalone

Install Alsa

Install Alsa to get sound, run alsamixer to change the volumes as they are all initially zero. Then save the values from alsamixer.

sudo apt-get install linux-sound-base alsa-base alsa-utils
sudo alsamixer
#unmute PCM, Master and increase the volume
sudo alsactl store 0

Mount Additional Drives

I have several drives on my system used for storing video formatted using jfs. By adding these entries to /etc/fstab they will be automatically mounted

/dev/sdb1       /mnt/s320a      jfs     auto,noatime            0       2
/dev/sdc1       /mnt/s320b      jfs     auto,noatime            0       2
/dev/sdd1       /mnt/s500       jfs     auto,noatime            0       2

auto means that the drive will be automatically mounted, noatime turns off file access time, and the “2” means that the file will be scanned by fsck on startup. This last option is useful for jfs as they get cranky if they aren’t unmounted properly.

Mount NFS Share

I have one nfs drive shared over the network that I would like to mount:

sudo apt-get install nfs-common

Add another entry to fstab to mount the /mnt/s200 share on the nfs server to /mnt/s200 on the xbmc box:

nfs-server:/mnt/s200    /mnt/s200  nfs     _netdev,auto    0       0

Grant XBMC User Power Management Permissions

sudo apt-get install acpid #install acpid to allow shutdown from power button
sudo polkit-auth --user xbmc --grant org.freedesktop.hal.power-management.suspend 
sudo polkit-auth --user xbmc --grant org.freedesktop.hal.power-management.hibernate
sudo polkit-auth --user xbmc --grant org.freedesktop.hal.power-management.reboot
sudo polkit-auth --user xbmc --grant org.freedesktop.hal.power-management.shutdown
sudo polkit-auth --user xbmc --grant org.freedesktop.hal.power-management.reboot-multiple-sessions
sudo polkit-auth --user xbmc --grant org.freedesktop.hal.power-management.shutdown-multiple-sessions

Setup Samba

I use samba to easily transfer files from my windows machine onto my media center.
Samba should be already installed as we selected it during the Ubuntu installation, so all we have to do is setup the configuration file.

vim /etc/samba/smb.conf

Modify the security setting in smb.conf to set per-share security (which we will leave wide open).

security = share

I’m not too worried about security, so I’ve made some very liberal shares:

[s320a]
comment = XBMC Files
path = /mnt/s320a
read only = no
writeable = yes
hosts allow =
create mask = 0777
guest ok = yes
 
[s320b]
comment = Xbmc Files
path = /mnt/s320b
writeable = yes
read only = no
create mask = 0777
guest ok = yes
 
[s500]
comment = Xbmc Files
path = /mnt/s500
writeable = yes
read only = no
create mask = 0777
guest ok = yes
 
[yellowface]
path = /mnt/yellowface.remote
writeable = yes
read only = no
create mask = 0777
guest ok = yes

Add samba to system startup

update-rc.d smbd defaults 20 21

Additional XBMC Customizations:
ATI Remote Wonder Setup
Disable Windowed Mode

, , ,

3 Comments