Posts Tagged ‘Tutorial’

Ubuntu 9.04 on MacBookPro5,3

Thursday, August 20th, 2009

How I installed Ubuntu Jaunty Jackalope 9.04 on my MacBook Pro 5,3.

After you have installed Ubuntu on your MBP and connected to internet. We need to add some lines in sources.list to be able to get special packages developed for apple products.

WARNING: be carefull with all the ” when pasting, they tend to change into a similar sign!

Update
echo deb http://ppa.launchpad.net/mactel-support/ubuntu jaunty main | sudo tee -a /etc/apt/sources.list
echo deb-src http://ppa.launchpad.net/mactel-support/ubuntu jaunty main | sudo tee -a /etc/apt/sources.list
sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 7A6BC20C4FE04DADD10837608DB7F87A2B97B7B8 (DONT WORK)

sudo apt-get update
sudo apt-get upgrade

REBOOT (recommended)

Get hardware packages
sudo apt-get install mbp-nvidia-bl-dkms applesmc-dkms hal-applesmc bcm5974-dkms lm-sensors

Reboot if you want it to work right away or just continue below.

Keyboard
Apple keyboard backlight and Fn-keys should now work.
If you want to change the fn-usage buttons.

echo options hid_apple fnmode=2 | sudo tee -a /etc/modprobe.d/hid_apple.conf
sudo update-initramfs -u

I like to use gnome-do and usually use the Menu key for this. You will be prompted for next login, make sure you load the file.
Add this to ~/.xmodmaprc
keycode 252 = Super_R
echo keysym Super_R = Menu
keycode 49 = apostrophe

If you`re having problems getting the $ or brackets (and more) we need to do edit your keyboard layout. Go to Gnome menu -> preferences -> keyboard -> layout and change keyboard model to apple and make sure you have the right layout selected.

Sensors
For using sensors and fans we need to load apple modules:

echo coretemp | sudo tee -a /etc/modules
echo applesmc | sudo tee -a /etc/modules

Reboot (optional).

Caps lock
By default the green caps-lock does not work. It´s a easy fix.

sudo apt-get remove mouseemu

Monitor
If you don`t like the way your MBP auto dim your screen, you can disable it.

gconftool -s /apps/gnome-power-manager/ambient/enable -t bool false

Touchpad
To get multitouch we need to do a little trick.

echo bcm5974 | sudo tee -a /etc/modules
echo usbhid | sudo tee -a /etc/modules
echo blacklist usbhid | sudo tee -a /etc/modprobe.d/blacklist.conf

Open /etc/hal/fdi/policy/x11-synaptics-bcm5974.fdi and paste.
sudo gedit /etc/hal/fdi/policy/x11-synaptics-bcm5974.fdi

<?xml version="1.0" encoding="ISO-8859-1"?>
<deviceinfo version="0.2">
 <device>
  <match key="info.capabilities" contains="input.touchpad">
   <match key="info.product" contains="bcm5974">
   <merge key="appledevice" type="bool">true</merge>
   </match>

   <match key="appledevice" bool="true">
        <merge key="input.x11_driver" type="string">synaptics</merge>
        <merge key="input.x11_options.SHMConfig" type="string">1</merge>

        <merge key="input.x11_options.FingerLow" type="string">40</merge>
        <merge key="input.x11_options.FingerHigh" type="string">70</merge>
        <merge key="input.x11_options.ClickFinger1" type="string">1</merge>
        <merge key="input.x11_options.ClickFinger2" type="string">3</merge>
        <merge key="input.x11_options.ClickFinger3" type="string">2</merge>
        <merge key="input.x11_options.TapButton1" type="string">1</merge>
        <merge key="input.x11_options.TapButton2" type="string">3</merge>
        <merge key="input.x11_options.TapButton3" type="string">2</merge>

        <merge key="input.x11_options.VertEdgeScroll" type="string">false</merge>
        <merge key="input.x11_options.HorizEdgeScroll" type="string">false</merge>
        <merge key="input.x11_options.VertTwoFingerScroll" type="string">1</merge>
        <merge key="input.x11_options.HorizTwoFingerScroll" type="string">1</merge>

        <merge key="input.x11_options.MinSpeed" type="string">0.5</merge>
        <merge key="input.x11_options.MaxSpeed" type="string">2.5</merge>
        <merge key="input.x11_options.AccelFactor" type="string">0.15</merge>

        <merge key="input.x11_options.PalmDetect" type="string">0</merge>
        <merge key="input.x11_options.PalmMinWidth" type="string">25</merge>
        <merge key="input.x11_options.PalmMinZ" type="string">250</merge>
   </match>
  </match>
 </device>
</deviceinfo>

Reboot (optional).

Sound
Follow this recipe and your sound should work.


sudo apt-get install linux-headers-generic linux-image-generic linux-restricted-modules-generic
wget ftp://ftp.kernel.org/pub/linux/kernel/people/tiwai/snapshot/alsa-driver-unstable-snapshot.tar.gz
tar xf alsa-driver-unstable-snapshot.tar.gz
cd alsa-driver-unstable
sudo ./configure --enable-dynamic-minors --with-cards="hda-intel" --with-oss
sudo make
sudo make install
cd ..
sudo rm -rf alsa-driver-unstable alsa-driver-unstable-snapshot.tar.gz

REBOOT (recommended)

Now, don´t forget to unmute sound channels.

If you´d want a automatic fan program, I wrote one in bash. It requires lm-sensors (installed above) to work. I will write it in C some day.
#!/bin/bash

# we don`t want to go all the way up to critiacal temp, safe_temp is substracted from critical temp
SAFE_TEMP=10

