| |||
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] |
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);
...
X MOTION: dev is 0, value is 0, timestamp: 2196624116What 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.
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
****************************************************************************
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>) |
| Home | Archives | FAQ | Terms/Conditions | Contact | RSS | Lists | About |
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.