Sunday, 8 May 2011

[Update] Ubuntu Netbook Remix - Tethering to iPhone

Ubuntu 11.04
My previous instructions successfully worked for natty!

Saturday, 2 April 2011

Installing MCE Remote for XBMC

The remote I purchased was a Media Center Remote Control / Receiver, RC118 / IR6065A / QIR606A / Q. This being a MCE certified device I thought it would be easy to set-up. However, it took a little more effort than expected. Fortunately the steps are easy, and it was a useful problem solving exercise. 
System
I am running Ubuntu 10.04 LTS with kernel 2.6.32-31-generic for use as a server for XBMC version 10.1.  I received advice from Jarod Wilson of lirc that,
lirc_mceusb is obsolete. This device is already supported by the in-kernelmceusb driver.
So hopefully you are much luckier than I was in setting this up!
Getting the remote to work
Even though dmesg reported that I had a infrared receiver, lirc failed to recognise it when testing with irw. dmesg reports:
[ 23.721796] generic-usb 0003:147A:E03E.0003: timeout initializing reports
[ 23.722033] generic-usb 0003:
147A:E03E.0003: hiddev97,hidraw2: USB HID v1.00 Device [Formosa21 eHome Infrared Transceiver] on usb-0000:00:1d.2-1/input1
[ 23.722127] usbcore: registered new interface driver usbhid
[ 23.722136] usbhid: v2.6:USB HID core driver
To configure lirc I used the command,
dpkg-reconfigure lirc
Selecting Windows Media Center Transceivers/Remotes (all), and transmitter, none. The default remote device was /dev/lirc0, see /etc/lirc/hardward.conf. But no such device exists! However, checking with lsusb the receiver is being recognised:
# lsusb -v -s 004:002
Bus 004 Device 002: ID
147a:e03e Formosa Industrial Computing, Inc.
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.00
bDeviceClass 0 (Defined at Interface level)
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 8
idVendor 0x147a Formosa Industrial Computing, Inc.
idProduct 0xe03e
bcdDevice 10.01
iManufacturer 1
iProduct 2
...
So, why does lirc not recognise it? Are the modules being loaded?
# lsmod | grep lirc
lirc_mceusb 12100 1
lirc_dev8890 3 lirc_mceusb
...
So, yes modules are being loaded. So is the device known by the modules? To answer that question, I have to install lirc-modules-source:
apt-get install lirc-modules-source
Now look in /usr/src/lirc-0.8.6/drivers/lirc_mceusb/lirc_mceusb.c for your receiver,
grep -i formosa /usr/src/lirc-0.8.6/drivers/lirc_mceusb/lirc_mceusb.c
#define VENDOR_FORMOSA
0x147a
/* Formosa eHome Infrared Transceiver */
{ USB_DEVICE(VENDOR_FORMOSA, 0xe015) },
/* Formosa21 / eHome Infrared Receiver */
{ USB_DEVICE(VENDOR_FORMOSA, 0xe016) },
/* Formosa aim / Trust MCE Infrared Receiver */
{ USB_DEVICE(VENDOR_FORMOSA, 0xe017) },
/* Formosa Industrial Computing / Beanbag Emulation Device */
{ USB_DEVICE(VENDOR_FORMOSA, 0xe018) },
/* Formosa21 / eHome Infrared Receiver */
{ USB_DEVICE(VENDOR_FORMOSA, 0xe03a) },
/* Formosa Industrial Computing AIM IR605/A */
{ USB_DEVICE(VENDOR_FORMOSA, 0xe03c) },
So, my receiver isn't listed here! Easy to fix, just add:
/* Formosa21 / eHome Infrared Transceiver */
{ USB_DEVICE(VENDOR_FORMOSA,
0xe03e) },
Next, rebuild modules using,
dpkg-reconfigure lirc-modules-source
Restart lirc:
service lirc restart
This should have recreated the device /dev/lirc0. But it still didn't exist! But using,
# ls -lh /dev/lirc*
lrwxrwxrwx 1 root root 19 2011-03-30 08:57 /dev/lircd -> /var/run/lirc/lircd

