Archive for the ‘Hacks’ Category

forked-daapd: FreeBSD & kFreeBSD port completed

Tuesday, January 12th, 2010

Mostly an update to my previous post on the subject, I’ve just completed the FreeBSD port. It also builds and runs on GNU/kFreeBSD, by the way.

The filescanner for forked-daapd on FreeBSD is now up to par with its Linux counterpart, as much as possible. Contrary to the latter, it will lose some metadata (play count, for instance) when files get moved around, because it’s not possible to track moves and renames accurately. It also performs more rescans than the Linux/inotify implementation. Still, it works just as good.

On a related note, the machine I tried to install FreeBSD 8.0 on and finally ended up installing GNU/kFreeBSD on just seemingly committed suicide. I’m not sure what message it’s trying to send me. It’s previously been my main workstation for the best part of 10 years, so this is a bit sad.

At least I found some bugs in the process and fixed some too:

  • 2 bugs in forked-daapd, one of them a crasher,
  • a bug in Avahi on kFreeBSD,
  • a bug in GRUB2 as used on the kFreeBSD daily d-i images.

Not bad, is it?

forked-daapd: porting to FreeBSD

Saturday, January 9th, 2010

Since I released forked-daapd, I’ve got a couple of emails about porting it to FreeBSD. Apart from isolating and reimplementing the parts of the code using signalfd and inotify, there isn’t much work to do beside taking care of the usual libc/platform issues. However, when you don’t know the codebase and don’t know the APIs you’re replacing, it makes it a bigger job.

So, I’ve just spent a day going through FreeBSD documentation, installing FreeBSD 8.0 in qemu (because it wouldn’t install on my spare machine due to a bootloader issue that’s at least 5 years old…), and started porting the codebase.

A dozen or so commits later, forked-daapd builds and runs on FreeBSD.

With one caveat: the filescanner doesn’t update the database on the fly when the library directory is modified. While I’ve put in support for kqueue/kevent to replace inotify, it’s only a stub for now. Someone will have to write the code to actually act on the events and trigger the rescans/database updates.

kqueue/kevent delivers a lot less information compared to inotify, which means there’s a lot of work needed to track renames and moves. And I didn’t feel like doing it.

So, FreeBSD users: send patches! :)

VMware Workstation 7.0.0 packaging

Thursday, December 31st, 2009

I’ve spent the last week packaging VMware Workstation 7.0.0 at work. Looking around on the net, I’ve been unable to find anything helpful about packaging this new version, so it seems nobody’s got around to packaging it yet.

I’ve asked our customer for its approval for releasing our packaging scripts to the community and got it, so here are our packaging scripts for this version, courtesy of EDF. See the instructions in debian/README.source for what has to be done to turn it into a full source package.

The packaging is based on our previous 6.5.2 packaging, which was itself based (partially, at least) upon the Gento 6.5.2 ebuild. It uses a tweaked vmware-installer to install the products to debian/tmp, then makes use of the vmware-installer database to populate the packages.

I think this method should work with any VMware product using vmware-installer 1.1.

Packages have been built and tested on Etch and Lenny.

Hope it helps! Bugs, comments, questions to the email address listed as Maintainer in debian/control, please :-)

forked-daapd news: FrontRow support, TV shows

Saturday, December 26th, 2009

Over the past weeks, a couple of contributors sent me fixes and new features for forked-daapd. Thanks to you all!

The biggest change is the addition of TV shows metadata as found, for instance, in TV shows bought on the iTunes store. Together with the added support for FrontRow and QuickTime clients, this means forked-daapd is a lot more able at streaming video files than it ever was. Kudos to Ace Jones for his work!

Note, however, that you’ll need a patched version of ffmpeg to pick up the TV shows metadata from your MP4 files. At the time of writing, the patches have not landed into ffmpeg upstream yet, and it’s a bit unclear when this will happen. Contact Ace for the patch and instructions, see the commits in the git tree for his email address.

Git tree on Alioth: http://git.debian.org/?p=users/jblache/forked-daapd.git (git URIs on the page)

Packard Bell OneTwo all-in-one with touch screen

Thursday, December 24th, 2009

I’ve just bought a Packard Bell OneTwo (M3700), a 600 Euros all-in-one computer with a 20″ multipoint touch screen (there are bigger models with 23″ touch screen, wifi and some other options). This machine will be used to run OpenBravoPOS, a free (libre) point of sale software. So far, I think this machine is just perfect for the job.

Getting it to run smoothly under Linux is not a walk in the park, however. There are some quirks and some assembly is required, but once you’re done (that takes a couple of hours at most once you’ve got all the info, which you have if you’re reading this) this machine is just great.

It’s fast, with a 2.1 GHz Pentium Dual-Core (T4300) CPU, 4 GB of RAM, an Intel GM45 GPU with up to 256 MB of shared RAM, gigabit networking, a fast 320 GB SATA disk and a combo DVD-drive (not a slot-in, too bad). The screen is nice, and the touchscreen is incredibly smooth, precise and sensitive. The sound is good, the webcam is great and it works out of the box, too!

Update: added a note about the card reader.

Update 2: the instructions can also be found on the Debian wiki now.

(more…)

Pommed v1.30: bug fixes

Thursday, October 22nd, 2009

