tail -f findings.out

Fixing the function keys on the Apple Keyboard in Ubuntu

As I mentioned in a previous post, I love the feel of the Apple Keyboard. It’s comfortable, fast, reliable, and looks great to boot.

There is a fly in the ointment, however, for Hardy Heron, Intrepid Ibex [and now Jaunty Jackelope] users: The prime real estate of the function keys is unavailable without the finger-pain-inducing <fn> + <FUNCTION> key combo. Changes designed to improve functionality for Apple MacBook keyboard users introduced this bug. This was quite frustrating. I had those keys mapped to all sorts of useful life-changing functions.

There is a solution!

[Hardy and Intrepid users:]
Edit /etc/modprobe.d/options, add “options hid pb_fnmode=2″. Then run

1
sudo update-initramfs -u

and reboot. After things are back up, the function keys will act as normal, no more pressing <fn>!

For Jaunty Jackelope (9.10) users:
As it turns out, this bug didn’t get fixed for 9.10. What’s worse: the old fix doesn’t work now! Here’s what you need to do to get the function keys as well as the numpad working.

Numpad

  1. Select System -> Preferences -> Keyboard
  2. Go to Layouts
  3. Click “Layout Options” button
  4. Under “Miscellaneous compatibility options”, select “Default numeric keypad keys” and “Numeric keypad keys work as with Mac”

Now you have a numpad back!

Function keys

I found a comment on this page that said the fix for the function keys was:

  • Edit /etc/rc.local
  • Add:
    1
    echo 2 > /sys/module/hid/parameters/pb_fnmode
  • Reboot

This couldn’t work for me, as the directories from hid down didn’t exist on my system. Instead I did:

  • Edit /etc/rc.local
  • Add:
    1
    echo 2 > /sys/module/hid_apple/parameters/fnmode

    before “exit 0″

  • Reboot

Then the function keys worked as normal!

Tags: , , ,
January 30, 2009 - 11:56 PM Comments (18)

Convenient OS and hardware summary information

There are quite a number of ways to get information on your OS and especially your hardware on a Linux system. Instead of remembering them all and sorting through their output, I put together a pair of functions that provide useful summary information at a glance. While the more detailed tools are indispensable when you need, well, more detailed information, these might fit the bill most often when you just need to find out what sort of system you are dealing with.

OS and Kernel

This function doesn’t show a lot of information, but for me it makes things more intuitive. It took a while before uname came naturally. So I created:

1
2
3
4
5
6
7
function os {
    export OPER_SYS_1="`uname -s`"
    export OPER_SYS_2="`cat /etc/issue | head -n 1`"
    export KERN_INFO="`uname -r`"
    echo -ne "\033[31mOS:\033[0m " &amp;&amp; echo "$OPER_SYS_1, $OPER_SYS_2"
    echo -e "\033[32mKernel:\033[0m $KERN_INFO"
}

Which will give you something like:

Hardware

While there is an obscene amount of information you can gather from Linux about your machine’s hardware, you often don’t necessarily care about most of it. Most often you probably just need basic stats such as total RAM, CPU speed and HDD space. This function will give you that in a compact display. I also threw in some motherboard information because I often need to check the manual for a board online and don’t want to have to open the case just to get the model:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
function hw () {
    export MOBO_MAN="`sudo dmidecode --type baseboard | grep 'Manufacturer' | cut -d' ' -f2-`"
    export MOBO_MOD="`sudo dmidecode --type baseboard | grep 'Product' | cut -d' ' -f3-`"
    export CPU="`cat /proc/cpuinfo | grep 'model name' | cut -d' ' -f3-`"
    export RAM_TOTAL_KB="`cat /proc/meminfo | grep MemTotal | awk '{print $2}'`"
    export HDD_INFO="`sudo fdisk -l | grep Disk | grep -v identifier`"
    echo -e "\033[1;34mHardware\033[0m:"
    echo " * Motherboard:"
    echo "   * Manufacturer: $MOBO_MAN"
    echo "   * Model: $MOBO_MOD"
    echo " * CPU(s):"
    echo "$CPU"
    echo " * Total RAM: $(($RAM_TOTAL_KB / 1024)) MB"
    echo " * HDD info: "
    echo "$HDD_INFO"
    echo
}

The result:

Putting them together

I find I most often want to see information on the OS and hardware together. To achieve that, just create a simple alias such as:

1
alias system="os && hw"

Then simply running “system” will show you basic information about the system you are on. Pretty intuitive!

Notes

  • I made use of the DMI via dmidecode to provide some of the hardware information. Although I have never had any problems with it, it is possible for this information to be inaccurate. From everything I have read, it seems to be reliable on all common Linux systems and platforms.
  • If you run this on, say, a virtual private server (pretty common as a hosting solution), you will likely not have permission to get some of the hardware info, even running it with sudo, simply because of how your VPS is setup. Not much you can do about that, but the commands will still show you what output they can.
Tags: , , , ,
January 3, 2009 - 8:13 PM No Comments

Apple keyboard with Vista

I have taken a definite liking to the newer style Apple keyboard. On the whole, this keyboard works just fine OTB on Vista. But some of the special keys, media ones for instance, do not. This guide introduced me to an amazing little program: SharpKeys. Once you run it, you can select a key (or press a button and then press the key to map), and map that to another key in the list (or again press a button and then press the key to map). So in a few clicks, I had F7-F12 remapped to what I wanted, wrote that to the registry, and voila. You can also remap whatever else you want, of course, like switching the command/Windows key and alt, if you are so inclined.

Tags: , , ,
November 3, 2008 - 12:16 AM Comment (1)

Twitter links powered by Tweet This v1.6.1, a WordPress plugin for Twitter.