Search This Blog

Thursday, September 30, 2010

Getting a non standard MCE IR receiver to work with XBMC

That is, one that doesn't work 'out of the box'.  I bought this remote and reciever:

...thinking because it was another MCE remote/reciever and supported RC6 like my other one (a Rock Vista Remote) - it would just be plug in and go.

Not so much.

No response what so ever from the remote.  In a shell, tried 'irw' - no response at all.  Oh dear.  Is it broken?  Probably not, tried it under Windows, ok it works.

In the shell, lsusb gives:

  • Bus 005 Device 002: ID 147a:e03e Formosa Industrial Computing, Inc.

  • Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

  • Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

  • Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

  • Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

  • Bus 001 Device 004: ID 04d9:1203 Holtek Semiconductor, Inc. MC Industries Keyboard

  • Bus 001 Device 002: ID 05e3:0605 Genesys Logic, Inc. USB 2.0 Hub [ednet]

  • Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

That top device is the reciever (unplug it and it goes away, plug it in and there it is, that's my fancy way of working it out!) Turns out that reciever is not supported by the lirc that comes with XBMCLive (well, this Freak B2T3 version anyway).

Followed this guide to add the device to the list of MCE compatible recievers: One caveat - I had to do one extra thing as there's been a recent change in lirc:
sudo rmmod lirc_mceusb2
sudo rmmod lirc_dev
sudo modprobe lirc_dev
sudo modprobe lirc_mceusb2
sudo /etc/init.d/lirc restart

(the extra bit is to remove lirc_dev and add the new one back in).

Wa la - remote works just like my other one.

Wednesday, September 29, 2010

Testing Dharma on the new fanless Shuttle XS35GT

I have just performed a test install of Dharma B2 on my new Shuttle XS3GT (fanless ION 2 system).

Here's the log of what has been a bit fiddly in all, but is working really well now:

  1. Basic install plus get network drivers active for XBMCLive

  2. Swapped Shuttle drive for an SSD (60GB Corsair Nova I had spare).

  3. Downloaded latest XBMCFreak Dharma B2 T3 and burned ISO to CD.

  4. Install Windows 7 Ultimate and XBMC to a 20GB Partition - man it's slower than XBMC Live but I wanted a Win system available for testing.  Haven't done much mroe than a basic install of this, no testing as yet.  THis is also useful because it gives access to the grub menu at boot once XBMCLive is installed

  5. Install XBMCFreak to a 20GB partition.  Went well but the network card was not identified.

  6. Enable network card:

enable eth0

1. download & unpack the sources from to an usb key

2. plug the usb key into the shuttle

3. mount the drive
mount /dev/sdb1 /mnt

4. follow the instructions in
cp -r /mnt/jme- /usr/local/src/
cd /usr/local/src/jme-
sudo make install

5. test the driver:
sudo modprobe jme

6. edit your /etc/network/interfaces, add something like
auto eth0
iface eth0 inet dhcp

(From now on use putty/WinSCP to connect to the box)

Get Audio to Work
1. make sure ALSA is 1.0.23 or newer:
cat /proc/asound/version

2. run alsamixer and unmute all the nvidia channels.  Use F6 to change cards to Nvidia, then use 'm' on each of the channels to unmute them (changes to little infinity symbol)

3. unmute alsa on startup
 sudo nano /etc/rc.local, add before exit 0:
/usr/bin/amixer -q -c 1 sset 'IEC958',0 unmute &> /dev/null
/usr/bin/amixer -q -c 1 sset 'IEC958',1 unmute &> /dev/null
/usr/bin/amixer -q -c 1 sset 'IEC958',2 unmute &> /dev/null
/usr/bin/amixer -q -c 1 sset 'IEC958',3 unmute &> /dev/null

4. reboot

5. xmbc settings (System > Audio):
Audio Output: HDMI
Audio Output Device: Custom
Custom Audio Device: plughw:1,7
Passthrough Audio Device: Custom
Custom Passthrough Device: plughw:1,7


Using same harmony remote set up and receiver as below works perfectly.

A second IR receiver (Made by 'Formosa' according to 'lsusb' does not work yet.

Get temperature readouts to work in XBMC

Add this to advancedsettings.xml in your userdata folder:
<gputempcommand>echo "$(nvidia-settings -c :0 -tq gpuCoreTemp) C"</gputempcommand>
<cputempcommand>echo "$(sensors -u | tail -n4 | grep temp1_input | awk '{print $2 }' |awk '{printf("%d\n",$1 + 0.5);}') C"</cputempcommand>

Use AutoFS For Hang Free Win7 Shares

See this post.

Tune the SSD Drive

See here.

Enable Suspend/Resume

***NB This is not working properly for me yet!

You just need to enable the S3 suspend/resume interface on the appropriate USB port - I just enabled all of them.  Here's my /etc/rc.local:
Enable USB ports so it has power to respond to MCE remote wakeup: USB0 is the port next to the
# capped VGA port
# To check which USB ports are enabled during suspend:
# cat /proc/acpi/wakeup
# USB ports layout for the xs35gt:
# EUSB = front
# USB0 = back usb port next to the capped vga
# USB1 = next to USB1
# USB2 = back usb port next to the vga
# UBS3 = back usb port next to the lan

echo EUSB > /proc/acpi/wakeup
echo USB0 > /proc/acpi/wakeup
echo USB1 > /proc/acpi/wakeup
echo USB2 > /proc/acpi/wakeup
echo USB3 > /proc/acpi/wakeup

# Unmute ALSA mixer so we can hear HDMI audio
/usr/bin/amixer -q -c 1 sset ‘IEC958?,0 unmute &> /dev/null
/usr/bin/amixer -q -c 1 sset ‘IEC958?,1 unmute &> /dev/null
/usr/bin/amixer -q -c 1 sset ‘IEC958?,2 unmute &> /dev/null
/usr/bin/amixer -q -c 1 sset ‘IEC958?,3 unmute &> /dev/null

# 1. Force filesystem to use noop disk scheduler (good for SSDs as no moving parts)
echo noop > /sys/block/sda/queue/scheduler
# 2. Discourage swapping to the max
echo 1 > /proc/sys/vm/swappiness

Enable Wireless LAN

Haven't tried this yet but it should work

enable wlan (RTL8192SE) (lucid only)

update bios

1. update bios to 1.0.9 or newer
2. enable wifi card "always on" in bios

install RTL8192S wifi card

1. download sources from

2. compile:
cp -r /mnt/rtl8192se_linux_2.6.0017.0705.2010/ /usr/local/src/
cd /usr/local/src/rtl8192se_linux_2.6.0017.0705.2010/
make install

maybe needed:
apt-get install build-essential subversion module-assistant
module-assistant prepare

3. generate wpa-psk hex key
wpa_passphrase "<wlan network name>" "<plaintext passphrase>"

4. edit /etc/network/interfaces
auto wlan0
iface wlan0 inet dhcp
wpa-ssid "<wlan network name>"
wpa-psk <generated wpa key from step 3 or alternatively plaintext passphraase>

5. protect the network key
sudo chmod o=-r /etc/network/interfaces

Notes On The Result

At this point, the system works very well indeed - totally silent (goodbye and good riddance to ASRock fan buzzing although the example I have here is the best of three I have heard and really not too bad, but still no fan is much better than any fan!),and playing video much more smoothly than my previous Camelot to SVN some time ago install on the ASRock.  I am surprised that the quality of video seems generally better - not sure if this is Dharma or ION2 or what, but somehow things look a bit sharper, there is much less jitter, startup is much quicker and more in sync, coming off unpause is neater, and what is really odd is that the brightness of both Confluence and the system as a whole seems much better - I have not had to set brightness to 56 and contrast to 43 as with Camelot/Babylon - it's almost like the newer NVidia drivers are rendering correctly to TV levels but I have not enabled anything for this - it just looks right on the defaults now.

Also, I am using the default XMBCFreak Xorg.conf - and it is nicely switching to 24/50/60 as it should with no further work.  I have experiement with these a lot (using the famous script and also trying modelines) - but it seems clear now that the previous video jitter was XBMC's fault and that once these bugs were fixed, playback is MUCH smoother, and the Xorg.conf mucking about is not necessary with my hardware (this shuttle plus Denon 2309 receiver into Panasonic V50 plasma, anyway).  I am very sensitice to jitter and the Shuttle with this Dharma is playing very smoothly, although there can be a slight jitter after seeking or pause/unpause, it's very minor and there is next to never any jitter during actual continuous playback.

Open Issues

  • no sound on iPhone4 .mov files

  • UI is slower and not as silky smooth as Camelot on my ASRock - just a bit jerkier.  Is this Dharma or the 2gb of ram less than my ASROCK?  I suspect Dharma as other forum reports have reported UI slowdown.

  • When browsing long lists (hold down on the remote) - I get a wierd pause after every 10 elements or so - nto sure if this is remote or some sort of Dharma issue?

  • no addons in the add ons list?? Fixed by 'force refresh' on the add on repository

  • suspend/resume not tried yet Suspend/resume appears to work fine once the appropriate USB port is enabled by

  • need to test DVD & USB Stick playback although barely ever use this

  • No bluray support evident - have to manually find the .m2ts file in the stream folder and play that - indeed, even playlists no longer seem to work (they were working in Camelot SVN).  I should try the bluray add on...

  • Of the bluray m2ts files tried, almost all seem to work fine in terms of video playback (both h264 and vc1 now work) - except Avatar where the frame rate jumps all over the place.  I believe this is related to 'timestamping' issues and there's some progress in the trac on this it seems.  Still the easiest option seems to be to remux into a nice MKV which should work with forced subs etc now as well.

  • Trailers are appearing in the movie library as a second copy of the movie - my trailers are named <moviename>-trailer.mp4 ???

Solution to XBMC idle hanging problem

As per this thread on the XBMC forums, I was for a long time having problems with XBMC hanging when idle.  On average about once a day for the last 6 months - very very annoying.  And no solution - until now!

The solution is to work around the buggy smb mounting code in XBMC that creates these hangs and also, in general, doesn't play so nicely with Windows 7 shares.  Instead, we use 'autofs' to mount the shares locally into a mount point within the XBMCLive Ubuntu outside of XBMC itself - this way the shares appear to XBMC as local folders, and the hangs disappear!

Here's the solution:

In a terminal (e.g. a putty connection), you must:

Create an entry in /etc/hosts for your server

eg. homeserver

sudo apt-get install smbclient
sudo apt-get install smbfs
sudo apt-get install

(this installs the appropriate packages for automounting shares)

Add to /etc/auto.master


/smb    /etc/auto.smb --timeout=60

Create /etc/auto.smb.yourservername



Restart autofs


sudo service autofs restart

Your shares can now be accessed via /smb/yourservername/...

(That is, to list them, you need to 'ls  /smb/youservername/' - if you just 'ls /smb/' you won't see the shares as they are mounted on demand!)

You must also remove ANY references to your old smb shares in XBMC.

Goto the folder: /home/#XBMCUSER/.xbmc/userdata, Edit sources.xml
Remove any source that has "smb://" in it. In my case I did a replace of smb://#USER@..../ to /mnt/share/.... since I've mounted all my shares on my box.

Then edit passwords.xml
Remove your smb passwords

Last edit mediasources.xml
And also remove the share there.

This solution completely eliminates the hangs.  It is needed for Dharma as well as the hanging issue remains as of Beta2 for Dharma.

Another nice thing about this solution is that browsing to shares seem quicker in general this way.