Tuesday, April 28, 2009

Record TV programs with Asus U3100 Mini in my EeePC

I have recently purchased an Asus My Cinema-U3100 Mini USB DVB-T Digital TV Tuner and I spent the last few days testing how to record TV programs with it. Although it is 100% EeePC compatible, the supplied driver asus-dmbth-20080528.tar.bz2 is only for watching TV, but not for recording.

To install this driver and the Digital TV (DVBT) program, follow the instructions in the readme.txt, copy the package to "My Home" (from the folder \For EeePC\Linux of the TV Tuner - Driver & Utilities CD), then open a terminal and enter these commands:
sudo su
tar jxvf asus-dmbth-20080528.tar.bz2
cd asus-dmbth-20080528
Then simply plug-in the ASUS USB dongle, and the AP will auto launch. [Note: You can also start this program with the icon "Digital TV (DVBT) in the "Play" tab]

The manuals in the CD are not useful to EeePC Linux users at all. However, Asus do have a U3000/U3100 Mini Quick Guide For EeePC on Linux Operating System on their website.

Basically, the initial setup is of course, selecting country and scanning for available channels. I don't know why, although it is listed in the manual, but there is no selection for "Hong Kong". But anyway, with the coaxial cable of home antenna connected, I have been able to watch TV for all available free Hong Kong TV channels. [NB. The portable AV antennas is of no use in my home.]

Just for watching TV, this is simple enough. But I bought this mainly for recording TV programs so that I don't need to stay up late to watch those weekend blockbuster movies, and of course skip the ads. So I have to look for a program that can record TV programs.

Initially, I looked for MythTV. There is a wiki page on getting Asus MyCinema U3100 Mini USB to work: http://www.mythtv.org/wiki/Asus_My_Cinema_U3100_mini, but apparently this is for other Linux distributions, not for EeePC Linux.

Meeting with no success, I checked on kaffeine and found that Asus has provided a package kaffeine-dtv (and v4ldvbpb). And further checking their dependencies, it seems that these 2 packages are built all independent. They come pre-installed in EeePC Linux version 1.6 en locale, but should also be possible to install in any other version.

To install this, you can add this entry to your /etc/apt/sources.list,
deb http://update.eeepc.asus.com/1.6 en main
Then in a terminal,
sudo apt-get update
sudo apt-get install kaffeine-dtv
[EDIT 2009/5/3: Re-installing kaffeine-dtv again in my 4G with the standard 701 version, I met with an error: not able to overwrite the file /etc/udev/rules.d/15-usbmycinema.rules, and has to install with the dpkg force overwrite option. Be careful you need to backup the file first and restore it after this operation, or the popup TV won't work.]

To run kaffeine is a bit tricky. After some trials, I've found that to be able for the program to find the DVB device at start up, you have to run kaffeine as root.
sudo kaffeine &
EDIT 2009/5/4: I have worked out another way to run kaffeine by ordinary user instead of root because I don't feel comfortable running applications as root. I got this information from this blog. And to achieve this, I set an bash alias for the command "kaffeine" by editing ~/.bashrc and add this line:
alias kaffeine='sudo chgrp user /dev/dvb0*; kaffeine'

Next, again, is to scan for TV channels. From the pull down menu, select [DVB] > [Channels].

Then click on [START Scan]. For the first time, it will take quite a while. If channels can be found (will show up in the "Found" box on the right), click on [Select All], then [ Add Selected].

Now you can watch TV with kaffeine. If you want to record instantaneously, you can either select [DVB] > [Instant Record], or just press on the icon in the shape of a floppy disk. But you will probably need to change the "Records directory" first because a 30 mins file is 2.25 GB.

To do this, from the menu select [DVB] > [Configure DVB]. In the [Recording] tab, you can find the "Records directory". You will probably need an USB stick or SDHC to store this file.

Finally, to schedule recording is very straightforward, select [DVB] > [Timers], then enter start/stop time and channel. However, be careful not to watch TV while recording another channel. In my experience, kaffeine will record the channel you are watching instead of the channel you've told it to record.

What's next?

- I guess I still need to write a simple shell script to close kaffeine and switch off my EeePC after finish recording the TV program.
- Also, how to convert programs recorded by kaffeine to another video format, e.g. mpeg4, for to watch with my cellphone.
- Fix font display problem with program list in Chinese.
- Finally work out how to use the remote controller (need to re-compile the kernel modules).

EDIT 2009/5/3: I found that my EeePC cannot properly shutdown after watching TV. I believe this is because the USB dvb driver modules have not been unloaded. Finally, today, I worked out the solution. Just edit /sbin/fastshutdown.sh (as root) and add this line:
/sbin/modprobe -r dvb_usb_dibusb_mc

Sunday, April 19, 2009

Update my 4G to EeePC Linux version 1.6

In the past 2 weeks, I have been looking into the possibility to upgrade my 4G to EeePC Linux version 1.6 which is now factory default in all new EeePCs. First I tested this out in the EeePC Linux version 1.0 I have installed to my desktop (with unionfs removed) and found that I need around 300-400 MB disk space to do the upgrade. At that attempt, I ended up filling my 4 GB partition full and had to do it all over again moving apt cache downloaded files to another disk. So this dist-upgrade is probably not possible with union filesystem retained.

After success with my EeePC Linux desktop version, this weekend I proceed to do the same to my 4G. The pre-requisite is, of course, to remove union filesystem and merge the changes following instructions in EeeUser Wiki. Please note that I've found that the instructions Merging changes from partition 2 into partition 1 works only for unionfs but not for aufs. And further test running these instructions, I also found that they only works for bash shell but not for ash shell as in rescue mode. Also, it cannot process dir/file names with white space. But since Linux system files usually don't have white spaces, this should not be critical. You can manually search for .wh* files after merging and remove them.

The process is simple, just add the Asus EeePC version 1.6 repositories and then run a dist-upgrade with apt-get. However, it is not easy at all. Both times, the process was interrupted a few times with dpkg process terminating with errors. I checked and found that this is because with Asus updates, some packages from the p701 repos have higher software version than those of the 1.6 repos. In particular, foomatic-db* packages resulted in a large no of programs cannot be upgraded and dpkg terminated with errors. So I have to pin this package to the version provided by 1.6 repos and run dist-upgrade again. But still, I ended up with 4 broken packages and had to fix them a few times before synaptic gives no more complain.

Here are the detailed steps:
1) Backup my old apt sources.list and replace its content as follows:
#Asus Update
deb http://update.eeepc.asus.com/p701/ p701 main
deb http://update.eeepc.asus.com/p701/en/ p701 main
deb http://update.eeepc.asus.com/1.6 common main
deb http://update.eeepc.asus.com/1.6 p701 main
deb http://update.eeepc.asus.com/1.6 en main
2) Backup my old apt preferences and edit it to pin some packages I don't want to upgrade, e.g. libc6, adobe-flash-player 10, firefox 3, and foomatic-db* packages which is causing problem.
Package: libc6
Pin: version 2.3.6*
Pin-Priority: 1001

