mouse input

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
k2000

mouse input

Post by k2000 »

how can I determine where the mouse is??? ???
mystran

Re:mouse input

Post by mystran »

I'd first look at the desk, and if that fails (too much paper lying around?) I'd then check if it's connected, and follow the cord.

Seriously, I think we need a bit more information about what exactly do you want to do, what kind of mouse you have, and so on, before we can help. I'd also try Google. Google knows a lot.
distantvoices
Member
Member
Posts: 1600
Joined: Wed Oct 18, 2006 11:59 am
Location: Vienna/Austria
Contact:

Re:mouse input

Post by distantvoices »

... if not where the mouse is hidden on the desk ...

In such a case, take a mouse trap, put some bits on it and wait. This method is said to have the highest success rate and all the while the highest mouse drop out rate in computing.

you could also follow the mouse droppings to find your mouse. maybe it has dug a hole somewhere under your pc to hide and collect cheese there. eventually to get a buncha little mice?

*rofl* thanks, mystran, the idea is so fine, i couldna withstand to explore it a little bit even if a wild pig was after me.

@k2000: stfw. rtfm. Hint: PS2 mouse protocol. Programming ps2 mice. It has definitely to do with your average keyboard controller. And watch out for irq line 12. It is the best cheese for stubborn mice.
... the osdever formerly known as beyond infinity ...
BlueillusionOS iso image
Dreamsmith

Re:mouse input

Post by Dreamsmith »

mystran wrote:I'd first look at the desk, and if that fails (too much paper lying around?) I'd then check if it's connected, and follow the cord.
...and that's why I refuse to buy a cordless mouse! ;D

It's bad enough I lost my cordless phone for two days recently. Kept having to listen to my answering machine and return calls with my cell phone...

As for the programming questions, it should be noted that there's no way to determine where it "is" -- you can only tell how far it moved over a time interval. You maintain an idea of its position yourself, modifying the position based on the information regarding it's movement. So, you don't determine where the mouse is, you define where the mouse is, then periodically determine how much it has moved.
fraserjgordon

Re:mouse input

Post by fraserjgordon »

Maybe the question was "how do I find out what port the mouse in connected to?"

My solution: write a driver for each port (serial, usb, ps/2) and get them to determine if a mouse is present there or not.

Or maybe I read the question the wrong way...
User avatar
Candy
Member
Member
Posts: 3882
Joined: Tue Oct 17, 2006 11:33 pm
Location: Eindhoven

Re:mouse input

Post by Candy »

k2000 wrote: how can I determine where the mouse is??? ???
In my case (wireless mouse) it's kicking a random pile of junk and then seeing whether my mouse pointer moved. If so, it's in the pile, if not, it wasn't. Determining whether it's on the desk is giving the desk a shove to see whether the computer wakes up.

Practically, I can see two points. Where should I look for a mouse (in the OS, finding an object to call a "mouse"), and where should I place / move the mouse pointer.

The answer to the first is to try to command a mouse on any random port where a mouse could be, and if you don't get an answer, assume it isn't there. These ports include all serial ports you can find / think of, and the PS2 port obviously. Search the web for docs on them. If you can do USB detection, look for a mouse in your results and if there's one, use it.

Where to place the mouse pointer is the location where it was, plus where it moved. All mice send you movement data, because they just can't find any other data since they don't know what you'd want to do with it. Same with a keyboard, but that's kind of off-topic. You can scale, invert, transpose, do anything with the mouse data to make it do what you want.


A more complex issue is, how can I detect what a user wants to use as a mouse. For that, allow him to connect any directional movement indicators as mouse direction indicators, and any buttons as mouse buttons. You can also accept buttons as direction indicators. This allows anybody to set their preferences as they'd like, and you can define any number of virtual mice using buttons, keys, or for instance three keyboards a joypad two joysticks and three real mice. You can also let them devise multiple virtual desktops, where they define a desktop of their own based on a virtual mouse, a virtual keyboard and a virtual display location, plus additional virtual devices you like to give them. That makes it very straightforward to make everybody at home, and to allow people to connect more than one mouse. It also allows for "cheap solutions" for people without cash, to use a computer with two monitors, two mice and two keyboards as if it were two computers. Of course, you can allow other things, such as two users working on one desktop, although I now already envision sisters stealing their brothers document windows :)

HTH, Candy
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:mouse input

Post by Pype.Clicker »

k2000 wrote: how can I determine where the mouse is??? ???
may i suggest you check How to Ask Questions the Smart Way for the next time ?
Post Reply