Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

This may be too broad of a question, but I'm not really sure what exactly I'm looking for. My main question is how the open source community reverse engineers windows drivers (for say, video cards) to re-write them under linux.

I'm an EE graduate, so I've taken courses in microprocessor design and such, assembly, C for embedded systems, and I've worked on embedded linux. But I feel like I'm missing something when trying to understand how drivers are written for linux without an API from the hardware manufacturer.

What leads to my question is that on some new laptops, they come with dual video cards. Both an integrated one and a discrete one. There's driver software that allows switching between the 2 in windows, but as far as I know, there's no either open source or proprietary drivers. Obviously I'm not asking something stupid like "omg how do I write that msyelf". But it did make me realize that I've always wondered the process of getting hardware support on linux.

Links to resources are fine, I don't expect a tutorial on driver development in an answer. But at least I need to be pointed in the right direction.

share|improve this question
3  
Dave Airlie wrote vga_switcheroo for Linux, which is the driver software to switch between dual video cards - you can find the current sources git.kernel.org/?p=linux/kernel/git/torvalds/… and some of his writeups airlied.livejournal.com/70348.html airlied.livejournal.com/70480.html airlied.livejournal.com/70828.html airlied.livejournal.com/71012.html airlied.livejournal.com/71434.html . –  ephemient Sep 20 '10 at 14:07
    
You might want to contact the Nouveau developers, as a significant part of how they build the Nouveau drivers is to reverse-engineer the official, proprietary Nvidia ones. –  InkBlend Mar 1 '13 at 4:28
    
Additionally, there is now a Reverse Engineering SE on Area 51. You might want to check that out. –  InkBlend Mar 12 '13 at 3:43
add comment

1 Answer 1

up vote 3 down vote accepted

There are of course a lot of possibilities.

For example if it is an USB device you could monitor the USB traffic between the device/compute on a system with driver support (analogous to tcpdump for network). For example for Windows there are several USB monitor tools available (IIRC usbsnoop for example).

In the case of a USB scanner you could e.g. generate a trace with the default settings, then change one setting, generate another trace, compare them and figure out what changed and so on.

Analogous to that you could trace stuff for SCSI, Firewire etc. devices.

Then you could try to dis-assemble/debug a proprietary driver (for example with IDA pro).

Or you could execute Windows in a virtual machine or emulator (e.g. qemu) and use breakpoints and inspect the hardware state before/after driver calls. Analogous to that you could observe to what registers or something like that a driver writes/reads.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.