Deleted Added
full compact
psm.c (244405) psm.c (248478)
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 244405 2012-12-18 20:02:53Z dumbbell $");
62__FBSDID("$FreeBSD: head/sys/dev/atkbdc/psm.c 248478 2013-03-18 23:22:47Z jkim $");
63
64#include "opt_isa.h"
65#include "opt_psm.h"
66
67#include <sys/param.h>
68#include <sys/systm.h>
69#include <sys/kernel.h>
70#include <sys/module.h>

--- 184 unchanged lines hidden (view full) ---

255 int squelch_x;
256 int squelch_y;
257 int fingers_nb;
258 int tap_button;
259 int in_taphold;
260 int in_vscroll;
261} synapticsaction_t;
262
63
64#include "opt_isa.h"
65#include "opt_psm.h"
66
67#include <sys/param.h>
68#include <sys/systm.h>
69#include <sys/kernel.h>
70#include <sys/module.h>

--- 184 unchanged lines hidden (view full) ---

255 int squelch_x;
256 int squelch_y;
257 int fingers_nb;
258 int tap_button;
259 int in_taphold;
260 int in_vscroll;
261} synapticsaction_t;
262
263enum {
264 TRACKPOINT_SYSCTL_SENSITIVITY,
265 TRACKPOINT_SYSCTL_NEGATIVE_INERTIA,
266 TRACKPOINT_SYSCTL_UPPER_PLATEAU,
267 TRACKPOINT_SYSCTL_BACKUP_RANGE,
268 TRACKPOINT_SYSCTL_DRAG_HYSTERESIS,
269 TRACKPOINT_SYSCTL_MINIMUM_DRAG,
270 TRACKPOINT_SYSCTL_UP_THRESHOLD,
271 TRACKPOINT_SYSCTL_THRESHOLD,
272 TRACKPOINT_SYSCTL_JENKS_CURVATURE,
273 TRACKPOINT_SYSCTL_Z_TIME,
274 TRACKPOINT_SYSCTL_PRESS_TO_SELECT,
275 TRACKPOINT_SYSCTL_SKIP_BACKUPS
276};
277
278typedef struct trackpointinfo {
279 struct sysctl_ctx_list sysctl_ctx;
280 struct sysctl_oid *sysctl_tree;
281 int sensitivity;
282 int inertia;
283 int uplateau;
284 int reach;
285 int draghys;
286 int mindrag;
287 int upthresh;
288 int threshold;
289 int jenks;
290 int ztime;
291 int pts;
292 int skipback;
293} trackpointinfo_t;
294
263/* driver control block */
264struct psm_softc { /* Driver status information */
265 int unit;
266 struct selinfo rsel; /* Process selecting for Input */
267 u_char state; /* Mouse driver state */
268 int config; /* driver configuration flags */
269 int flags; /* other flags */
270 KBDC kbdc; /* handle to access kbd controller */
271 struct resource *intr; /* IRQ resource */
272 void *ih; /* interrupt handle */
273 mousehw_t hw; /* hardware information */
274 synapticshw_t synhw; /* Synaptics hardware information */
275 synapticsinfo_t syninfo; /* Synaptics configuration */
276 synapticsaction_t synaction; /* Synaptics action context */
295/* driver control block */
296struct psm_softc { /* Driver status information */
297 int unit;
298 struct selinfo rsel; /* Process selecting for Input */
299 u_char state; /* Mouse driver state */
300 int config; /* driver configuration flags */
301 int flags; /* other flags */
302 KBDC kbdc; /* handle to access kbd controller */
303 struct resource *intr; /* IRQ resource */
304 void *ih; /* interrupt handle */
305 mousehw_t hw; /* hardware information */
306 synapticshw_t synhw; /* Synaptics hardware information */
307 synapticsinfo_t syninfo; /* Synaptics configuration */
308 synapticsaction_t synaction; /* Synaptics action context */
309 int tphw; /* TrackPoint hardware information */
310 trackpointinfo_t tpinfo; /* TrackPoint configuration */
277 mousemode_t mode; /* operation mode */
278 mousemode_t dflt_mode; /* default operation mode */
279 mousestatus_t status; /* accumulated mouse movement */
280 ringbuf_t queue; /* mouse status queue */
281 packetbuf_t pqueue[PSM_PACKETQUEUE]; /* mouse data queue */
282 int pqueue_start; /* start of data in queue */
283 int pqueue_end; /* end of data in queue */
284 int button; /* the latest button state */

--- 54 unchanged lines hidden (view full) ---

339
340/* Tunables */
341static int tap_enabled = -1;
342TUNABLE_INT("hw.psm.tap_enabled", &tap_enabled);
343
344static int synaptics_support = 0;
345TUNABLE_INT("hw.psm.synaptics_support", &synaptics_support);
346
311 mousemode_t mode; /* operation mode */
312 mousemode_t dflt_mode; /* default operation mode */
313 mousestatus_t status; /* accumulated mouse movement */
314 ringbuf_t queue; /* mouse status queue */
315 packetbuf_t pqueue[PSM_PACKETQUEUE]; /* mouse data queue */
316 int pqueue_start; /* start of data in queue */
317 int pqueue_end; /* end of data in queue */
318 int button; /* the latest button state */

--- 54 unchanged lines hidden (view full) ---

373
374/* Tunables */
375static int tap_enabled = -1;
376TUNABLE_INT("hw.psm.tap_enabled", &tap_enabled);
377
378static int synaptics_support = 0;
379TUNABLE_INT("hw.psm.synaptics_support", &synaptics_support);
380
381static int trackpoint_support = 0;
382TUNABLE_INT("hw.psm.trackpoint_support", &trackpoint_support);
383
347static int verbose = PSM_DEBUG;
348TUNABLE_INT("debug.psm.loglevel", &verbose);
349
350/* for backward compatibility */
351#define OLD_MOUSE_GETHWINFO _IOR('M', 1, old_mousehw_t)
352#define OLD_MOUSE_GETMODE _IOR('M', 2, old_mousemode_t)
353#define OLD_MOUSE_SETMODE _IOW('M', 3, old_mousemode_t)
354

--- 72 unchanged lines hidden (view full) ---

427static probefunc_t enable_aglide;
428static probefunc_t enable_kmouse;
429static probefunc_t enable_msexplorer;
430static probefunc_t enable_msintelli;
431static probefunc_t enable_4dmouse;
432static probefunc_t enable_4dplus;
433static probefunc_t enable_mmanplus;
434static probefunc_t enable_synaptics;
384static int verbose = PSM_DEBUG;
385TUNABLE_INT("debug.psm.loglevel", &verbose);
386
387/* for backward compatibility */
388#define OLD_MOUSE_GETHWINFO _IOR('M', 1, old_mousehw_t)
389#define OLD_MOUSE_GETMODE _IOR('M', 2, old_mousemode_t)
390#define OLD_MOUSE_SETMODE _IOW('M', 3, old_mousemode_t)
391

--- 72 unchanged lines hidden (view full) ---

464static probefunc_t enable_aglide;
465static probefunc_t enable_kmouse;
466static probefunc_t enable_msexplorer;
467static probefunc_t enable_msintelli;
468static probefunc_t enable_4dmouse;
469static probefunc_t enable_4dplus;
470static probefunc_t enable_mmanplus;
471static probefunc_t enable_synaptics;
472static probefunc_t enable_trackpoint;
435static probefunc_t enable_versapad;
436
437static struct {
438 int model;
439 u_char syncmask;
440 int packetsize;
441 probefunc_t *probefunc;
442} vendortype[] = {

--- 18 unchanged lines hidden (view full) ---

461 { MOUSE_MODEL_INTELLI, /* Microsoft IntelliMouse */
462 0x08, MOUSE_PS2INTELLI_PACKETSIZE, enable_msintelli },
463 { MOUSE_MODEL_GLIDEPOINT, /* ALPS GlidePoint */
464 0xc0, MOUSE_PS2_PACKETSIZE, enable_aglide },
465 { MOUSE_MODEL_THINK, /* Kensington ThinkingMouse */
466 0x80, MOUSE_PS2_PACKETSIZE, enable_kmouse },
467 { MOUSE_MODEL_VERSAPAD, /* Interlink electronics VersaPad */
468 0xe8, MOUSE_PS2VERSA_PACKETSIZE, enable_versapad },
473static probefunc_t enable_versapad;
474
475static struct {
476 int model;
477 u_char syncmask;
478 int packetsize;
479 probefunc_t *probefunc;
480} vendortype[] = {

--- 18 unchanged lines hidden (view full) ---

499 { MOUSE_MODEL_INTELLI, /* Microsoft IntelliMouse */
500 0x08, MOUSE_PS2INTELLI_PACKETSIZE, enable_msintelli },
501 { MOUSE_MODEL_GLIDEPOINT, /* ALPS GlidePoint */
502 0xc0, MOUSE_PS2_PACKETSIZE, enable_aglide },
503 { MOUSE_MODEL_THINK, /* Kensington ThinkingMouse */
504 0x80, MOUSE_PS2_PACKETSIZE, enable_kmouse },
505 { MOUSE_MODEL_VERSAPAD, /* Interlink electronics VersaPad */
506 0xe8, MOUSE_PS2VERSA_PACKETSIZE, enable_versapad },
507 { MOUSE_MODEL_TRACKPOINT, /* IBM/Lenovo TrackPoint */
508 0xc0, MOUSE_PS2_PACKETSIZE, enable_trackpoint },
469 { MOUSE_MODEL_GENERIC,
470 0xc0, MOUSE_PS2_PACKETSIZE, NULL },
471};
472#define GENERIC_MOUSE_ENTRY \
473 ((sizeof(vendortype) / sizeof(*vendortype)) - 1)
474
475/* device driver declarateion */
476static device_method_t psm_methods[] = {

--- 226 unchanged lines hidden (view full) ---

703 { MOUSE_MODEL_INTELLI, "IntelliMouse" },
704 { MOUSE_MODEL_MOUSEMANPLUS, "MouseMan+" },
705 { MOUSE_MODEL_VERSAPAD, "VersaPad" },
706 { MOUSE_MODEL_EXPLORER, "IntelliMouse Explorer" },
707 { MOUSE_MODEL_4D, "4D Mouse" },
708 { MOUSE_MODEL_4DPLUS, "4D+ Mouse" },
709 { MOUSE_MODEL_SYNAPTICS, "Synaptics Touchpad" },
710 { MOUSE_MODEL_GENERIC, "Generic PS/2 mouse" },
509 { MOUSE_MODEL_GENERIC,
510 0xc0, MOUSE_PS2_PACKETSIZE, NULL },
511};
512#define GENERIC_MOUSE_ENTRY \
513 ((sizeof(vendortype) / sizeof(*vendortype)) - 1)
514
515/* device driver declarateion */
516static device_method_t psm_methods[] = {

--- 226 unchanged lines hidden (view full) ---

743 { MOUSE_MODEL_INTELLI, "IntelliMouse" },
744 { MOUSE_MODEL_MOUSEMANPLUS, "MouseMan+" },
745 { MOUSE_MODEL_VERSAPAD, "VersaPad" },
746 { MOUSE_MODEL_EXPLORER, "IntelliMouse Explorer" },
747 { MOUSE_MODEL_4D, "4D Mouse" },
748 { MOUSE_MODEL_4DPLUS, "4D+ Mouse" },
749 { MOUSE_MODEL_SYNAPTICS, "Synaptics Touchpad" },
750 { MOUSE_MODEL_GENERIC, "Generic PS/2 mouse" },
751 { MOUSE_MODEL_TRACKPOINT, "IBM/Lenovo TrackPoint" },
711 { MOUSE_MODEL_UNKNOWN, "Unknown" },
712 };
713 int i;
714
715 for (i = 0; models[i].model_code != MOUSE_MODEL_UNKNOWN; ++i)
716 if (models[i].model_code == model)
717 break;
718 return (models[i].model_name);

--- 728 unchanged lines hidden (view full) ---

1447 /* Some touchpad devices need full reinitialization after suspend. */
1448 switch (sc->hw.model) {
1449 case MOUSE_MODEL_SYNAPTICS:
1450 case MOUSE_MODEL_GLIDEPOINT:
1451 case MOUSE_MODEL_VERSAPAD:
1452 sc->config |= PSM_CONFIG_INITAFTERSUSPEND;
1453 break;
1454 default:
752 { MOUSE_MODEL_UNKNOWN, "Unknown" },
753 };
754 int i;
755
756 for (i = 0; models[i].model_code != MOUSE_MODEL_UNKNOWN; ++i)
757 if (models[i].model_code == model)
758 break;
759 return (models[i].model_name);

--- 728 unchanged lines hidden (view full) ---

1488 /* Some touchpad devices need full reinitialization after suspend. */
1489 switch (sc->hw.model) {
1490 case MOUSE_MODEL_SYNAPTICS:
1491 case MOUSE_MODEL_GLIDEPOINT:
1492 case MOUSE_MODEL_VERSAPAD:
1493 sc->config |= PSM_CONFIG_INITAFTERSUSPEND;
1494 break;
1495 default:
1455 if (sc->synhw.infoMajor >= 4)
1496 if (sc->synhw.infoMajor >= 4 || sc->tphw > 0)
1456 sc->config |= PSM_CONFIG_INITAFTERSUSPEND;
1457 break;
1458 }
1459
1460 if (!verbose)
1461 printf("psm%d: model %s, device ID %d\n",
1462 unit, model_name(sc->hw.model), sc->hw.hwid & 0x00ff);
1463 else {

--- 1973 unchanged lines hidden (view full) ---

3437 }
3438 break;
3439
3440 case MOUSE_MODEL_SYNAPTICS:
3441 if (proc_synaptics(sc, pb, &ms, &x, &y, &z) != 0)
3442 goto next;
3443 break;
3444
1497 sc->config |= PSM_CONFIG_INITAFTERSUSPEND;
1498 break;
1499 }
1500
1501 if (!verbose)
1502 printf("psm%d: model %s, device ID %d\n",
1503 unit, model_name(sc->hw.model), sc->hw.hwid & 0x00ff);
1504 else {

--- 1973 unchanged lines hidden (view full) ---

3478 }
3479 break;
3480
3481 case MOUSE_MODEL_SYNAPTICS:
3482 if (proc_synaptics(sc, pb, &ms, &x, &y, &z) != 0)
3483 goto next;
3484 break;
3485
3486 case MOUSE_MODEL_TRACKPOINT:
3445 case MOUSE_MODEL_GENERIC:
3446 default:
3447 break;
3448 }
3449
3450 /* scale values */
3451 if (sc->mode.accelfactor >= 1) {
3452 if (x != 0) {

--- 1016 unchanged lines hidden (view full) ---

4469 synaptics_sysctl_create_tree(sc);
4470
4471 sc->hw.buttons = buttons;
4472 }
4473
4474 return (TRUE);
4475}
4476
3487 case MOUSE_MODEL_GENERIC:
3488 default:
3489 break;
3490 }
3491
3492 /* scale values */
3493 if (sc->mode.accelfactor >= 1) {
3494 if (x != 0) {

--- 1016 unchanged lines hidden (view full) ---

4511 synaptics_sysctl_create_tree(sc);
4512
4513 sc->hw.buttons = buttons;
4514 }
4515
4516 return (TRUE);
4517}
4518
4519/* IBM/Lenovo TrackPoint */
4520static int
4521trackpoint_command(KBDC kbdc, int cmd, int loc, int val)
4522{
4523 const int seq[] = { 0xe2, cmd, loc, val };
4524 int i;
4525
4526 for (i = 0; i < nitems(seq); i++)
4527 if (send_aux_command(kbdc, seq[i]) != PSM_ACK)
4528 return (EIO);
4529 return (0);
4530}
4531
4532#define PSM_TPINFO(x) offsetof(struct psm_softc, tpinfo.x)
4533#define TPMASK 0
4534#define TPLOC 1
4535#define TPINFO 2
4536
4537static int
4538trackpoint_sysctl(SYSCTL_HANDLER_ARGS)
4539{
4540 static const int data[][3] = {
4541 { 0x00, 0x4a, PSM_TPINFO(sensitivity) },
4542 { 0x00, 0x4d, PSM_TPINFO(inertia) },
4543 { 0x00, 0x60, PSM_TPINFO(uplateau) },
4544 { 0x00, 0x57, PSM_TPINFO(reach) },
4545 { 0x00, 0x58, PSM_TPINFO(draghys) },
4546 { 0x00, 0x59, PSM_TPINFO(mindrag) },
4547 { 0x00, 0x5a, PSM_TPINFO(upthresh) },
4548 { 0x00, 0x5c, PSM_TPINFO(threshold) },
4549 { 0x00, 0x5d, PSM_TPINFO(jenks) },
4550 { 0x00, 0x5e, PSM_TPINFO(ztime) },
4551 { 0x01, 0x2c, PSM_TPINFO(pts) },
4552 { 0x08, 0x2d, PSM_TPINFO(skipback) }
4553 };
4554 struct psm_softc *sc;
4555 int error, newval, *oldvalp;
4556 const int *tp;
4557
4558 if (arg1 == NULL || arg2 < 0 || arg2 >= nitems(data))
4559 return (EINVAL);
4560 sc = arg1;
4561 tp = data[arg2];
4562 oldvalp = (int *)((intptr_t)sc + tp[TPINFO]);
4563 newval = *oldvalp;
4564 error = sysctl_handle_int(oidp, &newval, 0, req);
4565 if (error != 0)
4566 return (error);
4567 if (newval == *oldvalp)
4568 return (0);
4569 if (newval < 0 || newval > (tp[TPMASK] == 0 ? 255 : 1))
4570 return (EINVAL);
4571 error = trackpoint_command(sc->kbdc, tp[TPMASK] == 0 ? 0x81 : 0x47,
4572 tp[TPLOC], tp[TPMASK] == 0 ? newval : tp[TPMASK]);
4573 if (error != 0)
4574 return (error);
4575 *oldvalp = newval;
4576
4577 return (0);
4578}
4579
4580static void
4581trackpoint_sysctl_create_tree(struct psm_softc *sc)
4582{
4583
4584 if (sc->tpinfo.sysctl_tree != NULL)
4585 return;
4586
4587 /* Attach extra trackpoint sysctl nodes under hw.psm.trackpoint */
4588 sysctl_ctx_init(&sc->tpinfo.sysctl_ctx);
4589 sc->tpinfo.sysctl_tree = SYSCTL_ADD_NODE(&sc->tpinfo.sysctl_ctx,
4590 SYSCTL_STATIC_CHILDREN(_hw_psm), OID_AUTO, "trackpoint", CTLFLAG_RD,
4591 0, "IBM/Lenovo TrackPoint");
4592
4593 /* hw.psm.trackpoint.sensitivity */
4594 sc->tpinfo.sensitivity = 0x64;
4595 SYSCTL_ADD_PROC(&sc->tpinfo.sysctl_ctx,
4596 SYSCTL_CHILDREN(sc->tpinfo.sysctl_tree), OID_AUTO,
4597 "sensitivity", CTLTYPE_INT|CTLFLAG_RW|CTLFLAG_ANYBODY,
4598 sc, TRACKPOINT_SYSCTL_SENSITIVITY,
4599 trackpoint_sysctl, "I",
4600 "Sensitivity");
4601
4602 /* hw.psm.trackpoint.negative_inertia */
4603 sc->tpinfo.inertia = 0x06;
4604 SYSCTL_ADD_PROC(&sc->tpinfo.sysctl_ctx,
4605 SYSCTL_CHILDREN(sc->tpinfo.sysctl_tree), OID_AUTO,
4606 "negative_inertia", CTLTYPE_INT|CTLFLAG_RW|CTLFLAG_ANYBODY,
4607 sc, TRACKPOINT_SYSCTL_NEGATIVE_INERTIA,
4608 trackpoint_sysctl, "I",
4609 "Negative inertia factor");
4610
4611 /* hw.psm.trackpoint.upper_plateau */
4612 sc->tpinfo.uplateau = 0x61;
4613 SYSCTL_ADD_PROC(&sc->tpinfo.sysctl_ctx,
4614 SYSCTL_CHILDREN(sc->tpinfo.sysctl_tree), OID_AUTO,
4615 "upper_plateau", CTLTYPE_INT|CTLFLAG_RW|CTLFLAG_ANYBODY,
4616 sc, TRACKPOINT_SYSCTL_UPPER_PLATEAU,
4617 trackpoint_sysctl, "I",
4618 "Transfer function upper plateau speed");
4619
4620 /* hw.psm.trackpoint.backup_range */
4621 sc->tpinfo.reach = 0x0a;
4622 SYSCTL_ADD_PROC(&sc->tpinfo.sysctl_ctx,
4623 SYSCTL_CHILDREN(sc->tpinfo.sysctl_tree), OID_AUTO,
4624 "backup_range", CTLTYPE_INT|CTLFLAG_RW|CTLFLAG_ANYBODY,
4625 sc, TRACKPOINT_SYSCTL_BACKUP_RANGE,
4626 trackpoint_sysctl, "I",
4627 "Backup range");
4628
4629 /* hw.psm.trackpoint.drag_hysteresis */
4630 sc->tpinfo.draghys = 0xff;
4631 SYSCTL_ADD_PROC(&sc->tpinfo.sysctl_ctx,
4632 SYSCTL_CHILDREN(sc->tpinfo.sysctl_tree), OID_AUTO,
4633 "drag_hysteresis", CTLTYPE_INT|CTLFLAG_RW|CTLFLAG_ANYBODY,
4634 sc, TRACKPOINT_SYSCTL_DRAG_HYSTERESIS,
4635 trackpoint_sysctl, "I",
4636 "Drag hysteresis");
4637
4638 /* hw.psm.trackpoint.minimum_drag */
4639 sc->tpinfo.mindrag = 0x14;
4640 SYSCTL_ADD_PROC(&sc->tpinfo.sysctl_ctx,
4641 SYSCTL_CHILDREN(sc->tpinfo.sysctl_tree), OID_AUTO,
4642 "minimum_drag", CTLTYPE_INT|CTLFLAG_RW|CTLFLAG_ANYBODY,
4643 sc, TRACKPOINT_SYSCTL_MINIMUM_DRAG,
4644 trackpoint_sysctl, "I",
4645 "Minimum drag");
4646
4647 /* hw.psm.trackpoint.up_threshold */
4648 sc->tpinfo.upthresh = 0xff;
4649 SYSCTL_ADD_PROC(&sc->tpinfo.sysctl_ctx,
4650 SYSCTL_CHILDREN(sc->tpinfo.sysctl_tree), OID_AUTO,
4651 "up_threshold", CTLTYPE_INT|CTLFLAG_RW|CTLFLAG_ANYBODY,
4652 sc, TRACKPOINT_SYSCTL_UP_THRESHOLD,
4653 trackpoint_sysctl, "I",
4654 "Up threshold for release");
4655
4656 /* hw.psm.trackpoint.threshold */
4657 sc->tpinfo.threshold = 0x08;
4658 SYSCTL_ADD_PROC(&sc->tpinfo.sysctl_ctx,
4659 SYSCTL_CHILDREN(sc->tpinfo.sysctl_tree), OID_AUTO,
4660 "threshold", CTLTYPE_INT|CTLFLAG_RW|CTLFLAG_ANYBODY,
4661 sc, TRACKPOINT_SYSCTL_THRESHOLD,
4662 trackpoint_sysctl, "I",
4663 "Threshold");
4664
4665 /* hw.psm.trackpoint.jenks_curvature */
4666 sc->tpinfo.jenks = 0x87;
4667 SYSCTL_ADD_PROC(&sc->tpinfo.sysctl_ctx,
4668 SYSCTL_CHILDREN(sc->tpinfo.sysctl_tree), OID_AUTO,
4669 "jenks_curvature", CTLTYPE_INT|CTLFLAG_RW|CTLFLAG_ANYBODY,
4670 sc, TRACKPOINT_SYSCTL_JENKS_CURVATURE,
4671 trackpoint_sysctl, "I",
4672 "Jenks curvature");
4673
4674 /* hw.psm.trackpoint.z_time */
4675 sc->tpinfo.ztime = 0x26;
4676 SYSCTL_ADD_PROC(&sc->tpinfo.sysctl_ctx,
4677 SYSCTL_CHILDREN(sc->tpinfo.sysctl_tree), OID_AUTO,
4678 "z_time", CTLTYPE_INT|CTLFLAG_RW|CTLFLAG_ANYBODY,
4679 sc, TRACKPOINT_SYSCTL_Z_TIME,
4680 trackpoint_sysctl, "I",
4681 "Z time constant");
4682
4683 /* hw.psm.trackpoint.press_to_select */
4684 sc->tpinfo.pts = 0x00;
4685 SYSCTL_ADD_PROC(&sc->tpinfo.sysctl_ctx,
4686 SYSCTL_CHILDREN(sc->tpinfo.sysctl_tree), OID_AUTO,
4687 "press_to_select", CTLTYPE_INT|CTLFLAG_RW|CTLFLAG_ANYBODY,
4688 sc, TRACKPOINT_SYSCTL_PRESS_TO_SELECT,
4689 trackpoint_sysctl, "I",
4690 "Press to Select");
4691
4692 /* hw.psm.trackpoint.skip_backups */
4693 sc->tpinfo.skipback = 0x00;
4694 SYSCTL_ADD_PROC(&sc->tpinfo.sysctl_ctx,
4695 SYSCTL_CHILDREN(sc->tpinfo.sysctl_tree), OID_AUTO,
4696 "skip_backups", CTLTYPE_INT|CTLFLAG_RW|CTLFLAG_ANYBODY,
4697 sc, TRACKPOINT_SYSCTL_SKIP_BACKUPS,
4698 trackpoint_sysctl, "I",
4699 "Skip backups from drags");
4700}
4701
4702static int
4703enable_trackpoint(KBDC kbdc, struct psm_softc *sc)
4704{
4705 int id;
4706
4707 kbdc = sc->kbdc;
4708
4709 if (send_aux_command(kbdc, 0xe1) != PSM_ACK ||
4710 read_aux_data(kbdc) != 0x01)
4711 return (FALSE);
4712 id = read_aux_data(kbdc);
4713 if (id < 0x01)
4714 return (FALSE);
4715 if (sc != NULL)
4716 sc->tphw = id;
4717 if (!trackpoint_support)
4718 return (FALSE);
4719
4720 if (sc != NULL) {
4721 /* Create sysctl tree. */
4722 trackpoint_sysctl_create_tree(sc);
4723
4724 trackpoint_command(kbdc, 0x81, 0x4a, sc->tpinfo.sensitivity);
4725 trackpoint_command(kbdc, 0x81, 0x4d, sc->tpinfo.inertia);
4726 trackpoint_command(kbdc, 0x81, 0x60, sc->tpinfo.uplateau);
4727 trackpoint_command(kbdc, 0x81, 0x57, sc->tpinfo.reach);
4728 trackpoint_command(kbdc, 0x81, 0x58, sc->tpinfo.draghys);
4729 trackpoint_command(kbdc, 0x81, 0x59, sc->tpinfo.mindrag);
4730 trackpoint_command(kbdc, 0x81, 0x5a, sc->tpinfo.upthresh);
4731 trackpoint_command(kbdc, 0x81, 0x5c, sc->tpinfo.threshold);
4732 trackpoint_command(kbdc, 0x81, 0x5d, sc->tpinfo.jenks);
4733 trackpoint_command(kbdc, 0x81, 0x5e, sc->tpinfo.ztime);
4734 if (sc->tpinfo.pts == 0x01)
4735 trackpoint_command(kbdc, 0x47, 0x2c, 0x01);
4736 if (sc->tpinfo.skipback == 0x01)
4737 trackpoint_command(kbdc, 0x47, 0x2d, 0x08);
4738
4739 sc->hw.hwid = id;
4740 sc->hw.buttons = 3;
4741 }
4742
4743 return (TRUE);
4744}
4745
4477/* Interlink electronics VersaPad */
4478static int
4479enable_versapad(KBDC kbdc, struct psm_softc *sc)
4480{
4481 int data[3];
4482
4483 set_mouse_resolution(kbdc, PSMD_RES_MEDIUM_HIGH); /* set res. 2 */
4484 set_mouse_sampling_rate(kbdc, 100); /* set rate 100 */

--- 198 unchanged lines hidden ---
4746/* Interlink electronics VersaPad */
4747static int
4748enable_versapad(KBDC kbdc, struct psm_softc *sc)
4749{
4750 int data[3];
4751
4752 set_mouse_resolution(kbdc, PSMD_RES_MEDIUM_HIGH); /* set res. 2 */
4753 set_mouse_sampling_rate(kbdc, 100); /* set rate 100 */

--- 198 unchanged lines hidden ---