Deleted Added
full compact
psm.c (281127) psm.c (281440)
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 281127 2015-04-06 01:04:08Z rpaulo $");
62__FBSDID("$FreeBSD: head/sys/dev/atkbdc/psm.c 281440 2015-04-11 18:44:07Z rpaulo $");
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>

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

193 SYNAPTICS_SYSCTL_VSCROLL_DIV_MIN,
194 SYNAPTICS_SYSCTL_VSCROLL_DIV_MAX
195};
196
197typedef struct synapticsinfo {
198 struct sysctl_ctx_list sysctl_ctx;
199 struct sysctl_oid *sysctl_tree;
200 int directional_scrolls;
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>

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

193 SYNAPTICS_SYSCTL_VSCROLL_DIV_MIN,
194 SYNAPTICS_SYSCTL_VSCROLL_DIV_MAX
195};
196
197typedef struct synapticsinfo {
198 struct sysctl_ctx_list sysctl_ctx;
199 struct sysctl_oid *sysctl_tree;
200 int directional_scrolls;
201 int two_finger_scroll;
201 int min_pressure;
202 int max_pressure;
203 int max_width;
204 int margin_top;
205 int margin_right;
206 int margin_bottom;
207 int margin_left;
208 int na_top;

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

331 int watchdog; /* watchdog timer flag */
332 struct callout callout; /* watchdog timer call out */
333 struct callout softcallout; /* buffer timer call out */
334 struct cdev *dev;
335 struct cdev *bdev;
336 int lasterr;
337 int cmdcount;
338 struct sigio *async; /* Processes waiting for SIGIO */
202 int min_pressure;
203 int max_pressure;
204 int max_width;
205 int margin_top;
206 int margin_right;
207 int margin_bottom;
208 int margin_left;
209 int na_top;

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

332 int watchdog; /* watchdog timer flag */
333 struct callout callout; /* watchdog timer call out */
334 struct callout softcallout; /* buffer timer call out */
335 struct cdev *dev;
336 struct cdev *bdev;
337 int lasterr;
338 int cmdcount;
339 struct sigio *async; /* Processes waiting for SIGIO */
340 int extended_buttons;
339};
340static devclass_t psm_devclass;
341
342/* driver state flags (state) */
343#define PSM_VALID 0x80
344#define PSM_OPEN 1 /* Device is open */
345#define PSM_ASLP 2 /* Waiting for mouse data */
346#define PSM_SOFTARMED 4 /* Software interrupt armed */

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

2747 touchpad_buttons |= MOUSE_BUTTON4DOWN;
2748 if (pb->ipacket[5] & 0x01)
2749 touchpad_buttons |= MOUSE_BUTTON5DOWN;
2750 if (pb->ipacket[4] & 0x02)
2751 touchpad_buttons |= MOUSE_BUTTON6DOWN;
2752 if (pb->ipacket[5] & 0x02)
2753 touchpad_buttons |= MOUSE_BUTTON7DOWN;
2754 } else {
341};
342static devclass_t psm_devclass;
343
344/* driver state flags (state) */
345#define PSM_VALID 0x80
346#define PSM_OPEN 1 /* Device is open */
347#define PSM_ASLP 2 /* Waiting for mouse data */
348#define PSM_SOFTARMED 4 /* Software interrupt armed */

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

