View | Details | Raw Unified | Return to bug 57230 | Differences between
and this patch

Collapse All | Expand All

(-)psm.c (-2 / +51 lines)
Lines 774-779 Link Here
774
	}
774
	}
775
    }
775
    }
776
776
777
    /*
778
     * The Avocent SwitchView KVM appears to force an Intellimouse Explorer
779
     * to revert to plain Intellimouse protocol whenever the device is
780
     * disabled. This hack checks to see if we previously detected an Explorer,
781
     * and tests if the device is now reporting a different ID. If this is the 
782
     * case, we try to re-enable Explorer functionality.
783
     */
784
    if ((sc->hw.hwid == PSM_EXPLORER_ID) &&
785
            (get_aux_id(sc->kbdc) != PSM_EXPLORER_ID)) {
786
        log(LOG_DEBUG, "psm%d: Intellimouse Explorer reverted to lower "
787
                       "protocol.\n", sc->unit);
788
        enable_msexplorer(sc);
789
        if (get_aux_id(sc->kbdc) == PSM_EXPLORER_ID)
790
            log(LOG_DEBUG, "psm%d: Restored Intellimouse Explorer protocol.\n",
791
                sc->unit);
792
        else
793
            log(LOG_DEBUG, "psm%d: Could not restore Intellimouse Explorer "
794
                           " protocol.\n", sc->unit);
795
            /* We shouldn't get here unless someone switched mice out from
796
             * underneath us. How and/or should we deal with this? */
797
    }
798
777
    if (get_mouse_status(sc->kbdc, stat, 0, 3) < 3) 
799
    if (get_mouse_status(sc->kbdc, stat, 0, 3) < 3) 
778
        log(LOG_DEBUG, "psm%d: failed to get status (doopen).\n", sc->unit);
800
        log(LOG_DEBUG, "psm%d: failed to get status (doopen).\n", sc->unit);
779
801
Lines 2768-2785 Link Here
2768
static int
2790
static int
2769
enable_msexplorer(struct psm_softc *sc)
2791
enable_msexplorer(struct psm_softc *sc)
2770
{
2792
{
2793
    /* IntelliMouse initialization sequence */
2771
    static unsigned char rate0[] = { 200, 100, 80, };
2794
    static unsigned char rate0[] = { 200, 100, 80, };
2795
    /* IntelliMouse Explorer initialization sequence */
2772
    static unsigned char rate1[] = { 200, 200, 80, };
2796
    static unsigned char rate1[] = { 200, 200, 80, };
2773
    KBDC kbdc = sc->kbdc;
2797
    KBDC kbdc = sc->kbdc;
2774
    int id;
2798
    int id;
2775
    int i;
2799
    int i;
2776
2800
2777
    /* the special sequence to enable the extra buttons and the roller. */
2801
    /*
2802
     * According to Microsoft's documentation for the IntelliMouse Explorer,
2803
     * full functionality is activated by first sending the IntelliMouse
2804
     * initialization sequence, then sending the Explorer initialization
2805
     * sequence.
2806
     * Reference: http://www.microsoft.com/whdc/hwdev/tech/input/5b_wheel.mspx
2807
     */ 
2808
2809
    /* First send the IntelliMouse init sequence */
2810
    for (i = 0; i < sizeof(rate0)/sizeof(rate0[0]); ++i) {
2811
        if (set_mouse_sampling_rate(kbdc, rate0[i]) != rate0[i])
2812
            return FALSE;
2813
    }
2814
    /* If we've got an Explorer, it will claim to be an IntelliMouse here */
2815
    id = get_aux_id(kbdc);
2816
    if (id != PSM_INTELLI_ID)
2817
        return FALSE;
2818
2819
    /* Now send the Explorer init sequence */
2778
    for (i = 0; i < sizeof(rate1)/sizeof(rate1[0]); ++i) {
2820
    for (i = 0; i < sizeof(rate1)/sizeof(rate1[0]); ++i) {
2779
        if (set_mouse_sampling_rate(kbdc, rate1[i]) != rate1[i])
2821
        if (set_mouse_sampling_rate(kbdc, rate1[i]) != rate1[i])
2780
	    return FALSE;
2822
	    return FALSE;
2781
    }
2823
    }
2782
    /* the device will give the genuine ID only after the above sequence */
2824
    /* If we've got an Explorer, now it will identify itself */
2783
    id = get_aux_id(kbdc);
2825
    id = get_aux_id(kbdc);
2784
    if (id != PSM_EXPLORER_ID)
2826
    if (id != PSM_EXPLORER_ID)
2785
	return FALSE;
2827
	return FALSE;
Lines 2797-2807 Link Here
2797
     * sequence; it will make the KVM think the mouse is IntelliMouse
2839
     * sequence; it will make the KVM think the mouse is IntelliMouse
2798
     * when it is in fact IntelliMouse Explorer.
2840
     * when it is in fact IntelliMouse Explorer.
2799
     */
2841
     */
2842
2843
#if 0
2844
    /*
2845
     * This breaks IntelliMouse Explorer support with the Avocent
2846
     * SwitchView, which DOES actually understand the Explorer protocol.
2847
     */
2800
    for (i = 0; i < sizeof(rate0)/sizeof(rate0[0]); ++i) {
2848
    for (i = 0; i < sizeof(rate0)/sizeof(rate0[0]); ++i) {
2801
        if (set_mouse_sampling_rate(kbdc, rate0[i]) != rate0[i])
2849
        if (set_mouse_sampling_rate(kbdc, rate0[i]) != rate0[i])
2802
	    break;
2850
	    break;
2803
    }
2851
    }
2804
    id = get_aux_id(kbdc);
2852
    id = get_aux_id(kbdc);
2853
#endif
2805
2854
2806
    return TRUE;
2855
    return TRUE;
2807
}
2856
}

Return to bug 57230