Firefox plugin woes

The PackageKit browser plugin hasn’t had a lot of love recently. It was written in C++ a few months ago by Owen, but started to bitrot over the last few xulrunner releases.

I’ve spruced up the code, and ported everything to C (using GObject where possible) and now it all seems to work with one exception: invalidaterect doesn’t seem to work where I think it’s supposed to.

I’m setting up the plugin with some default content, which gets shown to the screen. I’m then doing a PackageKit query, and a few ms later I get the results. I then update some internal state, and call the invalidaterect for the whole drawing area, expecting a GraphicsExpose event to render the new content. But alas, invalidaterect seems to do nothing.

I’ve even tried adding a forceredraw call after invalidaterect, but that also gets ignored. If I manually resize the epiphany/firefox window then the GraphicsExpose event gets called, and the plugin then shows the correct state. This is a windowless plugin and nsplugginwrapper has been removed, and so I think I’m doing everything by the book, so to speak. Help welcomed, and anyone pointing out the bug will be rewarded with a beverage of your choice. Code is here. Thanks.

Updating shared libraries

I want to add functionality to PackageKit to detect when a new version of a shared library is installed, and there are applications still using the old version that no longer exists. We can then inform the user if they need to restart the computer or log off and back on if the library was updated for a security vulnerability.

Does anyone have any example code (preferably written in C, although I’m not that bothered) that I could use? I think this would be quite nice functionality in future versions of PackageKit.

Thanks.

HALectomy of gnome-power-manager complete

This morning I committed a rather largish (23 files changed, 28 insertions, 1551 deletions) patch:

commit f884a1ae954d14928a6a7055d4d4b182fbb2a3bc
Author: Richard Hughes <richard_at_hughsie.com>
Date:   Fri Jul 3 13:49:05 2009 +0100
    HAL is no longer a dependency of gnome-power-manager

This means that gnome power manager in git master no longer needs HAL to compile or run. This is a quite a significant moment, as now it relies just on the thriving DeviceKit* stack, rather than the old lumbering HAL.

Just a word of warning: You’ll need DeviceKit-power 009 (released in a few days time) if you want to use g-p-m in git master without loosing your ability to change your backlight, or to set the lid action preferences. It’ll still compile with 008, but 009 is very much recommended.

Dell Mini 10v and the touchpad of death

The Dell Mini 10v does have a very nice keyboard. But then it also has a very bad mousepad. The buttons are actually on the trackpad, so if you click you end up moving, or if you’re dragging you end up shooting across the screen. Pain.

Anyway, there’s a fairly nice workaround by setting the System->Preferences->Mouse values to “Scrolling: disabled” and enabling “Mouse clicks with the touchpad“. All you have to do then is remember not to click the physical buttons, but tap instead. Not perfect, but saves you wanting to hurt someone. Bug for a proper fix is filed here.

Dell Mini 10 and BCM4312

I’ve just been bought a Dell Mini 10 by my employer, Red Hat.

I’ve wiped Ubuntu, and installed Fedora 11 on the machine, as it’s what I’m familiar with, and the kernel seems to be a bit more up to date than what it came with. Kudos to Dell for shipping with any Linux, I’m sure most people don’t care that much what “version” of Linx they are using.

Now, the interesting part: most stuff “just works”. The screen is fantastic, the keyboard is pretty good considering it’s so small, and the backlight seems to DTRT. It also weighs about one thousandths of a gram, or something in that order or magnitude.

Now, what doesn’t work: the Broadcom BCM4312 network device. Now, somebody has reversed engineered the Broadcom hardware and has published really good specs about the 43xx hardware, and the 4312 is no exception. The 4312 seems to be a LP PHY, so a little different than what the kernel knows about already. There’s already enough code in the wireless-testing kernel tree thanks to Michael Buesch (but EXPERIMENTAL and BROKEN) to get the chip operational, and recognised by NetworkManager, by alas, 95% of the setup code is needs to be written.

Now, all it would take is for a couple of expert network hackers to take the spec, and implement the engine setup in a few days of hacking. Unfortunately for me, I’m no network hacker, and am crazy busy with PackageKit/DeviceKit/PolicyKit work. That said, if no-one steps up to the mark in the next few weeks, I’ll have a go and submit some patches.

There’s also the firmware issue. Using b43-fwcutter I can get working firmware, but this doesn’t feel very “Fedora” as you have to use the Windows non-free driver and cut the binary data from it. I’ve tried to push through the open firmware package into Fedora, but this only supports a few of the older Broadcom cards. It wouldn’t take much to add support for the newer cards, although that’s probably a task for someone very familiar with the hardware, like for instance, Broadcom.

Now, Broadcom, I’m sure the open source community would really appreciate an engineer-day per week (I guess circa $12,000pa plus some good PR) for the open drivers and firmware. If that were to happen, and Linux support for Broadcom networking goes from 10% done to 90% done, I’m sure a whole lot more vendors would ship with your hardware inside. Whether or not that would translate to greater than $12k’s extra profit is left as an exercise for the reader.

For me, so the notebook is at least useful, I’ve replaced the Broadcom card with an Intel 5100AGN mini PCIe half height card with free drivers and distributable firmware. It cost £10, brand new.

