Blog archive

Friday 4 January 2008

MythTv - more madness

Update to ubuntu 7.10

Problem:

Can't get Terratec Cinergy XS DVB tuner USB stick to work.
Device is recognised but dvbdate does not work, channels cannot be viewed or recorded with mythtv


Cause:

Using USB 1.1 support by disabling ehci_hcd. ehci_hcd is required for USB 2.0. note the message in dmesg

em28xx: setting up device on a USB 1.1 bus
em28xx: your device won't work properly when
em28xx: not attached to a USB 2.0 highspeed bus


Solution

Re-enable ehci_hcd. Perhaps you added it to /etc/modprobe.d/blacklist? If so remove it.

Now lsusb doesn't list the device. Just blank entries, but you're sure it's plugged in. What's going on ????

You need to add this to your /etc/fstab

usbfs /proc/bus/usb usbfs auto 0 0

Now force a mount:

mount /proc/bus/usb


Now, you can reboot or force a reload of everything with something like this:

lsusb
/etc/init.d/mythtv-backend stop
sleep 1
rmmod em2880_dvb
rmmod em28xx
rmmod uhci_hcd
rmmod ehci_hcd
rmmod usbcore
rmmod tuner
rmmod tveeprom
rmmod xc3028_tuner
modprobe usbcore
modprobe ehci_hcd
#modprobe uhci_hcd
modprobe usbcore
modprobe em28xx
modprobe em2880_dvb
modprobe xc3028_tuner
/etc/init.d/mythtv-backend start
lsusb
dvbdate

dvbdate should return the current date from the "air". This is a good test of full functionality of a dvb tuner.

dmesg should show something like this instead

em28xx: device is attached to a USB 2.0 bus

Further reading

Official em28xx module support
https://bugs.launchpad.net/ubuntu/+source/linux-source-2.6.22/+bug/88746

Adam : 9:21 PM

Comments are disabled, I'm tired of cleaning up after spam attacks. If you desperately wish to contribute email me at blog at adamish dot com. Thanks

Saturday 10 November 2007

Converting mythtv recorded files

In order to use TV programs recorded by mythtv with a video editor such as Final Cut Pro some conversion needs to be done.

The first step is to fix the video using mythtranscode. Raw mpeg TS files recorded by mythtv will only play with mplayer/VLC but crash most other programs


mythtranscode --mpeg2 --infile input.mpg --outfile output.mpg

However, mythtranscode appears to loose the audio stream!

So run this to extract the audio from the original file


mplayer -vo null -hardframedrop -ao pcm:file=soundtrack.wav input.mpg

Now output.mpg and soundtrack.wav can be loaded into Final Cut Pro and you can edit away. This does not deinterlace the file though and various deinterlace filters in final cut do not appear to work.


Another way possibly better way to convert the files is use nuvexport. This has the disadvantage of quality loss of re-encoding the files. It does do de-interlacing. nuvexport also seems tied into mythtv, i.e. you can't give it arbitary mpeg files to work with as it queries the mythtv database to lookup the file.


nuvexport-xvid --transocde --deinterlace --quantisation 1 --a_bitrate 192 --v_bitrate 5000 --nice 10 --input=1001_20071025193000.mpg

Adam : 11:09 PM

Comments are disabled, I'm tired of cleaning up after spam attacks. If you desperately wish to contribute email me at blog at adamish dot com. Thanks

Ubuntu gutsy gibbon update fstab problems

Extra partitions can no longer be accessed via standard /dev/sdxn (x=a,b,c etc, n=0,1,3 etc) references, instead /dev/mapper/sdb5 style references should be used.

If one tries to mount a drive via /dev/sdxn a rather confusing message is displayed.

mount: /dev/sdb5 already mounted or /mountpoint busy

This implies the volume is already mounted, which it is not.

The symlinks in /dev/disk/by-uuid (used if you use UUID references in fstab) also point to /dev/sdxn references.

Interestingly additional drives added after startup such as external USB drives are accessible via /dev/sdxn references and not /dev/mapper/sdxn.

Adam : 10:57 PM

Comments are disabled, I'm tired of cleaning up after spam attacks. If you desperately wish to contribute email me at blog at adamish dot com. Thanks

