Jump to content

Hacking USB mouse driver


Recommended Posts

Since you guys are so good at hacking Dune2000 and Dune2 I wonder if you guys also know how to do this - or at least point me to where I could start looking.

I got an optical Microsoft USB mouse and I want to use it for getting data from an ATtiny(13) microcontroller to the PC. I would like to get the click signals (ON/OFF) from the mouse and read that on the pc. This way I can open the mouse and send 010101 and stuff from the microcontroller to the PC. I was thinking about stuff like temperature or speed from something.

Any idea's how to hack the mouse driver and get the clicking of the mouse, for example, in an .txt file without it really clicking in windows (or perhaps that is not that bad if it happens). edit: Is that called a hook?

Thanks for reading.  :)

Link to comment
Share on other sites

I think it will be easier to make the micro controller send the data to a COM port of your pc, and read that. That is, if you have a com port. Otherwise you would need to get a converter. I've never written USB code myself (I did some hardware communication on a COM port some time ago, I couldn't find a Java USB API), but I believe it is harder to code than when using a com port.

Link to comment
Share on other sites

You can record all the events a mouse triggers (move, button click, wheel action) by hooking Windows messages. I don't think you need to drill down as deep as the mouse driver to capture such data. If you know C++, I'm sure there's something on MSDN about it...

http://msdn.microsoft.com/en-us/library/ms644959(VS.85).aspx

The WM_MOUSE messages would contain all the info you need I think.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...