Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Microsoft Mouse hid_device_interface problem



Title: Re: Microsoft Mouse hid_device_interface problem
Hi.

What happens if you tap the Logitech mouse horizontally? Maybe the Logitech mouse would show a similar problem?
What happens if you click the mouse button on the Microsoft Mouse or move it vertically or use the scroll wheel? Maybe using one input would reset the others.

If I tap the Logitech mouse it doesn’t show the same problem. It shows movement and then stops immediately. As for the Microsoft mous, if I use the buttons or the scroll wheel, those events are captured, but the mouse movement still continues in whatever direction the mouse was last moved, even after I’m no longer touching the mouse.

What if you used the
HID class device interface queue instead of the HID class device interface functions?
http://developer.apple.com/documentation/DeviceDrivers/Conceptual/HID/workingwith/chapter_4_section_5.html
Instead of polling, you should use a queue callback:
http://developer.apple.com/documentation/DeviceDrivers/Conceptual/HID/workingwith/chapter_4_section_6.html

I haven’t tried either of those. I guess that will probably have to be my next step, although that seems more complicated.

Thanks for your response. I’m still hoping to hear of anyone else having the same problem and how they fixed it!
Celine


From: Celine Latulipe <email@hidden>
Date: Tue, 06 Mar 2007 16:34:16 -0500

Hi. This is posted to both the USB mailing list and the HIT mailing list, as I’m not sure where it would be most appropriate. I apologize for the double posting.

I'm writing code that allows me to seize input devices from the system and use them with separate input streams in my application (ie. Two USB mice controlling two separate cursors that I draw in my carbon app, but NOT controlling the system cursor). All works fine with my Logitech mice (or Dell mice, which are from Logitech). However, when I plug in a Microsoft mouse (such as the Intellimouse Optical), the Microsoft mouse gives me x and y motions all the time, even when I'm not moving the mouse.

Here is a snippet of my mouse driver code (this is after I have acquired the devices in exclusive mode):
int MouseDriver::getState(int dev, mouse_state &state)
{
    // initialize
    int movement = 0;
    HRESULT result = KERN_SUCCESS;
    IOHIDEventStruct hidEvent;
                
    // get x-axis value
    result = (*_hid_device_interface)->getElementValue(_hid_device_interface, _cookies.gXAxisCookie, &hidEvent);
    if (result != kIOReturnSuccess) {
        printf("problem getting x value: %x\n", result);
        }
    state._x_move = hidEvent.value;
    state.x_event_time = hidEvent.timestamp;
    state.x_nano = UnsignedWideToUInt64(AbsoluteToNanoseconds(state.x_event_time));
    printf("X MOTION: dev is %d, value is %d, timestamp: %u\n", dev, state._x_move, state.x_nano);

    ...

Here is some output from my run log in Xcode, this is output when I am not moving either of the two mice (one Logitech, one Microsoft):
X MOTION: dev is 0, value is 0, timestamp: 2196624116
X MOTION: dev is 1, value is 1, timestamp: 3042156966
X MOTION: dev is 0, value is 0, timestamp: 2196624116
X MOTION: dev is 1, value is 1, timestamp: 3062126826
X MOTION: dev is 0, value is 0, timestamp: 2196624116
X MOTION: dev is 1, value is 1, timestamp: 3077079460
X MOTION: dev is 0, value is 0, timestamp: 2196624116
X MOTION: dev is 1, value is 1, timestamp: 3092107586
X MOTION: dev is 0, value is 0, timestamp: 2196624116
X MOTION: dev is 1, value is 1, timestamp: 3112110256
X MOTION: dev is 0, value is 0, timestamp: 2196624116
X MOTION: dev is 1, value is 1, timestamp: 3127080441
X MOTION: dev is 0, value is 0, timestamp: 2196624116
X MOTION: dev is 1, value is 1, timestamp: 3142168016
X MOTION: dev is 0, value is 0, timestamp: 2196624116
X MOTION: dev is 1, value is 1, timestamp: 3172120711
X MOTION: dev is 0, value is 0, timestamp: 2196624116
X MOTION: dev is 1, value is 1, timestamp: 3192110444
X MOTION: dev is 0, value is 0, timestamp: 2196624116

What you can see is that the Logitech mouse (dev 0) is giving no mouse movement values for the x-axis, and the timestamp is constant (set the last time there was a mouse movement). But, the Microsoft mouse (dev 1) is giving a value of 1, with a constantly changing timestamp (every 20 Microseconds, if I’m doing the time conversion correctly). So, when I run my program, the cursor I’m drawing using the coordinates polled from device 1 is moving across the screen even when the mouse is still. The cursor keeps moving in whatever direction/acceleration it was moving in when I last touched it.

It seems like the Microsoft mouse is not resetting its values after I do the hid_device_interface -> getElementValue call. And, it seems like every time I call this, the device timestamp is getting set???

However, the Microsoft mouse works fine on the Mac in general (ie. When I haven’t seized it for use within my specialized software). It doesn’t cause my system cursor to move unexpectedly, so the OS X system software manages to handle this device just fine.

Can anybody help me with this?

Thanks,
Celine



--
Celine Latulipe, PhD
Assistant Professor
Department of Software and Information Systems
University of North Carolina at Charlotte
email@hidden
704.687.8195
http://www.sis.uncc.edu/~clatulip/
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Usb mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/usb/email@hidden

This email sent to email@hidden

References: 
 >Re: Microsoft Mouse hid_device_interface problem (From: Joe van Tunen <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.