Search:  
Gentoo Wiki

HOWTO_Car_Computer


Please format this article according to the guidelines and Wikification suggestions, then remove this notice {{Wikify}} from the article



Please improve it in any way that you see fit, and remove this notice {{Cleanup}} from the article. For tips on cleaning and formatting see Cleanup process


Contents

Introduction

This HOWTO styled article describes the process of building a car computer based around Gentoo GNU/Linux. Originally written by Jason of timekiller.org. He deserves credit for inspiration and a huge amount of work. Visit the original page here.

Hardware Table

Here is a list of hardware either known to work, or known to not work:

Touchscreens
Lilliput touchscreenWorksevtouch (>=0.8.1) with Xorg 7.1
GPS Devices
TripNav USB GPS Receiver TN-200Worksftdi_sio (in main kernel tree)
Bluetooth Adapters
D-Link DBT-120WorksJust enable Bluetooth in the Kernel
WiFi Adapters
D-Link DWL-AG530 802.11a/g Dualband PCIWorksMadWifi driver, with a hack
Cell Phones
Motorola E815 Cell PhoneWorksUsing bluetooth tethering you can use the cell phone as a modem to get on Verizon's highspeed EVDO network. An average about 756KBPS should be expected

BIOS

Well, I suppose the best place to start is with the BIOS. With v2.0 of my CarPC, I opted to go all out. Meaning I want this carputer to look as "factory" as possible. For me this meant changing the "Via" BIOS splash screen. You know, the very first thing displayed when you turn on the computer. I changed mine to this (click for full size):


Even if you are not as hardcore as me, you may want to update your BIOS anyway. The BIOS revision I started with did not support the native resolution of my Lilliput touchscreen (800x480). Updating to the latest revision (1.16 as of this doc) fixed this issue. You can get the latest BIOS revision here. Because I never trust sites to stay up, you can get the BIOS revision I used (unmodified) here. Or, if you happen to own a Mazda, you can get my custom bootsplash version here.

To update your bios, grab yourself a nice new BIN file. If you are not going to add a custom splash, all you have to do is make a boot disk and copy awfl823b.exe and the .bin file to the boot disk. Now boot off the disk and run the awfl823b.exe, giving it the name of the BIN file when it asks.

If, however you want to go all out, read on...

Customizing your BIOS

If you want to customize your BIOS splash, you need to start by making a new splash image. The image needs to be 640x480 and Indexed to 256 colors. If you are using Photoshop, you do this by first creating the image, then selecting Image->Mode->Indexed Color. In the new window, for Palette, I selected System (Windows). And make sure you select None for Dither. Now save the file in TIFF format. Select LZO for the compression type so the image is small enough to fit in the BIOS bin file.

Now you need to convert the image to something the BIOS understands. Download AWBMTools from here. There are both Linux and Windows versions available. Extract the files and read the README. To convert your image you should need to ru something like this:

> ./tiff2awbm logo.tif logo.bmp


After you have created the bmp file, you can merge it into your bios file. You will need a program called CBROM. I was only able to find the windows (DOS) version of this program, so that's what I used:

C:\> CBROM215 I0100116.bin /logo logo.bmp


If you get an error, chances are the image you created was too big (too detailed). Try again with a less detailed image. If you are desparate to get a larger image in, you can free up some space in the BIOS by deleting some uneeded stuff (read the README that came with AWBMTools for details).

If there were no errors reported, you can verify your new BIOS is ok by running:

C:\> CBROM215 I0100116.bin /d


Look for the filename of your logo in the output. If it's there, you are ready to try out your new BIOS! Just install as described above.

Install Gentoo

Install Gentoo as you normally would (See here for a nice, digested guide by MrEcho), except that it's perhaps nice to tell Gentoo to disable mandatory scanning of your partitions every X mounts, to do this, we use tune2fs:

tune2fs -c 0 /dev/hda#
Note: Replace # with each partition number.

Your /etc/make.conf file may look similar to the following:

File: /etc/make.conf
 CFLAGS="-O2 -mtune=i686 -pipe"
 CHOST="i386-pc-linux-gnu"
 CXXFLAGS="${CFLAGS}"
 VIDEO_CARDS="via"
 
 USE="aac acpi bluetooth bzip2 dhcp divx dvdread fame festival ffmpeg fftw flac
     gphoto2 gps innodb insecure-drivers libcaca lzo madwifi mpeg2 mplayer
     mysql network pcap real realmedia stream transcode v4l v4l2 wifi
     win32codecs wma xine xosd xvid xvmc -apm -arts -cli -cups -gnome -ipv6
     -isdnlog -kde -oss"
 

Kernel patch-set selection & configuration

Of course, we use the sys-kernel/gentoo-sources kernel because it's nice enough for us for now. Optionally one would use a kernel which includes the suspend2 patches, such as sys-kernel/suspend2-sources. This allows much quicker bootup times, especially if you suspend to a USB 2.0 enabled flash memory storage device.

FIXME: Add instructions on enabling suspend2 support to a suspend2 patched kernel.

Who isn't fond of a pretty splashy boot screen? Exactly:

Linux Kernel Configuration: Fbsplash Options

Device Drivers --->

Graphics support: --->
  [*] Support for frame buffer devices
  <*>   VESA VGA graphics support
          VESA driver type (vesafb)  --->
Device Drivers > Graphics support > Console display driver support:
 [*] Video mode selection support
 <*> Framebuffer Console support
Device Drivers > Graphics support:
 [*] Support for the framebuffer splash

Most touchscreens which work on Linux are supported by the EvTouch driver:

Linux Kernel Configuration: Evtouch Options
Device Drivers --->
 Input device support  --->
  <M> Event interface --->
 USB support --->
  <M> USB Touchscreen Driver

Many GPS devices use the Prolific 2303 USB to RS232 chip:

Linux Kernel Configuration: GPS Reciever BU-353
Device Drivers --->
 USB support --->
  USB Serial Converter support --->
   <M> USB Prolific 2303 Single Port Serial Driver

For Bluetooth support:

Linux Kernel Configuration: Bluetooth
Networking --->
 <M> Bluetooth subsystem support --->
  <M> L2CAP protocol support
  <M> RFCOMM protocol support
   [*]   RFCOMM TTY support
 Bluetooth device drivers --->
  <M> HCI USB driver

Init system tweaks

Some init system performance tweaks may help your carpc to boot up faster from cold-boot

File: /etc/conf.d/rc:
 
RC_PARALLEL_STARTUP="yes"
RC_PLUG_SERVICES=""
RC_NET_STRICT_CHECKING="none"
RC_FORCE_AUTO="yes"
RC_DEVICE_TARBALL="yes"
svcmount="yes"
  

Packages

