Archive for the ‘Linux’ Category

Ubuntu Linux on Desktop PC

Tuesday, September 8th, 2009

I refurbished a couple of PCs for my family to use, and installed the latest Ubuntu Linux on them – Ubuntu 9.04 Jaunty.  I also updated my dual boot work computer with the latest Ubuntu – it was running Kubuntu and the latest Kubuntu is just foreign to me.

As is usually the case, adding additional packages is essential to getting the computer working right for me.

Add Codecs, Java, and other Customizations

The official way to do this is documented in the Ubuntu Wiki under CommonCustomizations. There is also a wiki page on EasyCodecInstallation. The official meta package is called “ubuntu-restricted-extras” and this installs:

  • MP3 playback and decoding
  • Sun Java runtime environment
  • Flash plugin
  • DVD playback
  • LAME (to create MP3 compressed audio files)
  • msttcorefonts (may be missing in kubuntu extras)
  • DeCSS script to download and install for DVD viewing

$ sudo apt-get install ubuntu-restricted-extras
$ sudo /usr/share/doc/libdvdread4/install-css.sh
$ sudo apt-get install msttcorefonts

Add the ability to compile, edit, and maintain code

Here are the compilers and their documents
$ sudo apt-get install build-essential subversion-tools gcc-4.2-doc glibc-doc manpages-dev
$ sudo apt-get install mingw32 mingw32-binutils mingw32-runtime
I need access to subversion and XSLT ChangeLog tools
$ sudo apt-get install subversion-tools
$ sudo apt-get install xsltproc
I install a couple of editors, useful for various things. Kate is already installed.
$ sudo apt-get install scite
$ sudo apt-get install vim-full
Useful tools for cleaning up code, converting comments and line endings, and code statistics:
$ sudo apt-get install splint
$ sudo apt-get install sloccount
$ sudo apt-get install indent
$ sudo apt-get install liwc
$ sudo apt-get install tofrodos

Add favorite online music source and music/video player VLC

$ sudo apt-get install streamtuner
$ sudo apt-get install vlc

Add the Adobe Flash Plugin and Sun Java JRE

A lot of websites use Flash or Java for their user interface, so it seems that they are essential.

$ sudo apt-get install adobe-flashplugin
$ sudo apt-get install sun-java6-jre

Get rid of annoying PC speaker beep

Using a console, remove the PC Speaker driver from the kernel:
$ sudo modprobe -r pcspkr
Create /etc/modprobe.d/blacklist-user.conf and add a line to keep the PC Speaker driver from automatically loading:

# Keep the annoying beep from occurring
# don't load the PC Speaker driver

blacklist pcspkr

SynapticsTouchpad

The laptop has a touchpad, which is really annoying when you also have a USB mouse attached, because the touchpad picks up thumps made by my big fingers and makes the mouse click somewhere that you didn’t want it to click.  Correcting this in Ubunut Jaunty is as easy as selecting System > Preferences > Mouse, under the Touchpad tab. Uncheck the Enable mouse clicks with touchpad check box.

AVR ISP mkII on Ubuntu Hardy

Tuesday, May 12th, 2009

BACnet Development Kit

I created a BACnet Development Kit, compiled the open source BACnet Protocol Stack hosted on SourceForge.net firmware using gcc-avr, and attempted to load the firmware onto the kit using an Atmel AVR ISP mkII USB programmer.  I connected the AVR ISP mkII to my Ubuntu Hardy Linux PC and attached the 2×3 ISP cable to the development kit board, and attempted to program using avrdude:

$ avrdude -c avrispmkII -p m644p -P usb -e -U flash:w:bacnet.hex
avrdude: usb_open(): cannot read serial number "error sending..."
avrdude: usb_open(): cannot read product name "error sending..."
avrdude: usbdev_open(): error setting configuration...
avrdude: usbdev_open(): did not find any USB device "usb"

Wow! That wasn’t nice.  A search on the Internet turned up some answers about how to fix the problem, and I modified my /etc/udev/avarice.rules file to look like this:

SUBSYSTEM!="usb_device", ACTION!="add", GOTO="avarice_end"

# Atmel Corp. JTAG ICE mkII
SYSFS{idVendor}=="03eb", SYSFS{idProduct}=="2103", MODE="660", GROUP="dialout"
# Atmel Corp. AVRISP mkII
SYSFS{idVendor}=="03eb", SYSFS{idProduct}=="2104", MODE="660", GROUP="dialout"
# Atmel Corp. Dragon
SYSFS{idVendor}=="03eb", SYSFS{idProduct}=="2107", MODE="660", GROUP="dialout"

LABEL="avarice_end"

I disconnected and reconnected my AVR ISP mkII, and tried again.  I still had the same results.  I checked that I was a member of the dialout group:

$ groups
skarg adm dialout cdrom floppy audio dip video plugdev users fuse lpadmin admin

I looked at the symbolic link in the /etc/udev/rules.d/ directory and also consumed the README file.  My file had the following name:

/etc/udev/rules.d/z60_avarice.rules

So I changed the filename:

$ sudo mv /etc/udev/rules.d/z60_avarice.rules /etc/udev/rules.d/60-avarice.rules

I unplugged the AVR ISP mkII, and plugged it in again.  I tried to run avrdude again:

avrdude -c avrispmkII   \
     -p m644p -P usb -e        \
     -U flash:w:bacnet.hex

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x1e960a
avrdude: erasing chip
avrdude: reading input file "bacnet.hex"
avrdude: input file bacnet.hex auto detected as Intel Hex
avrdude: writing flash (57406 bytes):

Writing | ################################################## | 100% 6.31s

avrdude: 57406 bytes of flash written
avrdude: verifying flash memory against bacnet.hex:
avrdude: load data flash data from input file bacnet.hex:
avrdude: input file bacnet.hex auto detected as Intel Hex
avrdude: input file bacnet.hex contains 57406 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 5.41s

avrdude: verifying ...
avrdude: 57406 bytes of flash verified

avrdude: safemode: Fuses OK

avrdude done.  Thank you.

The kit programmed successfully, and began operation.

Convert to MP3 Konqueror Service Menu

Tuesday, August 5th, 2008

I wanted an easy way to convert music to MP3 from various formats under Konqueror in KDE on Kubuntu Linux.  I found an interesting post about creating a KDE Service Menu which got me started in the right direction.  However, I didn’t like the way ffmpeg converted to 64kbps MP3 quality and the bad sounding results regardless of the bitrate settings that I chose.  I tried lame, and was quite pleased with the results.  I also didn’t like the way the service menu used the entire filename without stripping the dotted extension, so I copied another service menu perl example.  My “Convert to MP3″ service menu script goes into the following location:

/usr/share/apps/konqueror/servicemenus/

File convertmp3.desktop:

[Desktop Entry]
ServiceTypes=audio/*
Actions=convertToMP3

[Desktop Action convertToMP3]
Name=Convert to MP3
Exec=lame -V2 %f "`echo %f | perl -pe 's/\.[^.]+$//'`.mp3"

Enjoy!

Configuring Kubuntu 8.04 Linux for Dell Latitude D820 Notebook

Sunday, April 20th, 2008

I was pleasantly surprised to have all the hardware working and a smooth install of Kubuntu 8.04rc for a year old Dell Latitude D820 notebook PC. There was still a bit of customization to do to make it work like I wanted, but who can fault Canonical for not knowing what I like?

Add Codecs, Java, and other Customizations

The official way to do this is documented in the Ubuntu Wiki under CommonCustomizations. There is also a wiki page on EasyCodecInstallation. The official meta package is called “ubuntu-restricted-extras” and this installs:

  • MP3 playback and decoding
  • Sun Java runtime environment
  • Flash plugin
  • DVD playback
  • LAME (to create MP3 compressed audio files)
  • msttcorefonts (may be missing in kubuntu extras)
  • DeCSS script to download and install for DVD viewing

$ sudo apt-get install kubuntu-restricted-extras
$ sudo /usr/share/doc/libdvdread3/install-css.sh
$ sudo apt-get install msttcorefonts

Add the ability to compile, edit, and maintain code

Here are the compilers and their documents
$ sudo apt-get install build-essential subversion-tools gcc-4.2-doc glibc-doc manpages-dev
$ sudo apt-get install mingw32 mingw32-binutils mingw32-runtime
I need access to subversion and XSLT ChangeLog tools
$ sudo apt-get install subversion-tools
$ sudo apt-get install xsltproc
I install a couple of editors, useful for various things. Kate is already installed.
$ sudo apt-get install scite
$ sudo apt-get install vim-full
Useful tools for cleaning up code, converting comments and line endings, and code statistics:
$ sudo apt-get install splint
$ sudo apt-get install sloccount
$ sudo apt-get install indent
$ sudo apt-get install liwc
$ sudo apt-get install tofrodos

Add favorite online music source and music/video player VLC

$ sudo apt-get install streamtuner
$ sudo apt-get install vlc

Get rid of limited use Dolphin

This is one of the main reasons I use Kubuntu and KDE: Konqueror allows me to do many things that Nautilus and Dolphin prevent or are unable to customize
$ sudo apt-get remove dolphin

Get Rid of IcedTea – Install Sun Java JRE

I had several errors which prevented me from doing useful work on some websites that used Java.  Turns out that the default install of Kubuntu used IcedTea – the OpenJDK.  Well, apparently it doesn’t mimic Java the way the websites expected, and so, it didn’t work.  Into the hopper it goes, and Sun gets the install.
$ sudo apt-get remove openjdk-6-jre
$ sudo apt-get install sun-java6-jre

Get rid of annoying PC speaker beep

Using a console, remove the PC Speaker driver from the kernel:
$ sudo modprobe -r pcspkr
Edit /etc/modprobe.d/blacklist and add a new line to keep the PC Speaker driver from automatically loading:
# Keep the annoying beep from occurring - don't load the PC Speaker driver
blacklist pcspkr

Get rid of annoying Synaptic Tap Button

Edit the X11 configuration file /etc/X11/xorg.conf

Add the Tapbutton line and any other missing lines in the Synaptic Touchpad section:

Section "InputDevice"
Identifier  "Synaptics Touchpad"
Driver      "synaptics"
Option      "SendCoreEvents" "true"
Option      "Device" "/dev/psaux"
Option      "Protocol" "auto-dev"
Option      "HorizScrollDelta" "0"
Option      "SHMConfig" "On"
Option      "TapButton1" "0"
EndSection

You can disable the Tap Button effect immediately using the synclient tool as long as SHMConfig is On:
$ synclient TapButton1=0

Fix a bug in Firefox 3 rendering Check boxes and Radio boxes

Check boxes and Radio boxes show as a blank box or circle until the focus is moved away.  This bug was reported, and the solution is to install a GTK2 engine:
$ sudo apt-get install gtk2-engines-qtcurve

Additionally,  go to System Settings->Appearance->GTK Styles and fonts, and Set: Use another style = QtCurve.

Updating a Toshiba A135 Notebook

I also updated our Toshiba A135 Notebook and the sound and sound controls now work!  I did have to fix an fglrx bug to keep from locking up on logout.

Using GCC for ARM7 or AVR

Monday, September 3rd, 2007

Inspired by Building Bare-Metal ARM Systems with GNU series of articles, I recently ported the BACnet MS/TP datalink layer to an Atmel AT91SAM7S-EK board – an ARM7 processor – using a GCC cross compiler for ARM.

I evaluated GNU Toolchain for ARM, GNU ARM, WinARM, and YAGARTO toolchains on the Windows platform. They all have their merits, but all have some slight differences too. I followed an excellent tutorial by James P. Lynch called Using Open Source Tools for AT91SAM7S Cross Development to get me up and running quickly. Jim used the YAGARTO project as his toolchain.

I used the YAGARTO toolchain and created my own Makefile. Makefiles are an interesting bit of programming that seems to be a lost art. Any of the cross compiler toolchain builds should work with the Makefile with a slight modification to the name of the compiler (one of the differences in each of the various GNU ARM cross compiler projects).

During my travels down the GCC road, I found the GCC-AVR and WinAVR for Atmel AVR series of microcontrollers. I searched for GCC for an 8051. I found the SDCC project – Small Device C Compiler – for Intel 8051, Maxim 80DS390, Zilog Z80 and the Motorola 68HC08. Both projects are also in the Ubuntu Linux repository.  I noticed that the Microchip PIC24 compiler C30 is based on GCC and the source code is available on their website.

Ubuntu Linux on a Toshiba Laptop

Wednesday, May 30th, 2007

toshiba KDE desktopI acquired two Toshiba laptops from a local computer store. They were close out models at significantly reduced prices. Their hardware specifications were faster than my existing desktop (Intel(R) Celeron(R) M CPU 430 @ 1.73GHz, 512MB RAM, Radeon Xpress 200M video, SB450 HDA Audio, Atheros wireless, 80GB harddrive, CD/DVD R/W, 3470 bogomips).

I used a Ubuntu Feisty Linux Live CD to test the functionality of several laptops at the store before I made my decision. I think the two features of the laptop that made it stand out from the others were the Atheros wireless chipset and the ATI Radeon video, both of which have good driver support in Linux. I also looked on the Ubuntu Laptop Testing project for advice before and after I went shopping.

After I got the laptops home, I powered them up and saw Windows Vista Basic Edition. Windows Vista was incredibly slow. Apparently it requires a much faster CPU and significantly more RAM. I shrunk the hard disk space and repartitioned under Windows. I rebooted under Kubuntu Feisty 7.04 and installed Linux on the 41GB SDA3 partition. When Kubuntu started I was delighted to see the correct screen resolution and the wireless Ethernet picked up my internet access point using Wireless LAN Manager. The only hardware that was not functioning was the sound card. There was already a bug filed for the ATI SB450 HD Audio and some work around solutions, but none of the easy workarounds worked for me. A month later I stumbled upon another ATI SB450 HD Audio bug on Launchpad.net, and followed the fix at the end of the thread. Edit the parameters passed to the ALSA driver:

$ sudo vim /etc/modprobe.d/alsa-base

Add the following line at the end of the file:

options snd-hda-intel probe_mask=8 model=3stack

Save the alsa-base file and restart the computer. After I logged into KDE, I opened the Kmix controls, and enabled the front sound and it worked!

I installed the ATI graphics accelerator. I had to make some edits to the xorg.conf file to get it working. I had to edit the kdmrc file to work around a problem when logging out. I then had accelerated graphics! I updated the community Wiki installation guide with the edits required to make it work.

For the second laptop, I decided that sound was important since I didn’t have the fix yet, and installed Kubuntu Edgy 6.10 Linux. The sound worked, but wireless ethernet did not. Since that was important, I downloaded the latest MadWifi source code, compiled it, installed the driver. I also installed the Wireless Internet Assistant – a wonderful tool for jumping on a hotspot.

Edit: The latest version of Ubuntu / Kubuntu seems to fix the issues that I had with this Toshiba laptop.

Create favicon.ico with Ubuntu Linux

Saturday, January 6th, 2007

I was interested in creating a favicon.ico file in Ubuntu Linux for a new website that I helped create. I recalled having used KIconEdit to do it before. I installed KIconEdit and used that to create the icon. However, KIconEdit did not have any options to save as favicon.ico. I turned to the internet for help.

Most of the information gleened by Google search said to save the file as a 16×16 pixel PNG file, and use one of the icon command line tools to convert it to the favicon.ico format. So I looked in apt-get cache to see if any icon tools were available.

$ apt-cache search favicon
icoutils - Create and extract MS Windows icons and cursors

Yeah! That looked promising. So I install icoutils using apt-get.

$ sudo apt-get install icoutils

Wow! That was easy! Now how do I use this tool? Well, man pages usually help.

$ man icoutils
No manual entry for icoutils

Bummer! Well, maybe the package will give me some clues.

$ apt-cache show icoutils
Package: icoutils
Status: install ok installed
Priority: optional
Section: graphics
Installed-Size: 172
Maintainer: Colin Watson
Architecture: i386
Version: 0.25.0-1
Depends: libc6 (>= 2.3.4-1), libpng12-0 (>= 1.2.8rel), zlib1g (>= 1:1.2.1), perl, libwww-perl
Suggests: libterm-readline-gnu-perl | libterm-readline-perl-perl
Description: Create and extract MS Windows icons and cursors
Icoutils is a set of programs that deal with MS Windows icons and cursors. Resources such as icons and cursors can be extracted from MS Windows executable and library files with "wrestool". Conversion of these files to and from PNG images is done with "icotool". "extresso" automates these tasks with the help of special resource scripts.
.
This package can be used to create "favicon.ico" files for web sites.

Aha! I could potentially use icotool to convert the PNG icon to a favicon. icotool had both a man page and a --help option. I used icotool on the command line to convert my PNG file.

$ icotool -o favicon.ico -c favicon.png

maryfeet.jpgI also used The GIMP image tool to convert a JPEG scan of my daughter Mary Elizabeth’s footprints to a PNG. I opened the image, scaled it to 16×16 pixels, and saved it as favicon.png. I used icotool to convert the PNG file to a favicon.ico file. I uploaded the favicon.ico file to her memorial website anencephaly.net.

USB Drive Read-Only

Monday, December 18th, 2006

trio_mp3_player.jpgI was in a hurry on Sunday as our family was about to leave on a road trip to visit some relatives. Joshua had a problem copying some music from his Kubuntu Linux PC to an MP3 player that I have because the MP3 player was full. I had purchased the 512MB Trio MP3 player from eCost, one of my favorite discount online stores. I have used the MP3 player on many airline trips.
Joshua tried to delete the existing files on the MP3 player but his KDE Konqueror file manager window said that the files could not be deleted since the files were read-only. I had put the files on there with my Ubuntu Linux PC. Why couldn’t he use the USB drive?

I took over at his keyboard and attempted to remount the Trio USB thumb drive MP3 player as read-write:

$ mount -o remount,rw -t vfat /dev/sdb1 /media/sdb

mount refused replying that it could not mount the read-only file system as read-write. Maybe the drive was corrupted or something. I searched the internet for some information on fixing the filesystem of a USB flash drive. Then I tried to repartition and reformat:

$ fdisk /dev/sdb

I entered the fdisk utility as read-only and knew then that fdisk was not going to work. By this time I was really frustrated and it was time to leave. Why wouldn’t Linux allow me to delete the existing files or partition or format? We left the house without the music and began the trip. I was deep in thought about this perplexing issue.

trio_mp3_hold.jpgThen an idea came to me about half way to our destination. The Trio MP3 player has a HOLD button that I use to keep the keys from being pressed while it is in my pocket. I began to suspect that the hold button was preventing the USB flash drive files from being deleted. When we returned home, I moved the HOLD button, and inserted the Trio MP3 thumb drive into my Linux PC. I selected a music file and deleted it. Success! The drive had automatically mounted as read-write, and I could add and remove files at will. PEBKAC!

Website backup using Linux Command Line

Friday, December 15th, 2006

easy buttonI needed to backup a website that I run onto a Linux server in my garage, and wondered what the easy button tool for Linux on the command line would be. Just try searching Google for “Website backup using Linux Command Line” and you don’t get what I was looking for. What I should have searched for was “Website Mirroring With wget” but I didn’t know what tool I was looking for, remember? As you may have guessed, I finally found a page full of ads and some outdated command line options for Windows describing how to website mirror with wget.

wget is a great tool for website backup, offline browsing, or mirroring as it is known in the server realm. A simple one line command gets you all the files and images that are accessable from the website index and puts them in a directory it creates named after the domain name:

$ wget -mp http://anencephaly.net/

Yeah! Job accomplished. That was easy, and I didn’t even have to ask the reindeer.

Linux in-flight entertainment

Thursday, October 19th, 2006

Linux entertainment LCD touch screen in every headrest of a Song airline 757.I traveled to Phoenix this week to give a BACnet and Lighting Applications presentation to the NEMA JSC on DALI. I flew there aboard a Song Airlines 757. During the powerup sequence for the plane, all the passengers were greeted with the image of Tux and the Linux boot sequence as the in-flight entertainment system in each headrest initialized. The touch panel color LCD screens provided games, movies, music, flight information, and satellite television. During the 3 hour flight, I watched Fox News, Mythbusters on Discovery, TLC, and Sunday night football. I also listened to some Ramones and The Smiths. I played trivia with other passengers – I came in 3rd place out of 3 players. I normally dread longer flights, but having satellite TV and Linux serving up entertainment really made the trip go by quickly.