Writing a Linux Device Driver on Company Time?
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."
One programmer could write a usb driver for your device in a matter of days. The hardest, absolutely the hardest thing about writing a driver for linux is getting the docs on the chip, and those docs being complete and accurate.
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?
Well, from reading the source of a couple drivers, it looks like most are one or two person deals.
:)
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
I've had enough abrasive sigs. Kittens are cute and fuzzy.
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.
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 (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.
i-name =twylite [http://public.xdi.org/=twylite], see idcommons.net
For the most part, writing a linux device driver is pretty much the same difficulty as writing a Windows device driver. The real question is, do you really want to make your driver GPL compliant? See, you'll be giving up some pretty important IP that you may not want to give up. Now somebody else could come along and make a device that behaves exactly like your company's device, just because you gave away interesting tidbits about how your hardware works. Initially you may gain some acceptance and increased revenue for doing this, but in the long run it may end up sabatoging the product you're trying to support. I know I'm probably gonna get flamed to high hell for this, but I'm personally not the biggest fan of the GPL. You may want to contact your HW engineers and lawyers before you dive to deep into doing this. They may have a much different take than you on supporting linux.
So technically speaking, writing a driver is going to be the same difficulty as far as programming, but much more complicated as far as the business decision involved.