Writing a Linux Device Driver on Company Time? 65
DriverSubversion asks: "Excuse the anonymity: I'm covering my back and that of my company. My company makes some USB and PCI peripherals, currently only supported under Windows. Several of us have pointed out that there is a large cross-over between the people who buy these things and the people who run linux - and thus it's in the company's best interest to develop device drivers for Linux,as well as Windows. Now while our boss is kind of convinced that this might sell some more units, he understandably wants to know how much it will cost to write and maintain the drivers... and where better to ask than here? So has anyone else gone though this? On scale of 1-10, how hard is it, (1 being 'extremely easy, 2 programmers could do it' and 10 is 'a team of no less than 20 programmers, lawyers and salesmen'). Keep in mind that our intent is to keep the code up-to-date, GPL-compliant and in at least some major distributions."
I have no idea (Score:5, Funny)
Re:I have no idea (Score:2, Informative)
reading (Score:5, Informative)
Re:reading (Score:5, Informative)
Re:reading (Score:5, Informative)
(You may also want to look at the porting to the 2.6 kernel series that has been written over at Linux Weekly News [lwn.net] As an aside, I'd really advocate subscribing there.)
When your device is a new class of device that linux isn't used to, it can be harder (e.g. when the phonejack cards came to linux, a new api for them had to be made).
Note, I've only limited experience, but this is what I've observed.
Re:reading (Score:4, Informative)
USB drivers are pretty easy (Score:3, Funny)
Re:USB drivers are pretty easy (Score:2)
Try finding out what this means:
usbdevfs: USBDEVFS_CONTROL failed dev 10 rqt 128 rq 6 len 18 ret -110
Google has lots of questions asking, but noone answering.
Re:USB drivers are pretty easy (Score:2)
Don't forget, the source is the documentation.
Re:USB drivers are pretty easy (Score:1)
Read The Source, Luke!
It's pretty easy (Score:5, Interesting)
Maintenance is very easy, however 2.0 -> 2.2 you'll have to do something, 2.2 -> 2.4 you'll have to do something, 2.4 -> 2.6 you'll have to do something, 2.6 -> 2.8...the linux croud delights in changing everything around. Revisionist thinking and all--if it's clean now it was never ugly, dirty code before. The cleanest code in linux is in the device drivers themselves. The infrastructure the device drivers use is, well, less than fresh. And if anyone tells you RTFM ask them where is TFM?
Re:It's pretty easy (Score:3, Insightful)
If you can convince the PHBs to release it under the GPL, then you don't have to spend time or money maintaining it. One of the kernel janitors will probably port it to new kernels.
Re:It's pretty easy (Score:4, Insightful)
Maybe, but I hope you don't give hardware companies those kinds of ideas.
A hardware company really should, ideally, maintain the drivers for their own products AND work with the kernel janitors or maintainers to keep an up to date copy in the Linux kernel sources.
The kernel guys do great with most of the drivers they write, but it seems like it's best for the hardware company to do it 1) out of courtesy, to prevent others from having to maintain drivers that make the company money, and 2) for quality control -- the community might not know how to get the most out of the device.
Re:It's pretty easy (Score:2)
I really think that just accurately documenting your hardware and providing the documentation for free or a nominal distribution cost (which should then imply some nice hardcopy AND a digital copy) is sufficient. I don't feel companies have any responsibility to maintain anything.
Remember, money talks. So buy d
Easiest way to create/maintain a driver (Score:5, Insightful)
There are lots of people who attempt to write a driver for a device, but fail only because the manufacturer won't give them information. IMHO, this doesn't make much sense - if someone wants to help you out for free, why would you stop them?
Re:Easiest way to create/maintain a driver (Score:1)
Answer #1: the GPL.
Now then, before the flames start -- please keep in mind that I am a staunch Open Source advocate, okay?
Let's say that the interested, free developer writes the hottest Linux driver imaginable for the manufacturer's wonderful version of gadget A. The open GPL code base for the driver is also an open book to the implementation of the hardware & chips inside the gadget, whether for cracking, hacking, writing twisty b
Re:Easiest way to create/maintain a driver (Score:2)
Of course, that leads to my rule of thumb for hardware selection. The more secretive a company is about how to simply interface with their product, the crappier it is. There are only a few reasons to be afraid:
Fear that someone will clone the chip: If it's that easy to clone from nothing but a register spec, it's nothing special, move along. If it's meant to be a low cost item, it must be too expensive. If it really was the cost leader, no amount of cloning would harm it.
Embarassed about the tech detail
Hmm (Score:5, Interesting)
3ware, for example, is a company that provides open source drivers that have been accepted into the linus tree. They seem to be primarily written and maintained by Adam Radford alone.
There's also a userspace component to manage raids, would your devices also need userspace apps developed to make them useful? That's one question you have to ask.
Anyway, good job. It's always good to see devices with open source drivers that don't suck. (Make sure yours don't
Driver complexity is the tricky point (Score:2, Insightful)
Take a look at many of the USB serial drivers; tiny drivers, very clean. The USB storage drivers, same thing (assed-up hardware is the reason for complexity in those drivers).
Writing a device driver for Linux is no more difficult than writing a device driver for Win32. You're in Ring 0 (for ia32) for both, so a poor driver can cause the system to come down. My suggestion would be to take a look at what you've written for win32, estimate how much of that you can keep, and write the linux kernel abstract
Re:Driver complexity is the tricky point (Score:5, Insightful)
Re:Driver complexity is the tricky point (Score:1)
Writing drivers for windows has gotten so complex the Microsoft is working on a new driver framework called the "Windows Driver Framework" to try and simplify it and to get more robust drivers from 3rd party developers. You can read an introductory article here [wd-3.com] by Walter Oney... it is very enlightening and highlights the various issues that a driver writer has to know at a very deep level to write even the simplest driver these days.
New platforms come at a fraction of the cost. (Score:5, Insightful)
Linus' kernel. Don't worry about liason with distro vendors.
Worry about liason with vger.
Since understanding the device, finding its quirks, and
designing protocol is the overwhelming bulk of the work
of writing a device driver, a reasonable rule of thumb is
that adding another platform will entail an additional
10-20% in manpower. Since the gap between a WinXP
driver and a Linux driver is relatively large, the high-end
of the scale is a closer approximation: Take the
development time for the Windows driver and divide by 5.
Now for maintenance, the new platform cost is much higher,
because each platform has its quirks, etc. You do get to
amortize some stuff over the platforms (no need to
diagnose protocol bugs twice, etc.), but it doesn't count
for a whole lot, so I would estimate that adding a new
platform will entail 80-90% again as much in maintenance
costs.
However, for an open source driver, you will quickly find
(if your hardware is at all useful) that the chore of forward-
porting maintenance as the kernel develops will be largely
assumed by the user community, so give any open-source
platform a -25% maintenance cost tick, at least.
Customer support issues are an entirely different ballgame,
and depend so much on your audience that I won't venture
even a guess -- keep in mind that customer support for
a smaller community typically is less work than is a similar
level of support for a larger community -- and Linux
users are accoustomed to self-support and community-support.
win_cost = win_dev + win_maint + win_support
lin_cost = lin_dev + lin_maint + lin_support
lin_dev = win_dev * 0.2
lin_maint = win_maint * 0.6
lin_support = win_support * k
Fill in k.
Re:New platforms come at a fraction of the cost. (Score:4, Interesting)
The only downside is that legally you cannot take fixes made by those outside users and put them into your closed-source drivers. However it is highly likely that you can ask the authors of the changes for permission to use the code, one way to convince them is to say that doing that is the only way for their code to get into the "official linux driver" that can be downloaded from your web page.
Re:New platforms come at a fraction of the cost. (Score:5, Insightful)
Or just release your Windows drivers under the GPL. I mean, if you're releasing GPL Linux drivers anyway, then you're clearly not protecting any proprietary interface information or whatnot, and drivers are hardly an item on which you can make a profit by selling them anyway, so it really seems like you don't lose anything at all by GPLing the Windows drivers too.
Yeah, this is "not the way it's done" and the managers won't agree to it. My point isn't necessarily that this is realistic, but that the people opposed to it are just being stupid.
Re:New platforms come at a fraction of the cost. (Score:2)
What I meant, which may still apply, is that you cannot change your mind and make your drivers (either the Windows or Linux ones) closed-source without either removing all the donated changes or getting permission to all the donated changes.
I'm also under the impression that open-source Windows d
Re:New platforms come at a fraction of the cost. (Score:5, Insightful)
One company I worked for even developed a linux deriver, it had no intention of officialy releasing, (It was just one part of a bigger device) just to get the ability to debug the the hardware efficiantly.
(Yes I am a linux kernel programmer.)
Besides, if your devieces are usefull, the Linux comunity has an intrest in having them work under linux.
If your device is something of common use, say an IDE controller or a NIC, you would find people willing to help you, or even write the driver for you, if you provid the full documantation and a working sample. (and if you give them a peek at the sources of your working windows driver it will probably be a very simple job. )
If you are willing to supply these then the right place to ask is on the LKML.
WinDriver (Score:3, Interesting)
I'm not a driver developer, but I've had to look into the possibility of cross-platform USB (and other) drivers before. Do yourself a favour and take a look at WinDriver [jungo.com] (no, I have nothing whatsoever to do with the company or the product).
The initial cost can be a bit steep, but the ROI could well be worth it. The suite allows you to write a USB driver that is source-compatible over Win98/Me/2K/XP/2003, Linux 2.0/2.2/2.4, and WinNT, for USB 1.1/2.0 and UHCI, OHCI, or EHCI.
Re:WinDriver (Score:2, Insightful)
Re:WinDriver (Score:2)
Third parties aren't meant to maintain the driver. Performance isn't an issue for USB 1.1 (maybe for USB 2.0, depending on the device), and you're talking about a company that specialises in creating device drivers -- their collective knowledge of performance and stability issues almost certain outweighs what can be achieved by a non-dedicated (to driver development) individual or team.
Re:WinDriver (Score:2)
Well, WinDriver offers a product for building Solaris drivers ... but not specifically USB ones.
HOWEVER ... I've defended this position many times before, so I guess I'll defend it again: if you buy a piece of hardware, and the manufacturer doesn't claim to support it on a particular platform, then you can't expect it to be supported on that platform.
And, from the opposite perspective, a manufacturer has every right to expect that their hardware is NOT supported on other platforms without their approva
Re:WinDriver (Score:2)
They can fuckoff for all I care. If they don't care enough about their product to support it, then they get a bad name. I ONLY buy hardware which works (well) in linux. Why? Because it's usually not a shoddy piece of shit.
Rather flexible situation methinks... (Score:1)
OTOH, if you could somehow just pay one guy to lead the open-source driver effort, even if only part-time, the costs of supporting linux could be quite minimal.
Pi isn't complex... (Score:2, Offtopic)
Pi isn't a complex number (at least not one with an imaginary part).
2 + 3i, however, is a complex number.
Re:Pi isn't complex... (Score:2)
Sure it is! It has an imaginary part of magnitude P, and a real part of magnitude zero.
Re:Pi isn't complex... (Score:1)
Running around in circles (Score:2)
(Pi: the ratio of a a circle's circumference to its diameter. But you knew that.)
definitely a 1 or 2, no higher (Score:4, Insightful)
How long will it take YOU? (Score:2)
How long will it take for ( some unknown number ) of our ( unknown skill and experience level ) developers to write a driver of complexity level ( X ).
What resources will be devoted to maintaining it? Documenting it? Adding features?
Will it be as fully supported as the current Win drivers?
Percentages and Markets (Score:1)
Oh, your boss noticed that if "several" of his own techs are interested in Linux, that there must be a huge number of techs (and non-techs) involved in Linux? Some companies are awfully slow at figuring that out.
Same difficulty as Windows (Score:2, Interesting)
Re:Same difficulty as Windows (Score:1)
Personally, I never understood how a hardware API would need to give away too much about the hardware itself, but I guess it depends a bit on the hardware itself.
Then again, if someone wants to clone your hardware, and thinks it will help to have your device driver, they can always decompile the source code and read it (it will take a lot more effort, but that will probably no
Re:Same difficulty as Windows (Score:1, Interesting)
Depends on how much is in the hardware. If the hardware is a bunch of little functional units that are bound together in the driver then you can give away lots. If the hardware is opaque and mega-lithic then you don't give away so much.
Re:Same difficulty as Windows (Score:2)
Re:Same difficulty as Windows (Score:1)
However.
You do have to look at the future of your product.
Are you the sole supplier of this product? If so, then you may wish to hold on to your code and specifications and attempt to corner the market.
On the third hand, if you are the sole supplier of this product, it may well behoove you to release the source code for the drivers. This might encourage
buying devices with both Windows and Linux support (Score:1)
how about OS X? (Score:3, Insightful)
Get the community to do it. (Score:1)
how hard is it?? (Score:2)
You have to be able to do the following: 1) open the device; 2) close the device; 3) read from the device; 4) write to the device.
Go here (it has info on this): http://tldp.org/LDP/khg/HyperNews/get/device
Professional experience (Score:2, Informative)
The time it takes to port the drivers in itself isn't very much - I spent one and a half year in that company, but that was because that's how long it took them to get the hardware for the PCI device I was supposed to drive working. The actual driver, for working and tested hardware, should be a couple of weeks for one coder, full-time.
When it comes to complexity, that varies a l
Pretty Straightforward (Score:2, Informative)