Posts Tagged ‘Linux’

Ubuntu on an HP Compaq dx2300 Microtower

Thursday, March 19th, 2009

My new desktop at varsity is, as described in the title, an HP Compaq dx2300 Microtower. First thing I did when I got access to it was, of course, to install Linux – Ubuntu 8.10 in this case. It’s a pretty nice machine (although not particularly high-spec) and pretty much everything worked straight away from install. The graphics card is Intel, so I’m not going to be doing any serious gameplaying (this is a work computer, anyway) but it runs Compiz pretty well. Being a desktop, suspend and hibernate aren’t terribly important, but as it happens they work fine.

The only problem – and this is the main point of this post – was with the soundcard (an Intel HDA). The box has three audio outputs: headphone plugs front and back, and a tinny built-in speaker. Under Ubuntu all three outputs were switched on all the time, and it wasn’t possible to adjust them separately. The purpose of headphones in a shared lab environment is entirely defeated if the built-in speaker is always on! I tried fiddling with all of the multitude of ALSA settings, but nothing worked. It couldn’t have been a hardware problem, because it did the right thing under Windows.

So, the problem was narrowed down to the audio driver, snd-hda-intel to be specific. Some googling established that changing the model parameter to the module might have some effect on the output selection behaviour. Further searching established that the possible values are listed in Documentation/sound/alsa/HD-Audio-Models.txt in the kernel source.

To find out what the possible values are, you have to know which codec your card uses. This you can do by running

cat /proc/asound/card0/codec#0 | grep Codec

For the dx2300 the result was Realtek ALC888. Indeed, under the list of models for the ALC888, there is one called “3stack-hp” for “HP machines with 3stack”. Guessing that this was the correct one, I added to /etc/modprobe.d/alsa-base the line

options snd-hda-intel model=3stack-hp

and rebooted. Hey presto, suddenly the internal speaker switches off when headphones are plugged in.

tl;dr summary: If you have a dx2300 and you’re having problems with the audio under Linux, then add the line options snd-hda-intel model=3stack-hp to the file /etc/modprobe.d/alsa-base (at least in Ubuntu; your distro might put module options in a different file).

HSDPA modem and custom routing

Tuesday, January 13th, 2009

So, for my Christmas present to myself I got a Huawei E220 HSDPA modem – it’s one of the Vodafone-branded ones, but I reflashed it with the generic firmware. Anyway, it’s an awesome thing to have for a geek like me – I can be connected to the Internet at broadband speeds almost anywhere in the city. It’s particularly useful when i’m on campus, so I can avoid the dog-slow UCT internet connection.

Problem is, I’d like to stay connected to the UCT network as well so that I don’t use up my precious* data bundle for UCT services, and this requires a bit of custom routing magic. So I have a script:

#!/bin/sh
GATEWAY=137.158.32.97
route add -net 137.158.0.0/16 gw $GATEWAY
route add -net 192.48.253.0/24 gw $GATEWAY
route del default
route add default ppp0

137.158.0.0/16 and 192.48.253.0/24 are the UCT netblocks, and 137.158.32.97 is the router on the subnet that I’m mostly using at the moment. ppp0 is, of course, the name of the interface associated with the HSDPA connection.

The problems with this script currently are that I have to edit it to change the gateway for each subnet that I’m on, that I have to run it manually each time I connect, and that it doesn’t restore the original routing when I disconnect. The first and third problems should be reasonably easy to solve, but the second will probably require that I dig into the mysterious world of NetworkManager. (Cue dramatic music.)

*It’s ourssss, my preciousss… they wants to take it from us, the nasssty Vodacom…

XRandR – finally, simple monitor configuration for Linux

Thursday, December 6th, 2007

The most recent Linux distribution releases – Ubuntu 7.10, Fedora 8 and so on – are now shipping with version 1.2 of the XRandR extension for the X server. This allows the user to dynamically change resolutions, refresh rates, and – this is the really impressive thing – switch monitors on and off on the fly. All of this, without ever having to edit xorg.conf, or restart the X server, or reboot. This was one of the major things that the Linux desktop lacked compared to other major operating systems.