/dev/lirc:
total 0
crw-rw---- 1 root root 61, 0 2011-03-30 08:57
0
I saw that there was indeed a device created, just not where I had expected it to be. So, change the entry in /etc/lirc/hardward.conf, from:
REMOTE_DEVICE="/dev/lirc0"
to:
REMOTE_DEVICE="/dev/lirc/0"
Restart lirc:
service lirc restart
And test with irw to check to see if it responds!  Success!
References
XBMC on Acer Aspire Revo R3700
lirc.org
xbmc.org
Mediagate MG-IR01BK and Ubuntu

Friday, 18 March 2011

Xfce no panel

It doesn't happen often (but I'd love to know why), but I lost by Xfce panel again today. Luckily this is easy to fix. Open a terminal (right mouse click) and re-start the panel with:
xfce4-panel &
Now that you have you're panel working make this permanent by removing current session information:
rm -rf ~/.cache/sessions/
Logout and restart your session.
One final hint, backup your Xfce4 settings! I alias the backup command and keep a local and remote copy of the generated archive:
alias backupxfce='cd ~;tar jcvf Backups/xfce4.tar.bz2 .config/xfce4'
This alias will create a bzip2 archive.

Friday, 11 March 2011

XBMC on a ACER Aspire Revo R3700

The following guide is to assist installation of XBMC onto an ACER Aspire Revo R3700 320G/ 2G RAM Mini PC running Ubuntu 10.04. See also my notes on installing MCE remote for XBMC.

Please feel free to suggest corrections or clarifications.

Installation of Ubuntu 10.04
I installed Ubuntu 10.04 from USB. Instructions for this can be found at Ubuntu here.

References

https://help.ubuntu.com/community/Installation/FromUSBStick
http://forum.xbmc.org/showthread.php?t=53812
http://wiki.xbmc.org/index.php?title=Installing_XBMC_for_Linux

Enable SSH

Enable ssh for easy remote management.
  • enable X11 forwarding, in /etc/ssh/sshd_config set,
    X11Forwarding yes
  • enable SSH daemon with,
    update-rc.d
    ssh defaults
  • restart SSH daemon with,
    service ssh restart
  • on the server allow an X client with,
    xhost +[ip_of_client]
To start a session with X enabled,
ssh -X user@192.168.0.6
To copy a file from local to remote host use,
scp local_file user user@192.168.0.6:/home/user/

References

http://www.cyberciti.biz/faq/howto-runlevel-configuration-tool-to-start-service/
http://www.go2linux.org/linux/2011/02/my-top-five-ssh-tips-and-tricks-small-cheatsheet-914

Replace GDM On Startup

I’ll assume that the user name for access to you XMBC box is xmbc.
  • Auto-login xmbc user, edit /etc/init/tty2.conf
    exec /bin/su xmbc -l -c "/bin/bash --login -c /usr/bin/startx > ~xmbc/.tty2.errors 2>&1"

    Where errors are reported into ~xmbc/.tty2.errors
  • Put xmbc startup in users X initialisation, edit ~xmbc/.xinitrc
    exec /usr/bin/ck-launch-session /usr/bin/dbus-launch --exit-with-session /usr/bin/xbmc --standalone -fs > .xinitrc.errors 2>&1

    Where errors are reported into ~xmbc/.xinitrc.errors
  • Ensure user has correct authorities. The following fixes the error,
    X: user not authorized to run the X server, aborting.
    Edit /etc/X11/Xwrapper.config and replace allowed_users=console with
    allowed_users=anybody

  • Remove GDM from startup.
    mv /etc/init/gdm.conf /etc/init/gdm.conf.bak
    update-rc.d -f gdm remove

  • Reboot.
To recover GDM reverse the fourth step. GDM will then start despite errors being logged by xbmc complaining that startx is already active.

References

http://ubuntuforums.org/showthread.php?t=625230

Sound over HDMI

