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
As explained on http://lists.apple.com/mailman/listinfo/hit-dev , the hit-dev list deals with Event, Window, Control, Dialog, Menu, List, Appearance, and TextEdit APIs. I think the USB list is the more appropriate place for discussing HID although the web page does not mention it and HID devices don’t necessarily need to be USB.

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.

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



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/


Sent using the Microsoft Entourage 2004 for Mac Test Drive.

****************************************************************************

This email may contain confidential
material. If you were not an intended recipient,
Please notify the sender and delete all copies.
We may monitor email to and from our network.

 ***************************************************************************

 
 _______________________________________________
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: 
 >Microsoft Mouse hid_device_interface problem (From: Celine Latulipe <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.