Until very recently, using my external monitor with my laptop required several irritating customisations – you can see the details in my earlier post:

  1. To have it switch on, and run in Xinerama mode along with my laptop panel, required fiddling with MetaModes and other fiddly settings of the radeon driver.
  2. To drive it at its native resoution (1440×900) i had to add a custom modeline to xorg.conf (except on Fedora, for some reason).
  3. If the X server originally started without the external monitor attached, then it would have to be restarted to detect the monitor once it was attached. And restarting X means having to log out and lose all my application state.

XRandR 1.2 has removed all three of these irritations. It requires (almost) no preconfiguration, autodetects all resolutions correctly, and detects monitors when they are plugged in without a restart.

Let’s take a brief look at some of what XRandR can do: this is basically what I do with it daily. Note that at the moment graphical tools to control XRandR are still under development and none are really at a releaseable state (in my opinion); but now that the infrastructure exists in the X server and the drivers, tools to control it will come soon. What I use here is the command-line tool, sensibly named xrandr. (more…)

SCO is bankrupt

Monday, September 17th, 2007

Well, not quite. Remember what I (along with half of the world – I’m not claiming any particular brilliance on my part) predicted a month ago? That SCO would file for Chapter 11 bankruptcy protection? Well, it’s happened. Hopefully we will soon be seeing the last gasps of SCO.

In other news: Microsoft loses anti-trust appeal. All in all, a bad day for IP trolls and monopolists.

SCO share price

Tuesday, August 14th, 2007

With regard to the SCO v. Novell ruling, I think this says it all:

SCOX price

SCO lost two-thirds of its value over the weekend after the ruling. It might not be long before they file for Chapter 11 bankruptcy, I imagine.

CLUG in LinuxFormat!

Thursday, July 5th, 2007

This is actually quite old news, but I’ve only got around to blogging it now. CLUG, my local Linux Users Group, was featured as “Overseas LUG of the month” in Linux Format magazine’s May issue:

CLUG in LF (click to expand)

GPL 3.0

Saturday, June 30th, 2007

highvoltage has already blogged about it, but I just wanted to remark upon the launch of the GNU GPL version 3.0. Reading those words

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

was quite disturbing. Not in a bad way; it just felt really weird to see the number 3 there. Ever since I’ve been involved with free software, the GPL has been at version 2. I can’t count the number of times I’ve copied those familiar paragraphs into the beginning of a source file, or that familiar COPYING file into a new project.

Other than that, I’m quite happy with the new license. Despite the FUD that has been spread about it, it actually seems perfectly reasonable. The new anti-”tivoisation” and patent licensing clauses are appropriate to the aims of the FSF. True, they inconvenience the “corporate open source” world, which sometimes seems to want to use free software for the convenience while actually avoiding granting users the freedoms we expect. I don’t see this as a problem.

The biggest problem I do see is that GPLv2 and GPLv3 are mutually incompatible. We already have so much trouble with incompatible licenses between different bits of free software with essentially similar licensing goals and it’s irritating that we now have another incompatibility to deal with. (On the other hand, GPLv3 is now compatible with the Apache License, which is an improvement.)

How to make ThinkPad volume keys work properly in Kubuntu

Monday, April 2nd, 2007

I really like Ubuntu. I mean, I really, really like it. But it exhibits one really irritating behaviour on most IBM/Lenovo ThinkPads. You see, ThinkPads (except for some in the R series) have a hardware sound mixer, and the volume control buttons operate the mixer directly in hardware, without any interaction from the operating system. This is unusual; most other laptops have software buttons which the OS must interpret and use to control the software mixer.

Now, on most distributions, I would just run tpb, and it gives a little on-screen display when I press one of the buttons. Ubuntu, however, is different. It has a special hotkeys subsystem which interprets the button presses on all sorts of laptops and passes them to a generic control program. Unfortunately, this system doesn’t know that the ThinkPad interprets the keys on its own; so every time you press a volume key, it gets interpreted in hardware and in software. This is really irritating, because the volume jumps in huge steps every time you press the button. And if you change the volume in software, they get out of sync and it all gets really complicated.

The appropriate behaviour, of course, would be to just display a notification without changing the software mixer’s volume; and I hope the Ubuntu folks will eventually implement this. For the meanwhile, anyway, there is a fix at least for Kubuntu. (Sorry, GNOME users, I don’t know what the equivalent solution is for you).

  1. Install the package kmilo-legacy.
  2. Arrange to have read access to the device /dev/nvram. On Feisty, at least, this required setting up a custom udev rule by creating a file /etc/udev/rules.d/50-user-custom.rules with contents KERNEL=="nvram", MODE="0664" and running chmod 0664 /dev/nvram to fix the permissions without rebooting.
  3. Run kcmshell thinkpad, and then tick the “Run Thinkpad Buttons KMilo Plugin” option and untick the “Change volume in software” option.
  4. Remove the file /usr/share/services/kmilo/kmilo_generic.desktop. (Or move it somewhere else, or rename it to something that doesn’t end in .desktop, or whatever else will stop KDE from seeing it.)
  5. Log out and log in again.
  6. Voila!

One useful side effect is that you will now get on-screen notifications when the other ThinkPad special buttons – like the brightness controls, the ThinkLight button, and so on – are pressed.

Another reason I can’t use Windows

Monday, April 2nd, 2007

This is a rant. It’s, hopefully, not a biased Linux fanboy rant; rather, it is a reasonable description of yet another problem with Microsoft Windows. The problem is CPU scheduling. Windows’ CPU scheduler simply can’t cope properly with running CPU-intensive processes concurrently with interactive processes. A few days ago, I was in Windows with iTunes ripping a CD and encoding to AAC, and I was trying to surf the web simultaneously. It was impossible; Internet Explorer was completely unresponsive – it would take several minutes from clicking on the “new tab” button to seeing a new tab appear.

Later that day I was doing the same thing, but in Linux – using Banshee to rip and encode the same CD to AAC (I would use OGG if I didn’t have an iPod). I was also surfing the web with Epiphany, and there was no noticeable slowdown in the web browser. No doubt the ripping/encoding process took a little longer because of the CPU time provided to other processes; but I imagine that most users would rather have their backround tasks take a little longer in return for being able to carry on using the computer while they run.

This is something where Linux really excels: the scheduler is really very good. Windows’ is simply pathetic, and completely unsuited for an interactive system (which doesn’t really make sense, since Windows has never been used as a batch system, as far as I know!).

Ubuntu + widescreen monitor + radeon + AIGLX + beryl

Sunday, December 17th, 2006

Wohoot! I’ve finally managed to get my 1440×900 widescreen monitor working with the open-source radeon (r300) driver instead of ATi’s proprietary fglrx driver. Turns out I just needed the right “Device” section:

Section "Device"
Identifier "ATI Technologies, Inc. M22 [Radeon Mobility M300]"
Driver "ati"
BusID "PCI:1:0:0"
Option "DDCMode" "true"
Option "MonitorLayout" "LVDS, TMDS"
Option "MergedFB" "true"
Option "MetaModes" "1024x768+1440x900"
EndSection

and, especially, a special modeline for the 1440×900 mode:

Section "Modes"
Identifier "Modes"
Modeline "1024x768" 76.16 1024 1080 1192 1360 768 769 772 800
Modeline "1024x768" 64.11 1024 1080 1184 1344 768 769 772 795
Modeline "1440x900" 100.000 1440 1456 1464 1480 900 916 924 940 -hsync -v
sync
EndSection

and then the right display settings:

Section "Screen"
Identifier "Default Screen"
Device "ATI Technologies, Inc. M22 [Radeon Mobility M300]"
Monitor "Generic Monitor"
DefaultDepth 24
SubSection "Display"
Depth 24
Modes "1440x900" "1024x768"
Virtual 1440 900
EndSubSection
EndSection

Even better, AIGLX compositing just works with the open-source drivers; so after installing Beryl I have all the fancy window effects without the hassle and complication of running the Xgl server that you have to use with the fglrx drivers. Admittedly, 3D is somewhat slower with the open-source drivers than it was with the ATi drivers, but it’s not as if I use 3D stuff a lot.