Thursday, July 31, 2008

Getting the Touchpad to work in Slackware!

This is how I got the touchpad on my laptop to work using synaptics.

After installing synaptics, the following lines have to be added to /etc/X11/xorg.conf. Before fiddling with xorg.conf, it is always suggested that you take a backup of the file -

# cp /etc/X11/xorg.conf /etc/X11/xorg.conf.old

The lines to be added to xorg.conf are as follows -

Section "Module"
Load "synaptics

Then in the "InputDevice" Section -

Section "InputDevice"

Identifier "Synaptics Mouse"
Driver "synaptics"
Option "Device" "/dev/psaux"
Option "Protocol" "auto-dev"
Option "HorizEdgeScroll" "0"
Option "LeftEdge" "1700"
Option "RightEdge" "5300"
Option "TopEdge" "1700"
Option "BottomEdge" "4200"
Option "FingerLow" "25"
Option "FingerHigh" "30"
Option "MaxTapTime" "180"
Option "MaxTapMove" "220"
Option "VertScrollDelta" "100"
Option "HorizScrollDelta" "100"
Option "MinSpeed" "0.09"
Option "MaxSpeed" "0.18"
Option "AccelFactor" "0.0015"
Option "SHMConfig" "on"
Option "TapButton1" "1"
Option "TapButton2" "2"
Option "TapButton3" "3"


Then in the "ServerLayout" Section

Section "ServerLayout"

Input Device "Synaptics Mouse" "CorePointer"


After this reload the "psmouse" module as follows -

$ sudo modprobe -r psmouse
$ sudo modprobe psmouse

This should be added to your startup scripts.
The touchpad should be working after you reboot.

Sunday, July 20, 2008

Command Line Music Player!

mpg321 can be used to play mp3 files from command line. We can even create a playlist of all the songs stored in various directories and play the list via mpg321. If your songs are stored in various folders, the folder names can be appended to the file-names using the following script. First of all the spaces have to be removed from the file names (as described in a previous post). Then we can create the following script -

for i in *;
b=`echo $PWD\`$i;
echo $b >> playlist; # the file names are stored in "playlist"

this way the names of all the files in all the subdirectories will be stored in "playlist" along with the appropriate path. Then we can play the list
as follows -

$ mpg321 --list playlist -z # -z for shuffle mode

That is it! Enjoy your music! Here we are assuming that all files are stored in various subdirectories of one parent directory, say 'music'. The script has to executed from the directory 'music'.

Samsung ML 2010 on Slackware 12.1

The Samsung ML 2010 is automatically configured on Ubuntu, however on Slackware 12.1, the Samsung Unified Driver fails to install with the following error -

Unable to restart cups, script not found.

After going through the install script in the cdroot/Linux directory created by untarring the driver, if found that the para - restart-cups() in the script reads as follows -

elif test -e /etc/init.d/cupsys; then

it is obvious that the installer wouldn't work. So I changed it to

elif test -e /etc/rc.d/rc.cups; then

Moreover, the driver to be used for this printer is the one for 2150 and not 2010, that is the right driver is ML-2150 SPL II instead of ML-2010.

Saturday, July 19, 2008

Removing spaces from file names!

The following script, which I found here after an hour of googling, can be used to remove spaces and replacing them with any character (like '_') from file names

$ for f in *; do
> file=$(echo $f | tr ' ' _)
> [ ! -f $file ] && mv "$f" $file
> done

Command line utility to print a Calendar

$ cal

will print out a calendar for the current month on the screen.

$ cal 2008

will do the same for the year 2008.

$ cal 03 2008

will do the same for the month of March, 2008. If, however, we want to print the calendar as a .ps file, we can use the pcal utility.

$ pcal -w 2008 -s 0:0:0 -P a4 >

We can convert this .ps file to .pdf using

$ ps2pdf 2008.pdf

Command Line Calculator!

To do small calculations without starting your calculator utility here is a small trick. Suppose you want to multiply 2 and 3, do this -

$ echo $[2*3]

However if you wanted to divide 2 by 3

$ echo $[2/3]

would give a '0'.

We can still make use of the command line to get the correct answer. We have to use 'bc'. Like this -

$ echo '2 / 3' | bc -l

Here is the output -


Friday, July 18, 2008

Magic Keys (Alt + SysRq)

When your Linux install completely refuses to respond and no amount of coaxing and cajoling brings it back to life you can try -
  • Alt + SysRq + k
This will kill all running programmes and will drop you back to the login screen.

Even this fails? The try this -

  • Alt + SysRq + r + e + i + s + u + b
This is easy to remember with the help of the mnemonic "Raising Elephants Is So Ultra Boring".

Explanation -
  • Alt + SysRq + r = raw keyboard mode
  • Alt + SysRq + e = ends all programmes
  • Alt + SysRq + i = kills all programmes that did not terminate nicely
  • Alt + SysRq + s = syncs the disks
  • Alt + SysRq + u = remounts all filesystems as read-only
  • Alt + SysRq + b = reboots
But for this to work two things are required
  1. Your kernel must support magic keys
  2. The following line must be appended to /etc/sysctl.conf
  • kernel.sysreq=1
So when your Linux box simply refuses to respond (yes, even a Linux box does sometimes act up), you can safely tide over the situation if you follow these instructions.

Thursday, July 17, 2008

How I configured Wireless Internet on my Slackware 12.1 installation!

I have a Broadcom Wireless card on my Acer Aspire 5100 laptop running Slackware 12.1.
This is how I configured a wireless network -
  1. Downloaded and installed ndiswrapper from Linuxpackages site.
  2. Copied the card drivers from Windows. The drivers are bcmwl5.inf and bcmwl5.sys.
  3. Then I installed the drivers using ndiswrapper as
    $ ndiswrapper -i bcmwl5.inf
  4. To check whether the drivers have been properly installed, issue the following command
    $ ndiswrapper -l
    the driver should be listed here.
  5. Then we have to make sure that /etc/rc.d/rc.netdevice loads ndiswrapper
  6. Edit /etc/rc.d/rc.inet1 to incorporate the wireless card details like essid, key etc.
  7. unload the following modules - b43 and ssb using the following commands
    $ sudo modprobe -r b43 ssb
  8. Load bcm43xx and ndiswrapper
    $ sudo modprobe bcm43xx
    $ sudo modprobe ndiswrapper
  9. Restart the network as
    $ sudo /etc/rc.d/rc.inet1 wlan0_restart
  10. Bring up the wlan0 interface as follows -
    $ sudo ifconfig wlan0 up
That's it. The wireless internet connection was up and running!

Using ffmepg to convert a '.rm' file to '.mp3' format

Ffmpeg is a nifty command line utility. Among the various things it can do, converting a '.rm' file to '.mp3' format is one. I was looking for a utility to convert a beautiful Telugu song in .rm format to .mp3 format. Ffmpeg came to my rescue.

I keyed in the following in a terminal and I was through in a jiffy -
    $ ffmpeg -i filename.rm filename.mp3