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.


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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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