Package: firefox
Pin: version 2.*
Pin-Priority: 1001

Package: adobe-flash-player
Pin: version 9.*
Pin-Priority: 1001

Package: foomatic-db
Pin: version 1:3.0-20070724-1xandros1
Pin-Priority: 1001

Package: *
Pin: origin update.eeepc.asus.com
Pin-Priority: 960

Package: *
Pin: origin
Pin-Priority: 925
3) Change the default download folder of apt to an external drive (/dev/sdc1 in my case)
/home/user> sudo bash
eeepc-albkwan:/home/user> apt-get clean
eeepc-albkwan:/home/user> mkdir /mnt/sdc1
eeepc-albkwan:/home/user> mount -t vfat /dev/sdc1 /mnt/sdc1
eeepc-albkwan:/home/user> cp -r /var/cache/apt/archives/ /mnt/sdc1/
eeepc-albkwan:/home/user> mv /var/cache/apt/archives/ /var/cache/apt/archives.old
eeepc-albkwan:/home/user> ln -s /mnt/sdc1/archives/ /var/cache/apt/
4) Run apt-get with the option download only to download all required packages. This step is necessary because the Asus EeePC update repository is faulty and some packages have to be downloaded manually or otherwise apt-get will exit with error.
eeepc-albkwan:/home/user> apt-get update
eeepc-albkwan:/home/user> apt-get dist-upgrade -d
In my 2nd run, I found only 1 package that cannot be downloaded and I use wget to download it:
Fetched 490MB in 12m56s (630kB/s)
Failed to fetch http://update.eeepc.asus.com/1.6/pool/common/kde-i18n-zhcn_4%3a3.4.2.97-3_all.deb 404 Not Found
E: Some files failed to download

