Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Writing device driver?

I wonder if I understand correctly...

Say, if I want to control how my mouse work, i.e Left Button open window, Right Button send keystroke 'A' etc.

But I am not talking about writting something like follows in an application:

void MouseDown(xxxxEventArgs e, sender object)
{

}

I want to completely controls how the device work, then I will need to write a driver for it? From what I learn in assembly before, controlling a device I should need to know their port to communicate with the device. But say if I buy a Logitech mouse, is it possible to write a mouse driver myself to use it?

Because I saw some project that they buy a usb web cam from store, and they could able to control the web came to rotate, recevie the image from the web cam, I wonder if that's because the web cam has API provided them?

Thanks in advance.

like image 390
King Avatar asked Apr 28 '11 14:04

King


2 Answers

If you want to control the device in it's entirety, then you need to write a device driver indeed. This is a non-trivial task and you should read up on it. There is a tutorial on it here and there a book for windows driver development here.

If you want to write device drivers, you should be very well versed with C and/or C++.

like image 85
Tony The Lion Avatar answered Oct 11 '22 17:10

Tony The Lion


You do not need to write a device driver for what you are trying to do.The device driver has nothing but as per the data sheet of the device address of registers where it can read,write,do IOMMU etc or some other stuff.What you will need is some kind of hacking the application programming part of the thing which you are trying to achieve.

Because device driver code just reads the data from device and writes back it is the application which is concerned for it.Though in some case device driver programmer provide a method (function) to application programmer so that they can write their application and invoke those methods.In your case you need to just understand how the application code is talking to device driver. In case you want to write a device driver check this http://www.freesoftwaremagazine.com/articles/drivers_linux?page=0%2C0

like image 26
Registered User Avatar answered Oct 11 '22 15:10

Registered User