Of course, each carpc is unique (and that's what makes it special), however this package list serves as a base.

FIXME: All packages required for the base car computer installation should be included here, minus the kernel and obscure hardware drivers.
File: File Title
vim
ufed
acpid
screen
slocate
syslog-ng
vixie-cron
udev
grub
dhcpcd
splashutils
splash-themes-gentoo
splash-themes-livecd
bind-tools
alsa-utils
xosd
x11-terms/aterm
gpsd

Xorg

Later versions of Xorg use a modular model, and so it is possible to compile just the needed components, for example, you may compile just only the video driver for the card present in your system.

1. First you want to install Xorg

First off, the current stable gentoo via driver did not compile for me. Unmasking the unstable did the trick:

echo "x11-drivers/xf86-video-via ~x86" >> /etc/portage/package.keywords

Now emerge Xorg and your favorite window manager. I went with Fluxbox for it's versatility, and small footprint:

emerge -vD xorg-server fluxbox

Now go do your taxes, paint the house, or call your mother and ask her how her day was. Compiling all the dependencies on the Nehemiah is going to take a while (hours).

2. Install OpenChrome

(See http://wiki.openchrome.org/tikiwiki/tiki-index.php?page=Compiling+the+source+code+on+Gentoo for more up to date information.) Similar to installing DRM, but this time you will need subversion:

emerge -va subversion

'Now get the sources:'

mkdir openchrome
cd openchrome
svn co http://svn.openchrome.org/svn/trunk

'Compile and Install:'

     > cd trunk
     > ./autogen.sh --prefix=/usr
     > make
     > make install

3. Get ready for reboot

Lastly you want to make sure your modules get loaded, and X if configured:

echo "via-agp" >> /etc/modules.autoload.d/kernel-2.6

Now grab my xorg.conf, take a look at it and make any changes you deem necessary. Once your xorg.conf is setup to your liking, go ahead and reboot and test it out.

Touchscreen Driver (Lilliput 7" VGA)

Below I document the install and configuration of 2 different Linux drivers for the Lilliput 7" touchscreen (also works for a number of other touchscreens). I documented both because I tried both. My personal preference is the evtouch driver. If you don't know which to use, try the evtouch first. It is the opensource driver, and I personally have had better luck with it.

eGalax Driver

When i started updating all the software on my CarPC, by far the biggest headache I had was with the touchscreen. I updated to a modular Xorg (7.1), and I could not get the evtouch driver to compile. As a result I was forced to find an alternative. It turns out The company that makes the touchscreen also made a linux driver, although not for Gentoo. This means I had to "shoehorn" it in. The following steps are an adaptation of the notes I found for Debian: 1. First grab the installer: We will be using the Fedora Core 6 drivers.

 wget http://www.egalax.com.tw/web20/drivers/Fedora/Fedora6.tar.gz

2. Next you will need sharutils, xmkmf and tcl:

 emerge -va sharutils imake tcl

3. Now install the touchscreen driver Extract the tarball you downloaded

tar zxvf Fedora6.tar.gz

Run the extracted file

./touchkit.setup.sh

This will fail, but it creates the needed install files:

cd /tmp/touchkit

The setup script is looking for the `rpm` command, which we are obviosly lacking. We want to skip this part of the install:

vi setup

Delete lines 11 ("package=(make tcl tk)") through 39 ("done"). Another thing the installer is going to try is to update /etc/rc.d/rc.local, so we have to give the install what it wants:

mkdir /etc/rc.d
ln -s /etc/conf.d/local.start /etc/rc.d/rc.local

Now you are ready to run the setup again (this time step 1 will be skipped

./setup

When prompted, select option #2: (2) Full Mode (RS232, PS/2 and [USB]) The installer should finish successfully now.

Notes on the eGalax Driver:

Here are some thing I did to clean up these problems:

1. First move /lib/modules/tkusb.ko to /lib/modules/`uname -r`/kernel/drivers/usb/input/tkusb.ko (this is a little more conventional 2. Next comment out the entries the installer made to /etc/rc.d/rc.local (/etc/conf.d/local.start):

# rmmod touchkitusb #insmod /lib/modules/tkusb.ko # /usr/bin/usbpnpd

3. Now, we want to start /usr/bin/usbpnpd as early as possible so it has time to create the devices before X starts. I did this by editing /etc/init.d/modules: Go to line 117. Just before the end of the start() function you will see a line like this:

[[ -n $(modprobe -l -t boot) ]] && modprobe -a -t boot \* &>/dev/null

Add this line BEFORE that one:

/usr/bin/usbpnpd

Test it out:

Now reboot and give it a try. If all went well, X should launch and respond to touchscreen input (although it may not be what you expect). There are 2 calibration utilities that also got built with the touchscreen driver. I recommend you copy these somewhere useful, and run the calibration: > emerge -vD xhost > su - > cp /tmp/touchkit/diag/25pcal /tmp/touchkit/diag/4pcal /usr/local/bin/ > /usr/local/bin/4pcal /dev/tkpanel0

  1. hold your finger on each pulsating dot until the pc speaker beeps, and the next point starts pulsating.

Final notes on the touchscreen:

As I said, the accuracy of this driver is not very good (at least for me). When I relied on this driver, I also kept a wireless gyration mouse in my car as a backup for when the touchscreen got really annoying. I am very happy that the evtouch driver was updated, and I am able to use that now.

evtouch Driver

After not being satisfied with the eGalax driver, I did a LOT of searching to get the evtouch driver working. A forum post suggested I use the precomoiled binary. When I went to download it, I found, much to my surprise, that the developer had updated his driver to version 0.8.1. The new version has a proper configure script (which previous versions lack). And more importantly compiles against my modular Xorg! 1. First grab the sources: We will be using version 0.8.1

wget http://www.stz-softwaretechnik.de/~ke/touchscreen/xf86-input-evtouch-0.8.1.tar.bz2

2. Now make sure your kernel is configured properly : The evtouch driver is only the Xorg driver, in order to make the touchscreen work, you will also need the kernel driver. Make sure have these options set in your kernel.Now verify you can load the kernel modules

modprobe evdev
modprobe usbtouchscreen

3. Install the evtouch Xorg driver: Now compile and install the Xorg driver.

tar jxvf xf86-input-evtouch-0.8.1.tar.bz2
cd xf86-input-evtouch-0.8.1
./configure
make
make install

Use this link if you're having trouble compiling for xorg-server 1.4: http://git.debian.org/?p=pkg-xorg/driver/xserver-xorg-input-evtouch.git;a=blob;f=debian/patches/05_build_with_1_4.patch;h=3a60d4f43cd84f1f66b8e0937b7b213af61535de;hb=ab5e06325473febb7af64c601236299af13e61f8

Click the 05_build_with_1_4.patch link to grab the patch, and apply it with: patch -p0 < debian-patches-05_build_with_1_4.patch

Also, feel free to use the newer evtouch-0.8.7 if you use this patch.

4. Next you need to know the right event Interface: The kernel driver works by creating a raw event interface that will pass coordinates to the Xorg driver. Unfortunatley, this means Xorg does not dynamically find the right USB device. If you change the usb port the touchscreen is plugged into, you will have to repeat this step

cat /proc/bus/input/devices

Look for N: Name="eGalax Inc." Two lines under that you should see something like: H: Handlers=mouse1 event5 Note the event number Now you may need to create the event devices

mknod /dev/input/event0 c 13 64
mknod /dev/input/event1 c 13 65
mknod /dev/input/event2 c 13 66
mknod /dev/input/event3 c 13 67

And so one, max is event31 but 5 should be plenty 5. Calibrate and Configure: Now (re)start Xorg. Using a mouse, not the touchscreen, open a terminal and do the following (make sure you have an Internet connection):

wget http://www.timekiller.org/carpc/files/calibrator.c
gcc -L/usr/X11R6/lib/ -lX11 -o calibrator calibrator.c

Now tht the calibrator is compiled, run it

./calibrator /dev/input/event5
Replace with the proper event number.

Touch the points in order. (If your getting numbers that have no range, try touching the points as if the points and touchscreen were rotated. Then, enable the Rotate option in xorg.conf. ) When you are done, you will be given 4 values for Min/Max X/Y coordinates. Use these to create the new input device in your xorg.conf:

Section "InputDevice"
     Identifier "touchscreen0"
     Driver "evtouch"
     Option "Device" "/dev/input/event3"
     Option "DeviceName" "touchscreen"
     Option "MinX" "62"
     Option "MinY" "1910"
     Option "MaxX" "1966"
     Option "MaxY" "45"
     Option "ReportingMode" "Raw"
     Option "SendCoreEvents"
EndSection

Replace with your event number, and the values from your calibration. You may also have to play with additional options like "SwapX" "SwapY" and "Rotate". See this for more details. 6. The Phantom "Double Click" Many people using the evtouch driver have complained of a double click that occurs when tapping the screen. I experienced this too, which was frustrating when trying to type an address into iGuidance. After a lot of searching, and some experimenting, I fixed the issue on my screen. Here's how : The double click appears to be caused not by the touchscreen device, but the regular mouse input. I, like many people, use "/dev/input/mice" as my normal mouse device. It seems this caused a second click when using the touchscreen. One from the raw event, and one from the mouse device By changing my mouse input to the actual standard mouse device, not the generic "all mice" device, I elimated the double click:

Section "InputDevice"
    Identifier  "Mouse0"
    Driver      "mouse"
    Option      "Protocol" "IMPS/2"
    Option      "Device" "/dev/input/mouse0"
    Option      "ZAxisMapping" "4 5"
    Option      "Emulate3Buttons" "yes"
EndSection

Final Notes:

Calibration is not very stream lined. There is plenty of info out there, so do some googling if you run into problems. This driver is still pretty young, so I expect things will get better eventually.

MythTV

Now this where we get to the heart of the CarPC. Truly the most important part of a car computer is it's interface. It has to be intuitive, functional, and easy to use. Of the options available in linux (admittedly, not very many), MythTV seemed to have the most versatility, and able to accomplish everything I wanted it to. The downside, is that MythTV is designed to be a homebrew PVR. This means there is a LOT of stuff in there that we will not need (record TV for example). This makes MythtTV a rather bloated option for a carpc. On the upside, MythTV has been around for a while, has some really great features and is visually very appealing. If you are going to build a linux based CarPC, I would suggest you look at all the options, and chose something that fits your needs. For me, aside from functionality, a "from the factory" look was most important. Read on to see how I accomplished this. 1. First we need to unmask the .20 version of MythTV:

> su -
> vi /etc/portage/package.keywords

Enter the following lines:

media-tv/mythtv ~x86
x11-themes/mythtv-themes ~x86
media-plugins/mythvideo ~x86
media-plugins/mythweather ~x86
media-plugins/mythmusic ~x86
media-plugins/mythgame ~x86
media-plugins/mythnews ~x86

Save and exit. 2. Now install MythTV, and a few of it's plugins:

> su -
> emerge -vD mythtv mythtv-themes mythmusic mythvideo mythweather mythnews mythgame

IMPORTANT: Although I am installing things like mythgame and mythnews, I do not advocate, nor do I practice playing games or reading news articles while driving. These packages are intalled fr testing, and passing time while the car is in a PARKED state.

Now go do something for a while. Installation here will include mysql, qt, and a bunch of other things. This will take a few more hours :)

3. Setup the database:

> su -
> /usr/bin/mysql_install_db
> /etc/init.d/mysql start
> mysql -uroot < /usr/share/mythtv/database/mc.sql

4. Next run mythtv-setup, this enter some more default DB entries: (run the following from a terminal in X)

> su -
> /usr/bin/mythtv-setup

(just exit after the window launches)

5. Time to launch the frontend!: Run the frontend and an unprivileged user - NOT ROOT!

> /usr/bin/mythfrontend

That's it ! You now have a GUI. There is still plenty of work so do, but if you have made it this far, you are well on your way. There are approximately 1037 different things you can customize within Mythtv, including where you keep your music and videos. Most of which is beyond the scope of this doc. Explore the menus, join the mailing list, jump in the IRC channel if you have myth related questions (in other words, don't ask me!).

Customizing It

Ok, so you have a GUI, what now ? Well, first lets get rid of the menu items we don't want, and add some things we do. Everything in the Myth menus is controlled by xml files. The files we want to edit are located at /usr/share/mythtv. For a good starting point, you can download my CarPC theme. If you are familiar with MythTV, you will notice it is basically a variation of the "Blue" theme. I chose it because the buttons work well with a touch interface. Unpack the tarball to /usr/share/mythtv/themes/:

> su -
> wget http://www.timekiller.org/carpc/files/CarPC_Myth_theme.tar.gz
> cd /usr/share/mythtv/themes/
> tar zxvf ~/CarPC_Myth_theme.tar.gz

I have made a few changes to the menu items MythTV displays. Menu items are not controlled from the theme, so you will have to overwrite some xml files. I made 2 scripts which will make it easy to switch between my menu and the default Myth theme :

> su -
> cd /usr/share/mythtv/themes/CarPC
> ./createcarpcui.sh

And to return the original Myth Menu:

> su -
> cd /usr/share/mythtv/themes/CarPC
> ./returnmythui.sh

Now restart the mythfrontend, and navigate to Utilities/Setup->Setup->Appearance. Select the CarPC theme. Also, select "OpenGL" for the Paint Engine (makes the menus fade in and out, and looks GREAT. trust me). This will more or less give you the same interface I am currently using. I am sure there are changes you will want to make. The Mazda logo for example (unless you have a Mazda). I suggest you explore the theme, and the xml files to make the changes that suit you. For example, I have added a number of menu items that run scripts or external apps that I need, and you may not (the script to conect ot Verizon's EVDO network, which is discussed later, is a good example).

Mplayer

In order for Mplayer to take advantage of the MPEG-2 hardware acceleration the Via provides, you will have to patch and recompile it.

Patch and Install Mplayer: > cd /usr/local/src > tar jxvf /usr/portage/distfiles/MPlayer-1.0pre8.tar.bz2 > wget -o mplayer_xvmc.diff "http://wiki.openchrome.org/tikiwiki/tiki-download_file.php?fileId=17"

  1. NOTE: You may have a different version of mplayer. Go to here for the latest patches.

> cd MPlayer-1.0pre8 > patch -p1 < ../mplayer_xvmc.diff > ./configure --prefix=/usr/local --enable-xv --enable-xvmc --with-xvmclib=XvMCW

  1. I used /usr/local for my prefix so I would not squash the other install of Mplayer.

> make > su -c "make install"

Be sure to go into your settings for MythVideo and set the default player to /usr/local/bin/mplayer

On Screen Information

When doing some funtions with a car computer, it is useful to have the system give you informational feedback. For example, when I connect to the Internet, I want to know if it connected successfully, etc. For this I use 2 applications: xosd, and gxmessage.

Install XOSD

Xosd is a perfect solution, but it is just a library, you will need an app to actually use the Xosd interface. > su - > emerge -v xosd


As I said, this only installs the libraries. Now you need an application.


Install onscreend

I stumbled upon this little app a long time ago. I use it on my main desktop for volume functions. It is very simple, there is a daemon, and a fifo writer. You launch the daemon with your window manager, and anything you echo to the fifo gets displayed on your screen. Unfortunately, there is no portage ebuild, so we have to install it by hand: > mkdir onscreend > cd onscreend > wget http://caladan.nanosoft.ca/download/onscreend.tar.gz > tar zxvf onscreend.tar.gz

  1. The developer hardcoded a font that is not on most systems, so we will have to make a source code change:

> vi onscreend.c

  1. go to line 19 and change:
                   char *font = "-urw-serpentine d-bold-r-normal-*-*-720-*-*-p-*-iso8859-1";
                   char *colour = "rgb:0/0/f";
                   int outline_offset=2;
                   char* outline_colour="rgb:0/0/7";
                   char* shadow_colour="rgb:0/0/3";
                   int delay = 5;
                   xosd_pos pos = XOSD_bottom;
                   int voffset = 150;
                   int hoffset = 0;
                   int shadow = 7;
                   

to:

                   char *font = "-*-times-bold-*-normal-*-25-180-100-100-*-128-iso8859-15";
                   char *colour = "rgb:f/f/f";
                   int outline_offset=0;
                   char* outline_colour="rgb:0/0/0";
                   char* shadow_colour="rgb:0/0/0";
                   int delay = 2;
                   xosd_pos pos = XOSD_bottom;
                   int voffset = 75;
                   int hoffset = 0;
                   int shadow = 2;
                   int scroll_age = 0;
                   struct timeval old_age,new_age;
                   int screen_line = 0;
                   xosd_align align=XOSD_center;
                   fd_set selset;
                   
  1. There are many configurable option including font,size,color, position, and drop shadow. Tweak these settings until they are what you want.
  1. Now compile and install:

> make > su > cp onscreend putfifo /usr/local/bin

  1. Finally add onscreend to your window manager startup script (for fluxbox, add it to ~/.fluxbox/startup).
  2. Restart Xorg, and test it by echoing some text to the fifo:

> echo "Some test text" | /usr/local/bin/putfifo /tmp/onscreen

  1. Did it work ? If so, you are ready to script some on screen display!

Install gxmessage

While XOSD is a very useful tool for displaying information, gxmessage allows to you interact with the information by providing the ability to add buttons when the information is displayed. For example, if a connection to the internet failed, I can have gxmessage display a button to retry the connection. > su - > emerge -v gxmessage

GPS Navigation

Since posting my CarPC page, I have received MANY emails telling me to try out XYZ on linux for my navigation. So, let me first go down the list, so people can stop emailing me:

GPS Software That Doesn't Work

So What DOES Work ?

Ok, so you must be wondering what I AM using for GPS, right ? Well, thanks to this thread on mp3car.com, I decided to try out iGuidance v3 under windows emulation. I have been using CrossOver Office pretty much since the company released its first version. I am a HUGE fan of their product, and what they are doing for the Linux community. Once I saw some positive feedback from someone who tried it on iGuidance, I decided to download the latest beta version and give it a shot. I should note that the latest stable release (5.x) has problems. Read the thread I mentioned above for detils. I am THRILLED that I decided to try this! I can honestly say I have a very good GPS system in my CarPC now. This is HUGE. So how did I make it work ? Here's how:

1. First make sure your kernel can see the USB GPS device (in my case, BU-353). Look above for the proper kernel configuration. 2. Install CrossOver Office. I am currently running version 6 beta (will upgrade when 6 stable is released). Update: Crossover Office 6 is out now, and I have upgraded. 3. Create a new bottle (I used the windows 2000 template) and install iGuidance into it 4. When the installer finishes, it will auto launch the Map Loader. Use it to copy the maps you need to the harddrive (I copied all of them). 5. Next I disabled the Warning screen when iGuidance launches:

> vi ~/.cxoffice/[bottlename]/desktopdata/cxmenu/Desktop.c^5E3A^5Fwindows^5Fprofiles^5FAll^2BUsers^ 5FDesktop/iGuidance+UMPC
# (Your path might be slightly different)
# Change the 'exec' line to include "nowarning":
exec "/opt/cxoffic/bin/wine" --bottle "iGuidance" --check --wait-children --start "c:/windows/profiles/All Users/Desktop/iGuidance UMPC.lnk" "nowarning" "$@"

6. Add the user that will run iGuidance to the 'tty' group. This ensures the user can read from the GPS device 7. Make the serial port (GPS device) available to cxoffice:

> ln -s /dev/ttyUSB0 ~/.cxoffice/[bottlename]/dosdevices/com2

This creates 'COM2' in your windows environment. When you launch iGuidance, make sure to set the GPS device to COM2. 8. Last thing is to make sure you are loading 'extmod' in your xorg.conf. Uner the "Modules" section, make sure you have 'Load "extmod"'

Making it Better

Now this is where we get really crazy. What good is GPS Navigation if you can't listen to tunes while you drive ? When I originally set this up, I had Myth launch iGuidance directly, which effectively "locked" Myth until I closed iGuidance. I have since installed a couple of apps and wrote some scripts to fix this. This is how:

1. First install wmctrl. wmctrl is a handy little command line app to control elements in your desktop environment. You can you it to focus, unfocus apps, minimize them, switch virtual desktop, etc.

su -
emerge -v wmctrl

2. Now install bbbutton. This is a very simple dock app that has one purpose: display and image you choose, and execute the command you choose when clicked.

wget http://bbbutton.sourceforge.net/bbbutton_0.8.tar.gz
tar zxvf bbbutton_0.8.tar.gz
cd bbbutton_0.8
make linux
su
cp bbbutton /usr/local/bin/

3. Next, we change the script used to launch iGuidance. Two things are accomplished here. First, we make it possible to detach iGuidance from Myth. Without this, Myth would "hang" until iGuidance is closed. Second, we want to make sure hitting the iGuidance menu item a second time does not launch a second instance. Below is what the new /usr/local/bin/iGuidance will look like.

/usr/local/bin/iGuidance:

#!/bin/bash
STATE=`ps aux | grep iGuidance | wc -l`
                    
if [ $STATE -gt 1 ]; then
  wmctrl -s 1
else
  /usr/local/bin/LaunchiGuidance &
fi
                       

4. Finally, lets look at the LaunchiGuidance script. This is the script that really ties it all together. What I am doing is switching to another virtual desktop, launching the dockapp bbbutton which controls switching back and forth, then finally launching iGuidance. When iGuidance is closed, we are automatically brought back to the Myth menu, and the dockapp is closed as well. Here is the script:

/usr/local/bin/LaunchiGuidance:

#!/bin/bash
/usr/local/bin/wmctrl -s 1
echo "Launching Navigation" | /usr/local/bin/putfifo /tmp/onscreen
/usr/local/bin/bbbutton /usr/share/mythtv/themes/CarPC/switch.xpm /usr/local/bin/deskswitch.sh &
exec "/opt/cxoffic/bin/wine" --bottle "iGuidance" --check --wait-children --start \
                      "c:/windows/profiles/All Users/Desktop/iGuidance UMPC.lnk" "nowarning" "$@"
/usr/local/bin/wmctrl -s 0
pkill -9 bbbutton
                       

Two things to notice in the above script. First, notice I am making use of xosd/onscreend to let me know Navigtion is launching. This app takes a couple of seconds to come up, so I use this to let me know the command was received and understood. Second, the bbbutton dockapp references 2 other files. The first is an image, which I have made part of my CarPC theme. The second file is the switching script which gets executed when you click (touch) the dockapp. The deskswitch.sh script is as follows:

/usr/local/bin/deskswitch.sh:

#!/bin/bash
CURDESK=`/usr/local/bin/wmctrl -d | grep '*' | awk '{print $1}'`
if [ "$CURDESK" == "0" ]; then
 /usr/local/bin/wmctrl -s 1
 else
  /usr/local/bin/wmctrl -s 0
fi

All this script does is determine if you are currently on desktop 0 or 1, and toggle between them.

That's it! It may not be some cool new open sourced Linux app, but hey, at least it's navigational software, and it works. This software works great, and gets me where I need to be, I'll take it!

Here's another horrible video showing how smooth this works:

Additional links

ToDo

There is still a lot I want to cover, but this doc took long enouh as it is. Check back, because some of the coolest stuff is yet to come. Here's the teaser to keep you checking:

   * Optimize Boot Time
   * Custom Bootsplash - I created it, I just have to upload and document it.
   * Bluetooth Internet (Verizon EVDO)
   * Streaming Live TV
Retrieved from "http://www.gentoo-wiki.info/HOWTO_Car_Computer"

Last modified: Wed, 01 Oct 2008 09:06:00 +0000 Hits: 16,968