October will be a month full of events:
- On 17th, October, I’ll be (hopefully) in Pisa attending the nss06 conference;
- On 24-25-26th October I’ll attend a VoIP & Networking conference in Bari, at the Sheraton Hotel;
- On 28th October I’ll hold a talk in the italian linux day, probably about vectorial graphic using inkscape.
If you’ll be in one of these events please let me know!
WARNING: long post
I bought my first laptop: an IBM ThinkPad R50e (I found only an italian page for this model, sorry me, but I guess there’s a translation somewhere over the IBM’s site). It has all the things I need withouth any esotic component. So I started hacking it…
The debian’s installation worked well (with testing netinstaller) and I hadn’t any problem. The only think you should keep in mind when configuring xorg is to use this in the video section:
Section "Device"
Identifier "Intel Corporation 82852/855GM Integrated Graphics Device"
Driver "i810"
Option "VBERestore" "yes"
Option "Clone" "true"
Option "MonitorLayout" "CRT,LFP"
Option "DevicePresence" "yes"
EndSection
In this way you’ll have the monitor port working (for example if you want to connect the laptop to a video projector).
The first thing I wanted to make work has been the software suspend feature (I’m not talking about the ACPI sleep state, or as it is commonly named “stand by”, but a real suspend-to-disk feature).
This can be accomplished in several ways, but usually with swsusp (that’s kernel integrated since 2.6.12 if I recall correctly) or suspend2. With a default setup it doesn’t always work; the shutdown process works well, but the resume hangs when restoring ACPI interrupts. I tried both ways, with suspend2 it never worked: when resuming it hangs at “copying original kernel back”. With swsusp you have to exclude some drivers in order to don’t always hang. First of all, remove rtc (real time clock) support. With it enabled I get crashing more often than I need. Then don’t use intelfb: although it should be supported, the swsusp with this module loaded works one out three times. I had some crashes withouth 3D acceleration enabled too (but just load i915 and everything goes ok).
Then I tried to make something cool with the thinklight. There’s already something really cool out there (rocklight over everything). But I did something cooler: every key I press makes the thinklight blink. That’s not useful, nor mindsane, but definitely geek. That’s done through a kernel patch over the keyboard driver. As soon as I finish to do some checks I’ll publish the patch here.
About the wireless card: I can’t get it in monitor mode by using vanilla kernel sources. If you want monitor mode, use ipw2200 and ieee80211 from sf.net (http://www.ieee80211.sf.net and http://www.ipw2200.sf.net) but they’re not so stable. I keep losing 10-15% of wireless packets with them. There’s not monitor mode, but since I never done wardriving (and I don’t plan to make it), I think it’s good for me.
And if you want to make something cool to show to the friends, then install fluxbox and 3ddesktop and bind /usr/bin/3ddesk to some key: that’s what will bring your friends to linux.
If we talk about gcc extensions then probably we shouldn’t talk about likely/unlikely functions. But since they are widely used into the GNU/Linux kernel, they are much more than strictly related.
In the truth, they are not functions, but macros. Let see how they’re defined:
#define likely(x) __builtin_expect(!!(x), 1)
#define unlikely(x) __builtin_expect(!!(x), 0)
You can see these lines in include/linux/compiler.h into your kernel sources. As you can see, likely and unlikely are just macros, the real gcc extension is __builtin_expect.
Pratically talking, __builtin_expect is a way to say to gcc that such condition is easier to happen then another (this is usually called branch prediction) and is needed to optimize the code (a jump, or better, an IP changement, takes a lot of cpu cycles, so if you can, optimize it).
With 1 we say that the if branch is more probable than the else one. While, on the other side, with 0 we say that the else branch is more probable than the if one.
That said, this means that if we know that an if (or an else) is much more probable to happen, we should use such macro.
Please note that we’re talking about kernel code that needs to be extremely optimized. If you’re writing your own application you probably won’t need to use such extensions since rarely you’ll have to do branch prediction (better, the compiler should do this for you).
If you bought a SoundBlaster Live! 24 bit and you wanted to use its AUX input under linux then you probably noticed that alsa’s driver (ca0106) doesn’t provide such functionality.
Adding it is not a real issue, pratically the card has three inputs:
- microphone
- line in
- input
Those inputs are mutually exclusive since they uses the same channel. Pratically talking this mean that they cannot operate simultaneously, and making the AUX working is just a matter of enabling/disabling the pipe against its controller.
Here there is a patch against linux kernel vanilla 2.6.16-rc1. The only issue I found is that if anyone uses the AUX, there’s some background noise but I’m still trying to figuring out if this issue comes from the TV card that’s attached to or from the patch itself.
Please note that this patch needs testing: if you can test it let me know both if everything goes ok and if something goes wrong.