# AUTOMATIC VALUES BELOW, DON`T EDIT

# CPU critical temp
CPU_CRIT=`cat /sys/devices/platform/coretemp.0/temp1_crit`

# FAN SPEED
FAN1_SPEED_MIN=`cat /sys/devices/platform/applesmc.768/fan1_min`
FAN1_SPEED_MAX=`cat /sys/devices/platform/applesmc.768/fan1_max`
FAN2_SPEED_MIN=`cat /sys/devices/platform/applesmc.768/fan2_min`
FAN2_SPEED_MAX=`cat /sys/devices/platform/applesmc.768/fan2_max`
CPU_CRIT=`expr "(" "$CPU_CRIT" "/" 1000 ")" "-" "$SAFE_TEMP"`

echo 1 > /sys/devices/platform/applesmc.768/fan1_manual
echo 1 > /sys/devices/platform/applesmc.768/fan2_manual

# dynamic values
while [ 1 ]; do

# CPU TEMPS
CPU_TEMP0=`cat /sys/devices/platform/coretemp.0/temp1_input`
CPU_TEMP1=`cat /sys/devices/platform/coretemp.1/temp1_input`
CPU_TEMP=`expr "(" $CPU_TEMP0 + $CPU_TEMP1 ")" "/" 2000`

# calculate
FAN_SPEED=`expr "(" $CPU_TEMP "-" 34 ")" "*" 200`

# if CPU reaches critical - SAFE_TEMP, shut off
if [ "$CPU_TEMP" -gt "$CPU_CRIT" ]; then
shutdown -h now
fi

# don`t go below min limit
if [ "$FAN_SPEED" -le "$FAN1_SPEED_MIN" ]; then
FAN_SPEED=$FAN1_SPEED_MIN;
fi

# don`t go above max limit
if [ "$FAN_SPEED" -gt "$FAN1_SPEED_MAX" ]; then
FAN_SPEED=$FAN1_SPEED_MAX;
fi

# only write if speed has changed
if [ "$FAN_SPEED" != "$FAN_SPEED_OLD" ]; then
#echo $CPU_TEMP $FAN_SPEED
echo $FAN_SPEED > /sys/devices/platform/applesmc.768/fan1_output
echo $FAN_SPEED > /sys/devices/platform/applesmc.768/fan2_output
fi

# store old speed
FAN_SPEED_OLD=$FAN_SPEED;

sleep 5
done

Pommed
If you would like to install pommed on this machine at this time we have to modify pommed. I have notified creator of pommed about macbook5,3 support. If you have version above 1.27 you can skip this how to.

wget https://alioth.debian.org/frs/download.php/3084/pommed-1.27.tar.gz
tar zxf pommed-1.27.tar.gz
cd pommed-1.27/pommed/
pico pommed-mpb5,3.patch

Then paste following.
--- pommed.c-old 2009-08-22 20:23:21.796989322 +0200
+++ pommed.c 2009-08-22 20:22:42.270020918 +0200
@@ -677,6 +677,7 @@
* MacBook Pro 13" (June 2009) */
else if ((strcmp(buf, "MacBookPro5,1") == 0)
|| (strcmp(buf, "MacBookPro5,2") == 0)
+ || (strcmp(buf, "MacBookPro5,3") == 0)
|| (strcmp(buf, "MacBookPro5,5") == 0))
ret = MACHINE_MACBOOKPRO_5;
/* Core Duo MacBook (May 2006) */

Now apply the patch
patch -p0 < pommed-mpb5,3.patch

Install required packages
sudo apt-get install pommed libdbus-1-dev libalsa-ocaml-dev libaudiofile-dev libconfuse-dev libpci-dev

Compile
cd ..
make pommed
sudo cp pommed/pommed /usr/sbin/pommed

Reboot.

Read additional info here.

Let's make a needle shooter in 5 minutes

Tuesday, February 17th, 2009

Guide on how to make a needle shooting peg gun. The author of this tutorial can not be hold responsibility for any harm this weapon might cause on anything or any one. Use with caution.

As a child I was able to make my self a neat gun which could fire over 5 meters and still being cheap and cool. Now I will share how I made it before I completly forget it.

To complete this tutorial you’ll need the following

  • wooden clothing peg (check first image)
  • rubber band
  • small saw or you can just break of the first part
  • needle, toothpick, match or something similar for ammunition

1. Split your peg.

2. Saw and grind.

Gently saw the parts off and keep the biggest part. You only want to do this to one of the pieces. If you don’t have a saw it’ll do just breaking off the larger piece and forget about the small at the back (upper in picture below).

The piece you haven’t touched now needs some grinding where the spring is going to be sitting. Make sure you make enough room for the spring to securely stay in it’s place (check step 3).

3. Put it together.

Put the spring back on the biggest piece you just grined and mount the upper piece (now refereed to as the re-loader) with a rubber band. Please do use a smaller rubber. I didn’t have any other band when making this tutorial. Make sure the re-loader is not to tight mounted, this will cause the projectile to eject slower and shoot shorter.

4. Re-loading and arming.

Pull the re-loader forward until you hit the spring. Pull the re-loader down and backwards until the spring is locked in it’s position. Now arm your weapon with desired ammunition.

Troubleshoot

  • If the spring is stuck in arming position, you may have to grind it’s lock-hole a bit.
  • If above dosen’t work because the spring is slipping from it’s place underneath the gun, you didn’t grind a good enough room for it.
  • When your spring is going back inside the re-loader when fireing, you didn’t saw off enough at the end of it. Grind off some more.

Again; use with caution. Do not aim at any human, animals or like. This is not a toy.