This was by far the trickiest to set up on the Acer. I've used alsa in preference to pulse. I also un-installed pulse just to be sure it wouldn't clash with my alsa settings.
  • For this XBMC installation I've used the custom audio output of plughw:1,7
  • In /etc/asound.conf I added,
    # source: https://bbs.archlinux.org/viewtopic.php?id=100759
    pcm.dmixer {
         type dmix
         ipc_key 2048
         slave {
             pcm "hw:1,7"        # always use pure hw. dmix will resample
             period_size 512     # a reasonable default
             buffer_size 4096
             rate 48000          # HDMI assumes 48kHz
             format S16_LE       # a  reasonable default
         }
         bindings {
             0 0
             1 1
         }
     }
     pcm.!default {
         type plug
         slave.pcm  "dmix:1,7"
     }
  • Open alsamixer and ensure channels are not muted. Muted are keyed as (MM), non-muted are something like, (00).
  • Save the volumes of alsamixer with,
    alsactl store 0
  • To test, aplay -D plughw:1,7 /usr/share/sounds/alsa/Front_Center.wav

References

https://bbs.archlinux.org/viewtopic.php?id=100759
http://guide.ubuntuforums.org/showthread.php?t=1625530&page=2
http://ubuntuforums.org/showthread.php?t=1532355
http://forums.boxee.tv/showthread.php?t=21106

Wireless drops connection periodically

The Revo wireless card raLink rt3090 is known to cause some problems.
  • First check with setup with,
    lshw -C network
    This will show a wealth of wireless information.
  • To see what drivers are actually loaded try,
    lsmod | grep -e rt2 -e rt3
    For this device we only want to see rt3090 and not any of the rt2* drivers.
  • To exclude the rt2* drivers append to /etc/modprobe.d/blacklist.conf the following,
    # cat /etc/modprobe.d/blacklist.conf
    blacklist ndiswrapper
    blacklist rt2800pci
    blacklist rt2860sta
    blacklist acer-wmi
  • <note – the last line must be blank>
  • Next ensure wireless driver is loaded in /etc/modules
    # wireless drivers for Ralink 2860
    rt3090sta
  • To get interface information, use on or all of,
    nm-tool
    lshw -C network
    iwlist scan
  • To check clients to your local network,
    nmap -sP 192.168.0.0/29
  • To restart wireless,
    service network-manger restart

References

http://crunchbanglinux.org/wiki/howto/rt2860sta_wireless

Saturday, 5 February 2011

upgrade - a simple Debian package script

While Ubuntu and variants have a good package upgrade mechanism, I find that this little script can sometimes help when these fail.

echo "Sources:\n"
grep '^deb ' /etc/apt/sources.list
sudo apt-get --fix-missing --list-cleanup update
sudo apt-get dist-upgrade
sudo apt-get -f check
sudo apt-get autoclean
sudo apt-get autoremove
sudo deborphan -Pz
This script has the following dependencies:

deborphan sudo apt
To install, use:

install -p -m 755 -o root upgrade /sbin/upgrade
Occasionally, run this to check for redundant packages:

deborphan --guess-all -Pz
And run this to clean local repository:

apt-get clean
One finally problem may be reported by gnupg about package authentication keys. To fix this, follow this example. I followed the example described here.
I recently updated this script to include the following:

sudo dpkg --configure -a
This is to complete installation of unpacked but unconfigured packages.

Sunday, 16 January 2011

Running a paperless office (update)

A friend raised question a question with regard to keeping digital taxation records. Are you sure you can do that? Well, a quick search on our Government's ATO website revealed a positive answer:
Electronic records
Documents that you are required to keep can be in written or electronic form. If you make paper or electronic copies they must be a true and clear reproduction of the original.
We recommend that if you store your records electronically you make a back-up copy to ensure the evidence is easily accessible if the original becomes inaccessible or unreadable (for example, where a hard drive is corrupted).
Source: Australian Government, Australian Taxation Office, Keeping your tax records, Electronic records

Tuesday, 4 January 2011

Edit a PDF using flpsed

I've been looking for a simple tool to annotate PDF files.   Since going paperless, I've often wanted to annotate scanned images with additional information.  Well, I finally found a tool that is light weight and simple to use.  It is flpsed.  Some advice on its use:
  1. When using "Save As", ensure this is saved with file extension ".ps" so not to get confused.  
  2. "Export" the finished annotated document as a PDF.
To Do: How to use an external tags file?  I assume this is a PostScript file containing key/value pairs.