Fix botch on newlock2 merge.
This commit is contained in:
parent
b501f9bf07
commit
b184e0b11b
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: adb_bus.c,v 1.3 2007/02/09 21:55:27 ad Exp $ */
|
||||
/* $NetBSD: adb_bus.c,v 1.4 2007/02/10 03:38:47 tsutsui Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2006 Michael Lorenz
|
||||
|
@ -30,7 +30,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: adb_bus.c,v 1.3 2007/02/09 21:55:27 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: adb_bus.c,v 1.4 2007/02/10 03:38:47 tsutsui Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -111,8 +111,8 @@ nadb_init(struct device *dev)
|
|||
}
|
||||
|
||||
/* bus reset (?) */
|
||||
//nadb_send_sync(sc, 0, 0, NULL);
|
||||
//delay(200000);
|
||||
nadb_send_sync(sc, 0, 0, NULL);
|
||||
delay(200000);
|
||||
|
||||
/*
|
||||
* scan only addresses 1 - 7
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: adb_ms.c,v 1.3 2007/02/09 21:55:27 ad Exp $ */
|
||||
/* $NetBSD: adb_ms.c,v 1.4 2007/02/10 03:38:47 tsutsui Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 1998 Colin Wood
|
||||
|
@ -31,7 +31,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: adb_ms.c,v 1.3 2007/02/09 21:55:27 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: adb_ms.c,v 1.4 2007/02/10 03:38:47 tsutsui Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/device.h>
|
||||
|
@ -42,6 +42,7 @@ __KERNEL_RCSID(0, "$NetBSD: adb_ms.c,v 1.3 2007/02/09 21:55:27 ad Exp $");
|
|||
#include <sys/signalvar.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/sysctl.h>
|
||||
|
||||
#include <machine/autoconf.h>
|
||||
|
||||
|
@ -85,6 +86,7 @@ struct adbms_softc {
|
|||
* always down
|
||||
*/
|
||||
int sc_x, sc_y;
|
||||
int sc_tapping;
|
||||
/* buffers */
|
||||
int sc_poll;
|
||||
int sc_msg_len;
|
||||
|
@ -129,6 +131,7 @@ static void adbms_mangle_2(struct adbms_softc *, int);
|
|||
static void adbms_mangle_4(struct adbms_softc *, int);
|
||||
static void adbms_handler(void *, int, uint8_t *);
|
||||
static int adbms_wait(struct adbms_softc *, int);
|
||||
static int sysctl_adbms_tap(SYSCTLFN_ARGS);
|
||||
|
||||
const struct wsmouse_accessops adbms_accessops = {
|
||||
adbms_enable,
|
||||
|
@ -168,6 +171,7 @@ adbms_attach(struct device *parent, struct device *self, void *aux)
|
|||
sc->sc_devid[4] = 0;
|
||||
sc->sc_poll = 0;
|
||||
sc->sc_msg_len = 0;
|
||||
sc->sc_tapping = 1;
|
||||
|
||||
ems_init(sc);
|
||||
|
||||
|
@ -562,20 +566,22 @@ adbms_process_event(struct adbms_softc *sc, int len, uint8_t *buffer)
|
|||
|
||||
if (sc->sc_class == MSCLASS_TRACKPAD) {
|
||||
|
||||
if (sc->sc_down) {
|
||||
/* finger is down - collect motion data */
|
||||
sc->sc_x += dx;
|
||||
sc->sc_y += dy;
|
||||
}
|
||||
DPRINTF("buttons: %02x\n", buttons);
|
||||
switch (sc->sc_buttons) {
|
||||
case 2:
|
||||
buttons |= ((buttons & 2) >> 1);
|
||||
adbms_mangle_2(sc, buttons);
|
||||
break;
|
||||
case 4:
|
||||
adbms_mangle_4(sc, buttons);
|
||||
break;
|
||||
if (sc->sc_tapping == 1) {
|
||||
if (sc->sc_down) {
|
||||
/* finger is down - collect motion data */
|
||||
sc->sc_x += dx;
|
||||
sc->sc_y += dy;
|
||||
}
|
||||
DPRINTF("buttons: %02x\n", buttons);
|
||||
switch (sc->sc_buttons) {
|
||||
case 2:
|
||||
buttons |= ((buttons & 2) >> 1);
|
||||
adbms_mangle_2(sc, buttons);
|
||||
break;
|
||||
case 4:
|
||||
adbms_mangle_4(sc, buttons);
|
||||
break;
|
||||
}
|
||||
}
|
||||
/* filter the pseudo-buttons out */
|
||||
buttons &= 1;
|
||||
|
@ -683,7 +689,8 @@ adbms_disable(void *v)
|
|||
static void
|
||||
init_trackpad(struct adbms_softc *sc)
|
||||
{
|
||||
int cmd, addr;
|
||||
struct sysctlnode *me = NULL, *node = NULL;
|
||||
int cmd, addr, ret;
|
||||
uint8_t buffer[16];
|
||||
uint8_t b2[] = {0x99, 0x94, 0x19, 0xff, 0xb2, 0x8a, 0x1b, 0x50};
|
||||
|
||||
|
@ -714,6 +721,28 @@ init_trackpad(struct adbms_softc *sc)
|
|||
cmd = ADBFLUSH(addr);
|
||||
adbms_send_sync(sc, cmd, 0, NULL);
|
||||
delay(1000);
|
||||
|
||||
/*
|
||||
* setup a sysctl node to control wether tapping the pad should
|
||||
* trigger mouse button events
|
||||
*/
|
||||
|
||||
sc->sc_tapping = 1;
|
||||
|
||||
ret = sysctl_createv(NULL, 0, NULL, (const struct sysctlnode **)&me,
|
||||
CTLFLAG_READWRITE,
|
||||
CTLTYPE_NODE, sc->sc_dev.dv_xname, NULL,
|
||||
NULL, 0, NULL, 0,
|
||||
CTL_MACHDEP, CTL_CREATE, CTL_EOL);
|
||||
|
||||
ret = sysctl_createv(NULL, 0, NULL, (const struct sysctlnode **)&node,
|
||||
CTLFLAG_READWRITE | CTLFLAG_OWNDESC | CTLFLAG_IMMEDIATE,
|
||||
CTLTYPE_INT, "tapping", "tapping the pad causes button events",
|
||||
sysctl_adbms_tap, 1, NULL, 0,
|
||||
CTL_MACHDEP, me->sysctl_num, CTL_CREATE, CTL_EOL);
|
||||
if (node != NULL) {
|
||||
node->sysctl_data = sc;
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -748,3 +777,40 @@ adbms_send_sync(struct adbms_softc *sc, uint8_t cmd, int len, uint8_t *msg)
|
|||
adbms_wait(sc, 1000);
|
||||
return (sc->sc_msg_len != -1);
|
||||
}
|
||||
|
||||
static int
|
||||
sysctl_adbms_tap(SYSCTLFN_ARGS)
|
||||
{
|
||||
struct sysctlnode node = *rnode;
|
||||
struct adbms_softc *sc = node.sysctl_data;
|
||||
|
||||
node.sysctl_idata = sc->sc_tapping;
|
||||
|
||||
if (newp) {
|
||||
|
||||
/* we're asked to write */
|
||||
node.sysctl_data = &sc->sc_tapping;
|
||||
if (sysctl_lookup(SYSCTLFN_CALL(&node)) == 0) {
|
||||
|
||||
sc->sc_tapping = (node.sysctl_idata == 0) ? 0 : 1;
|
||||
return 0;
|
||||
}
|
||||
return EINVAL;
|
||||
} else {
|
||||
|
||||
node.sysctl_size = 4;
|
||||
return (sysctl_lookup(SYSCTLFN_CALL(&node)));
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
SYSCTL_SETUP(sysctl_ams_setup, "sysctl ams subtree setup")
|
||||
{
|
||||
|
||||
sysctl_createv(NULL, 0, NULL, NULL,
|
||||
CTLFLAG_PERMANENT,
|
||||
CTLTYPE_NODE, "machdep", NULL,
|
||||
NULL, 0, NULL, 0,
|
||||
CTL_MACHDEP, CTL_EOL);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
#
|
||||
# $NetBSD: files.adb,v 1.3 2007/02/10 03:38:47 tsutsui Exp $
|
||||
#
|
||||
# Apple Desktop Bus protocol and drivers
|
||||
|
||||
defflag adbdebug.h ADB_DEBUG
|
||||
defflag adbdebug.h ADBKBD_DEBUG
|
||||
defflag adbdebug.h ADBMS_DEBUG
|
||||
defflag adbdebug.h ADBKBD_POWER_PANIC
|
||||
|
||||
define adb_bus {}
|
||||
|
||||
device nadb {}
|
||||
attach nadb at adb_bus
|
||||
file dev/adb/adb_bus.c nadb needs-flag
|
||||
|
||||
device adbkbd : wskbddev, wsmousedev
|
||||
attach adbkbd at nadb
|
||||
file dev/adb/adb_kbd.c adbkbd needs-flag
|
||||
|
||||
device adbms : wsmousedev
|
||||
attach adbms at nadb
|
||||
file dev/adb/adb_ms.c adbms needs-flag
|
Loading…
Reference in New Issue