Slashdot Mirror


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."

11 of 65 comments (clear)

  1. Re:It's pretty easy by leviramsey · · Score: 3, Insightful
    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.

    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.

  2. Driver complexity is the tricky point by tzanger · · 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 abstraction layer code.

    If you've written the driver correctly it shouldn't be a very large task at all, I would imagine.

    1. Re:Driver complexity is the tricky point by Anonymous Coward · · Score: 5, Insightful

      This was not an insightful comment. Win32 drivers are a lot more complicated. In Linux, there isn't much to implementing the file operations block, and going from there. In Windows, managing those IRPs and power management requests is a lot trickier. The NT kernel API gets tricky, and learning about the IRQLs and all of the NT kernel features is really hard. Plus, you don't get kernel source. It's a real pain in the ass. If I were given the assignment of writing a Linux driver vs a Windows driver, I'd take the Linux driver -anyday-. It's infinitely easier.

  3. Easiest way to create/maintain a driver by Anonymous Coward · · Score: 5, Insightful

    The easiest way to get a Linux driver would be to give find an interested developer, give them a free device and detailed documentation, and answer any questions they have. If you're working on a tight budget, this might be the best option.

    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?

  4. New platforms come at a fraction of the cost. by aminorex · · Score: 5, Insightful

    You don't want the drivers in distros -- you want them in
    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.

    --
    -I like my women like I like my tea: green-
    1. Re:New platforms come at a fraction of the cost. by sigxcpu · · Score: 5, Insightful

      You should also cinsider the fact, that debugging device drivers under Linux, is much easier then under windows, because you have the source of the OS, and if you suspect that there is a bug, you can add your debug code wherever you want and test it. (sometimes much faster then reading the code and trying to find it - something you can't do in windoze anywhay.)

      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.

      --
      As of Postgres v6.2, time travel is no longer supported.
    2. Re:New platforms come at a fraction of the cost. by TephX · · Score: 4, Insightful
      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.

      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.

      --
      I metamoderate all Redundant and Offtopic moderations as Unfair.
  5. Re:It's pretty easy by Micah · · 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.

    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.

  6. definitely a 1 or 2, no higher by itzdandy · · Score: 3, Insightful

    I have done some driver work, build and debuging and linux is a driver writers dream compared to windows. I would estimate that a linux driver will consume about 50% as much time as a windows drive writing either from scratch. I reality, you may have a lot or reusable code from the windows drivers so you could be looking at less. Also do take the advice of other posts and get the basic driver out ASAP, and allow the OS community help out on the rest.

  7. Re:WinDriver by Anonymous Coward · · Score: 2, Insightful

    Maybe, but what kind of performance cost are you facing? And how are any 3rd parties meant to maintain the driver then?

  8. how about OS X? by The+Lynxpro · · Score: 2, Insightful

    Does your company support OS X as well? Just remember that Mac customers tend to have the extra discretionary income to purchase all sorts of Firewire and USB goodies... Be a sport and advocate for a multi-polar OS environment, Win32, OS X, and Linux... I relinquish control of the soapbox...

    --
    "Right now, somewhere in this world, Scott Baio is plowing a woman he doesn't love," - Peter Griffin, *Family Guy*