vuidm3p.c revision 57f4a14abf7408570afb91750e10e4b57f721549
/*
* 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.
*/
/*
* 3-Byte Mouse Protocol
*/
#include <sys/vuid_event.h>
#include "vuidmice.h"
/*
* VUID_BUT(0) BUT(1) LEFT BUTTON
* VUID_BUT(1) BUT(3) RIGHT BUTTON
*/
#define MOUSE_START 0 /* Beginning of packet */
int
{
return (0);
}
static void
{
int b;
/*
* both buttons going down simultaneously means button
* two going down
*/
return;
/*
* both buttons going up simultaneously means button
* two going up
*/
return;
}
/*
* for each button, see if it has changed
*/
for (b = 0; b < 2; b++) {
}
}
void
{
int r, code;
for (r--; r >= 0; r--) {
/* strip the high-order bit (mouse sends 7-bit data) */
code &= 0x7f;
/*
* 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;
/*
* remember state
*/
}
/*
* 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;
/*
* We receive the remaining 6 bits of delta x, forcing
* us to the next state. We just piece the value of
* delta x together.
*/
case MOUSE_BUTTON:
if (code & MOUSE_START_CODE) {
goto start_code; /* restart */
}
break;
/*
* The last part of delta Y, and the packet
* *may be* complete
*/
case MOUSE_DELTA_X:
if (code & MOUSE_START_CODE) {
goto start_code; /* restart */
}
/*
* generate motion Event
*/
break;
}
}
}