psm.c (135945) | psm.c (139628) |
---|---|
1/*- 2 * Copyright (c) 1992, 1993 Erik Forsberg. 3 * Copyright (c) 1996, 1997 Kazutaka YOKOTA. 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 45 unchanged lines hidden (view full) --- 54 * HiNote UltraII/Latitude/Armada laptops. 55 * - 30 July 1997. Added APM support. 56 * - 5 March 1997. Defined driver configuration flags (PSM_CONFIG_XXX). 57 * Improved sync check logic. 58 * Vendor specific support routines. 59 */ 60 61#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 1992, 1993 Erik Forsberg. 3 * Copyright (c) 1996, 1997 Kazutaka YOKOTA. 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 45 unchanged lines hidden (view full) --- 54 * HiNote UltraII/Latitude/Armada laptops. 55 * - 30 July 1997. Added APM support. 56 * - 5 March 1997. Defined driver configuration flags (PSM_CONFIG_XXX). 57 * Improved sync check logic. 58 * Vendor specific support routines. 59 */ 60 61#include <sys/cdefs.h> |
62__FBSDID("$FreeBSD: head/sys/dev/atkbdc/psm.c 135945 2004-09-29 23:49:57Z philip $"); | 62__FBSDID("$FreeBSD: head/sys/dev/atkbdc/psm.c 139628 2005-01-03 13:19:49Z philip $"); |
63 64#include "opt_psm.h" 65 66#include <sys/param.h> 67#include <sys/systm.h> 68#include <sys/kernel.h> 69#include <sys/module.h> 70#include <sys/bus.h> --- 161 unchanged lines hidden (view full) --- 232 233/* other flags (flags) */ 234#define PSM_FLAGS_FINGERDOWN 0x0001 /* VersaPad finger down */ 235 236/* Tunables */ 237static int synaptics_support = 0; 238TUNABLE_INT("hw.psm.synaptics_support", &synaptics_support); 239 | 63 64#include "opt_psm.h" 65 66#include <sys/param.h> 67#include <sys/systm.h> 68#include <sys/kernel.h> 69#include <sys/module.h> 70#include <sys/bus.h> --- 161 unchanged lines hidden (view full) --- 232 233/* other flags (flags) */ 234#define PSM_FLAGS_FINGERDOWN 0x0001 /* VersaPad finger down */ 235 236/* Tunables */ 237static int synaptics_support = 0; 238TUNABLE_INT("hw.psm.synaptics_support", &synaptics_support); 239 |
240static int verbose = PSM_DEBUG; 241TUNABLE_INT("debug.psm.loglevel", &verbose); 242 |
|
240/* for backward compatibility */ 241#define OLD_MOUSE_GETHWINFO _IOR('M', 1, old_mousehw_t) 242#define OLD_MOUSE_GETMODE _IOR('M', 2, old_mousemode_t) 243#define OLD_MOUSE_SETMODE _IOW('M', 3, old_mousemode_t) 244 245typedef struct old_mousehw { 246 int buttons; 247 int iftype; --- 129 unchanged lines hidden (view full) --- 377 .d_open = psmopen, 378 .d_close = psmclose, 379 .d_read = psmread, 380 .d_ioctl = psmioctl, 381 .d_poll = psmpoll, 382 .d_name = PSM_DRIVER_NAME, 383}; 384 | 243/* for backward compatibility */ 244#define OLD_MOUSE_GETHWINFO _IOR('M', 1, old_mousehw_t) 245#define OLD_MOUSE_GETMODE _IOR('M', 2, old_mousemode_t) 246#define OLD_MOUSE_SETMODE _IOW('M', 3, old_mousemode_t) 247 248typedef struct old_mousehw { 249 int buttons; 250 int iftype; --- 129 unchanged lines hidden (view full) --- 380 .d_open = psmopen, 381 .d_close = psmclose, 382 .d_read = psmread, 383 .d_ioctl = psmioctl, 384 .d_poll = psmpoll, 385 .d_name = PSM_DRIVER_NAME, 386}; 387 |
385/* debug message level */ 386static int verbose = PSM_DEBUG; 387 | |
388/* device I/O routines */ 389static int 390enable_aux_dev(KBDC kbdc) 391{ 392 int res; 393 394 res = send_aux_command(kbdc, PSMC_ENABLE_DEV); 395 VLOG(2, (LOG_DEBUG, "psm: ENABLE_DEV return code:%04x\n", res)); --- 1608 unchanged lines hidden (view full) --- 2004 psmintr(sc); 2005 kbdc_lock(sc->kbdc, FALSE); 2006 } 2007 sc->watchdog = TRUE; 2008 splx(s); 2009 sc->callout = timeout(psmtimeout, (void *)(uintptr_t)sc, hz); 2010} 2011 | 388/* device I/O routines */ 389static int 390enable_aux_dev(KBDC kbdc) 391{ 392 int res; 393 394 res = send_aux_command(kbdc, PSMC_ENABLE_DEV); 395 VLOG(2, (LOG_DEBUG, "psm: ENABLE_DEV return code:%04x\n", res)); --- 1608 unchanged lines hidden (view full) --- 2004 psmintr(sc); 2005 kbdc_lock(sc->kbdc, FALSE); 2006 } 2007 sc->watchdog = TRUE; 2008 splx(s); 2009 sc->callout = timeout(psmtimeout, (void *)(uintptr_t)sc, hz); 2010} 2011 |
2012static int psmhz = 20; 2013SYSCTL_INT(_debug, OID_AUTO, psmhz, CTLFLAG_RW, &psmhz, 0, ""); | 2012/* Add all sysctls under the debug.psm and hw.psm nodes */ 2013SYSCTL_NODE(_debug, OID_AUTO, psm, CTLFLAG_RD, 0, "ps/2 mouse"); 2014SYSCTL_NODE(_hw, OID_AUTO, psm, CTLFLAG_RD, 0, "ps/2 mouse"); |
2014 | 2015 |
2015static int psm_soft_timeout = 500000; /* 0.5 sec */ 2016SYSCTL_INT(_debug, OID_AUTO, psm_soft_timeout, CTLFLAG_RW, 2017 &psm_soft_timeout, 0, ""); | 2016SYSCTL_INT(_debug_psm, OID_AUTO, loglevel, CTLFLAG_RW, &verbose, 0, ""); |
2018 | 2017 |
2018static int psmhz = 20; 2019SYSCTL_INT(_debug_psm, OID_AUTO, hz, CTLFLAG_RW, &psmhz, 0, ""); |
|
2019static int psmerrsecs = 2; | 2020static int psmerrsecs = 2; |
2020SYSCTL_INT(_debug, OID_AUTO, psmerrsecs, CTLFLAG_RW, &psmerrsecs, 0, ""); | 2021SYSCTL_INT(_debug_psm, OID_AUTO, errsecs, CTLFLAG_RW, &psmerrsecs, 0, ""); |
2021static int psmerrusecs = 0; | 2022static int psmerrusecs = 0; |
2022SYSCTL_INT(_debug, OID_AUTO, psmerrusecs, CTLFLAG_RW, &psmerrusecs, 0, ""); | 2023SYSCTL_INT(_debug_psm, OID_AUTO, errusecs, CTLFLAG_RW, &psmerrusecs, 0, ""); |
2023static int psmsecs = 0; | 2024static int psmsecs = 0; |
2024SYSCTL_INT(_debug, OID_AUTO, psmsecs, CTLFLAG_RW, &psmsecs, 0, ""); | 2025SYSCTL_INT(_debug_psm, OID_AUTO, secs, CTLFLAG_RW, &psmsecs, 0, ""); |
2025static int psmusecs = 500000; | 2026static int psmusecs = 500000; |
2026SYSCTL_INT(_debug, OID_AUTO, psmusecs, CTLFLAG_RW, &psmusecs, 0, ""); | 2027SYSCTL_INT(_debug_psm, OID_AUTO, usecs, CTLFLAG_RW, &psmusecs, 0, ""); 2028static int pkterrthresh = 2; 2029SYSCTL_INT(_debug_psm, OID_AUTO, pkterrthresh, CTLFLAG_RW, &pkterrthresh, 0, ""); |
2027 | 2030 |
2028static int psmpkterrthresh = 2; 2029SYSCTL_INT(_debug, OID_AUTO, psmpkterrthresh, CTLFLAG_RW, 2030 &psmpkterrthresh, 0, ""); | 2031static int tap_threshold = PSM_TAP_THRESHOLD; 2032SYSCTL_INT(_hw_psm, OID_AUTO, tap_threshold, CTLFLAG_RW, &tap_threshold, 0, ""); 2033static int tap_timeout = PSM_TAP_TIMEOUT; 2034SYSCTL_INT(_hw_psm, OID_AUTO, tap_timeout, CTLFLAG_RW, &tap_timeout, 0, ""); |
2031 | 2035 |
2032SYSCTL_INT(_debug, OID_AUTO, psmloglevel, CTLFLAG_RW, &verbose, 0, ""); 2033 2034 | |
2035static void 2036psmintr(void *arg) 2037{ 2038 struct psm_softc *sc = arg; 2039 struct timeval now; 2040 int c; 2041 packetbuf_t *pb; 2042 --- 47 unchanged lines hidden (view full) --- 2090 * the queued packets have undetected errors. 2091 */ 2092 dropqueue(sc); 2093 if (sc->syncerrors == 0) 2094 sc->pkterrors++; 2095 ++sc->syncerrors; 2096 sc->lastinputerr = now; 2097 if (sc->syncerrors >= sc->mode.packetsize * 2 || | 2036static void 2037psmintr(void *arg) 2038{ 2039 struct psm_softc *sc = arg; 2040 struct timeval now; 2041 int c; 2042 packetbuf_t *pb; 2043 --- 47 unchanged lines hidden (view full) --- 2091 * the queued packets have undetected errors. 2092 */ 2093 dropqueue(sc); 2094 if (sc->syncerrors == 0) 2095 sc->pkterrors++; 2096 ++sc->syncerrors; 2097 sc->lastinputerr = now; 2098 if (sc->syncerrors >= sc->mode.packetsize * 2 || |
2098 sc->pkterrors >= psmpkterrthresh) { | 2099 sc->pkterrors >= pkterrthresh) { |
2099 2100 /* 2101 * If we've failed to find a single sync byte in 2 2102 * packets worth of data, or we've seen persistent 2103 * packet errors during the validation period, 2104 * reinitialize the mouse in hopes of returning it 2105 * to the expected mode. 2106 */ --- 1355 unchanged lines hidden --- | 2100 2101 /* 2102 * If we've failed to find a single sync byte in 2 2103 * packets worth of data, or we've seen persistent 2104 * packet errors during the validation period, 2105 * reinitialize the mouse in hopes of returning it 2106 * to the expected mode. 2107 */ --- 1355 unchanged lines hidden --- |