Sunday 21 October 2007

uhci_hcd and ehci_hcd

Hmmm. Not sure what's going on here.

lsusb sometimes doesn't show the usb tuner stick (Terratec Cinergy XS T DVB tuner) that is obviously plugged in...

I discovered by removing and reinserting various kernel modules it started working again (showing it was not just a loose connection).

What is the difference between the host controller modules uhci_hcd and ehci_hcd and should both be inserted at once?

I found the card started working after just reinserting the uhci_hcd module suggesting the other one is unnecessary AND causes problems.

Adam : 5:12 PM

Comments are disabled, I'm tired of cleaning up after spam attacks. If you desperately wish to contribute email me at blog at adamish dot com. Thanks

Saturday 20 October 2007

Random

Removing accents from French text.

This is the only way I've found to do it so far. Any better ideas?


cat input.txt | tr "\350\351\352\340\341\342\343\344\345\362\363\364\365\366\371\372\373\374" "eeeaaaaaaooooouuuu"

Note tr \xxx is octal.

Adam : 11:36 PM

Comments are disabled, I'm tired of cleaning up after spam attacks. If you desperately wish to contribute email me at blog at adamish dot com. Thanks

Saturday 30 June 2007

Blair out

My "No war, blair out" t-shirt suddenly became fashionable.

Adam : 5:59 PM

Comments are disabled, I'm tired of cleaning up after spam attacks. If you desperately wish to contribute email me at blog at adamish dot com. Thanks

Saturday 28 April 2007

Benchmark drive speed

#!/bin/bash

path=$1

size=1000

if [ $# -ne 1 ]; then
echo "Usage: `basename $0` "
exit 1
fi

# Make file N MB large, time it to write
t1=`date +%s`
dd if=/dev/zero of=$path count=$(( 1024*1024*$size / 512 )) bs=512 &> /dev/null
t2=`date +%s`

echo -n "Write speed MB/s :"
echo "$size / ($t2 - $t1)" | bc

# Read from file created in previous step, time it to read

t1=`date +%s`
dd if=$path of=/dev/null count=$(( 1024*1024*$size / 512 )) bs=512 &> /dev/null
t2=`date +%s`

echo -n "Read speed MB/s :"
echo "$size / ($t2 - $t1)" | bc

Adam : 9:07 PM

Comments are disabled, I'm tired of cleaning up after spam attacks. If you desperately wish to contribute email me at blog at adamish dot com. Thanks

Or you could use /sbin/hdparm -tT ;)

Dave : Sun 29 Apr 2007

Bluetooth remote not working in feisty faun - solved

This happened because I updated from edgy ubuntu distribution which contained a previous version

/etc/init.d/bluetooth.dpkg-inst # new version
/etc/init.d/bluetooth # old version

Copy the new file over the old one

and call

/etc/init.d/bluetooth restart

The problem was caused because the old version silently failed when it could not find the sdpd binary which has now been incorporated into the hcid binary and activated by hcid -s

source/kdebluetooth/+bug/96916

Adam : 8:26 PM

Comments are disabled, I'm tired of cleaning up after spam attacks. If you desperately wish to contribute email me at blog at adamish dot com. Thanks

Tuesday 24 April 2007

Fixing My Book Western Digital boot up problem

Currently the message
"DISK BOOT FAILURE, INSERT SYSTEM DISK AND PRESS ENTER" is displayed if i attempt to boot with the disc attached (via USB2.0)

The BIOS is at fault here, the BIOS ID is "02/24/2004 KT600 8237 6A6LYA1GC-14"

Turning off USB does not work as ubuntu does not re-enable it rendering the computer without USB.

BIOS updates from motherboard manufacturer abit.

Reflash BIOS with update, remember how to use DOS. Boot from CD floppy discs are so 1990s.

BIOS ID now reads KT600 8237 6A6LYA1GC-20