eeepc-albkwan:/home/user> wget http://update.eeepc.asus.com/1.6/pool/common/kde-i18n-zhcn_4%253a3.4.2.97-3_all.deb
5) When everything is ready, now we can proceed to upgrade the system.
eeepc-albkwan:/home/user> apt-get dist-upgrade
Reading package lists... Done
Building dependency tree... Done
Calculating upgrade... Done
Please note that vlc and libwxgtk2.6-0 are not compatible with EeePC Linux version 1.6 and will be removed. Besides miro, the other packages that were removed are just for scim (Chinese input method), being replaced by gcin.
The following packages will be REMOVED:
eeepc-updatepack-20071126 kdelibs-bin libwxgtk2.6-0 miro scim-bridge-client-gtk
scim-gtk2-immodule vlc xandros-scim
Additional packages installed:
The following NEW packages will be installed:
asus-launcher-config asus-theme-p7xx binutils dpkg-dev eeedownload-helper enigma enigma-data
freemind gcompris gcompris-data gstreamer0.10-alsa gstreamer0.10-plugins-base
gstreamer0.10-plugins-good libcommons-codec-java libcommons-lang-java libdatrie0 libdv4
libgadu3 libiec61883-0 libjaxp1.2-java libjgoodies-forms-java libmysqlclient15off liboil0.3
libpq4 libqt4-qt3support libqt4-sql librelaxng-datatype-java libshout3 libsqlite0
libthai-data libthai0 libxandroskb0 libxandroskbmap-data libxandroskbmap0-qt3 libxcb-xlib0
libxcb1 libxerces27 libxml2-utils libxxf86misc1 libzipios++0c2a make metasys-java
mysql-common picasa stellarium stellarium-data tuxpuck voice-command-en x11-session-utils
x11-utils x11-xfs-utils x11-xserver-utils xandros-cnr-utils xandros-enigma-helper
xandros-file-manager-helper xandros-freemind-helper xandros-gcompris-helper
xandros-google-docs-helper xandros-hotmail-helper xandros-libcnrclient
xandros-libdownloadhelper xandros-libupdateservice-commonui xandros-picasa-helper
xandros-rclock xandros-rclock-asusdiag xandros-rclock-krecord xandros-stellarium-helper
xandros-tuxpaint-launcher-helper xandros-tuxpuck-helper xandros-updateservice
xandros-video-manager-helper xandros-video-mode-helper xmlstarlet
Packages kept back:
The following packages have been kept back:
firefox-locale-zh-cn firefox-locale-zh-tw locales xserver-xorg-input-evdev
xserver-xorg-input-kbd xserver-xorg-input-mouse xserver-xorg-video-intel
Packages upgraded:
The following packages will be upgraded:
acroread akregator asus-3gtool asus-acpi asus-categories asus-eeepc-core asus-icewm-config
asus-icons asus-launcher asus-multimedia-samples asus-ooo-writer asus-userdiag asus-xnlite
atheros-swan-modules- crack-attack diskutil display-settings display-switcher
eeepc-cursor-theme eeetips-en firstrunwizard foomatic-db foomatic-db-engine foomatic-filters
gnome-sudoku grub gsynaptics gtk2-engines gwenview gwenview-i18n huaweiaktbbo icewm
icewm-common kaddressbook kalarm kalzium kappfinder karm kate kbruch kcalc kcharselect
kcontrol kde-i18n-zhcn kdebase-bin kdebase-data kdebase-kio-plugins kdegames-card-data
kdelibs-data kdelibs4 kdemultimedia-kio-plugins kdepasswd kdepim-kio-plugins kdeprint
kdesktop kdm keyboardstatus kfind kghostview khangman khelpcenter khexedit kig kipi-plugins
kitchensync klipper kmail kmenuedit kmessedwords kmix kmplot knode knotes kolourpaint
konqueror konsole kontact korganizer kpager kpat kpersonalizer kpilot krdc krecord krfb
ksnapshot ksplash kstars kstars-data ksysguard ksysguardd ktimer ktip ktuberling kview kwin
kworldclock libaps libarts1-xine libcairo2 libfontenc1 libgl1-mesa-dri libgl1-mesa-glx
libglib2.0-0 libglu1-mesa libgtk2.0-0 libgtk2.0-bin libgtk2.0-common libkcal2a libkcddb1
libkdeedu1 libkdegames1 libkdepim1 libkleopatra0a libkonq4 libkpimexchange1
libkpimidentities1 libksieve0 libktnef1 libmimelib1a libmwncore libopenal0a libpango1.0-0
libpango1.0-common libpurple0 librsvg2-2 librsvg2-common libssl0.9.8 libucil-2 libunicap-2
libunicapgtk-2 libx11-6 libx11-data libxandroshardware libxandrosncs1 libxandrosprint
libxandrosxconfig libxau6 libxaw7 libxfont1 libxi6 libxkbfile1 libxmu6 libxmuu1 libxpm4
libxrandr2 libxtst6 libxxf86dga1 linux-image- minimixer mtpaint networkmonitor
openssl pidgin pidgin-data powermonitor smplayer ttf-arphic-asus tuxpaint tuxpaint-data
tuxpaint-stamps-default tzdata ucview udev usbstorageapplet uvcvideo-modules-
v4ldvbpb vdr voice-command wapmonitor x11-common xandros-adduserwizard xandros-antivirus
xandros-aol-helper xandros-asus-helper xandros-cdrecagent xandros-cdripper xandros-changepwd
xandros-detect-removable xandros-device-dialog xandros-eventviewer xandros-explorer
xandros-hardwarepanel xandros-hplip xandros-i18n-zhcn xandros-internet-radio-helper
xandros-kdeconfig-asus xandros-kfindcomputer xandros-libccsmb xandros-libcsmb
xandros-liblocale xandros-libmwn xandros-libprintutil xandros-libpropdlg
xandros-libusermanagerui xandros-libxandrosncsui xandros-libxcdrec xandros-localedialog
xandros-ndisdrivermanager xandros-netserv xandros-personalization xandros-printers
xandros-sambaconfig xandros-shortcutwizard xandros-shutdowndialog xandros-systeminfo
xandros-themedialog xandros-wallpaper-asus xandros-wikipedia-helper xandros-wpa-supplicant
xandros-xncsapplet xandros-xncsconfig xandros-xncswizard xandros-yahoo-helper xkb-data
xserver-xorg-video-i810 xutils
217 upgraded, 73 newly installed, 8 to remove and 8 not upgraded.
Need to get 492MB of archives.
After unpacking 317MB of additional disk space will be used.
Do you want to continue [Y/n]?
6) At a certain instance, the dpkg process terminated complaining it cannot upgrade some file also in the package xnview. So I have to uninstall xnview before I can proceed.
eeepc-albkwan:/home/user> apt-get remove xnview
7) On the way, I got a bunch of errors:
Unpacking replacement kdelibs-data ...
dpkg: kdelibs-bin: dependency problems, but removing anyway as you request:
kdelibs4 depends on kdelibs-bin (= 4:; however:
Package kdelibs-bin is to be removed.
(Reading database ... 85534 files and directories currently installed.)
Removing kdelibs-bin ...
(Reading database ... 85422 files and directories currently installed.)
Preparing to replace kdelibs4 4: (using .../kdelibs4_4%3a3.4.2.109-1_i386.deb) ...
Unpacking replacement kdelibs4 ...
8) Now I came up to the error with foomatic-db, and I have to edit /etc/apt/preferences and run it all over again.
Preparing to replace foomatic-db 1:3.0-20070724-1xandros1 (using .../foomatic-db_1%3a3.0-20080326-1xandros0_all.deb) ...
Unpacking replacement foomatic-db ...
dpkg: error processing /var/cache/apt/archives/foomatic-db_1%3a3.0-20080326-1xandros0_all.deb (--unpack):
trying to overwrite `/usr/share/foomatic/db/source/printer/HP-PhotoSmart_A520.xml', which is also in package xandros-hplip
dpkg-deb: subprocess paste killed by signal (Broken pipe)
9) Then I came up to kernel package upgrade and some screens that pop up:
Preparing to replace linux-image- 5 (using .../linux-image- ...

press [TAB] to highlight [OK] and press [Enter]

press [Right arrow], then [Enter]

press [TAB] to highlight [OK] and press [Enter]

10) Then some warning upgrading the package udev.
Preparing to replace udev 5:090.x.1.26-2asus12 (using .../udev_5%3a090.x.1.26-2asus17_i386.deb) ...
Unpacking replacement udev ...
postrm called with unknown argument `upgrade'
dpkg: warning - old post-removal script returned error exit status 1
dpkg - trying script from the new package instead ...
dpkg: ... it looks like that went OK.
11) Again another error upgrading the package asus-icons.
Unpacking replacement asus-icons ...
dpkg: error processing /var/cache/apt/archives/asus-icons_1%3a3.200-3_i386.deb (--unpack):
trying to overwrite `/opt/xandros/share/AsusLauncher/current_bios_norm.png', which is also in package asus-xnlite
dpkg-deb: subprocess paste killed by signal (Broken pipe)
12) On running it again, another error with upgrading the package asus-categories.

Preparing to replace asus-categories 1:2.0-23 (using .../asus-categories_1%3a3.200-11_i386.deb) ...
Unpacking replacement asus-categories ...
dpkg: error processing /var/cache/apt/archives/asus-categories_1%3a3.200-11_i386.deb (--unpack):
trying to overwrite `/opt/xandros/share/AsusLauncher/simpleui.rc', which is also in package vdr
13) Now came the pidgin error. I tried to pin it to the 1.6 version, but apparently this pinning don't work. However, on running it again, it went through.
Preparing to replace pidgin 1:2.4.2-1+eeepc1 (using .../pidgin_1%3a2.5.2-1xandros3_i386.deb) ...
Unpacking replacement pidgin ...
dpkg: error processing /var/cache/apt/archives/pidgin_1%3a2.5.2-1xandros3_i386.deb (--unpack):
trying to overwrite `/usr/share/man/man3/Pidgin.3pm.gz', which is also in package pidgin-data
dpkg-deb: subprocess paste killed by signal (Broken pipe)
14) Next came the error with libpurple0. Same case as above.
Preparing to replace libpurple0 1:2.4.2-1+eeepc1 (using .../libpurple0_1%3a2.5.2-1xandros3_i386.deb) ...
Unpacking replacement libpurple0 ...
dpkg: error processing /var/cache/apt/archives/libpurple0_1%3a2.5.2-1xandros3_i386.deb (--unpack):
trying to overwrite `/usr/share/man/man3/Purple.3pm.gz', which is also in package pidgin-data
dpkg-deb: subprocess paste killed by signal (Broken pipe)
Another non-critical error upgrading the package xandros-detect-removable.
Preparing to replace xandros-detect-removable 5:2.6-2asus32 (using .../xandros-detect-removable_5%3a2.6-2asus34_i386.deb) ...
No links found for xangenautotab
Died at /sbin/update_conf_order line 36.
dpkg: warning - old pre-removal script returned error exit status 255
dpkg - trying script from the new package instead ...
dpkg: ... it looks like that went OK.
Finally ended up with 4 errors
Errors were encountered while processing:
E: Sub-process /usr/bin/dpkg returned an error code (1)
15) Next I ran synaptic to fix these broken packages. From the menu, select [Edit] > [Fix Broken Packages]. This got pidgin installed but however also end up with error with asus-icons.

