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

Collapse All | Expand All

(-)src/sys/isa/psm.c (-2 / +51 lines)
Lines 751-756 Link Here
751
	}
751
	}
752
    }
752
    }
753
753
754
    /*
755
     * The Avocent SwitchView KVM appears to force an Intellimouse Explorer
756
     * to revert to plain Intellimouse protocol whenever the device is
757
     * disabled. This hack checks to see if we previously detected an Explorer,
758
     * and tests if the device is now reporting a different ID. If this is the 
759
     * case, we try to re-enable Explorer functionality.
760
     */
761
    if ((sc->hw.hwid == PSM_EXPLORER_ID) &&
762
            (get_aux_id(sc->kbdc) != PSM_EXPLORER_ID)) {
763
        log(LOG_DEBUG, "psm%d: Intellimouse Explorer reverted to lower "
764
                       "protocol.\n", sc->unit);
765
        enable_msexplorer(sc);
766
        if (get_aux_id(sc->kbdc) == PSM_EXPLORER_ID)
767
            log(LOG_DEBUG, "psm%d: Restored Intellimouse Explorer protocol.\n",
768
                sc->unit);
769
        else
770
            log(LOG_DEBUG, "psm%d: Could not restore Intellimouse Explorer "
771
                           " protocol.\n", sc->unit);
772
            /* We shouldn't get here unless someone switched mice out from
773
             * underneath us. How and/or should we deal with this? */
774
    }
775
754
    if (get_mouse_status(sc->kbdc, stat, 0, 3) < 3) 
776
    if (get_mouse_status(sc->kbdc, stat, 0, 3) < 3) 
755
        log(LOG_DEBUG, "psm%d: failed to get status (doopen).\n", sc->unit);
777
        log(LOG_DEBUG, "psm%d: failed to get status (doopen).\n", sc->unit);
756
778
Lines 2647-2664 Link Here
2647
static int
2669
static int
2648
enable_msexplorer(struct psm_softc *sc)
2670
enable_msexplorer(struct psm_softc *sc)
2649
{
2671
{
2672
    /* IntelliMouse initialization sequence */
2650
    static unsigned char rate0[] = { 200, 100, 80, };
2673
    static unsigned char rate0[] = { 200, 100, 80, };
2674
    /* IntelliMouse Explorer initialization sequence */
2651
    static unsigned char rate1[] = { 200, 200, 80, };
2675
    static unsigned char rate1[] = { 200, 200, 80, };
2652
    KBDC kbdc = sc->kbdc;
2676
    KBDC kbdc = sc->kbdc;
2653
    int id;
2677
    int id;
2654
    int i;
2678
    int i;
2655
2679
2656
    /* the special sequence to enable the extra buttons and the roller. */
2680
    /*
2681
     * According to Microsoft's documentation for the IntelliMouse Explorer,
2682
     * full functionality is activated by first sending the IntelliMouse
2683
     * initialization sequence, then sending the Explorer initialization
2684
     * sequence.
2685
     * Reference: http://www.microsoft.com/whdc/hwdev/tech/input/5b_wheel.mspx
2686
     */ 
2687
2688
    /* First send the IntelliMouse init sequence */
2689
    for (i = 0; i < sizeof(rate0)/sizeof(rate0[0]); ++i) {
2690
        if (set_mouse_sampling_rate(kbdc, rate0[i]) != rate0[i])
2691
            return FALSE;
2692
    }
2693
    /* If we've got an Explorer, it will claim to be an IntelliMouse here */
2694
    id = get_aux_id(kbdc);
2695
    if (id != PSM_INTELLI_ID)
2696
        return FALSE;
2697
2698
    /* Now send the Explorer init sequence */
2657
    for (i = 0; i < sizeof(rate1)/sizeof(rate1[0]); ++i) {
2699
    for (i = 0; i < sizeof(rate1)/sizeof(rate1[0]); ++i) {
2658
        if (set_mouse_sampling_rate(kbdc, rate1[i]) != rate1[i])
2700
        if (set_mouse_sampling_rate(kbdc, rate1[i]) != rate1[i])
2659
	    return FALSE;
2701
	    return FALSE;
2660
    }
2702
    }
2661
    /* the device will give the genuine ID only after the above sequence */
2703
    /* If we've got an Explorer, now it will identify itself */
2662
    id = get_aux_id(kbdc);
2704
    id = get_aux_id(kbdc);
2663
    if (id != PSM_EXPLORER_ID)
2705
    if (id != PSM_EXPLORER_ID)
2664
	return FALSE;
2706
	return FALSE;
Lines 2676-2686 Link Here
2676
     * sequence; it will make the KVM think the mouse is IntelliMouse
2718
     * sequence; it will make the KVM think the mouse is IntelliMouse
2677
     * when it is in fact IntelliMouse Explorer.
2719
     * when it is in fact IntelliMouse Explorer.
2678
     */
2720
     */
2721
2722
#if 0
2723
    /*
2724
     * This breaks IntelliMouse Explorer support with the Avocent
2725
     * SwitchView, which DOES actually understand the Explorer protocol.
2726
     */
2679
    for (i = 0; i < sizeof(rate0)/sizeof(rate0[0]); ++i) {
2727
    for (i = 0; i < sizeof(rate0)/sizeof(rate0[0]); ++i) {
2680
        if (set_mouse_sampling_rate(kbdc, rate0[i]) != rate0[i])
2728
        if (set_mouse_sampling_rate(kbdc, rate0[i]) != rate0[i])
2681
	    break;
2729
	    break;
2682
    }
2730
    }
2683
    id = get_aux_id(kbdc);
2731
    id = get_aux_id(kbdc);
2732
#endif
2684
2733
2685
    return TRUE;
2734
    return TRUE;
2686
}
2735
}

Return to bug 57230