Message reads the same :(

"DISK BOOT FAILURE, INSERT SYSTEM DISK AND PRESS ENTER"

Next strategy:

Install grub on the external hard disc and have it chain load the internal disc

run grub-install

"Error /dev/hdX does not have any corresponding BIOS drive and Solution"

This most likely means that the device needs adding to /boot/grub/device.map

Mine now looks like this, the first two lines are my existing two internal SATA drives, the last is the removable drive.

(hd0)   /dev/sda
(hd1)   /dev/sdb
(hd2)   /dev/sdc

mkdir foo # make a temp mount point
mount /dev/sdc1 foo # mount first partition of the disc
grub-install --root-directory=foo /dev/sdc # install grub

# run grub to configure the stage 1 loader
grub<
grub< root (hd2,0)
grub< setup (hd2)
Checking if "/boot/grub/stage1" exists... yes
Checking if "/boot/grub/stage2" exists... yes
Checking if "/boot/grub/e2fs_stage1_5" exists... yes
Running "embed /boot/grub/e2fs_stage1_5 (hd2)"... 15 sectors are embedded.
succeeded
Running "install /boot/grub/stage1 (hd2) (hd2)1+15 p (hd2,0)/boot/grub/stage2
/boot/grub/menu.lst"... succeeded
Done.


Actually scratch that, it's way easier just to copy across the contents of /boot on the internal to the external drive, maybe only include your current drive, and just do

grub< root (hd2,0)
grub< setup (hd2)

Adam : 9:38 PM

Comments are disabled, I'm tired of cleaning up after spam attacks. If you desperately wish to contribute email me at blog at adamish dot com. Thanks

Wednesday 21 February 2007

Terratec cinergy T USB XS linux module

Follow instructions on this site. Note that you need linux source installed. All this means is that you should have /usr/src/linux pointing at the same version of the source as your kernel (uname -a). If you're using ubuntu or other distribution with ready made kernels there is no need to install a kernel from source, just download, copy config from /boot/ to .config in source and do a make all modules.

Also note that there are two source repositories mentioned at the video for linux (V4L) site. Only the first of these contains the source for the em2880_dvb module.

  • http://linuxtv.org/hg/~mrechberger/v4l-dvb
  • http://linuxtv.org/hg/v4l-dvb
0ccd:0043 TerraTec Electronic GmbH
Adam : 8:18 AM

Comments are disabled, I'm tired of cleaning up after spam attacks. If you desperately wish to contribute email me at blog at adamish dot com. Thanks

A better mousetrap

Today i finally outwitted our resident mouse, or should i say; one of our resident mice! Here's the lego trap that finally worked. This was trap mkIII, a conventional non-fatal trap box with sprung snapping lid with very lightly triggered falling floor. The bait goes on the floor, the mouse climbs in, the lid comes down, wo ha hah ha hhhaaaa.

Homemade mousetrap, open


Homemade mousetrap, open

Other failed methods included

  1. Using a remote UPnP camera in the kitchen, monitoring from upstairs, then coming down to try and take on the mouse in hand-to-hand combat. Seemed a good idea after a few drinks.
  2. mkI - simply a sandwich box with a trap door, but it managed to jump out.
  3. mkII - similar idea, but using a waste-paper bin instead, again the mouse alluded the trap door and ate all the bait
Adam : 7:00 AM

Comments are disabled, I'm tired of cleaning up after spam attacks. If you desperately wish to contribute email me at blog at adamish dot com. Thanks

perhaps the bright colours helped to attract the little bastard!

I hope you took him over a mile away..

Kitty : Wed 21 Feb 2007

Tuesday 30 January 2007

Auto scp upload directory script

Put this script on your crontab to automatically check a given directory for files, if it finds any they will be uploaded with scp to a given host (e.g. your webhost).
# crontab line

* * * * */usr/bin/webup -l 200 /local/dir user@host:/remote/dir
End result drop a file into a local folder, and it will be uploaded to your website, ideal for uploading loads of media, files are loaded up sequentially with optional upload rate limiting.
#!/bin/bash

# Description 
#  Upload files from a directory to a host using scp
#  (hopefully using public/private key pair auth)
#  Files will be moved to ./complete subdirectory. So
#  folder can be used across samba etc for easy upload
#  to your webhost as drag and drop folder
# 
# Usage
#   webup [-l limitkbps] localfolder user@host:remotefolder 
#
# Warning
#  Be aware this script could upload a php pl asp or other
#  server side script which could then be run via apache
#  - Consider restricting access to localfolder 
#   or remote folder (i.e. chmod, .htaccess respectively)
#
# Requires
#  - Some host to upload with scp
#  - scp available
#  - key pair setup for SSH so there is no password prompt
#
# Uses
#   PID file - /var/run/webup 
#
# Suggested usage
#  Trigger this from a crontab 
#  Example crontab line, check every minute
#
#  * * * * */usr/bin/webup -l 200 /local/dir user@example.com:/remote/dir
#

pidf="/tmp/webup.pid"
default_uplimit_kbps="200"

sub=""
uplimit=""

while getopts l:s: name
    do
        case $name in
        l)
            uplimit="$OPTARG";;
        s)
            sub="$OPTARG";;
        ?)
            echo "Usage `basename $0` host localdir remotedir [limit_kbps]"
            exit 2;;
        esac
    done

