LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices


Reply
  Search this Thread
Old 08-14-2011, 03:24 AM   #1
wigry
Member
 
Registered: Jul 2004
Distribution: slackware
Posts: 225

Rep: Reputation: 53
Different concept for drivers?


Hi,

Had this idea in my head for a long time and maybe some less lazy programmer here will catch on and implement few of the following ideas about Linux driver concepts.

It all began when I reviewed ALSA soundcard drivers searching the way to support then malfunctioning ESI MAYA44 soundcard (which is currently working but dirver was not done by me). What I discovered was that 95% of all the drivers I went through were EXACTLY the same. I mean they contained immense amount of identical functionality - hardware protocol implementations, registry communications etc. But the problem I saw was that different driver authors reinvented the wheel at different level of correctness and some implementations were clean and some were plain ugly. The only reason they reimplemented the logic was because the variables had different values - the registry numbers and the meanings of bits were different.

So I started to think about what the driver is and came up with an idea:

For hardware to work, there must be an engine that is capable of operating the hardware given the hardware description exists. That engine should be part of the kernel or a userland daemon, written once and available for anybody to use. The hardware description however should be concern of driver developers - that description would become the driver.

Let me give you a simple example of my point:

Each and every audio card has number of channels 2-n and each and every card has the capability to mute individual channels by flipping some bits. Current audio drivers contain both the flipping logic as well as the hardcoded values of the registers and the bits to flip and for each card the values differ while the bit flipping logic remain constant ( although due different level of logical thinking capability of different developers result in very weird implementations of the same simple logic). But what about an engine that contains logic:

To mute audio in channel X, you need to flip the bit Y in registry Z

And then we have description for the specific audio card where it is written:

...
Registry: 12; Bit: 3; Feature: Mute channel 1
Registry: 12; Bit: 4; Feature: Mute channel 2
...

So in this way we could DESCRIBE all the features and capabilities of the particular piece of hardware WITHOUT writing a single line of code. The coding part would be written once as the part of the kernel and the correct description would be selected by PCI ID-s for example which could even be fetched over the network if desired. That way we could improve the quality of the drivers SO MUCH.

Security aspect: As the critical coding part would be single entity and drivers will not contain any code, there would not be possible to introduce security risk into the system or the driver would not be able to bring the system down. The engine would be verified code that simply parses the descriptions and behaves as understood from the description.

One more thing. If we have the working description for such an engine on one platform and that engine would be ported to different platform, the hardware would magically start working there as well. I mean, the registries and their meanings remain the same no matter what OS you have installed. So the hardware description remain the same and only the OS specific parts would change but that would be the concern of engine developers.

Damn, the world would be nice

Last edited by wigry; 08-14-2011 at 06:48 AM.
 
Old 08-14-2011, 07:17 AM   #2
qlue
Member
 
Registered: Aug 2009
Location: Umzinto, South Africa
Distribution: Crunchbangified Debian 8 (Jessie)
Posts: 747
Blog Entries: 1

Rep: Reputation: 172Reputation: 172
It's good thinking but keep in mind that this can only work for existing hardware. Every new piece of hardware technology will bring something different to the driver landscape. The original drivers for any given piece of hardware are usually written by the manufacturer. Some hardware is 'simple' by design. (for example, serial port) other hardware has large amounts of propriety 'handshaking' and are thus extremely complex. (for example, a multi-function 'printer')
But I do like the overall concept!
 
Old 08-14-2011, 07:32 AM   #3
wigry
Member
 
Registered: Jul 2004
Distribution: slackware
Posts: 225

Original Poster
Rep: Reputation: 53
Yes, such an approach is unsuitable for proprietary drivers but quite good IMHO for open source dirvers.

About new hardware - If there will be totally new concept introduced to the hardware, then an engine must be updated to support the feature and description syntax must be updated to accomodate the hardware description.

To bring examples form the world of soundcards, that are quite simple to understand.

For example, we would have an engine that would only support PCM playback and new generation of soundcards would incorporate SPDIF connectors. An engine update would be needed to implement neccessary logic to drive SPDIF. Once that is done, and descriprions contain neccessary sections for SPDIF, the hardware would immediately work and for all the cards with SPDIF connectors, only description update would be neccessary.

Also if person des not use SPDIF and would be happy with PCM playback, then one do not have to update an engine. Even if the driver/description would contain pieces neccesary to drive SPDIF, the older engine would simply ignore that extra info and drive only PCM part of the hardware.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Need help with the 'bridge' concept jonaskellens Linux - Newbie 3 12-28-2009 02:21 PM
concept deepaksinghnegi Linux - Newbie 2 10-23-2009 02:56 AM
Concept of Linux Drivers zdbrig Programming 2 01-07-2009 01:43 PM
what is the concept behind RAID ? tofee Linux - Newbie 2 05-20-2006 05:44 AM
Routing concept ajkannan83 Linux - Networking 1 09-30-2005 05:27 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 06:09 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration