Tag Archives: XBMC

Resuming from suspend with remote control on XBMC and Ubuntu 9.10

I’m so fucking lazy. I don’t want to have to get up, walk the 3 paces across my living room, open the cupboard door and press the power button on my HTPC to resume it from suspend (sleep). So I must be able to do it with the remote control, right? Well, you can with a little bit of work:

I completed all the steps in this excellent xbmc wiki article about enabling wake-on-device.

When I tested it by sleeping my computer, I had to press the ‘power’ button on my MCE remote to get it to resume, but all worked fine. However, it badgered me for a password. I didn’t want this as I wanted to be able to use it via the MCE remote ONLY. To disable the password nagging screen do this by starting terminal and type the following to bring up the configuration editor:

gconf-editor
Navigate to ‘Apps’ – ‘gnome-power-manager’ – ‘lock’ and untick ‘suspend’, as below:

Untick the 'suspend' box in the configuration manager

So there you go, resume your HTPC with the remote and no troublesome nagging password screen.

Fixing Blank Screen if Ubuntu 9.10 Started with HDTV or Monitor Turned Off

Lord knows this was painful to fix as I’m a relative Linux newbie.

Problem:

My HTPC, when started up with my HDTV turned off does not detect the TV and results in a blank screen. I can VNC into the Ubuntu OS but the resolution is very low (800×600). I suspect this is due to the television as I’ve read in some forums that this is just ‘one of those things’ on certain models. The graphics card is an Nvidia MSI 8400GS, connected to a Toshiba 37AV505D HDTV via an HDMI cable with a DVI adapter into the card.

After some research it appears the graphics card is waiting for monitor information to come down the connected cable via EDID. As the monitor is off, the card defaults to ‘failsafe’ settings and switches output to the VGA port at 800×600.

Solution:

Force the graphics to ignore missing EDID information, force output to DVI and also force the resolution.

Brief Solution Explanation:

Export EDID settings for connected and correctly configured flatscreen/HDTV. Point xorg.conf to use the exported settings and to ignore all else.

This is what I did to fix it:

Warning: This is, apparently, dangerous and can spanner your TV/monitor if done incorrectly. Proceed at your own risk etc etc

  1. Ensure ssh is installed
    This is so you can restore your xorg.conf file if everything goes tits up.
  2. Backup the xorg.conf file
    This file is, apparently, somewhat old and rarely used. When I totally spannered this setup (which I did a couple of times), I was be able to SSH back into the box and return the file to the original.
    First, open terminal and change permissions:
    cd /etc/X11
    sudo chmod 777 xorg.conf

    then make a new copy:
    sudo mv xorg.conf xorg.conf.original
  3. Make a new xorg.conf file
    At the moment no xorg.conf file exists. As I am using the Nvidia driver, I created a new xorg.conf file by starting the Nvidia settings in terminal:
    sudo nvidia-xconfig
  4. Start up the NVIDIA settings manager
    sudo nvidia-settings
    (You can also get to it by going to ‘System’ – ‘Preferences’ – ‘Display’. It should be present if your system is fully up-to-date) . Looks something like this:
  5. NVIDIA X Server Settings in Ubuntu 9.10Ensure the monitor/screen/LCD/HDTV or whatever is the ONLY monitor connected and save the settings
    Go to the ‘X Server Display Configuration’ option and ensure you select the correct resolution, frequency.
    Click on the ‘Advanced…’ button.
    Take a note of the ‘Model’ (in my case ‘TSB TOSHIBA (DFP-0 on GPU-0)’) and the ‘Mode Name’ (in my case ‘1920x1080_60i’).
    Click ‘Save to X Configuration File’ and save to ‘/etc/X11/xorg.conf’.
    If you have problems saving you will probably have to reset the permissions, as per step 2 (‘sudo chmod 777 xorg.conf’).

    Screenshot-NVIDIA X Server Settings

    Don't forget to save your settings

  6. Quit and restart Ubuntu.
  7. Export your EDID settings
    In terminal, start the Nvidia Settings GUI again with:
    sudo nvidia-settings
    Now go to the settings for your flat panel (in my case it was ‘DFP-0 – (TSB TOSHIBA-TV)’
    Click the ‘Acquire EDID…’ button and note where you saved it (in my case I chose ‘/home/mark/Desktop/edid.bin)
    Acquire EDID...
  8. Modify the xorg.conf file to use exported EDID file
    Open terminal and ensure you have write permissions for xorg.conf:
    cd /etc/X11
    sudo chmod 777 xorg.conf
    sudo gedit xorg.conf

    This should open your xorg.conf file.
    Under the ‘Section “Device”‘ I added:
    Option “CustomEDID” “DFP-0:/home/mark/Desktop/edid.bin”
    ‘DFP-0’ is ‘Digital Flat Panel – 0’, we noted this in step 5. Yours may well be different.
    The section ended up looking like this:
    Section "Device"
    Identifier     "Device0"
    Driver         "nvidia"
    VendorName     "NVIDIA Corporation"
    BoardName      "GeForce 8400 GS"
    Option         "CustomEDID" "DFP-0:/home/mark/Desktop/edid.bin"
    EndSection

    It’s probably worth restarting just to see that everything’s still ok. Still with the monitor on, it should boot up ‘normally’.
  9. Force the screen to use DVI and ignore other modes
    I added these two lines under the ‘Section “Screen”‘:
    Option         "ConnectedMonitor" "DFP-0"
    (This forces the graphics card to assume the above monitor is connected)
    Option         "ExactModeTimingsDVI" "TRUE"
    (This gets the graphics card to ignore any other possible modes available)
    I then removed all but the mode I wished to use and locked it to the monitor I wished to use:
    Option         "metamodes" "DFP-0: 1920x1080_60i +0+0"
    (This line had lots more modes specified, separated by commas and semicolons).
    The section ended up looking like this:
    Section "Screen"
    Identifier     "Screen0"
    Device         "Device0"
    Monitor        "Monitor0"
    DefaultDepth    24
    Option         "TwinView" "0"
    Option         "ConnectedMonitor" "DFP-0"
    Option         "ExactModeTimingsDVI" "TRUE"
    Option         "metamodes" "DFP-0: 1920x1080_60i +0+0"
    SubSection     "Display"
    Depth       24
    EndSubSection
    EndSection
  10. Reboot and check it boots up with monitor turned on
    The display should look totally normal.
  11. Reboot with monitor turned off to test
    Turn display on after it’s booted into the OS.

Problems? Troubleshooting? Try opening up ‘/var/log/xorg.0.log’ and looking through to see what’s not working.

If your display was hosed, you can see the log from the time BEFORE you just booted by checking out ‘/var/log/xorg.0.log.old’.

This post and this post really helped me out.

GUI legibility (on a Hi Def Widescreen TV) for Firefox on Ubuntu 9.10

One problem I didn’t anticipate was the (il)legibility of the screen on my new HTPC when browsing the web. I have a 37″ Toshiba 37AV505D flatscreen with the HTPC hooked up via DVI cable. Running at 1920 x 1080px everything ends up looking, at best, fucking tiny.

At first I squinted, begrudgingly shuffled closer and made do with it all, but it was quickly doing my head in, and this is before I’d even let my technophobic short-sighted other half at it. I wasn’t going to spend all day on the Internet with it as it’s mainly for running XBMC which has nice, big fonts and is built with widescreen TVs in mind. However, as I’d gone to so much effort to make Firefox start from within XBMC I thought I may as well bite the bullet and figure out how to jig the zoom settings around in Ubuntu and Firefox to make the whole experience more comfortable.

In the screen below you can see what it looked like before I touched the browser settings (I’d already changed the OS settings). I can’t see shit.

1920x1080 Ubuntu 9.10 with Firefox at 100% Zoom

After some digging I found the NoSquint Add-on for Firefox and changed the global Zoom settings (click here to see what I set them as). Way better.

1920x1080 Ubuntu 9.10

I changed some settings in ‘Preferences’ – ‘Appearance’ – ‘Fonts’ in the Ubuntu GUI. Here’s what I changed them to:

Font Appearance Preferences in Ubuntu

I then hit ‘Details…’, and changing the Resolution (DPI) really made a difference to the legibility of the whole GUI. I whacked it up to around 150:

Font Rendering Details in Ubuntu

Ideally I wanted to make it easier to scroll up and down in Firefox by making the scrollbars wider. Apparently this is possible in earlier (than 3.0) versions of Firefox by modifying the ‘userChrome.css’ file in your user profile directory, but apparently this is no longer possible, which is a shame. If I ever find a solution to this (as well as making the ‘back’ and ‘forward’ buttons larger, I’ll be sure to post.

So there you go. A perfectly legible HTPC display with 10ft GUI.

Modifying the Aeon XBMC Skin to Launch Firefox from main menu in Ubuntu

If you followed the instructions in my previous post about starting Firefox from inside XBMC you’ll probably have realised by now that with Launcher you have to navigate through the ‘Programs’ main menu  etc etc to find the shortcut.

Ideally, I wanted it in my XBMC main menu – using the beautiful Aeon skin. I got it set up so it launched from the menu as per the picture below:

Firefox Browser Launcher for XBMC in Ubuntu

Background wallpaper pinched from Geekpedia (see footnote for link)

If you’d like to know how I did it just follow the steps below.

Please note that this is a ‘quick and dirty’ method, as you’re editing an existing menu item (in this case, ‘ASSISTANT’):

  1. To change the text on the main menu, open ‘~/.xbmc/skin/Aeon/language/English/strings.xml’.
    On a Mac this is in ‘/userfolder/library/Application Support/XBMC/skin/Aeon/language/English/strings.xml’)
  2. Find the ‘ASSISTANT’ entry which looks like
    <string id="31021">ASSISTANT</string>
    and change it to
    <string is="31021">INTERNET</string>
  3. Make a note of the string id (in this case ‘31021’)
  4. Open ‘~/.xbmc/userdata/favourites.xml’ and locate the Launcher shortcut you created for Firefox. It should look something like ‘plugin://programs/Launcher/?Firefox’
  5. Now we need to change what happens when you click the link in the menu to the shortcut to Firefox (above), and this is dictated by ‘~/.xbmc/skin/Aeon/720p/Includes_MainMenu.xml’
    Find the entry in the file that refers to the string id you modified in strings.xml file (in our case, ‘31021’). It should look something like this:
    <item id="21">
    <description>Assistant</description>
    <label>31021</label>
    <onclick>XBMC.ActivateWindow(605)</onclick>
    <visible>Skin.HasSetting(assistant)</visible>
    </item>
  6. You’ll need to change the ‘onclick’ entry to use the shortcut from your ‘favourites/xml’ file:
    <onclick>XBMC.RunPlugin(plugin://programs/Launcher/?Firefox)</onclick>
  7. Save the ‘Includes_MainMenu.xml’ file and your modified shortcut should fire up Firefox and return to XBMC when closed

Remember, if you want to change the backdrop for your new shortcut, change the ‘ASSISTANT’ entry as you modified the behaviour of that menu entry. These menu hacks are limited to entries you don’t use, but if I find a way of creating new menu items I’ll be sure to post here.

Footnote: I pinched the ‘Internet’ menu background image from Geekpedia. I found it by searching for ‘Firefox’ in Google images, set to ‘Large’

Starting a web browser in XBMC for Ubuntu 9.10

One essential thing I wanted to be able to do with my HTPC is surf the web. The front-end that I am running, XBMC, doesn’t have any kind of built-in browser as it was originally built on the meagre XBox hardware, so it’d be best to go back to the Ubuntu 9.10 OS to start Firefox. To do this I’d have to suffer the almighty indignity of closing the XBMC application and having to restart it after I’d finished browsing.

Obviously this wasn’t a particularly elegant solution.

So after a little digging around I found the ‘launcher‘ plugin via the XBMC forums. Follow the instructions below to launch Firefox from XBMC. When you close Firefox, XBMC returns to the main menu automatically:

  1. Install the Launcher plugin by copying the folder in the .zip file to the plugins folder of XBMC (in Ubuntu it’s located in ‘/home/username/.xbmc/programs/plugins’).
  2. Run this command in a terminal (I have absolutely no idea what it does but it’s in the installation instructions):
    sudo ln -sf /usr/lib/libcurl.so.4 /usr/lib/libcurl.so
  3. Then I had to create a symlink for Firefox to my home folder (as inexplicably Launcher couldn’t see higher than that level). I did this by typing:
    sudo ln -sf /usr/bin/firefox /home/mark/Documents/Firefox
    Note: There were actually two entries: ‘Firefox’ and ‘Firefox 3.5’. To find out which one is used by the OS, type ‘which Firefox‘ at the terminal and you can get the path to your application here.
  4. To run the launcher plugin you need to use a skin that has the ‘Programs’ menu option on the menu. I changed from Aeon, my normal skin, to Confluence to do this next bit.

  5. On your XBMC, go to ‘Programs’ – ‘Program Plugins’ – ‘Launcher’. I hit ‘c’ on my keyboard to get the context menu and went to ‘Add new launcher’ – ‘Standalone (normal PC executable)’.
    Here’s where Launcher presented me with only 2 options, ‘Home Folder’ or ‘Profile Folder’. As I’d already created a symlink to Firefox in my Documents folder I navigated to it and clicked ‘OK’.
    Before closing Launcher I right-clicked the ‘Firefox’ entry I just created, added it to my favourites and also downloaded a nice big icon for it (using ‘Get Thumb’), all through the context menu (you have to select ‘Get Thumb’ first otherwise your icon won’t show).
  6. Once this is done (and still using the Confluence skin), I went back to the main menu and chose the little icon in the bottom left-hand corner of the screen that looks like a list. Firefox popped up and sure enough it worked.

*note* if Firefox is starting ‘behind’ XBMC, ensure you haven’t already got an instance (of Firefox) running.

The next step was to make Firefox launch from the main menu, with the Aeon skin.

HTPC Part 3a – Installing Boxee on Ubuntu 9.10 and OSX86 10.5.8

Boxee LogoAt the moment with Boxee’s beta, there’s no option or download for the latest  version of Ubuntu (9.10). The below was pinched online somewhere, but I lost the link!.

You can still install it on your 9.10 Karmic using its Jaunty repository; deb http://apt.boxee.tv jaunty main – copy and paste in your /etc/apt/sources.list (System -> Administration -> Software Sources).

Grab and install these 3 dependencies

before installing with sudo apt-get install boxee – from the command-line. This is enough to get Boxee up and running roughly – whilst waiting for the official repository for Ubuntu Karmic.

Enabling lirc for Microsoft MCE Remote Control in Ubuntu 9.10

MCE Remote ControlSo far my experience with getting XBMC in Ubuntu 9.10 hasn’t been too painful. Everything is set up quite nicely and I just decided to tackle the last piece of the puzzle to enable full girlfriend compatibility: the remote control.

I had an old MCE remote control left over from an old HTPC system I had, along with IR receiver so I thought I’d try to use that. I think it’s an aftermarket MCE copy remote – looks nearly exactly the same bar the missing Microsoft logo at the bottom (see other remotes here).

This is what I did, with significant help from this post on the XBMC forums:

Install lirc

lirc‘ (Linux Infrared Remote Control)  is the software Linux uses to recognise commands from your IR control/remote. To install it I opened a terminal window and typed:
sudo apt-get install lirc
The configuration takes place in the terminal window. Unfortunately I hadn’t a clue what I was doing and skipped the configuration. I restarted it by opening a terminal window and typing:
sudo dpkg-reconfigure lirc
The first screen will be for remotes, I chose
“Windows Media Center Transceivers/Remotes (all)”
For Receivers I chose
“Microsoft Windows Media Center V2 (usb) : Direct TV Receiver”
Don’t worry about the Direct TV part, it just references the mceusb2 driver that you need.
To check what configuration you have type
lsmod | grep lirc*
The first time I did it nothing was output, so I knew something was amiss (I reran the configuration as above)

Install the USB receiver

When I plugged in the USB  receiver, the red light came on, but how did I know it worked? First, I tested the remote AND the receiver on my Windows 7 box. The Media Center interface started up correctly so I knew the batteries were good and everything was OK. After some Googling I discovered this command:
lsusb
This lists the connected USB devices. I could see
Bus 004 Device 002: ID 0471:0815 Philips eHome Infrared Receiver
so I knew the receiver was working OK.

After that, a reboot and quick test in XBMC confirmed everything was working. Stoked.

Next job is to get the HTPC suspending (sleeping) and resuming (waking up) using the MCE remote control only.