Pommed v1.30 is a bug fix release fixing two small bugs:

  • a crasher bug on PowerMac machines
  • a bug in the sysfs backlight driver, mishandling brightness values with more than 3 digits

If you are running on a recent MacBook/MacBook Pro with a recent kernel, you’ll probably want to upgrade to this release.

pommed v1.29: architectural fix

Monday, October 19th, 2009

pommed v1.29 is a bugfix release, kind of. The fix is an architectural one related to the video mode switch feature.

When pressing the video switch key, your graphical pommed client of choice checks which VT its X server is running on and whether this VT is the active one before executing your video mode switch script.

To check that the VT is currently active, it is necessary to open one VT (we use the one our X server is running on) and perform an ioctl() call on it.

Depending on your setup (login manager or startx, basically), your user will or will not have any right on the device node associated to the VT. Which means the VT state checking code would always fail in some setups.

This is now fixed by moving that code into pommed itself, with a DBus method for the clients to call. You’ll need to update both pommed and the clients for this to work, for obvious reasons.

pommed v1.28: new machine

Sunday, September 13th, 2009

pommed v1.28 is a minor update adding support for the MacBookPro5,3.

pommed v1.27: new machines

Saturday, August 1st, 2009

pommed v1.27 is out as a maintenance release adding support for 3 of the newer machines:

  • MacBook5,2 (White MacBook)
  • MacBookPro5,2 (17″ MacBook Pro, June 2009)
  • MacBookPro5,5 (13″ MacBook Pro, June 2009)

Some machines are still missing, as I haven’t got any report about them yet.

Looks like the keyboard backlight behaviour and keys handling will have to be modified slightly for the new machines, but it’s really touchy to get right. I’ll need to try it out on the actual hardware.

Releasing a rewrite of mt-daapd/Firefly Media Server

Friday, June 12th, 2009

About a year ago, I bought a SoundBridge, having grown tired of running a media player on one machine or another to listen to music. The SoundBridge really fits my needs perfectly.

The server-side counterpart, mt-daapd (Firefly Media Server), on the other hand… not so much. Feature-wise, it works and does what it’s supposed to do, so the issues aren’t there.

The first issue was with the crappy, below-average packaging of mt-daapd in Debian. I’ve fixed that since I think, at least now it’s in a state where I’m not looking away from the screen while typing apt-get install mt-daapd.

The second issue came after looking at the code, while writing patches for Debian. Eek. It’s horrible in about every aspect you can think of. No coding standard, outdated comments, cruft everywhere, either #ifdef’d out or not, useless code left lying around inside functions, obvious memory leaks, and way more levels of indirection than is actually needed, let alone sane. Also, someone is clearly in deep and urgent need of taking “Pointers in C 101″. My eyes still hurt.

Well anyway, I’ve been contemplating either fixing it or rewriting it because I can’t stand such crappy code. Also, mt-daapd has been unmaintained upstream for something like 2 years, given that the upstream developer just pretty much disappeared.

So, with way more time on my hands than I’d like these days, I’ve finally jumped in, pulled the whole SVN into a git repository and started cleaning things up then rewriting it piece by piece. Good way to keep myself busy, producing something useful while doing so and playing with a couple new things.

This rewrite is called forked-daapd, for lack of a better name at the moment, it’s GPLv2+, and the code is available in a git repository at

git://git.debian.org/~jblache/forked-daapd.git

It’s not a feature-for-feature rewrite. I’ve tossed out a few things.

It’s Linux-only for a start, and then I’ve thrown out the web interface, the XML-RPC interface that goes with it,  the iTunes XML playlist support (only useful on Mac OS X) and the smart playlists. Maybe a couple other minor things I can’t think of right now.

It’s Linux-only because it uses signalfd and inotify. It’s built on libevent and pthreads, but doesn’t abuse threads either like mt-daapd does (spawning one thread per HTTP request … seriously). Parsers for the RSP and DAAP queries are built with ANTLR v3. Media handling is mostly done by ffmpeg, though ffmpeg suckiness in parsing metadata in some formats had to be compensated by dedicated metadata parsers. It’s a shame ffmpeg can’t handle raw FLAC streams with VORBIS comments, that is, bog-standard .flac files, while it goes to great length to support proprietary formats (though I should note it fails miserably on WMA too).

So, new things I played with: signalfd, libevent, threads, ANTLR, ffmpeg. Threads aren’t really a first, but I did some new things. inotify isn’t a first either, but it’s the first time I use it to watch events other than IN_CREATE or IN_MODIFY; that leads to quite some unhappiness towards the inotify API, which has some real shortcomings. I’m still shaking my head in disbelief.

It will happily support multiple concurrent clients, even when decoding media files to WAV, without abusing the machine it’s running on. I thought of adding more threading, especially in the decoding case, but I doubt this will be needed by anyone. Unless you’re streaming to hundreds of clients at the same time, which doesn’t look like a plausible usage scenario to me.

I don’t know where I’m going with this project. Right now it works for me and covers my needs. I’ve tested both the RSP and DAAP protocols with my SoundBridge, and DAAP with iTunes. I’m not an iTunes user so I may have skipped on the complicated things with iTunes, although I looked hard.

If there’s enough interest in this project, it can become a full-blown project on Alioth (it can even have a name that doesn’t suck!).