/*
* Copyright (c) 2004 Steve Rumble
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
* IP12/IP20 serial mouse driver attached to zs channel 1 at 4800bps.
* This layer feeds wsmouse.
*
* 5 byte packets: sync, x1, y1, x2, y2
* sync format: binary 10000LMR (left, middle, right) 0 is down
*/
/* No need to keep score if nobody is listening */
if (!sc->enabled) {
sc->rxq_head = sc->rxq_tail;
return;
}
/*
* Here's the real action. Read a full packet and
* then let wsmouse know what has happened.
*/
while (sc->rxq_head != sc->rxq_tail) {
int8_t c = sc->rxq[sc->rxq_head];
switch (sc->state) {
case ZSMS_STATE_SYNC:
if ((c & ZSMS_SYNC_MASK) == ZSMS_SYNC) {
sc->packet[ZSMS_PACKET_SYNC] = c;
sc->state = ZSMS_STATE_X1;
}
break;
case ZSMS_STATE_X1:
sc->packet[ZSMS_PACKET_X1] = c;
sc->state = ZSMS_STATE_Y1;
break;
case ZSMS_STATE_Y1:
sc->packet[ZSMS_PACKET_Y1] = c;
sc->state = ZSMS_STATE_X2;
break;
case ZSMS_STATE_X2:
sc->packet[ZSMS_PACKET_X2] = c;
sc->state = ZSMS_STATE_Y2;
break;
case ZSMS_STATE_Y2:
sc->packet[ZSMS_PACKET_Y2] = c;
static int
zsms_wsmouse_ioctl(void *cookie, u_long cmd,
void *data, int flag, struct lwp *l)
{
switch (cmd) {
case WSMOUSEIO_GTYPE:
*(u_int *)data = WSMOUSE_TYPE_SGI;
break;
#ifdef notyet
case WSMOUSEIO_SRES:
case WSMOUSEIO_SSCALE:
case WSMOUSEIO_SRATE:
case WSMOUSEIO_SCALIBCOORDS:
case WSMOUSEIO_GCALIBCOORDS:
case WSMOUSEIO_GETID:
#endif