Monday, January 31, 2011

User-scripts in Google Chrome aren't GreaseMonkey scripts

This weekend I was playing around with writing a GreaseMonkey script to force the new Twitter layout to take up the full screen width for the list of tweets.

What I expected to be a 5 minute job turned into an hour and a half. The main issue was that it turns out I wasn't writing a GreaseMonkey script. While the user-scripts in Google Chrome are very similar to GreaseMonkey scripts, they differ in how they handle security (as well as some other more minor differences such as no @require). Eventually I found a helpful page on the Chromiumn wiki explaining the differences.

For me the biggest difference was the absence of unsafeWindow. The easiest way I found to workaround this limitation (which is just a sensible security protect) was to inject the javascript to execute into the document.

The resulting code isn't pretty and is a little harder to debug, but it works and I now don't have large areas of blank screen space when using Twitter.

MythTV and network mounts

After setting up a MythTv 0.24 frontend to use a samba share for files from the backend I discovered that I could no longer watch live TV on it. If I tried to watch live TV there would just be a pause and then a "Error opening jump program file buffer" error message. Looking in the output on stdout wasn't much more helpful, with "Error: Took more than 10 seconds to be allowed to read, aborting" being about the only meaningful message.

It took me ages to track down that the problem is with cached IO on the network share. If the CIFS file system is caching the inode information (which includes the size attributes), then the MythTv frontend thinks that no live TV is being streamed and gives up after a while.

The solution to this is to add the 'directio' option when mounting the network partition (e.g. '-o directio' on the command line). If it's an NFS share then an alternative is to use 'forcedirectio' in the /etc/exports on the server (which is useful if you don't want to change all your MythTv frontends).

Friday, January 28, 2011

Upgrading MythTV 0.23 to 0.24 on Ubuntu

I recently upgraded MythTV 0.23 to 0.24 on both my backend (Debian testing) and the various front ends I use (Ubuntu with Mythbuntu auto-builds/MythTV-Updates).

Everything went smoothly until I tried to watch some TV or recordings from within the frontends. The video would playback at about half speed and with no audio.

After a while I managed to figure out that the problem was caused by using the default audio device. To fix this just update the audio device (in the frontend settings) to point to your actual audio device.

Saturday, January 22, 2011

Getting dual tuner KWorld U399 USB DVB-T working on linux 2.6.37

I recently upgraded the kernel version on my MythTV. One side affect of this was that the second tuner for my DVB-T USB stick (an af9015 based KWorld U399) no longer existed in /dev/dvb. In previous versions of the af9015 module it was just a case of explicitly enabling it with a module parameter of dual_mode=1 and possibly suffering some reception issues when both tuners are enabled.

To get the second tuner working it's necessary to use the very latest firmware for the device. So download the firmware file from here and place it in /lib/firmware. From a quick look at the source code for af9015 it looks like the driver now checks a value in the EEPROM to see if dual mode is safe or not. I assume the clever developer for the af9015 driver has worked out that this is what determines if there will be reception issues with both tuners enabled and that the firmware updates this EEPROM in a suitable way.

You'll need to unplug your USB stick and replug it in to get it to use the new firmware, but you should then get two DVB tuners.

Creative Commons License
The words and photos on this webpage which are created by Toby Gray are licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 2.0 England & Wales License.