Not logged in
Log in now
Create an account
Subscribe to LWN
LWN.net Weekly Edition for December 5, 2013
Deadline scheduling: coming soon?
LWN.net Weekly Edition for November 27, 2013
ACPI for ARM?
LWN.net Weekly Edition for November 21, 2013
Yet another HAL outside the kernel
Posted Aug 24, 2012 9:30 UTC (Fri) by rvfh (subscriber, #31018)
Userspace abstraction precedent
Posted Aug 24, 2012 9:56 UTC (Fri) by tialaramex (subscriber, #21167)
A PCI sound chipset, a USB headset, and a Bluetooth headset are very different from the perspective of the Linux kernel. The kernel is content to mediate both the USB and PCI solutions through a common userspace API (ALSA pcm) but Bluetooth data is just data until it hits userspace.
So the only way to have these three sound making devices behave interchangeably as far as, say, talking to your friend over VoIP, is either for every program to have separate handling for the different cases, or for a userspace abstraction to intermediate. That's one of the things the once widely despised PulseAudio does for you.
Or consider webcams. Kernel policy forbids format conversions and the like inside the kernel, and in recent years that policy has been increasingly enforced. Once upon a time cameras with custom encodings or weird format decisions would hide some conversion code in their kernel driver. No more. Today if you want cameras to work properly you use a userspace library which masks the various differences between cameras and offers to deliver plain RGB data (or various other useful formats) regardless of what the native camera hardware is.
The kernel is irreplaceable when it comes to access control, resource management, and so on. But when it comes to adding a "take a picture for your avatar" feature to a program, I want a userspace abstraction that can capture the picture just as well from a $5000 pro HD video camera as from the $5 USB webcam I, the developer, happen to own, without me needing to buy dozens of cameras to check they work.
Posted Aug 26, 2012 12:26 UTC (Sun) by alankila (subscriber, #47141)
The "do everything in kernel and then provide a file-based API to the programs" is merely ancient unix mentality. It is almost definitely not the best possible method to write every driver with.
Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds