Sunday, February 15, 2009

jerky green video output with mplayer and xv

After an upgrade to Ubuntu Jaunty, my mplayer video output (using -vo xv) was completely green and jerky. It turned out that during the upgrade apparently the proprietary nvidia driver was disabled. You simply need to reenable it at System -> Administration -> Hardware Drivers and reboot to fix the problem.

ssh connect error

error:
buffer_get_ret: trying to get more bytes 4 than in buffer 0
buffer_get_int: buffer error


Seems to have something to do with the public key.
It helps to remove ~/.ssh/id_dsa* (or the whole ~/.ssh directory if you want to be sure).

This appeared to me only after the upgrade to Ubuntu Jaunty, I don't know if it's related or what the correct fix is.

There seems to be a matching bug report here.

Update: Apparently it's fixed by now.

Tuesday, February 10, 2009

Stuttering sound after upgrade to Ubuntu 9.04 (Jaunty)

It turns out that some sound drivers don't work well with PulseAudio, especially regarding the "glitch-free mode". The fix (as described here) is to disable glitch-free:

/etc/pulse/default.pa:

load-module module-hal-detect tsched=0

Afterwards, restart PulseAudio (or simply reboot).

Sunday, February 8, 2009

colorgcc from within SCons error: uninitialized value

Eror: Use of uninitialized value $ENV{"HOME"} in concatenation (.) or string at /usr/local/bin/g++ line 211.

Solution, see here:

Replace

$configFile = $ENV{"HOME"} . "/.colorgccrc";

with

my($found_HOME) = 0;
while (my ($key, $value) = each (%ENV))
{
if ($key =~ /HOME/)
{
$found_HOME = 1;
last;
}
}

if ($found_HOME == 0)
{
$ENV{"HOME"} = "/";
}
$configFile = $ENV{"HOME"} . "/.colorgccrc";

Tuesday, December 23, 2008

Stop blinking WiFi LED on Latitude D630 and Ubuntu

Forum post

Run the following using sudo:

For Ubuntu Intrepid Ibex:

#!/bin/sh
echo none > /sys/bus/pci/drivers/iwl3945/0000:0c:00.0/leds/iwl-phy0:assoc/trigger
echo none > /sys/bus/pci/drivers/iwl3945/0000:0c:00.0/leds/iwl-phy0:radio/trigger
echo none > /sys/bus/pci/drivers/iwl3945/0000:0c:00.0/leds/iwl-phy0:RX/trigger
echo none > /sys/bus/pci/drivers/iwl3945/0000:0c:00.0/leds/iwl-phy0:TX/trigger

echo none > /sys/class/leds/iwl-phy0:RX/trigger
echo none > /sys/class/leds/iwl-phy0:TX/trigger
echo none > /sys/class/leds/iwl-phy0:radio/trigger
echo none > /sys/class/leds/iwl-phy0:assoc/trigger


For Ubuntu Karma Koala you need to add extra colons (thanks to James Becwar!):

#!/bin/sh
echo none > /sys/bus/pci/drivers/iwl3945/0000:0c:00.0/leds/iwl-phy0::assoc/trigger
echo none > /sys/bus/pci/drivers/iwl3945/0000:0c:00.0/leds/iwl-phy0::radio/trigger
echo none > /sys/bus/pci/drivers/iwl3945/0000:0c:00.0/leds/iwl-phy0::RX/trigger
echo none > /sys/bus/pci/drivers/iwl3945/0000:0c:00.0/leds/iwl-phy0::TX/trigger

echo none > /sys/class/leds/iwl-phy0::RX/trigger
echo none > /sys/class/leds/iwl-phy0::TX/trigger
echo none > /sys/class/leds/iwl-phy0::radio/trigger
echo none > /sys/class/leds/iwl-phy0::assoc/trigger

Friday, November 7, 2008

bash arguments and spaces

The showargs command is quite helpful for this. There's an interesting post on the issue here, I'm quoting Brian Dessent:

> I want to pass data arguments to curl using a bash variable instead of supplying
> them explicitly. So I defined a variable, like this:
>
> DOCDATA='-F "title=Hello World!" -F "body=Content goes here."'
>
> however, when I now invoke curl with that variable as an argument, like this:
> curl (url) $DOCDATA
>
> then I will get curl errors:
>
> Connection #0 to host localhost left intact
> * gethostbyname(2) failed for World!"
> * Couldn't resolve host 'World!"'
> * Closing connection #1

This has everything to do with how shell quoting works and nothing to do
with curl. Here's a simplified example that uses a C program "showargs"
that does nothing but print out its argv[]. (I find this program very
useful to keep around because if you have a problematic command you can
simply copy/paste or uparrow and insert 'showargs' at the beginning of
it.)

$ x='a b "c d"'

$ echo $x
a b "c d"

$ showargs $x
argv[0] = 'showargs'
argv[1] = 'a'
argv[2] = 'b'
argv[3] = '"c'
argv[4] = 'd"'

As you can see when the shell expands $x it does not see a string
containing three words, it sees four -- there are simply four things
separated by spaces (or more precisely, IFS.) The shell doesn't
consider quotes as meaningful in this context, so the fact that there
are double quotes inside x doesn't matter.

If you want to force the shell to evaluate x as an expression instead of
simply expanding it into words, then you have to use eval:

$ eval showargs $x
argv[0] = 'showargs'
argv[1] = 'a'
argv[2] = 'b'
argv[3] = 'c d'

But this is a dangerous solution to rely on, because if your "Hello
world" was actually "I have $4 in my pocket", it would be mangled
because now you're telling the shell to not just split words but to
evaluate the string (as if you'd typed it), and it would see $4 as a
variable and try to expand it -- most likely into nothing. So you'd
have to make sure that all of the metacharacters in the text of your
variables are quoted!

This can get very ugly, because essentially what you're doing is
combining multiple words into one word, only to turn right around and
parse them back out into multiple words -- and all the quoting has to be
just right to make that roundtrip correct. It's much simpler just to
use one variable where you intend one word. For example I would have
written:

title='Hello World!'
body="Content goes here."
url="http://foo/bar"
...
curl "$url" -F title="$title" -F body="$body"

Note that when you use a variable that might contain spaces and you
*don't* want it to be split into words, you need to quote it as "$foo".
This allows foo to have spaces in it but still only represent one word,
which is what you want:

$ showargs curl "$url" -F title="$title" -F body="$body"
argv[0] = 'showargs'
argv[1] = 'curl'
argv[2] = 'http://foo/bar'
argv[3] = '-F'
argv[4] = 'title=Hello World!'
argv[5] = '-F'
argv[6] = 'body=Content goes here.'

Sunday, November 2, 2008

Logitech mouse (e.g. MX 500) and Ubuntu

See this forum post.

Most notably, change the protocol in /etc/X11/xorg.conf to "evdev" and run lomoco -8 to increase the resolution to 800 cpi.