LWN.net Logo

LIRC delurks

By Jonathan Corbet
September 10, 2008
The Linux Infrared Remote Control project (LIRC) provides drivers for a number of infrared receivers and transmitters. It is, perhaps, most heavily used by people running MythTV and similar packages; it would, after all, completely ruin the experience to have to get up from the couch to change channels. Despite their established user base, and despite the fact that a number of distributors ship the code, the LIRC drivers have never found their way into the mainline kernel. In more recent times, little effort has gone into their development and maintenance; the link to "Caldera OpenLinux" on the project's web site would seem to make that clear.

But LIRC is useful code, and, as is the case with most out-of-tree drivers, most people would really rather see LIRC in the mainline kernel. Merging into the mainline got a step closer on September 9, when Jarod Wilson posted a version of the LIRC drivers for consideration. Jarod, it seems, has been working (with Janne Grunau) on these drivers for some months; in the process, they have eliminated "tens of thousands" of complaints from the checkpatch.pl script and cleaned up a number of things.

Even after that work, though, the LIRC drivers are clearly not yet up to normal kernel standards. Some very strange coding conventions are used in places. Many of the drivers have broken (or completely absent) locking. Duplicated code abounds. One driver has implemented a command parser in its write() function. Another driver is for hardware which already has a different driver in the mainline. And, importantly, these drivers do not work with the input subsystem.

The LIRC drivers would appear to strongly support the notion that out-of-tree code is, almost by necessity, worse code. In the past, Linus Torvalds (and others) have argued for merging drivers as soon as possible. If the code is poor, its chances of being improved get much higher once it's in the mainline and others can fix it. The LIRC drivers would appear to strongly support the notion that out-of-tree code is, almost by necessity, worse code. These drivers have been around for almost a decade, have been packaged by distributors, and have been used by large numbers of people. Despite all of that, they contain a large number of serious problems which have never been addressed.

Now that the drivers have been posted to the linux-kernel list, quite a few of these problems are being pointed out; Jarod and Janne have been responding to reviews and fixing the issues. The "merge drivers early" philosophy would argue for pushing LIRC into 2.6.28, even if serious problems remain. Presence in the mainline will raise the visibility of the code, inspiring (one hopes) more developers to work on fixing it up. Merging LIRC will also free distributors from the need to create separate packages for those drivers.

One important question will have to be addressed before merging LIRC can be seriously considered, though: its user-space API. Once LIRC is merged, its user-space API will be set in stone, so any problems with that API need to be resolved first. LIRC, being out of the mainline, did not follow the development of the input subsystem, so it does not behave like other input drivers - even in-tree drivers for infrared remotes. The use of an in-kernel command-line parser in at least one driver is sure to raise eyebrows; that sort of interaction should really be handled via ioctl() or sysfs. All told, it is hard to imagine this code being merged until the API problems have been resolved.

Changing the LIRC API will, of course, lead to problems of its own. There is user-space code which depends on the current API; any changes will break that code. The kernel community will certainly understand this problem, but is unlikely to be swayed by it. There are a number of risks associated with maintaining production kernel code out of the mainline tree; one of those risks is that your established APIs will not be accepted by the kernel development community. So an API change may simply be part of the cost of getting LIRC into the mainline at this late date.

It should be a cost worth paying. Once LIRC is in the mainline, interested developers will work to continue to bring the code up to kernel standards. The community will maintain it going forward. All Linux users will get the LIRC drivers with their kernel, with no need to deal with external packages. Getting there may be a bit frustrating for users of remotes and (especially) for the developers who have taken on the task of getting this code into the mainline. But, once it's done, remotes will just be more normal hardware, supported by the kernel like everything else.


(Log in to post comments)

LIRC delurks

Posted Sep 11, 2008 0:56 UTC (Thu) by flewellyn (subscriber, #5047) [Link]

Wow, I remember using LIRC back in college, in the 2.2 kernel days, for a project in my "digital logic" class. We built a circuit to read infrared signals on the RS-232 serial port, and I wrote a userspace daemon to read the LIRC signals and translate them into shell commands.

I had long since forgetten about this code. It's almost unbelievable to me that it still hasn't been merged!

LIRC delurks

Posted Sep 11, 2008 0:58 UTC (Thu) by jengelh (subscriber, #33263) [Link]

Given the recent issue with UVC, I would be more cautious to doing early merges.

LIRC delurks

Posted Sep 11, 2008 8:52 UTC (Thu) by Hanno (guest, #41730) [Link]

LIRC is a major component of my Linux video disk recorder (vdr) and it's highly useful there. Great to see it merged!

LIRC delurks

Posted Sep 12, 2008 1:31 UTC (Fri) by kirkengaard (subscriber, #15022) [Link]

Hooray for progress. Here's to more progress, so that what gets merged is worth keeping around. User base does not assure developer time for code fixes when something is functional, and badly-designed/sub-optimal -- but functional -- code has no better life in-tree now than it ever did. Cf. devfs for the canonical example, albeit with what sounds like less active developer interest. Do we have promise of active and ongoing maintainership?

Haven't we been talking about raising the quality of kernel code? Isn't this what -mm is for? Does anyone remember the flack that Reiser4 got for bad interface paradigm and mis-features in the code? Was that all just because Hans was an ungracious, arrogant, abrasive force in the community? Don't we work with developers who are willing to work with us through the external patch trees to get the code to be suitable for the mainline, and then ship it?

LIRC delurks

Posted Sep 23, 2008 10:11 UTC (Tue) by malcolmparsons (guest, #46787) [Link]

The LIRC userspace daemon handles remotes that use the input subsystem, so modifying drivers to use input shouldn't cause problems.

Copyright © 2008, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds