Page 1 of 1

iHome laser mouse pro

Posted: Fri Feb 26, 2010 12:02 am
by TomXP411
Hi, all.

I have the iHome wireless laser mouse. Here's a link to the product

I'm trying to map the zoom in/out buttons with EG, and I get a weird error on the HID plugin when pressing the zoom buttons:

When I press the - button, I get: invalid index for dataIndexType 8195/897
When I press the + button, I get: invalid index for dataIndexType 8451/897

Re: iHome laser mouse pro

Posted: Fri Feb 26, 2010 12:39 am
by TomXP411
I did a little more testing. By placing some debug code in the RawCallback and ButtonCallback functions, I figured out that the exception is popping up before the callbacks are actually entered. But I can't figure out what's happening in front of the callbacks...

After the callbacks are registered, which module is it that actually calls them? I am a complete noob to Python, so I'm not sure how to debug this and look at the call stack, other than to stick in some statements and see what comes out...

Re: iHome laser mouse pro

Posted: Fri Feb 26, 2010 12:59 am
by TomXP411
Okay, I found the exception text in the HID.py module.

Since this seems to work okay when I use the raw mode in the plugin, I guess this is probably more of an implementation error with my mouse, rather than a bug in EG. So never mind, I guess (unless you want to specially handle those values and just skip them.)

I changed the HID.py module to work around this problem; I'm sure there's a more elegant solution, but I'm totally new to Python and HID in general, so I took the easy way out...

This modified code starts on line 377; I'm using version 0.3.7.r1436

Code: Select all

                        for i in range(dataL.value):
                            tmpIndex = data[i].DataIndex
                            #special cases to handle iHome Mouse Pro
                            if  tmpIndex == 8195:
                                btnPressed.append(6)
                            elif  tmpIndex == 8451:
                                btnPressed.append(7)
                            elif  tmpIndex >= len(dataIndexType):
                                eg.PrintError("invalid index for dataIndexType %d/%d" % (tmpIndex, len(dataIndexType)));
                            elif dataIndexType[tmpIndex] == 1:#button
                                #collect buttons pressed
                                btnPressed.append(tmpIndex)
                            elif dataIndexType[tmpIndex] == 2:#control value
                                values[tmpIndex] = int(data[i].Data.RawValue)
                            else:
                                eg.PrintError(self.text.errorInvalidDataIndex)

Re: iHome laser mouse pro

Posted: Fri Feb 26, 2010 7:30 am
by Bartman
The HID device has a descriptor telling the OS how to interpret the raw values. The error looks like the descriptor does not match to send data.
I'm wondering why the mouse can be opened at all with the HID plug in as mice are normally opened exclusively by the OS.