I’ll still be testing the Broadcom free b43 driver, and hopefully be hacking on b43 in a few weeks if nobody beats me to it and my TODO list reduces in size.

edit: I’ve been informed the specs are not by Broadcom, they are reversed engineered. Wow.

abrt and pk-debuginfo-install

Recently I’ve been looking at the abrt project. It’s looking pretty good so far, with one notable exception: Currently they install the debugging packages using the Fedora script debuginfo-install, and scrape the standard out for errors, and inject to standard in an unconditional ‘Y’ to anything that looks like a question. The script is also used by gdb to ask the user to install certain debuginfo packages. It’s not great form to ask the user to run a random command, when the program is more than capable.

Program received signal SIGINT, Interrupt.
0x00a63422 in __kernel_vsyscall ()
Missing separate debuginfos, use: debuginfo-install DeviceKit-003-1.i586 DeviceKit-power-009-0.74.20090628git.fc11.i586 GConf2-2.26.2-1.fc11.i586

Now, some explaining. Fedora stores debuginfo packages in separate debuginfo repositories. This means the install-debuginfo script has to enable sources, get the deps of the packages to install, and install as many of the debuginfo packages as it can find, and then disable the sources it enabled. This is all horribly Fedora specific, and of course has to be done as root.

[hughsie@hughsie-laptop src]$ debuginfo-install DeviceKit-003-1.i586 DeviceKit-power-009-0.74.20090628git.fc11.i586 GConf2-2.26.2-1.fc11.i586
You must be root to run this command.

For a cool trick, I’ve make a PackageKit version of this script, called pk-install-debuginfo. It does exactly the same thing as the Fedora debuginfo-install script, but runs as the user and uses all the PK methods underneath the hood. So in theory pk-install-debuginfo would run on Kubuntu or on Foresight (or the others too) with a little tweaking.

[hughsie@hughsie-laptop ~]$ pk-debuginfo-install DeviceKit-003-1.i586
1. Getting sources list...OK. Found 10 enabled and 29 disabled sources.
2. Finding debugging sources...OK. Found 4 disabled debuginfo repos.
3. Enabling debugging sources...OK. Enabled 4 debugging sources.
4. Finding debugging packages...OK. Found 1 packages:
5. Finding packages that depend on these packages...OK. No extra packages required.
Found 1 packages to install:
1    DeviceKit-debuginfo-003-1(i586)    fedora-debuginfo
6. Installing packages...OK.
7. Disabling sources previously enabled...OK. Disabled 4 debugging sources.

Except it won’t, as other distros do things differently. I’m guessing some store the debuginfo files in the main repositories (and hence no sources need to be enabled), and some others call the files -dbg rather than -debuginfo. So now I need your help. If your distro does things differently from the Fedora way, please tell me how, and I’ll add support for it in pk-install-debuginfo.

Of course, if the sources are signed and no repos need to be enabled, then things just install without authentication. This is how it’s supposed to work. I’ve also added a man page and I’ll be adding a config file for pk-install-debuginfo soon.

Of course, if you don’t like the idea, just pass –disable-debuginfo-install to the configure script when compiling PackageKit. Comments welcome.

gnome-power-manager and multiple batteries

In times of 2-21 to 2-25, gnome-power-manager maintained an big fat elaborate cache of power devices and combination devices which was populated by HAL. This allowed us to have “virtual” devices such as multiple composite laptop batteries. This abstraction sucked and made some horrible assumptions about devices. And it was slow.

These virtual batteries were used for policy, and generally multiple batteries sort-of-just-worked, with a few random things happening when the engine virtual layer fell down. I couldn’t test virtual devices, as my Toshiba only had one battery with no expansion available, so I relied on random patches from strangers.

Fast forward to last-week/2-26/DeviceKit. Now gnome-power-manager had a very small new ‘thin’ engine with all the devices supplied by DeviceKit-power. Batteries, on the whole were a whole lot more predictable, and the architecture was at last fairly sane. I had now got a nice shiny Thinkpad, still with only one battery, but with extra space for another. But wait, I know what you are thinking; Thin engine means no composite devices, which makes people with multiple battery laptops sad.

Fast forward to this weekend/2-27/DeviceKit. My ultrabay battery arrived in the post from the US (with customs charge, bahh) which I plugged in to the Thinkpad. Much hacking was done, and a few changes (related to empty batteries) went into DeviceKit-power and a few changes went into gnome-power-manager. Now we have a composite store with a thin engine, so the best of both worlds.

So, long story, short: if you have laptop with multiple batteries and your experience with gnome-power-manager sucks, update to git versions of DeviceKit-power and gnome-power-manager. I’ll be making releases later this week, and backporting to stable once it’s had some testing.

Does your project use PackageKit?

Yesterday, somebody asked me on IRC if there was a list of projects using PackageKit. I said no. I’m now adding a section on the website with just this content.

So, please send an email to me or the mailing list if your project is using PackageKit BY DEFAULT. This doesn’t mean “can be installed on”, but means “is usable when freshly installed”. I think it makes sense to add projects like nautilus that hook into the session interface too.

So far we’ve got replies from Fedora, Foresight, Moblin and Kubuntu. If you’re interested, please follow the instructions here or email me off-list. Thanks.