16) From here on, I tried to fix broken packages with apt-get and reconfigure with dpkg a few times.
eeepc-albkwan:/home/user> apt-get install --fix-broken
eeepc-albkwan:/home/user> dpkg --configure -a
17) Finally I was left with one broken package asus-xnlite and I use synaptic to force downgrade it to version 0.71-1 from 1.6 repos. Then another dpkg reconfigure fix all errors.

18) To finish, I clean apt caches and change its download folder back to SSD.
eeepc-albkwan:/home/user> apt-get clean
eeepc-albkwan:/home/user> rm -r /mnt/sdc1/archives/
eeepc-albkwan:/home/user> rm /var/cache/apt/archives
eeepc-albkwan:/home/user> mv /var/cache/apt/archives.old/ /var/cache/apt/archives
This is surely not for the fainthearted.

So what did I get in the end?

Openoffice upgraded to 2.4, picasa, gcompris, freemind, eee download, and additional games tux puck and enigma. But I lost xnview, vlc and miro. So except for eee download, there is really not much to gain with this upgrade.

One comfort of heart is that synaptic no longer gives the "E: Unable to parse package file /var/lib/dpkg/status" error.

So, in conclusion, it really depends whether you think this upgrade is necessary. I may well revert the changes with my dd backup image or just install from 1.6 iso. Anyway, I think I will further proceed to upgrade Openoffice to 3.0 and may be firefox 3 with Yurenyu's install script, and play around with this dist-upgraded version for a while.

Wednesday, April 1, 2009

Watch DVD on EeePC

Like many Linux distributions, the default media player of the EeePC does not come with a software library for accessing and unscrambling DVDs encrypted with the Content Scramble System (CSS) due to fears of running afoul of DMCA-style laws. But you can easily install libdvdcss which is a simple library designed for accessing DVDs like a block device without having to bother about the decryption.

The instructions here are mainly from EeeUser Wiki: Watch DVD. I just add some screenshots for Linux novice.

1) Download the Debian package libdvdcss2_1.2.9-1_i386.deb (right click on this link and "Save Link as").

2) After your download is completed, open "File Manager", locate the file you have downloaded, right click on it, and select "Install DEB file".

3) Enter your password when prompted, then click [OK].

4) Wait until the installation is completed.

5) Open [Media Player] from the [Play] tab > Select [Options] > [Preferences]

6) Select "xv" as output video driver, then click on [OK].

Now your EeePC is ready to watch most DVDs on the default media player (smplayer).