2749 touchpad_buttons |= MOUSE_BUTTON4DOWN;
2750 if (pb->ipacket[5] & 0x01)
2751 touchpad_buttons |= MOUSE_BUTTON5DOWN;
2752 if (pb->ipacket[4] & 0x02)
2753 touchpad_buttons |= MOUSE_BUTTON6DOWN;
2754 if (pb->ipacket[5] & 0x02)
2755 touchpad_buttons |= MOUSE_BUTTON7DOWN;
2756 } else {
2755 touchpad_buttons |= MOUSE_BUTTON2DOWN;
2757 if (pb->ipacket[4] & 0x01)
2758 touchpad_buttons |= MOUSE_BUTTON1DOWN;
2759 if (pb->ipacket[5] & 0x01)
2760 touchpad_buttons |= MOUSE_BUTTON3DOWN;
2761 if (pb->ipacket[4] & 0x02)
2762 touchpad_buttons |= MOUSE_BUTTON2DOWN;
2763 sc->extended_buttons = touchpad_buttons;
2756 }
2757
2758 /*
2759 * Zero out bits used by extended buttons to avoid
2760 * misinterpretation of the data absolute position.
2761 *
2762 * The bits represented by
2763 *

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

2769 * (1 << n) - 1
2770 */
2771 int maskedbits = 0;
2772 int mask = 0;
2773 maskedbits = (sc->synhw.nExtendedButtons + 1) >> 1;
2774 mask = (1 << maskedbits) - 1;
2775 pb->ipacket[4] &= ~(mask);
2776 pb->ipacket[5] &= ~(mask);
2764 }
2765
2766 /*
2767 * Zero out bits used by extended buttons to avoid
2768 * misinterpretation of the data absolute position.
2769 *
2770 * The bits represented by
2771 *

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

2777 * (1 << n) - 1
2778 */
2779 int maskedbits = 0;
2780 int mask = 0;
2781 maskedbits = (sc->synhw.nExtendedButtons + 1) >> 1;
2782 mask = (1 << maskedbits) - 1;
2783 pb->ipacket[4] &= ~(mask);
2784 pb->ipacket[5] &= ~(mask);
2785 } else if (!sc->syninfo.directional_scrolls &&
2786 !sc->synaction.in_vscroll) {
2787 /*
2788 * Keep reporting MOUSE DOWN until we get a new packet
2789 * indicating otherwise.
2790 */
2791 touchpad_buttons |= sc->extended_buttons;
2777 }
2778 }
2792 }
2793 }
2794 /* Handle ClickPad. */
2795 if (sc->synhw.capClickPad &&
2796 ((pb->ipacket[0] ^ pb->ipacket[3]) & 0x01))
2797 touchpad_buttons |= MOUSE_BUTTON1DOWN;
2779
2780 ms->button = touchpad_buttons | guest_buttons;
2781
2798
2799 ms->button = touchpad_buttons | guest_buttons;
2800
2782 /* Check pressure to detect a real wanted action on the
2783 * touchpad. */
2801 /*
2802 * Check pressure to detect a real wanted action on the
2803 * touchpad.
2804 */
2784 if (*z >= sc->syninfo.min_pressure) {
2785 synapticsaction_t *synaction;
2786 int cursor, peer, window;
2787 int dx, dy, dxp, dyp;
2788 int max_width, max_pressure;
2789 int margin_top, margin_right, margin_bottom, margin_left;
2790 int na_top, na_right, na_bottom, na_left;
2791 int window_min, window_max;
2792 int multiplicator;
2793 int weight_current, weight_previous, weight_len_squared;
2794 int div_min, div_max, div_len;
2795 int vscroll_hor_area, vscroll_ver_area;
2805 if (*z >= sc->syninfo.min_pressure) {
2806 synapticsaction_t *synaction;
2807 int cursor, peer, window;
2808 int dx, dy, dxp, dyp;
2809 int max_width, max_pressure;
2810 int margin_top, margin_right, margin_bottom, margin_left;
2811 int na_top, na_right, na_bottom, na_left;
2812 int window_min, window_max;
2813 int multiplicator;
2814 int weight_current, weight_previous, weight_len_squared;
2815 int div_min, div_max, div_len;
2816 int vscroll_hor_area, vscroll_ver_area;
2796
2817 int two_finger_scroll;
2797 int len, weight_prev_x, weight_prev_y;
2798 int div_max_x, div_max_y, div_x, div_y;
2799
2800 /* Read sysctl. */
2801 /* XXX Verify values? */
2802 max_width = sc->syninfo.max_width;
2803 max_pressure = sc->syninfo.max_pressure;
2804 margin_top = sc->syninfo.margin_top;

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

2815 weight_current = sc->syninfo.weight_current;
2816 weight_previous = sc->syninfo.weight_previous;
2817 weight_len_squared = sc->syninfo.weight_len_squared;
2818 div_min = sc->syninfo.div_min;
2819 div_max = sc->syninfo.div_max;
2820 div_len = sc->syninfo.div_len;
2821 vscroll_hor_area = sc->syninfo.vscroll_hor_area;
2822 vscroll_ver_area = sc->syninfo.vscroll_ver_area;
2818 int len, weight_prev_x, weight_prev_y;
2819 int div_max_x, div_max_y, div_x, div_y;
2820
2821 /* Read sysctl. */
2822 /* XXX Verify values? */
2823 max_width = sc->syninfo.max_width;
2824 max_pressure = sc->syninfo.max_pressure;
2825 margin_top = sc->syninfo.margin_top;

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

2836 weight_current = sc->syninfo.weight_current;
2837 weight_previous = sc->syninfo.weight_previous;
2838 weight_len_squared = sc->syninfo.weight_len_squared;
2839 div_min = sc->syninfo.div_min;
2840 div_max = sc->syninfo.div_max;
2841 div_len = sc->syninfo.div_len;
2842 vscroll_hor_area = sc->syninfo.vscroll_hor_area;
2843 vscroll_ver_area = sc->syninfo.vscroll_ver_area;
2844 two_finger_scroll = sc->syninfo.two_finger_scroll;
2823
2824 /* Palm detection. */
2825 if (!(
2826 (sc->synhw.capMultiFinger && (w == 0 || w == 1)) ||
2827 (sc->synhw.capPalmDetect && w >= 4 && w <= max_width) ||
2828 (!sc->synhw.capPalmDetect && *z <= max_pressure) ||
2829 (sc->synhw.capPen && w == 2))) {
2830 /*

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

2974 dxp = abs(synaction->queue[synaction->queue_cursor].x -
2975 synaction->start_x);
2976 dyp = abs(synaction->queue[synaction->queue_cursor].y -
2977 synaction->start_y);
2978
2979 if (timevalcmp(&sc->lastsoftintr, &sc->taptimeout, >) ||
2980 dxp >= sc->syninfo.vscroll_min_delta ||
2981 dyp >= sc->syninfo.vscroll_min_delta) {
2845
2846 /* Palm detection. */
2847 if (!(
2848 (sc->synhw.capMultiFinger && (w == 0 || w == 1)) ||
2849 (sc->synhw.capPalmDetect && w >= 4 && w <= max_width) ||
2850 (!sc->synhw.capPalmDetect && *z <= max_pressure) ||
2851 (sc->synhw.capPen && w == 2))) {
2852 /*

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

2996 dxp = abs(synaction->queue[synaction->queue_cursor].x -
2997 synaction->start_x);
2998 dyp = abs(synaction->queue[synaction->queue_cursor].y -
2999 synaction->start_y);
3000
3001 if (timevalcmp(&sc->lastsoftintr, &sc->taptimeout, >) ||
3002 dxp >= sc->syninfo.vscroll_min_delta ||
3003 dyp >= sc->syninfo.vscroll_min_delta) {
2982 /* Check for horizontal scrolling. */
2983 if ((vscroll_hor_area > 0 &&
2984 synaction->start_y <= vscroll_hor_area) ||
2985 (vscroll_hor_area < 0 &&
2986 synaction->start_y >=
2987 6143 + vscroll_hor_area))
2988 synaction->in_vscroll += 2;
3004 /*
3005 * Handle two finger scrolling.
3006 * Note that we don't rely on fingers_nb
3007 * as that keeps the maximum number of fingers.
3008 */
3009 if (two_finger_scroll) {
3010 if (w == 0) {
3011 synaction->in_vscroll +=
3012 dyp ? 2 : 0;
3013 synaction->in_vscroll +=
3014 dxp ? 1 : 0;
3015 }
3016 } else {
3017 /* Check for horizontal scrolling. */
3018 if ((vscroll_hor_area > 0 &&
3019 synaction->start_y <=
3020 vscroll_hor_area) ||
3021 (vscroll_hor_area < 0 &&
3022 synaction->start_y >=
3023 6143 + vscroll_hor_area))
3024 synaction->in_vscroll += 2;
2989
3025
2990 /* Check for vertical scrolling. */
2991 if ((vscroll_ver_area > 0 &&
2992 synaction->start_x <= vscroll_ver_area) ||
2993 (vscroll_ver_area < 0 &&
2994 synaction->start_x >=
2995 6143 + vscroll_ver_area))
2996 synaction->in_vscroll += 1;
3026 /* Check for vertical scrolling. */
3027 if ((vscroll_ver_area > 0 &&
3028 synaction->start_x <=
3029 vscroll_ver_area) ||
3030 (vscroll_ver_area < 0 &&
3031 synaction->start_x >=
3032 6143 + vscroll_ver_area))
3033 synaction->in_vscroll += 1;
3034 }
2997
2998 /* Avoid conflicts if area overlaps. */
3035
3036 /* Avoid conflicts if area overlaps. */
2999 if (synaction->in_vscroll == 3)
3037 if (synaction->in_vscroll >= 3)
3000 synaction->in_vscroll =
3001 (dxp > dyp) ? 2 : 1;
3002 }
3038 synaction->in_vscroll =
3039 (dxp > dyp) ? 2 : 1;
3040 }
3003 VLOG(5, (LOG_DEBUG,
3004 "synaptics: virtual scrolling: %s "
3005 "(direction=%d, dxp=%d, dyp=%d)\n",
3006 synaction->in_vscroll ? "YES" : "NO",
3007 synaction->in_vscroll, dxp, dyp));
3008 }
3041 }
3042 /*
3043 * Reset two finger scrolling when the number of fingers
3044 * is different from two.
3045 */
3046 if (two_finger_scroll && w != 0)
3047 synaction->in_vscroll = 0;
3009
3048
3049 VLOG(5, (LOG_DEBUG,
3050 "synaptics: virtual scrolling: %s "
3051 "(direction=%d, dxp=%d, dyp=%d, fingers=%d)\n",
3052 synaction->in_vscroll ? "YES" : "NO",
3053 synaction->in_vscroll, dxp, dyp,
3054 synaction->fingers_nb));
3055
3010 weight_prev_x = weight_prev_y = weight_previous;
3011 div_max_x = div_max_y = div_max;
3012
3013 if (synaction->in_vscroll) {
3014 /* Dividers are different with virtual scrolling. */
3015 div_min = sc->syninfo.vscroll_div_min;
3016 div_max_x = div_max_y = sc->syninfo.vscroll_div_max;
3017 } else {

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

3242 *
3243 * xf86-input-mouse needs therefore a small patch to
3244 * understand these special values. Without it, the
3245 * horizontal wheel acts as a vertical wheel in X.Org.
3246 *
3247 * That's why the horizontal wheel is disabled by
3248 * default for now.
3249 */
3056 weight_prev_x = weight_prev_y = weight_previous;
3057 div_max_x = div_max_y = div_max;
3058
3059 if (synaction->in_vscroll) {
3060 /* Dividers are different with virtual scrolling. */
3061 div_min = sc->syninfo.vscroll_div_min;
3062 div_max_x = div_max_y = sc->syninfo.vscroll_div_max;
3063 } else {

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

3288 *
3289 * xf86-input-mouse needs therefore a small patch to
3290 * understand these special values. Without it, the
3291 * horizontal wheel acts as a vertical wheel in X.Org.
3292 *
3293 * That's why the horizontal wheel is disabled by
3294 * default for now.
3295 */
3296
3250 if (ms->button & MOUSE_BUTTON4DOWN) {
3251 *z = -1;
3252 ms->button &= ~MOUSE_BUTTON4DOWN;
3253 } else if (ms->button & MOUSE_BUTTON5DOWN) {
3254 *z = 1;
3255 ms->button &= ~MOUSE_BUTTON5DOWN;
3256 } else if (ms->button & MOUSE_BUTTON6DOWN) {
3257 *z = -2;

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

3455 MOUSE_BUTTON4DOWN : 0;
3456 break;
3457
3458 case MOUSE_MODEL_VERSAPAD:
3459 proc_versapad(sc, pb, &ms, &x, &y, &z);
3460 c = ((x < 0) ? MOUSE_PS2_XNEG : 0) |
3461 ((y < 0) ? MOUSE_PS2_YNEG : 0);
3462 break;
3297 if (ms->button & MOUSE_BUTTON4DOWN) {
3298 *z = -1;
3299 ms->button &= ~MOUSE_BUTTON4DOWN;
3300 } else if (ms->button & MOUSE_BUTTON5DOWN) {
3301 *z = 1;
3302 ms->button &= ~MOUSE_BUTTON5DOWN;
3303 } else if (ms->button & MOUSE_BUTTON6DOWN) {
3304 *z = -2;

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

3502 MOUSE_BUTTON4DOWN : 0;
3503 break;
3504
3505 case MOUSE_MODEL_VERSAPAD:
3506 proc_versapad(sc, pb, &ms, &x, &y, &z);
3507 c = ((x < 0) ? MOUSE_PS2_XNEG : 0) |
3508 ((y < 0) ? MOUSE_PS2_YNEG : 0);
3509 break;
3463
3510
3464 case MOUSE_MODEL_4D:
3465 /*
3466 * b7 b6 b5 b4 b3 b2 b1 b0
3467 * byte 1: s2 d2 s1 d1 1 M R L
3468 * byte 2: sx x x x x x x x
3469 * byte 3: sy y y y y y y y
3470 *
3471 * s1: wheel 1 direction

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

4103
4104 /* Attach extra synaptics sysctl nodes under hw.psm.synaptics */
4105 sysctl_ctx_init(&sc->syninfo.sysctl_ctx);
4106 sc->syninfo.sysctl_tree = SYSCTL_ADD_NODE(&sc->syninfo.sysctl_ctx,
4107 SYSCTL_STATIC_CHILDREN(_hw_psm), OID_AUTO, "synaptics", CTLFLAG_RD,
4108 0, "Synaptics TouchPad");
4109
4110 /* hw.psm.synaptics.directional_scrolls. */
3511 case MOUSE_MODEL_4D:
3512 /*
3513 * b7 b6 b5 b4 b3 b2 b1 b0
3514 * byte 1: s2 d2 s1 d1 1 M R L
3515 * byte 2: sx x x x x x x x
3516 * byte 3: sy y y y y y y y
3517 *
3518 * s1: wheel 1 direction

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

4150
4151 /* Attach extra synaptics sysctl nodes under hw.psm.synaptics */
4152 sysctl_ctx_init(&sc->syninfo.sysctl_ctx);
4153 sc->syninfo.sysctl_tree = SYSCTL_ADD_NODE(&sc->syninfo.sysctl_ctx,
4154 SYSCTL_STATIC_CHILDREN(_hw_psm), OID_AUTO, "synaptics", CTLFLAG_RD,
4155 0, "Synaptics TouchPad");
4156
4157 /* hw.psm.synaptics.directional_scrolls. */
4111 sc->syninfo.directional_scrolls = 1;
4158 sc->syninfo.directional_scrolls = 0;
4112 SYSCTL_ADD_INT(&sc->syninfo.sysctl_ctx,
4113 SYSCTL_CHILDREN(sc->syninfo.sysctl_tree), OID_AUTO,
4114 "directional_scrolls", CTLFLAG_RW|CTLFLAG_ANYBODY,
4115 &sc->syninfo.directional_scrolls, 0,
4116 "Enable hardware scrolling pad (if non-zero) or register it as "
4159 SYSCTL_ADD_INT(&sc->syninfo.sysctl_ctx,
4160 SYSCTL_CHILDREN(sc->syninfo.sysctl_tree), OID_AUTO,
4161 "directional_scrolls", CTLFLAG_RW|CTLFLAG_ANYBODY,
4162 &sc->syninfo.directional_scrolls, 0,
4163 "Enable hardware scrolling pad (if non-zero) or register it as "
4117 "a middle-click (if 0)");
4164 "extended buttons (if 0)");
4118
4165
4166 /*
4167 * Turn off two finger scroll if we have a
4168 * physical area reserved for scrolling or when
4169 * there's no multi finger support.
4170 */
4171 if (sc->synhw.verticalScroll || sc->synhw.capMultiFinger == 0)
4172 sc->syninfo.two_finger_scroll = 0;
4173 else
4174 sc->syninfo.two_finger_scroll = 1;
4175 /* hw.psm.synaptics.two_finger_scroll. */
4176 SYSCTL_ADD_INT(&sc->syninfo.sysctl_ctx,
4177 SYSCTL_CHILDREN(sc->syninfo.sysctl_tree), OID_AUTO,
4178 "two_finger_scroll", CTLFLAG_RW|CTLFLAG_ANYBODY,
4179 &sc->syninfo.two_finger_scroll, 0,
4180 "Enable two finger scrolling");
4181
4119 /* hw.psm.synaptics.min_pressure. */
4120 sc->syninfo.min_pressure = 16;
4121 SYSCTL_ADD_PROC(&sc->syninfo.sysctl_ctx,
4122 SYSCTL_CHILDREN(sc->syninfo.sysctl_tree), OID_AUTO,
4123 "min_pressure", CTLTYPE_INT|CTLFLAG_RW|CTLFLAG_ANYBODY,
4124 &sc->syninfo.min_pressure, SYNAPTICS_SYSCTL_MIN_PRESSURE,
4125 synaptics_sysctl, "I",
4126 "Minimum pressure required to start an action");

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

4514 * supports this number of extended queries. We can load
4515 * more information about buttons using query 0x09.
4516 */
4517 if (synhw.capExtended && synhw.nExtendedQueries) {
4518 if (mouse_ext_command(kbdc, 0x09) == 0)
4519 return (FALSE);
4520 if (get_mouse_status(kbdc, status, 0, 3) != 3)
4521 return (FALSE);
4182 /* hw.psm.synaptics.min_pressure. */
4183 sc->syninfo.min_pressure = 16;
4184 SYSCTL_ADD_PROC(&sc->syninfo.sysctl_ctx,
4185 SYSCTL_CHILDREN(sc->syninfo.sysctl_tree), OID_AUTO,
4186 "min_pressure", CTLTYPE_INT|CTLFLAG_RW|CTLFLAG_ANYBODY,
4187 &sc->syninfo.min_pressure, SYNAPTICS_SYSCTL_MIN_PRESSURE,
4188 synaptics_sysctl, "I",
4189 "Minimum pressure required to start an action");

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

4577 * supports this number of extended queries. We can load
4578 * more information about buttons using query 0x09.
4579 */
4580 if (synhw.capExtended && synhw.nExtendedQueries) {
4581 if (mouse_ext_command(kbdc, 0x09) == 0)
4582 return (FALSE);
4583 if (get_mouse_status(kbdc, status, 0, 3) != 3)
4584 return (FALSE);
4585 synhw.verticalScroll = (status[0] & 0x01) != 0;
4586 synhw.horizontalScroll = (status[0] & 0x02) != 0;
4587 synhw.verticalWheel = (status[0] & 0x08) != 0;
4522 synhw.nExtendedButtons = (status[1] & 0xf0) >> 4;
4588 synhw.nExtendedButtons = (status[1] & 0xf0) >> 4;
4589 if (verbose >= 2) {
4590 printf(" Extended model ID:\n");
4591 printf(" verticalScroll: %d\n",
4592 synhw.verticalScroll);
4593 printf(" horizontalScroll: %d\n",
4594 synhw.horizontalScroll);
4595 printf(" verticalWheel: %d\n",
4596 synhw.verticalWheel);
4597 printf(" nExtendedButtons: %d\n",
4598 synhw.nExtendedButtons);
4599 }
4523 /*
4524 * Add the number of extended buttons to the total
4525 * button support count, including the middle button
4526 * if capMiddle support bit is set.
4527 */
4528 buttons = synhw.nExtendedButtons + synhw.capMiddle;
4529 } else
4530 /*

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

4535 }
4536 if (verbose >= 2) {
4537 if (synhw.capExtended)
4538 printf(" Additional Buttons: %d\n", buttons);
4539 else
4540 printf(" No extended capabilities\n");
4541 }
4542
4600 /*
4601 * Add the number of extended buttons to the total
4602 * button support count, including the middle button
4603 * if capMiddle support bit is set.
4604 */
4605 buttons = synhw.nExtendedButtons + synhw.capMiddle;
4606 } else
4607 /*

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

4612 }
4613 if (verbose >= 2) {
4614 if (synhw.capExtended)
4615 printf(" Additional Buttons: %d\n", buttons);
4616 else
4617 printf(" No extended capabilities\n");
4618 }
4619
4620 /* Read the continued capabilities bits. */
4621 if (mouse_ext_command(kbdc, 0xc) != 0 &&
4622 get_mouse_status(kbdc, status, 0, 3) == 3) {
4623 synhw.capClickPad = (status[1] & 0x01) << 1;
4624 synhw.capClickPad |= (status[0] & 0x10) != 0;
4625 synhw.capDeluxeLEDs = (status[1] & 0x02) != 0;
4626 synhw.noAbsoluteFilter = (status[1] & 0x04) != 0;
4627 synhw.capReportsV = (status[1] & 0x08) != 0;
4628 synhw.capUniformClickPad = (status[1] & 0x10) != 0;
4629 synhw.capReportsMin = (status[1] & 0x20) != 0;
4630 synhw.capInterTouch = (status[1] & 0x40) != 0;
4631 synhw.capReportsMax = (status[2] & 0x02) != 0;
4632 synhw.capClearPad = (status[2] & 0x04) != 0;
4633 synhw.capAdvancedGestures = (status[2] & 0x08) != 0;
4634 synhw.capCoveredPad = (status[2] & 0x80) != 0;
4635
4636 if (verbose >= 2) {
4637 printf(" Continued capabilities:\n");
4638 printf(" capClickPad: %d\n", synhw.capClickPad);
4639 printf(" capDeluxeLEDs: %d\n", synhw.capDeluxeLEDs);
4640 printf(" noAbsoluteFilter: %d\n",
4641 synhw.noAbsoluteFilter);
4642 printf(" capReportsV: %d\n", synhw.capReportsV);
4643 printf(" capUniformClickPad: %d\n",
4644 synhw.capUniformClickPad);
4645 printf(" capReportsMin: %d\n", synhw.capReportsMin);
4646 printf(" capInterTouch: %d\n", synhw.capInterTouch);
4647 printf(" capReportsMax: %d\n", synhw.capReportsMax);
4648 printf(" capClearPad: %d\n", synhw.capClearPad);
4649 printf(" capAdvancedGestures: %d\n",
4650 synhw.capAdvancedGestures);
4651 printf(" capCoveredPad: %d\n", synhw.capCoveredPad);
4652 }
4653 buttons += synhw.capClickPad;
4654 }
4655
4543 /*
4544 * Add the default number of 3 buttons to the total
4545 * count of supported buttons reported above.
4546 */
4547 buttons += 3;
4548
4549 /*
4550 * Read the mode byte.

--- 468 unchanged lines hidden ---
4656 /*
4657 * Add the default number of 3 buttons to the total
4658 * count of supported buttons reported above.
4659 */
4660 buttons += 3;
4661
4662 /*
4663 * Read the mode byte.

--- 468 unchanged lines hidden ---