shift $(($OPTIND - 1 ))

# Save parameters
localdir=$1
localdircomplete=$localdir/complete
localdirlog=$localdir/log.txt
uhd=$2
localfile=$3

if [ "$sub" = "upload" ]; then

    echo "scp -r -l $uplimit "$localfile" $uhd" >> $localdirlog
    scp -r -l $uplimit "$localfile" $uhd >> $localdirlog

    return=$?

    # Only copy files which copied without fault
    # to complete

    if [ "$return" -eq 0 ]; then
        mv "$localfile" "$localdircomplete" 
    fi;

else

    if [ ! -d $localdir ]; then
        echo "Local directory $localdir does not exist. Exiting";
        exit 1;
    fi;

    # Make complete directory if does not already exist
    mkdir $localdircomplete 2> /dev/null;

    # Save optional limit
    if [ "$uplimit" == "" ]; then
        uplimit=$default_uplimit_kbps
    fi

    if [ -f $pidf ]; then
        echo "Instance `cat $pidf` already running. Exiting"
        exit 1
    fi;

    # create run lock
    echo $$ > $pidf

    # Find all files in localdir and pass to self for
    # upload

    find $localdir -mindepth 1 -maxdepth 1 -name "*" | grep -v "$localdircomplete" | grep -v "$localdirlog" | xargs -I{} $0 -l $uplimit -s upload $localdir $uhd "{}" \;

    # release run lock
    rm -f $pidf

fi
Adam : 11:49 PM

Comments are disabled, I'm tired of cleaning up after spam attacks. If you desperately wish to contribute email me at blog at adamish dot com. Thanks

Thursday 25 January 2007

Building kismet from source

These are the ubuntu/debian packages i needed to install to build kismet (Kismet-2007-01-R1b) from source:

apt-get install g++ gcc libc6-dev libc6-i686 libexpat1-dev libglib2.0-data libglib2.0-dev libncurses5-dev libpcap0.8-dev libmagick9-dev imagemagick libgmp3c2 libgmp3-dev 
Adam : 1:11 PM

Comments are disabled, I'm tired of cleaning up after spam attacks. If you desperately wish to contribute email me at blog at adamish dot com. Thanks

Wednesday 24 January 2007

MythTv terminal

i've found it useful to have a terminal available behind mythtv frontend, so it can be alt-tabbed to.

Unfortunately having mythtv on an actual TV, 12pt black on white text is almost impossible to read, even close up, so i now use this xterm (added as a gnome startup item).

xterm -bg black -fg green -fn *-fixed-*-*-*-20-*
Adam : 5:01 PM

Comments are disabled, I'm tired of cleaning up after spam attacks. If you desperately wish to contribute email me at blog at adamish dot com. Thanks

Lego rave

My first entry on youtube.com

http://www.youtube.com/watch?v=c4XTzgduTdk

Life good. Only angry about the following.

- amount of coverage of big brother on news 24
- lack of news on news 24
- increasing usage of user submitted pictures/videos on news 24, but no reduction in license fee.

Perhaps i should stop watching news 24.

More grey hairs spotted, esp on side of head. i keep plucking them out, but not sure if that helps. Grey hair vs no hair, hmmmm.

Adam : 4:57 PM

Comments are disabled, I'm tired of cleaning up after spam attacks. If you desperately wish to contribute email me at blog at adamish dot com. Thanks

Powered by
Movable Type 4.12