Using multiple mice separately, on identified USB ports

Hey everyone

I am quite new to Panda3D. I’m using Windows, and am writing an application where I’m trying to control it using several computer mice in parallel. I actually manage to do this as described in the manual (under using in the config file:

read-raw-mice #t

and then in the program something like:

#reading virtual system mouse coordinates; which I actually don’t use
md =
x = md.getX()
y = md.getY()

#reading coordinates of physical mouse 1
md1 =
x1 = md1.getX()
y1 = md1.getY()

#reading coordinates of physical mouse 2
md2 =
x2 = md2.getX()
y2 = md2.getY()

#and so on for a couple more mice…

But one big problem I encounter is that each time I plug something in or out of one of the USB ports, or each time I try to do this on a different computer, all the arrangement of the mice changes; it seems like the number of USB devices present and the order in which the different mice are plugged in matters a lot.

Ideally, I would like to be able to tell it once in the beginning to take the coordinates from the mice connected to particular USB ports. I don’t know how to do this, and while tha manual hints that it’s possible (i.e. that each mouse has a name which uniquely identifies it, based on its product key and port), it never actually explains how to access or use this information.

Can someone help me out here?

It does…

for mouse in base.pointerWatcherNodes:
  print "NAME=", mouse.getName()
  print "X=", mouse.getMouseX()
  print "Y=", mouse.getMouseY()

Print name will be the name of the mouse. As for checking, you can have a loop/task that check to see if a mouse is in use or not, and then use its input as needed.

Well, no, it doesn’t solve the problem. The mice in mouse.getName() are identified by names like “watcher0”, “watcher1”, “watcher2” etc, but their identity is not constant. To clarify, if I plug some of the mice out and then plug them in again, the same mice will now have different names even if I plugged them back each into the same USB port. Similarly, if I reboot the machine the identitiy could change too; I think it has a lot to do with the order in which the machine recognizes them.

What I would really want is the ability to unanimously address each individual moise through the USB port it is plugged into, but other solutions would be welcome too.