/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* 4-Byte Mouse Protocol
*/
#include <sys/vuid_event.h>
#include "vuidmice.h"
#ifdef VUIDM4P_DEBUG
static int vuidm4p_ptr = 0;
#endif
/*
* VUID_BUT(0) BUT(1) LEFT BUTTON
* VUID_BUT(1) BUT(3) RIGHT BUTTON
*/
int
{
/*
* The current kdmconfig tables imply that this module can be used
* for both 2- and 3- button mice, so based on that evidence we
* can't assume a constant. It should be possible to autodetect
* based on the mouse's startup behavior - "M" means 2 buttons,
* "M3" means 3 buttons - but that's for another day.
*/
return (0);
}
static void
{
int b;
/* for the LEFT and RIGHT button, see if it has changed */
for (b = 0; b < 2; b++) {
}
}
void
{
int r, code;
unsigned char *bufp;
for (r--; r >= 0; r--) {
#ifdef VUIDM4P_DEBUG
#endif
if (code & MOUSE_START_CODE) {
/*
* sync it here
*/
}
/*
* Start state. We stay here if the start code is not
* received thus forcing us back into sync. When we
* get a start code the button mask comes with it
* forcing us to the next state.
*/
default:
case MOUSE_START:
/* look for sync */
if ((code & MOUSE_START_CODE) == 0)
break;
/* Get the new state for the LEFT & RIGHT Button */
/*
* bits 0 & 1 are bits 6 & 7 of X value
* (Sign extend them with the cast.)
*/
/*
* bits 2 & 3 are bits 6 & 7 of Y value
* (Sign extend them with the cast.)
*/
/* go to the next state */
break;
case MOUSE_BUTTON:
/*
* We receive the remaining 6 bits of delta x,
* forcing us to the next state. We just piece the
* value of delta x together.
*/
break;
/*
* The last part of delta Y, and the packet *may be*
* complete
*/
case MOUSE_DELTA_X:
/*
* If we can peek at the next two mouse characters,
* and neither of them is the start of the next
* packet, don't use this packet.
*/
break;
}
}
/*
* remember state
*/
/*
* generate motion Events for delta_x
*/
/*
* Reverse the Sign for DELTA_Y
*/
/* allow us to keep looking for an optional 4th byte */
break;
case MOUSE_DELTA_Y:
/*
* We've seen delta Y. If we do NOT have the sync
* bit set, this indicates the middle button's status.
*/
/*
* if we're here, the fourth byte is indeed present
* to indicate something with the middle button.
*/
/*
* If we can peek at the next mouse character, and
* its not the start of the next packet, don't use
* this packet.
*/
if (r > 0 && !(bufp[0] & MOUSE_START_CODE))
break;
/*
* Check if the byte is a valid middle button state.
* It must either be 0x00 or 0x20 only.
*/
/*
* Get the new state for the MIDDLE Button
* Left button set in 4th byte indicates that the
* middle button is pressed, cleared means it
* has been released.
*/
if (code == MOUSE_BUTTON_L)
else if (code == 0)
else {
/*
* Invalid data in the 4th byte of the packet.
* Skip this byte.
*/
#ifdef VUIDM4P_DEBUG
#endif
break;
}
/*
* generate an Event with the middle button's status
*/
1 : 0));
}
/*
* remember state
*/
break;
}
}
}
#ifdef VUIDM4P_DEBUG
int
{
int i;
for (i = 0; i <= VBUF_SIZE; i++) {
}
for (i = 0; i <= VBUF_SIZE; i++) {
vuidm4p_buf[i] = buf[i];
}
}
#endif