King
King

Reputation: 183

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.

Upvotes: 5

Views: 12933

Answers (3)

Shiwangini
Shiwangini

Reputation: 836

In such kind of cases you can proceed with writing your own device driver by C++ and assemb lyem

Upvotes: 0

Registered User
Registered User

Reputation: 5371

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

Upvotes: 1

Tony The Lion
Tony The Lion

Reputation: 63250

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

Upvotes: 4

Related Questions