April 03, 2012

Instruments

http://www.earslap.com/projectslab/otomata

March 30, 2012

Creating a live distribution from your installation

There where my 3 references, they are there because I needed to create a new kernel for the Asus machine, It uses the inttel GMA500 chipset and therefore it must have build in KMS to get the correct framebuffer set.

I still build my kernels using the oldschool method!

Custom distro from your installation. Remember to remove all th eimages and crap you don't want to distribute.

Once you have your live distribution, you can use this strategy to update it.

March 02, 2012

Using Adobe Air on new linux distributions?

Whoa, if you really wanna feel the suck, this is where you need to go. There's no longer support for Air on Linux (or android) from adobe :(

So, if you're stuck with a bunca flashaholics, blinded by the virtual machine. A boss that insists this is the technology (Since it's blameable), be sure to wget the contents before the documentation disappear as well.

On Debian based systems: sudo aptitude install adobeair does the installation trick! At least for now. If not, here's an adobeair 2.6 package for your needs.


Rreferences:
help.adobe
air.administrators.guide

February 29, 2012

asciidoc

Today, I finally realized it's so much better to write documentation using asciidoc

asciidoc cheat sheet
Adding filters

We're using the program to traverse a build and collect readme files that then serves as different sections of a document. This has the documentation as close to source code as possible. That is a clear advantage. Also we can run scripts from inside the documents that ensure the latest version of the documentation is used.

Asciidoc ROCKs!!!! In a way Metallica can't even imagine!!!

February 17, 2012

Linux mint 12 configuration

There's a bloat of new stuff in Mint 12, mostly related to gnome 3 update ;) This helped me getting through the update.

Tips and tricks


Loads of stuff:


Only thing I didn't respolve yet is my iPhone :(

November 23, 2011

placing your local source under svn

http://maverick.inria.fr/~Xavier.Decoret/resources/svn/index.html

October 16, 2011

ftpfs to your website!?!

I always hated updating my website ;( Don't like the Hosting's website tool as it only works on the platform I don't use. And ftp'ing is just not 2100 century. Then I stumbeled on curlftpfs, it's old but good news.


#sudo apt-get install curlftpfs
#sudo nano /etc/fuse.conf

uncomment user_allow_other

#mkdir mountpoint
#curlftpfs -o allow_other ftp://user:pass@ftp.somewhere.org mountpoint/

Now you can do normal file commands in the mountpoint, Like editing in emacs and storing the files directly.

July 06, 2011

find command revisited

Finding empty directories and deleting them:
# find /path -depth -type d -empty -exec rm -r {} \;

Finding all gcc coverage files and removing them
find . -name '*gcno' -o -name '*.gcda' -exec rm -f {} \;

Great find command page.

Configuring Ubuntu 11.04 to run with the highest VGA resolution on i915

After the i915 configuration my screens did not use the 1920x1080 resolution that my monitor is capable of. Neither did it select VGA1 as input :(

# xrandr
reports LVDS1 at 1280x1024 as default display, editing my xorg.conf didn't seem ti fix the issue? Guess I edited it wrong!

There's two tweaks that need to be created, firstly I disabled LVDS1 and forced VGA1 as the default video device at boot Append:
video=LVDS-1:d video=VGA-1:e
to your kernel boot parameters in /etc/default/grub


Mine looks like this now:
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash video=LVDS-1:d video=VGA-1:e acpi=force elevator=noop i8042.noloop=1 usbhid.quirks=0xeef:0x1:0x40"

Next, force gdm to use the resolution at login, by adding:

xrandr --output VGA1 --mode1920x1080 --rate 60

to  /etc/gdm/Init/Default

The xrandr command does ofcource depend on your monitor and graphics device. You cn alwasy type xrandr to see it's capabilities. See man xrandr for details.

July 04, 2011

Configuring Ubuntu 11.04 with kernel 2.6.38 for intel 945 & egalax Touch screen

Got a small customized PC at work that needs to have both the eGalax touch screen and the intel i915 (i945GM) driver enabled. From out of the box the screen is booting with the vesa driver, quirkint it to use the intle driver just gave a plain blank screen. The eGalax touchpad didn't send any signals so that was a pretty sucky start.

There's a lot of discussion about what's wrong etc, how to configure both the kernel and the system. I googled the web for answers and there was a lot of noise, in all this noice i found the following posts quite helpfull. They're good backgound information if your're interested.

Bug report - Kernel Mode Setting - debian - Kernel Mode Setting - ubuntu - Xorg-edgers - Intel drivers - i915 Kernel configuration database

This is how I configured the box to work with both.

Fetching the Xorg-Edgers PPA:
You need to get the Xorg-edgers added to your ubuntu package list, the link has instrunctions on how to set up this ppa.

Then you'll have to update your system

#sudo apt-get update
#sudo apt-get upgrade

Should do the trick, you can add the xserver-xorg packages needed by hand if there'ssomething missing.

Configuring the kernel:

The eGalax touch screen is build into the kernel this is se by selecting: CONFIG_HID_EGALAX=y

The i915 driver is a bit more tricky, as there are some things that, apparently, depend on acpi. There are some things like kms, which for never kernels (2.6.36 i believe??) automatically enable kms for the intle, radeon and ati gfx cards.

I tried a number of different approaches, using the trial and error method, before i found a reasnoable configuration. As for the graphics configuration you'll have to add the following flags:

CONFIG_ACPI_VIDEO=y
CONFIG_VIDEO_CAPTURE_DRIVERS=y
CONFIG_VIDEO_HELPER_CHIPS_AUTO=y
CONFIG_VIDEO_SAA7134_RC=y
CONFIG_USB_VIDEO_CLASS_INPUT_EVDEV=y
CONFIG_VIDEO_CX231XX_RC=y
CONFIG_VGA_ARB=y
CONFIG_VGA_ARB_MAX_GPUS=16
CONFIG_VGASTATE=y
CONFIG_VIDEO_OUTPUT_CONTROL=y
CONFIG_FB=y
CONFIG_FB_BOOT_VESA_SUPPORT=y
CONFIG_FB_CFB_FILLRECT=y
CONFIG_FB_CFB_COPYAREA=y
CONFIG_FB_CFB_IMAGEBLIT=y
CONFIG_FB_MODE_HELPERS=y
CONFIG_FB_TILEBLITTING=y
CONFIG_VGA_CONSOLE=y
CONFIG_FRAMEBUFFER_CONSOLE=y
CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y
CONFIG_FRAMEBUFFER_CONSOLE_ROTATION=y
CONFIG_LOGO_LINUX_VGA16=y
CONFIG_DRM=y


For some reason, i don't know why, the i915 is not selected but the menuconfig or makeoldconfig option will generate new configuration for the experimental intel drivers that over look the i915 stuff.  So you'll have to append the .config file with these three options to get the correct intel driver build into the kernel.

CONFIG_DRM_KMS_HELPER=y
CONFIG_DRM_I915=y
CONFIG_DRM_I915_KMS=y


I removed CONFIG_FB_VESA and CONFIG_FB_VGA16 to avoid issues with conflicting framebuffers in Xorg. See  Kernel Mode Setting - debian for details. You can check all the dependency flags from CONFIG_DRM_I915 in the kernel configuration database if you're interested.

Building the kernel & installing the kernel:
kernel building help


#sudo fakeroot make-kpkg --append-to-version= kernel_image
#sudo dpkd -i ../linux-image..deb

Configurating the boot options:

Once kernel is ready you'll have to setup the system, to use it correctly. You'll have to add the i915 kms selection option to /etc/modprobe.d simply add a file called i915-kms.conf containing:

options i915 modeset=1

Then edit the grub configuration to get both eGalax and i915 to work, if you have other options to the GRUB_CMDLINE_LINUX_DEFAULT flag append these:

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash acpi=force elevator=noop i8042.noloop=1 usbhid.quirks=0xeef:0x1:0x40"

i915 kms depend on acpi, that why it is forced. The elavator=noop and i8042.noloop=1 and usnhid.quirks=0xeef:0x1:0x40 are all options for the eGalax touch screen. The quiet and splash are options to get a linux splash logo at boot and quiet boot.

dont forget to update grup with these new settings

#sudo update-grub

Adding policy file for the eGalax touch screen:

I added an evtouch.fdi file to the hal layer, this file contains thesetup for the touch screen. It is placed in:
/etc/hal/fdi/policy/evtouch.fdi

And it's contents are: evtouch.fdi
<?xml version="1.0" encoding="UTF-8" ?>
<deviceinfo version="0.2">
<device>
<match key="info.product" contains="eGalax Inc. USB TouchController">
<merge key="input.x11_driver" type="string">evtouch</merge>
<merge key="input.x11_options.ReportingMode" type="string">Raw</merge>
<merge key="input.x11_options.Emulate3Buttons" type="string">false</merge>
<merge key="input.x11_options.Emulate3Timeout" type="string">1</merge>
<merge key="input.x11_options.SendCoreEvents" type="string">On</merge>
<merge key="input.x11_options.MinX" type="string">0</merge>
<merge key="input.x11_options.MinY" type="string">2</merge>
<merge key="input.x11_options.MaxX" type="string">4096</merge>
<merge key="input.x11_options.MaxY" type="string">4096</merge>
</match>
</device>


Configuring Xorg:
Finally you'll need to modify the Xorg.conf file. As ubuntu doesent have one pr default you'll have to generate it.Go to a non graphical login and use Xorg to generate the config file.

#sudo service gdm stop
#sudo Xorg -configure

will create a xorg.conf.new file in your current directory. it may be a good idea to wait with the file generation until you have booted your system with the new kernel. There may be a risk that the generation will fail because Xorg cant load the i915 driver.

Once you have the configuration ready you'll need to copy it to the /etc/X11/ directory and name it xorg.conf

#sudo cp xorg.conf.new /etc/X11/xorg.conf
#sudo service gdm start

Calibrating the touch screen:
Then you should calibrate the eGalax touch pad, you can install the touchscreen calibration application with apt-get. There's a lot of very good information here.

#sudo apt-get install xinput_calibrator

You'll get a menu item in System | Administration | calibrate touch screen
Simply run it and follow the instructions.

I copied my calibration to a file called: 99-calibration.conf it contains:

Section "InputClass"
        Identifier      "calibration"
        MatchProduct    "eGalax Inc. USB TouchController"
        Option  "Calibration"   "192 3874 476 3636"
        Option  "SwapAxes"      "1"
EndSection

You may not need the SwapAxes flag, but mine where defenately swapped. I still cant the get the compiz_check script to run on my machine but Unity and the compiz window manager are both running with a resolution of 1280x1024.

My configuration files are available here: xorg.conf 99-calibration.conf i915-kms.conf grub evtouch.fdi

December 16, 2010

Running iTunes on LinuxMint

Check your wine setup:

#dpkg -l | grep wine | awk '{ print $2, " ",$3}'
 
wine   1.0.1-0ubuntu8
wine1.2   1.1.31-0ubuntu3
wine1.2-gecko   1.0.0-0ubuntu3

Install wine 1.2 and the iTunes version 10 (i took the latest from the iTunes.com) website. This worked out of the box. I still have to test iPhone connection.

The iPhone connection can be setup doing this. Using http://www.libimobiledevice.org/

October 20, 2010

Linux command line stuff

Finding number of files in a folder:
find . -type f | wc -l

Finding number of subfolders in a folder:
find . -type d | wc -l


All taken from here

Creating 1 pdf from multiple images:

cd FOLDER_WITH_IMAGES
FILES=$(ls *jpg)
mkdir temp && cd temp
for file in $FILES; do BASE=$(echo $file | sed 's/.jpg//g'); convert ../$BASE.jpg $BASE.pdf; done &&
pdftk *pdf cat output ../FINAL_NAME.pdf &&
cd ..
rm -rf temp

All taken from here

July 28, 2010

Active state perl under cygwin

Follow the script description here, But instead of removing the perl from the cygwin installation and adding stuff to the path :) Simply replace the cygwin perl.exe file with the script.


Perl and the windows registry links:
http://cpansearch.perl.org/src/INGY/Kwiki-0.39/lib/Kwiki/Registry.pm
http://www.xav.com/perl/site/lib/Win32/TieRegistry.html

March 04, 2010

LinuxMint 8 running in Virtualbox

At work I have a WineDoh$ machine :( So not to miss my trusty Mint machine during the day I decided to install it in virtualBox.

The tricky part is to get the network running for the guest machine (the LinuxMint), as you need to create a bridge between the host and the guest. Then you need to set the proxy on your LinuxMint guest machine.


Now you should be able to run: 

sudo apt-get update
sudo apt-get upgrade

And get the latest package updates, as well as intall your favorite applications. To share data between the two machines, open the host machines shared folder menu:


Create a shared drive
Then on the guest you need to mount this drive:

sudo mkdir /mnt/windows_drive
sudo mount.vboxfs D_DRIVE /mnt/windows_drive
ls /mnt/windows_drive

and you should be able to see your files.

 [Edit 1] Update on the proxy configuration

March 01, 2010

PS3 media server on LinuxMint

Setting up a ps3 media server was extremely easy! just follow the guide at: http://ps3mediaserver.org/forum/viewtopic.php?f=3&t=5589Tests

I previously attempted streaming to my ps3 using vlc but the result was not good. The video was stopping. It seemed like a transcoding problem.

However, installing vlc and using this through the ps3media server has an exellent result.

C++ enum inheritance

Today I needed to have enums with an inheritance ability. I have some HMI panels in an application where each panel button has a handler function, which is placed incide a stl vector. Each of these buttons can be enabled and disabled using a unique ID, it's number in the vector.

The problem I fased was that the base class implementing the basic functionality of the panels (done and cancel) also implemented the indecies for these functions. Now in a derived class i wanted to extend the enum with button indecies for the buttons added by the new class, but enums and C++ does not support this directly.

To overcome the problem a template can be used. here is a similar approach using atemplate to extend enum definitions. This solved my problems and I can get the panels back in action.

February 18, 2010

Asus eeepc 1101H & Linux

Woooa, and I thought my biggest problem was some F****r stealing my powerbook!! But no, I wasn't even close!

So in the lack of Mac i decided to get one of those nice looking eeePC seashells. In fact I was so "blinded by the light" that I completely forgot to look at the hardware compatibility.

So, I ended up buying a Asus eeePC 1101H, which I regretted until today! Since this machine includes the *famous* gma500 Intel (aka poulsbo) graphics chip :O

Ubuntu, 9.04  (EasyPeasy 1.5) and 9.10  all have vesa (read:slow graphics) Now what?? I waited! and waited and waited .... from October 2009 to Feburary 2010, when finally the poulsbo drivers have a decent installation script!!

Now I'm the lucky owner of a Asus eeePC running Ubuntu 9.10.

To get your own simply follow the instructions here, and here.

In short the procedure is:

0. Create ubuntu libe stick and Install ubuntu from live usb stick
2. Reboot
3. sudo apt-get update
4. sudo apt-get upgrade
5. reboot
6. wget http://dl.dropbox.com/u/1338581/Gma500/scripts/poulsbo.sh && sh ./poulsbo.sh
7. reboot
8. sudo apt-get install ndisgtk (may not be needed)
9. restart network (or reboot)
10. edit /etc/resolv.conf and /etc/dhcp3/dhcp.conf with settings from open dns (208.67.222.222, 208.67.220.220)
11. Open Firefox and put about:config in address bar and hit enter.
In filter type network.dns.disableIPv6 and hit enter:
double click on line and it will change to:
network.dns.disableIPv6;true
12. Disable the ipv6 kernel module
13. Install the wicd wireless handler


You should now have a running Ubuntu distro great with network and graphics!

Previous distro attempts:
Slackware13 from stick - booted after installation but, darn this distro could not see my hard disk, due to a missing scsi module in the kernel

Xandros from stick (I figured: hey this is an Asus distro so i most likely will install smoothly) No, not even close, during usb install it barfed all over me with "can't find installation media" There's no optical drive on the 1101!!

Debian (I already have a machine running this) - No network! no driver! and really slow graphics :(

ArchLinux. See debian.

I considering dumping MintLinux8 on a second partition just to test the installation again.

May 26, 2009

Designing devices with time

Currently there are many embedded devices that needs some sort of time settings. This is a brief description of what to remember when designing systems that depend on time.

Firstly, the device time chip should be checked for backup and recovery. Figure out how to use this for backing up the time!! This is important as the time becomes an issue when synchronizing data between devices like the embedded one and the PC.

Consider the following:
1. Initial time in the device, how is the time written to the time chip the first time? How can the device know the difference between first "real" boot and all other boot's.

2. How is the time synchronized between the systems?? What format is used for communication?? How is data marked as valid or invalid. Transmitted or not transmitted.

3. Is the implementation on both sides using the same interpretation of the "time.h" standard (if this is the chosen time format) and can they both handle the summer time setting?

October 09, 2008

Slackware 12 on the IBM x61s

Here is the description of how I got slackware 12 running on a lenovo x61s with
all the things I need.

Installation:
Scrinking the vista image
Dualboot installation (if you really need it ;)
Thinkpad kernel

System configuration:
Bluetooth
Wireless
Dual monitor setup
Acpi
vpn
Modified system configuration files

User applications:
Netbeans & Ant
Kdesvn, rapid svn
Openoffice
Diffing files
Cobertura

Installation:
Scrinking the vista image:
First off you'll have to scrink your vista image since the machine
comes with vista preinstalled. You can use the vista diskmanagement
tool for this (this is what I did).

I managed to get approx 32 GB from the vista installation, which is
more than enough for slackware.

Dualboot installation:
There's a problem with the intel boot loader, this problem means that
you can't install lilo in the mbr or on th efirst partition of the hd
becaue of the recovery partition.

So I deleted the recovery partition, it is the first partition
(/dev/sda1) of 5.4 GB. Then I created a linux partition instead and
installed grub on this. I didn't use lilo since it was never able to
go to the mbr???
Disk /dev/sda: 120.0 GB, 120034123776 bytes
255 heads, 63 sectors/track, 14593 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1         679     5448704   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2   *         679       10487    78781440    7  HPFS/NTFS
Partition 2 does not end on cylinder boundary.
/dev/sda3           10487       10518      254667   82  Linux swap
/dev/sda4   *       10519       14593    32732437+  83  Linux


That's my setup, planning to mount /dev/sda1 as /var clean the vista
partition and mount this as a windows path setup! But that's still to
come.

With the partitions ready get a hold of a CD drive and throw slackware
on the hdu. I selected everything ;) That's what slackbook reccomends.

Thinkpad kernel:
Version 2.6.23_rc5
Depending on your laptop type, mine's a x61s that at writing is a
retalively new machine, you should build a kernel. This is to ensure
that you get all the acpi features of you machine.

There's a bunch of patches you need, they are all listed on the
slackwiki.org. I just took a 2.6.23-rc9 this had everything except
suspend to ram. I'll apply the suspend patch once I have the
time. Since it seems like there's a lot of issues with recovering from
suspend to ram.

Follow the instructions on slackwiki for building your kernel and you
should be running in no time. While you're at it you should add fuse
(file system in user space) and smbfs support.

This'll be a great help since you can then use sshfs or obexfs to mount a ssh
login as a drive, mount a obex enabled phone as a drive and finally mount the
windows shared drives.

Add the following entry to /boot/grub/menu.lst
  title thinkpad on (/dev/sda4)
  root (hd0,3)
  kernel /boot/vmlinuz-huge-smp-2.6.23-rc9-smp root=/dev/sda4 ro vga=normal

To install your new kernel in the grub boot menu

Version 2.6.25.8:
Yes you should upgrade your kernel once in a while ;) There's a couple of new
ACPI configurations, and I also added the MPPE encryption in device drivers
to get vpn running. This is needed. It should be a module but because of
issues with the pptpsetup command I made a kernel with the encryption built
in. pptpsetup kept saying that the pppd_mppe_mppc module was not installed.

Copy the old configuration file for you latest running kernel
cp /oldkernelpath/.config /newkernelpath/

Then issue:
make oldconfig

Command to setup the new kernel with your latest changes. After this you can
run a:
make menuconfig

To add the new stuff you need. Once done
make
make modules_install

and I always manually copy the boot image to the /boot partition along with
any configuration for this particular kernel. See the 2.6.23_rc5 on how to
update grub.

System configuration:
Bluetooth:
Unfurtunately there's no bluetooth on/off switch, and this chip is
using a lot of power. but you can (enable|disable) the interface as
root via /proc/acpi/ibm/bluetooth.
 
echo disable > /proc/acpi/ibm/bluetooth
echo enable > /proc/acpi/ibm/bluetooth

switches bluetooth off and on respectively. When using bluetooth for
you everyday tasks, like uploading midlets to the phone or using dial
up in the train to and from work there's still a couple of things to
do.

I installed kdebletooth and kmobiletools. These tools integrate the
bluetooth interface directly in kqonquerer. The versions avaiiable as
beta3 never worked on my machine?? Dunno why, but I simply used the
versions from slax (www.slax.org). Convert the *.mo packages to
slackware tgz and install these as you'd install any other slack package.
You'll need linux live tools or a live distribution to do this. If you
havent all ready installed slax on your usb stick now's a good time to
do so. (see www.slax.org)

Once you have the mobile tools installed you'll have to ensure that
all users can run with bluetooth. Add:
hcid        # set the machine ID
hciconfig   # configure the bt subsystem
sdpd        # Let other BT devices see the machine

to our /etc/rc.d/rc.local or your distribution equivalent. On slack
there's a little trick copied from debian to set up the pin and phone
names.

In the file /etc/bluetooth/hcid.conf you'll can set the name of your machine
# Default settings for HCI devices
device {
    # Local device name
    #   %d - device id
    #   %h - host name
    name "darkstar (%d)";

Mines darkstar, the default name is Bluez. Setup the pin by echoing
the pin number you like to /etc/bluetooth/passkeys/default. I.e.
echo 1234 > /etc/bluetooth/passkeys/default

Now you can pair you phone. If you have issues chack the thinkpadwiki
for bluetooth details.

If you like you can autobind you bluetooth device using the
rfcomm.conf file. This is straight forward just place you phone's
bluetooth address with the one in the file, and voila you have a
rfcomm device you can use.

Heres my rfcomm.conf file:
cat /etc/bluetooth/rfcomm
rfcomm0 {
    # Automatically bind the device at startup
    #bind no;
    bind yes;

    # Bluetooth address of the device
    device 00:18:C5:3D:BF:C1; #Noia N73

    # RFCOMM channel for the connection
    channel    2; #Dial up networking port DUN profile connection

    # Description of the connection
    comment "Noia N73";
}

This is the best availabel guide to get BT dial up running:
http://www.marotori.com/blog/?p=16. You'll need a phone that supports the
bluetooth DUN profile. Believe me it's harder to get tha you think. I'm
currently using an Nokia N73. Runs perfectly with 3G

Heres my Slack dial up configuration:
first the chat-gprs file to set up th ebt moden for using the fastes
connection (gprs and 3G)
cat /etc/ppp/chat-gprs
'' ATZ OK
AT+CGDCONT=1,"IP","internet"
OK "ATD*99***1#"
CONNECT ''

Next my mobile internet provider is Danish TDC:
cat /etc/ppp/peers/tdc
/dev/rfcomm0 115200
connect '/usr/sbin/chat -v -f /etc/ppp/chat-gprs'
crtscts
modem -detach
noccp
defaultroute
usepeerdns
noauth
ipcp-accept-remote
ipcp-accept-local
noipdefault
debug
lcp-echo-failure 0

With these two files on place simply start the pppd as root, by issuing:
pppd call tdc

If you run into problems adding a debug on the pppd command will most likely
help
pppd call tdc debug

or you could use this small script
#!/bin/sh
sudo pppd call tdc debug

Wireless:
Is incredably straight forward. All you have todo is to insert the
inteldriver and then build the wrapper for it. The instructions to do so is
right here:
http://slackwiki.org/ThinkPad_X61s#Wireless_LAN_.28802.11.29

Next you'll need to get the wireless net running. You'll have to start the
service and the driver so it is loaded when you activate the machine.

Then you'll have to activate the card. This is done by starting the interface
with:
ifconfig wlan0 up
iwconfig wlan0 ESSID "your net work name"
dhcpcd wlan0

First you start the interface, then you attach it to your preffered network,
and finally you get an IP address from the networks dhcp server.

I added the following to my rc.local:
if [ -z ifconfig eth0 | grep ]; then
   if [ -s ifconfig wlan0 | grep ]; then
      iwconfig wlan0 ESSID "network name"
      dhcpcd wlan0
   else
      echo "wlan0 could not be found, check the wireless switch"
   fi
fi

Now you'll have to chmod the script to be able to execute it! And notice
you'll have to be either root or a sudo'er to activate the ifconfig and iw
config calls.
cat /root/wireless_nome.sh
#!/bin/sh

if [ -e /etc/dhcpc/dhcpcd-wlan0.pid ]; then
    rm /etc/dhcpc/dhcpcd-wlan0.pid
fi

ETH0=$(ifconfig|grep eth0|cut -c 1-4)
WLAN0=$(ifconfig|grep wlan0|cut -c 1-4)

if [ -z $ETH0 ];then
    if [ -z $WLAN0  ];then
        echo "No wireless adaptor found, check the wireless switch!"
    else
        iwconfig wlan0 ESSID "your wireless ssid"
        dhcpcd wlan0
        exit 0;
    fi
else
    echo "apparently there's a ethernet card!"
fi
exit 1;

Dual monitor setup:
Adding the following to your .xprofile file will utilize the screen you have
on your desk.
if [ -z xrandr|grep VGA ]; then
   xrandr --output LVDS --mode 1024x768  
else
   xrandr --output LVDS --mode 1600x1200  
fi

My xorg.conf file can be found here:
cat /etc/X11/xorg.conf
# John's handhacked dual monitor xorg.conf file
Section "ServerLayout"
    Identifier     "X.org Configured"
    Screen      0  "int" 0 0
    InputDevice    "Mouse0" "CorePointer"
    InputDevice    "Keyboard0" "CoreKeyboard"
EndSection

Section "Files"
    RgbPath      "/usr/share/X11/rgb"
    ModulePath   "/usr/lib/xorg/modules"
    FontPath     "/usr/share/fonts/TTF"
    FontPath     "/usr/share/fonts/OTF"
    FontPath     "/usr/share/fonts/Type1"
    FontPath     "/usr/share/fonts/misc"
    FontPath     "/usr/share/fonts/75dpi/:unscaled"
EndSection

Section "Module"
    Load  "xtrap"
    Load  "GLcore"
    Load  "dri"
    Load  "dbe"
    Load  "glx"
    Load  "extmod"
    Load  "record"
    Load  "freetype"
    Load  "type1"
EndSection

Section "InputDevice"
    Identifier  "Keyboard0"
    Driver      "kbd"
    Option        "XkbModel" "pc104"
    Option        "XkbLayout" "dk"
    Option        "XkbOptions" "grp:shifts_toggle"
EndSection

Section "InputDevice"
    Identifier  "Mouse0"
    Driver      "mouse"
    Option        "Protocol" "auto"
    Option        "Device" "/dev/input/mice"
    Option        "ZAxisMapping" "4 5 6 7"
EndSection

Section "Device"
    Identifier  "Card0"
    Driver      "intel"
    VendorName  "Intel Corporation"
    BoardName   "Mobile Integrated Graphics Controller"
    Option        "MergedFB" "true"
    Option        "MetaModes" "1024x768 1024x768"
    Option        "MergedDPI" "100 100"
    BusID       "PCI:0:2:0"
EndSection

Section "Device"
    Identifier    "Card1"
    Driver        "intel"
    BusID        "PCI:0:2:0"
    Screen        1
EndSection

Section "Screen"
    Identifier "int"
    Device     "Card0"
    Monitor    "laptop"
    DefaultDepth     24
    SubSection "Display"
        Viewport   0 0
        Depth     1
#        Virtual   3000 1600
    EndSubSection
    SubSection "Display"
        Viewport   0 0
        Depth     4
#        Virtual   3000 1600
    EndSubSection
    SubSection "Display"
        Viewport   0 0
        Depth     8
#        Virtual   3000 1600
    EndSubSection
    SubSection "Display"
        Viewport   0 0
        Depth     15
#        Virtual   3000 1600
    EndSubSection
    SubSection "Display"
        Viewport   0 0
        Depth     16
#        Virtual   3000 1600
    EndSubSection
    SubSection "Display"
        Viewport   0 0
        Depth     24
        Virtual   2624 2048
    EndSubSection
EndSection

Section "Monitor"
    Identifier   "laptop"
    VendorName   "LEN"
    ModelName    "4000"
    Option        "DPMS"
EndSection

Section "Screen"
    Identifier "ext"
    Device     "Card1"
    Monitor    "external"
    DefaultDepth     24
    SubSection "Display"
        Depth     24
        Modes    "1600x1200" "1280x1024"
    EndSubSection
EndSection

Section "Monitor"
    Identifier  "external"
    Option        "DPMS"
EndSection

Section "DRI"
    Mode         0666
EndSection

Acpi:
Getting the full potential of the laptop means using acpi! In the kernel part
of this document you have putin acpi support and the thinkpad dirvers for
acpi. The next part is to configure it. There is a big indepth guide tpo acpi
here: http://slackwiki.org/ThinkPad_X61s#ACPI

The generel idea is that you place small scripts in /etc/acpi/actions, then
you point to these scripts from /etc/acpi/events/

The lid event can be controlled like this:
event=button lid.*
action=/etc/acpi/actions/sleep.sh

Then dump the sleep script in /etc/acpi/actions. But you should notice that
there is aproblem with sleeping. The wake up part screws up the screen
light/brightness leaving the screen almost black. I have attempted to fic
this issue but no luck so far.

vpn:
Creating a vpn connection is quite tricky on slackware! Since all the common
and preffered wizards fails! Which leads to actually reading the
documentation and figuring out what actually happens ;) (I love Slackware)

So, read the pptpclient documentation for hand configuration:
http://pptpclient.sourceforge.net/howto-debian.phtml#configure_by_hand
and routing: http://pptpclient.sourceforge.net/routing.phtml#client-to-server

I created the options file as ressomended but added the refuce-eap option
as well, as the pptpserver om mpt1.dk kept kickin my machine off. Here are
the answers to the handconfiguration:
1.
    * the IP address or host name of the server ($SERVER) mpt1.dk
    * the name you wish to use to refer to the tunnel ($TUNNEL) mobile
    * the authentication domain name ($DOMAIN) MPOFFICE1 (not needed)
    * the username you are to use ($USERNAME) jd
    * the password you are to use ($PASSWORD) youwish!
    * whether encryption is required. But of course (mppe128)

2. cat /etc/ppp/options.pptp
lock noauth nodeflate nobsdcomp refuse-eap

3. cat /etc/ppp/chap-secrets
jd      PPTP    youwish!    *

4. cat /etc/ppp/peers/mobile
pty "pptp mpt1.dk --nolaunchpppd"
name jd
remotename PPTP
require-mppe-128
file /etc/ppp/options.pptp
ipparam mobile

The only problem with the handconfiguration is that it comes from debian, and
slackware does not contain the pon and poff commands. Så all you have to do
is to fire this little expression to start the vpn connection:
 
pppd pty 'pptp mpt1.dk --nolaunchpppd' call mobile debug dump logfd 2 nodetach

Where the mpt1.dk is replaced with your server name and the mobile is
replaced with tour tunnel name.

Next you'll need a route to the vpn network, this can be obtained with the
command
 
route add -net 192.168.1.0 netmask 255.255.255.0 dev ppp0

where the ip is the net you'll connect to and ppp0 is the interface you wich
to connect the route to! I have created a small script:
cat /etc/ppp/ip-up
#!/bin/sh
/sbin/route add -net 192.168.1.0 netmask 255.255.255.0 dev ppp

which adds the route to the network i need, there are several things to add
to this script to get the connections work automatically

The next thing was host resolving. The nameservice provided did not work over
the vpn tunnel :( But *nix systems have the /etc/hosts file. Here I added an
entry the hosts I need.
cat /etc/hosts
# For loopbacking.
127.0.0.1        localhost
127.0.0.1        darkstar.domain.com darkstar

#system specific hosts
svn.server.ip.address   svn_repo

That concludes the vpn configuration.

Modified system configuration files:
su -
find /etc/ -name '*~'
/etc/sudoers~
/etc/X11/xorg.conf~
/etc/bluetooth/rfcomm.conf~
/etc/bluetooth/hcid.conf~
/etc/fstab~
/etc/rc.d/rc.local~
/etc/rc.d/rc.bluetooth~
/boot/grub/menu.lst

User applications:
Netbeans & Ant:
I did a slackware package containing this. Its easy since it's located
in /opt. considering doing the same with openoffice. But hey it's a
bunch of small tgz's now so why bother ;)

You'll have to create a small script to be able to send the
environment variables to netbeans (if you'd like to activate this from
any menu item in your desktop)
#!/bin/sh
export EMC=/home/$USER/work/emc ;
export WORK=/home/$USER/work/ ;
netbeans --jdkhome /usr/lib/jdk1.6.0_01/ ;

Save this as netbeans.sh and make it executable with chmod u+x Put it
in you favorite desktop menu item and you are up running. Or you can simply
add the netbeans program to the panel as an application

I also added the work specific env vars to my .bashrc enabling me to
run netbeans from any terminal and set up ant.
#setup work environment for EMC client project
export EMC=/home/$USER/work/emc ;
export WORK=/home/$USER/work/;

#setup ant
export ANT_HOME=/usr/local/apache-ant-1.7.1
export JAVA_HOME=/usr/lib/jdk1.6.0_01
export PATH=${PATH}:${ANT_HOME}/bin:${JAVA_HOME}/bin

To install ant just copy the ant bin and lib folders to the place in
the system you prefer. Mine's /usr/local/ant/ insluding bin and lib

If you want to build ant it is a different story. Then you'll have to obtain
the sources from http://ant.apache.org/. Follow the instructions on
http://ant.apache.org/manual/index.html to somplete the installation.

I neede to place the junit for building the test cases for ant. This optional
package must go in ants optional directory:
cd $ANT_HOME
mkdir lib/optional/
cp junit.jar junit.jar

This gives you the junit file available for ant. Then just build normally,
and install the ant. My ant directory at writing is: /usr/local/apache-ant-1.7.1/

If you need the possibility of using the Sony ericsson emulator with netbeans
read the entry.

Kdesvn:
To get svn running with a wysiwyg thing you'll need something like
kdesvn. just fetch and install the package. It is done by following the
package instructions.

Openoffice:
Since openoffice installer is using rpm, which suck, and wont work
directly on slackware you'll have to rpm2tgz all the oo rpms. Do:
mkdir tgz
cd tgz
rpm2tgz ../rpms/*.rpm
installpkg *.tgz

now all you have todo is to create the menu items and the links to
/usr/bin if you prefer.

Diffing files:
You'll need meld. Its the best available diff and merge tool. Yess it beats
ediff! On a slack 12 kde machine you'll have to get the gnome-pythn
package. The best way (once you have slapt-get installed) is:
 
slapt-get --install gnome-python

That takes care of the meld dependencies. Now you'll need meld. It's
available here: http://meld.sourceforge.net/ there even is a slackware
package :) Down the meld slackpack and fire:
 
installpkg meld.whatever.version.you.downloaded.tgz

Next issue:
 
meld

To start melding the files ;)

October 07, 2008

iSync and Nokia N81

For years I have been wondering why Nokia didn't support my precious Powerbook. But I just found out (guess it's old news already) that it's possible to sync my N81 phone and the applications I use on the Mac.

phoneboy.com and Nokia both explain how to do this with the supported phones.

But there seem to be a catch with N81. Nokia have addressed this issue by launcing a installer package. This pakage is available by entering N81 in the search field at the Nokia iSync support page.

Once the plugin has been installed there are still some tweaks to do. This is because (at least on my machine running osx 10.4.10) the plugin got installed in the library
/Library/PhonePlugins/Nokia_N81_1v1.phoneplugin

Instead of inside the iSync.app folder.
So, simply copy the plugin contents to the iSync.app folder:
cp -r /Library/PhonePlugins/Nokia_N81_1v1.phoneplugin /Applications/iSync.app/Contents/PlugIns/ApplePhoneConduit.syncdevice/Contents/PlugIns/

and rename the Nokia_N81_1v1.phoneplugin so it used the naming convention already in the folder. On my machine this means issuing:
cd /Applications/iSync.app/Contents/PlugIns/ApplePhoneConduit.syncdevice/Contents/PlugIns/

And
mv Nokia_N81_1v1.phoneplugin Nokia-N81.phoneplugin

This brings up the synchronization, once the device have been added to iSync, follow the normal device add procedure on iSync.

I still have issues with synchronizing the phone and iTunes. But I guess I'll work this out later. As long as my calendar and contacts are in sync I can live with the music for now.