Category Archives: Linux

US date in a GB configured fedora system

I think this is probably a bug in FC4, even after you install with a GB setup you still get a US date in some apps such as firefox. To resolve this (it’s quite easy), simply replace en_US in your /etc/sysconfig/i18n file with en_GB. You’ll probably need to restart your system before the change takes effect, but it seems to fix all your LC_ environment variables also which is nice.

Radeon 7000 TV Out on Linux

If you want to get TV out to work on Linux on Radeon 7000, don’t bother with all those little tools and things (unless you want something other than ‘clone’ mode). Simply plug in your svideo cable and use the ‘vesa’ driver for X rather than radeon. I tried for a long time to find the right modeline to use but couldn’t get it to work. However, I’ll try some more later on, chances are I might be able to find the current modeline from the vesa driver and use it on the radeon/ati one.

update: I’ve bought an Nvidia geforce 4 mx with tv out for the machine as ati only offer proprietry drivers for radeon cards 8000+, which the radeon 7000 isn’t, and I simply had enough as this solution only cost £7 from ebay and it’s probably a better one as you can do alsorts with their driver.

Super conversion script

I’ve written a script to convert .flac files to .mp3 and retain a useful directory structure. This is mad-handy for my w800i phone.


source_path="${1%/}/";
dest_base="${2%/}/";
bit_rate=$3

if [ ! -r "$source_path" ]; then
echo "Source path not found."
exit 2
fi

if [ ! -r "$dest_base" ]; then
echo "Destination base path not found"
exit 2
fi

if [ ! $bit_rate ]; then
echo "No bit rate specified, defaulting to 128kbps"
bit_rate=128
fi

artist_album=`echo "$source_path" | sed 's:^.*/\([^/]*/[^/]*/[^/]*\)$:\1:'`
dest_path="$dest_base$artist_album"

# Check out source dir
if [ ! "$(ls -A "$source_path"*.flac )" ]; then
echo "No .flac files found in source path."
exit 2;
fi

cd "$source_path"
ls | grep .flac | while read file ;do
# Each flac
title=`metaflac --list --block-type=VORBIS_COMMENT "$file" | grep "TITLE=" | sed "s/comment\[0\]: TITLE=//g" | sed "s/^ *//g"`
artist=`metaflac --list --block-type=VORBIS_COMMENT "$file" | grep "ARTIST=" | sed "s/comment\[1\]: ARTIST=//g" | sed "s/^ *//g"`
tracknumber=`metaflac --list --block-type=VORBIS_COMMENT "$file" | grep "TRACKNUMBER=" | sed "s/comment\[2\]: TRACKNUMBER=//g" | sed "s/^ *//g"`
tracktotal=`metaflac --list --block-type=VORBIS_COMMENT "$file" | grep "TRACKTOTAL=" | sed "s/comment\[3\]: TRACKTOTAL=//g" | sed "s/^ *//g"` album=`metaflac --list --block-type=VORBIS_COMMENT "$file" | grep "ALBUM=" | sed "s/comment\[4\]: ALBUM=//g" | sed "s/^ *//g"`

echo "Converting: $artist - $album [$title]"
flac --silent -d "$file"
wavfile=${file%.flac}.wav
newfile=${file%.flac}.mp3
lame --quiet --tt "$title" --ta "$artist" --tl "$album" --tn $tracknumber --preset "$bit_rate"kbps "$wavfile" "$newfile"
done

rm *.wav
mkdir -p "$dest_path"
mv *.mp3 "$dest_path"

exit 0;

By no means perfect, but it does work. You will need flac and lame installed for this to work. Comments/suggestions welcome!

Suspend S3 on IBM Thinkpad R50e

Well, this one has had me stuck for ages…but Antoine from the linux-thinkpad mailing list managed to help out (thanks v.much!).

This mini-howto should help you get suspend working on your R50e, and perhaps many other laptops with the intel extreme graphics 2 chipset. The main problem is that the display is not restored properly or at all and you’re left with a blank screen.

Another symptom (that I was having) which was really frustrating me was I was left with a

Stopping tasks========

Screen when I hit Fn to resume, also the suspend light stayed on and the whole laptop was locked up. The reason for that was because I had the s3_bios= kernel param in my grub.conf, make sure you remove this.

Also, I’ve read that you’re not supposed to have any kind of framebuffer in your kernel or as a module…even un-loading the fb module won’t help; so make sure you remove all traces of framebuffer stuff from your kernel if it’s compiled in, or alternatively make sure the modules aren’t loaded on boot.

Ok? Right then. Read this guide:
How to make ACPI work

Make sure you don’t do this, it’ll cause symptoms of annoyance as described above:

acpi_sleep=s3_bios

Ok, so now check that we’ve got ACPI working.

As root:
dmesg | grep supports
and you should get this:
ACPI: (supports S0 S3 S4 S5)

Even if you don’t get that, you might as well try it. Here’s the script:

#!/bin/bash

chvt 1
cat /proc/bus/pci/00/02.0 > /tmp/video_state
sync
#------------------- [ Enter Sleep Mode ] -----------------------------
hwclock --systohc
echo -n 3 > /proc/acpi/sleep
hwclock --hctosys
#---------------------------------------------------------------------------
cat /tmp/video_state > /proc/bus/pci/00/02.0
chvt 7
rm /tmp/video_state

That also prevents the clock from drifting.

I’ll be updating this guide a bit when I have time.

Jabber (not the hutt)

People ought to stop using MSN. Did you know that Microsoft legally own everything you write on there? Start using the Jabber IM protocol. There are various clients out there for windows, one of them is called exodus which looks alright. Myself, I use gaim, which is primarily a linux client although I think there may be a windows version around.

It’s a good idea to start using something else, otherwise you’ll find microsoft taking over your lives even more.

Oh, my login on jabber is johnrhunt incase you were wondering.

Wireless networking in Gentoo

This is a work in progress
Fire up dhcp on the wireless interface: dhcpcd eth1
(that should create the device also kinda thing)

The init script (/etc/init.d/wireless)

#!/sbin/runscript
# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

depend() {
before net.eth0
}

start() {
#! /bin/sh
# wifi: wpa_supplicant init
echo " * [Wifi]: Enabling WPA supplicant..."
if [ -x /sbin/wpa_supplicant ]; then
wpa_supplicant -B -i eth1 -c /etc/wpa_supplicant.conf -D ipw -w -dd
dhcpcd eth1
fi
}

stop() {
echo "Stop doesn't work yet!"
}

restart() {
echo "Restart doesn't work yet!"
}

rc-update add wireless default

Then we configure /etc/wpa_supplicant.conf


#CONFIG_CTRL_IFACE=y
ctrl_interface=/var/run/wpa_supplicant

network={
ssid="home"
scan_ssid=1
proto=WPA
key_mgmt=WPA-PSK
psk="somepass"
}

Then hope for the best I guess!

Cool ideas for laptop

I’m getting a laptop soon, so I thought I’d jot down some ideas for work/home interoperability. If that is a word.

  • Cron job or something that tries to ping servers LAN address, if it can then mount server shares
  • If ping fails then have a go at creating ssh tunnel and mount the shares

As usual, I found that there’s already about 100 programs that do this sort of thing. I’ll just wait till I actually get the laptop.