View | Details | Raw Unified | Return to bug 200938
Collapse All | Expand All

(-)stable/sys/dev/atkbdc/psm.c (-56 / +62 lines)
Lines 458-464 Link Here
458
		    u_char *);
458
		    u_char *);
459
459
460
/* vendor specific features */
460
/* vendor specific features */
461
typedef int	probefunc_t(KBDC, struct psm_softc *);
461
enum probearg { PROBE, REINIT };
462
typedef int	probefunc_t(struct psm_softc *, enum probearg);
462
463
463
static int	mouse_id_proc1(KBDC, int, int, int *);
464
static int	mouse_id_proc1(KBDC, int, int, int *);
464
static int	mouse_ext_command(KBDC, int);
465
static int	mouse_ext_command(KBDC, int);
Lines 876-882 Link Here
876
	/* Re-enable the mouse. */
877
	/* Re-enable the mouse. */
877
	for (i = 0; vendortype[i].probefunc != NULL; ++i)
878
	for (i = 0; vendortype[i].probefunc != NULL; ++i)
878
		if (vendortype[i].model == sc->hw.model)
879
		if (vendortype[i].model == sc->hw.model)
879
			(*vendortype[i].probefunc)(sc->kbdc, NULL);
880
			(*vendortype[i].probefunc)(sc, REINIT);
880
881
881
	/* set mouse parameters */
882
	/* set mouse parameters */
882
	if (mode != (mousemode_t *)NULL) {
883
	if (mode != (mousemode_t *)NULL) {
Lines 887-899 Link Here
887
			    set_mouse_resolution(kbdc, mode->resolution);
888
			    set_mouse_resolution(kbdc, mode->resolution);
888
		set_mouse_scaling(kbdc, 1);
889
		set_mouse_scaling(kbdc, 1);
889
		set_mouse_mode(kbdc);
890
		set_mouse_mode(kbdc);
890
891
		/*
892
		 * Trackpoint settings are lost on resume.
893
		 * Restore them here.
894
		 */
895
		if (sc->tphw > 0)
896
			set_trackpoint_parameters(sc);
897
	}
891
	}
898
892
899
	/* Record sync on the next data packet we see. */
893
	/* Record sync on the next data packet we see. */
Lines 1383-1389 Link Here
1383
1377
1384
		/* other parameters */
1378
		/* other parameters */
1385
		for (i = 0; vendortype[i].probefunc != NULL; ++i)
1379
		for (i = 0; vendortype[i].probefunc != NULL; ++i)
1386
			if ((*vendortype[i].probefunc)(sc->kbdc, sc)) {
1380
			if ((*vendortype[i].probefunc)(sc, PROBE)) {
1387
				if (verbose >= 2)
1381
				if (verbose >= 2)
1388
					printf("psm%d: found %s\n", unit,
1382
					printf("psm%d: found %s\n", unit,
1389
					    model_name(vendortype[i].model));
1383
					    model_name(vendortype[i].model));
Lines 3710-3717 Link Here
3710
#ifdef notyet
3704
#ifdef notyet
3711
/* Logitech MouseMan Cordless II */
3705
/* Logitech MouseMan Cordless II */
3712
static int
3706
static int
3713
enable_lcordless(KDBC kbdc, struct psm_softc *sc)
3707
enable_lcordless(struct psm_softc *sc, enum probearg arg)
3714
{
3708
{
3709
	KBDC kbdc = sc->kbdc;
3715
	int status[3];
3710
	int status[3];
3716
	int ch;
3711
	int ch;
3717
3712
Lines 3732-3739 Link Here
3732
3727
3733
/* Genius NetScroll Mouse, MouseSystems SmartScroll Mouse */
3728
/* Genius NetScroll Mouse, MouseSystems SmartScroll Mouse */
3734
static int
3729
static int
3735
enable_groller(KBDC kbdc, struct psm_softc *sc)
3730
enable_groller(struct psm_softc *sc, enum probearg arg)
3736
{
3731
{
3732
	KBDC kbdc = sc->kbdc;
3737
	int status[3];
3733
	int status[3];
3738
3734
3739
	/*
3735
	/*
Lines 3762-3776 Link Here
3762
	if ((status[1] != '3') || (status[2] != 'D'))
3758
	if ((status[1] != '3') || (status[2] != 'D'))
3763
		return (FALSE);
3759
		return (FALSE);
3764
	/* FIXME: SmartScroll Mouse has 5 buttons! XXX */
3760
	/* FIXME: SmartScroll Mouse has 5 buttons! XXX */
3765
	if (sc != NULL)
3761
	if (arg == PROBE)
3766
		sc->hw.buttons = 4;
3762
		sc->hw.buttons = 4;
3767
	return (TRUE);
3763
	return (TRUE);
3768
}
3764
}
3769
3765
3770
/* Genius NetMouse/NetMouse Pro, ASCII Mie Mouse, NetScroll Optical */
3766
/* Genius NetMouse/NetMouse Pro, ASCII Mie Mouse, NetScroll Optical */
3771
static int
3767
static int
3772
enable_gmouse(KBDC kbdc, struct psm_softc *sc)
3768
enable_gmouse(struct psm_softc *sc, enum probearg arg)
3773
{
3769
{
3770
	KBDC kbdc = sc->kbdc;
3774
	int status[3];
3771
	int status[3];
3775
3772
3776
	/*
3773
	/*
Lines 3792-3799 Link Here
3792
3789
3793
/* ALPS GlidePoint */
3790
/* ALPS GlidePoint */
3794
static int
3791
static int
3795
enable_aglide(KBDC kbdc, struct psm_softc *sc)
3792
enable_aglide(struct psm_softc *sc, enum probearg arg)
3796
{
3793
{
3794
	KBDC kbdc = sc->kbdc;
3797
	int status[3];
3795
	int status[3];
3798
3796
3799
	/*
3797
	/*
Lines 3814-3822 Link Here
3814
3812
3815
/* Kensington ThinkingMouse/Trackball */
3813
/* Kensington ThinkingMouse/Trackball */
3816
static int
3814
static int
3817
enable_kmouse(KBDC kbdc, struct psm_softc *sc)
3815
enable_kmouse(struct psm_softc *sc, enum probearg arg)
3818
{
3816
{
3819
	static u_char rate[] = { 20, 60, 40, 20, 20, 60, 40, 20, 20 };
3817
	static u_char rate[] = { 20, 60, 40, 20, 20, 60, 40, 20, 20 };
3818
	KBDC kbdc = sc->kbdc;
3820
	int status[3];
3819
	int status[3];
3821
	int id1;
3820
	int id1;
3822
	int id2;
3821
	int id2;
Lines 3867-3874 Link Here
3867
3866
3868
/* Logitech MouseMan+/FirstMouse+, IBM ScrollPoint Mouse */
3867
/* Logitech MouseMan+/FirstMouse+, IBM ScrollPoint Mouse */
3869
static int
3868
static int
3870
enable_mmanplus(KBDC kbdc, struct psm_softc *sc)
3869
enable_mmanplus(struct psm_softc *sc, enum probearg arg)
3871
{
3870
{
3871
	KBDC kbdc = sc->kbdc;
3872
	int data[3];
3872
	int data[3];
3873
3873
3874
	/* the special sequence to enable the fourth button and the roller. */
3874
	/* the special sequence to enable the fourth button and the roller. */
Lines 3909-3915 Link Here
3909
	if (MOUSE_PS2PLUS_PACKET_TYPE(data) != 0)
3909
	if (MOUSE_PS2PLUS_PACKET_TYPE(data) != 0)
3910
		return (FALSE);
3910
		return (FALSE);
3911
3911
3912
	if (sc != NULL) {
3912
	if (arg == PROBE) {
3913
		sc->hw.hwid &= 0x00ff;
3913
		sc->hw.hwid &= 0x00ff;
3914
		sc->hw.hwid |= data[2] << 8;	/* save model ID */
3914
		sc->hw.hwid |= data[2] << 8;	/* save model ID */
3915
	}
3915
	}
Lines 3925-3932 Link Here
3925
3925
3926
/* MS IntelliMouse Explorer */
3926
/* MS IntelliMouse Explorer */
3927
static int
3927
static int
3928
enable_msexplorer(KBDC kbdc, struct psm_softc *sc)
3928
enable_msexplorer(struct psm_softc *sc, enum probearg arg)
3929
{
3929
{
3930
	KBDC kbdc = sc->kbdc;
3930
	static u_char rate0[] = { 200, 100, 80, };
3931
	static u_char rate0[] = { 200, 100, 80, };
3931
	static u_char rate1[] = { 200, 200, 80, };
3932
	static u_char rate1[] = { 200, 200, 80, };
3932
	int id;
3933
	int id;
Lines 3937-3943 Link Here
3937
	 * straight to Explorer mode, but need to be set to Intelli mode
3938
	 * straight to Explorer mode, but need to be set to Intelli mode
3938
	 * first.
3939
	 * first.
3939
	 */
3940
	 */
3940
	enable_msintelli(kbdc, sc);
3941
	enable_msintelli(sc, arg);
3941
3942
3942
	/* the special sequence to enable the extra buttons and the roller. */
3943
	/* the special sequence to enable the extra buttons and the roller. */
3943
	for (i = 0; i < sizeof(rate1)/sizeof(rate1[0]); ++i)
3944
	for (i = 0; i < sizeof(rate1)/sizeof(rate1[0]); ++i)
Lines 3948-3954 Link Here
3948
	if (id != PSM_EXPLORER_ID)
3949
	if (id != PSM_EXPLORER_ID)
3949
		return (FALSE);
3950
		return (FALSE);
3950
3951
3951
	if (sc != NULL) {
3952
	if (arg == PROBE) {
3952
		sc->hw.buttons = 5;	/* IntelliMouse Explorer XXX */
3953
		sc->hw.buttons = 5;	/* IntelliMouse Explorer XXX */
3953
		sc->hw.hwid = id;
3954
		sc->hw.hwid = id;
3954
	}
3955
	}
Lines 3971-3985 Link Here
3971
	return (TRUE);
3972
	return (TRUE);
3972
}
3973
}
3973
3974
3974
/* MS IntelliMouse */
3975
/*
3976
 * MS IntelliMouse
3977
 * Logitech MouseMan+ and FirstMouse+ will also respond to this
3978
 * probe routine and act like IntelliMouse.
3979
 */
3975
static int
3980
static int
3976
enable_msintelli(KBDC kbdc, struct psm_softc *sc)
3981
enable_msintelli(struct psm_softc *sc, enum probearg arg)
3977
{
3982
{
3978
	/*
3983
	KBDC kbdc = sc->kbdc;
3979
	 * Logitech MouseMan+ and FirstMouse+ will also respond to this
3980
	 * probe routine and act like IntelliMouse.
3981
	 */
3982
3983
	static u_char rate[] = { 200, 100, 80, };
3984
	static u_char rate[] = { 200, 100, 80, };
3984
	int id;
3985
	int id;
3985
	int i;
3986
	int i;
Lines 3993-3999 Link Here
3993
	if (id != PSM_INTELLI_ID)
3994
	if (id != PSM_INTELLI_ID)
3994
		return (FALSE);
3995
		return (FALSE);
3995
3996
3996
	if (sc != NULL) {
3997
	if (arg == PROBE) {
3997
		sc->hw.buttons = 3;
3998
		sc->hw.buttons = 3;
3998
		sc->hw.hwid = id;
3999
		sc->hw.hwid = id;
3999
	}
4000
	}
Lines 4001-4015 Link Here
4001
	return (TRUE);
4002
	return (TRUE);
4002
}
4003
}
4003
4004
4004
/* A4 Tech 4D Mouse */
4005
/*
4006
 * A4 Tech 4D Mouse
4007
 * Newer wheel mice from A4 Tech may use the 4D+ protocol.
4008
 */
4005
static int
4009
static int
4006
enable_4dmouse(KBDC kbdc, struct psm_softc *sc)
4010
enable_4dmouse(struct psm_softc *sc, enum probearg arg)
4007
{
4011
{
4008
	/*
4009
	 * Newer wheel mice from A4 Tech may use the 4D+ protocol.
4010
	 */
4011
4012
	static u_char rate[] = { 200, 100, 80, 60, 40, 20 };
4012
	static u_char rate[] = { 200, 100, 80, 60, 40, 20 };
4013
	KBDC kbdc = sc->kbdc;
4013
	int id;
4014
	int id;
4014
	int i;
4015
	int i;
4015
4016
Lines 4025-4031 Link Here
4025
	if (id != PSM_4DMOUSE_ID)
4026
	if (id != PSM_4DMOUSE_ID)
4026
		return (FALSE);
4027
		return (FALSE);
4027
4028
4028
	if (sc != NULL) {
4029
	if (arg == PROBE) {
4029
		sc->hw.buttons = 3;	/* XXX some 4D mice have 4? */
4030
		sc->hw.buttons = 3;	/* XXX some 4D mice have 4? */
4030
		sc->hw.hwid = id;
4031
		sc->hw.hwid = id;
4031
	}
4032
	}
Lines 4033-4046 Link Here
4033
	return (TRUE);
4034
	return (TRUE);
4034
}
4035
}
4035
4036
4036
/* A4 Tech 4D+ Mouse */
4037
/*
4038
 * A4 Tech 4D+ Mouse
4039
 * Newer wheel mice from A4 Tech seem to use this protocol.
4040
 * Older models are recognized as either 4D Mouse or IntelliMouse.
4041
 */
4037
static int
4042
static int
4038
enable_4dplus(KBDC kbdc, struct psm_softc *sc)
4043
enable_4dplus(struct psm_softc *sc, enum probearg arg)
4039
{
4044
{
4040
	/*
4045
	KBDC kbdc = sc->kbdc;
4041
	 * Newer wheel mice from A4 Tech seem to use this protocol.
4042
	 * Older models are recognized as either 4D Mouse or IntelliMouse.
4043
	 */
4044
	int id;
4046
	int id;
4045
4047
4046
	/*
4048
	/*
Lines 4063-4069 Link Here
4063
		return (FALSE);
4065
		return (FALSE);
4064
	}
4066
	}
4065
4067
4066
	if (sc != NULL) {
4068
	if (arg == PROBE) {
4067
		sc->hw.buttons = (id == PSM_4DPLUS_ID) ? 4 : 3;
4069
		sc->hw.buttons = (id == PSM_4DPLUS_ID) ? 4 : 3;
4068
		sc->hw.hwid = id;
4070
		sc->hw.hwid = id;
4069
	}
4071
	}
Lines 4484-4491 Link Here
4484
}
4486
}
4485
4487
4486
static int
4488
static int
4487
enable_synaptics(KBDC kbdc, struct psm_softc *sc)
4489
enable_synaptics(struct psm_softc *sc, enum probearg arg)
4488
{
4490
{
4491
	KBDC kbdc = sc->kbdc;
4489
	synapticshw_t synhw;
4492
	synapticshw_t synhw;
4490
	int status[3];
4493
	int status[3];
4491
	int buttons;
4494
	int buttons;
Lines 4690-4696 Link Here
4690
		return (FALSE);
4693
		return (FALSE);
4691
	}
4694
	}
4692
4695
4693
	if (sc != NULL)
4696
	if (arg == PROBE)
4694
		sc->synhw = synhw;
4697
		sc->synhw = synhw;
4695
	if (!synaptics_support)
4698
	if (!synaptics_support)
4696
		return (FALSE);
4699
		return (FALSE);
Lines 4701-4714 Link Here
4701
	/* "Commit" the Set Mode Byte command sent above. */
4704
	/* "Commit" the Set Mode Byte command sent above. */
4702
	set_mouse_sampling_rate(kbdc, 20);
4705
	set_mouse_sampling_rate(kbdc, 20);
4703
4706
4707
	if (trackpoint_support && synhw.capPassthrough) {
4708
		synaptics_passthrough_on(sc);
4709
		enable_trackpoint(sc, arg);
4710
		synaptics_passthrough_off(sc);
4711
	}
4712
4704
	VLOG(3, (LOG_DEBUG, "synaptics: END init (%d buttons)\n", buttons));
4713
	VLOG(3, (LOG_DEBUG, "synaptics: END init (%d buttons)\n", buttons));
4705
4714
4706
	if (sc != NULL) {
4715
	if (arg == PROBE) {
4707
		if (trackpoint_support && synhw.capPassthrough) {
4708
			synaptics_passthrough_on(sc);
4709
			enable_trackpoint(kbdc, sc);
4710
			synaptics_passthrough_off(sc);
4711
		}
4712
		/* Create sysctl tree. */
4716
		/* Create sysctl tree. */
4713
		synaptics_sysctl_create_tree(sc);
4717
		synaptics_sysctl_create_tree(sc);
4714
		sc->hw.buttons = buttons;
4718
		sc->hw.buttons = buttons;
Lines 4966-4973 Link Here
4966
}
4970
}
4967
4971
4968
static int
4972
static int
4969
enable_trackpoint(KBDC kbdc, struct psm_softc *sc)
4973
enable_trackpoint(struct psm_softc *sc, enum probearg arg)
4970
{
4974
{
4975
	KBDC kbdc = sc->kbdc;
4971
	int id;
4976
	int id;
4972
4977
4973
	if (send_aux_command(kbdc, 0xe1) != PSM_ACK ||
4978
	if (send_aux_command(kbdc, 0xe1) != PSM_ACK ||
Lines 4981-4990 Link Here
4981
	if (!trackpoint_support)
4986
	if (!trackpoint_support)
4982
		return (FALSE);
4987
		return (FALSE);
4983
4988
4984
	if (sc != NULL) {
4989
	if (arg == PROBE) {
4985
		/* Create sysctl tree. */
4986
		trackpoint_sysctl_create_tree(sc);
4990
		trackpoint_sysctl_create_tree(sc);
4987
4988
		/*
4991
		/*
4989
		 * Don't overwrite hwid and buttons when we are
4992
		 * Don't overwrite hwid and buttons when we are
4990
		 * a guest device.
4993
		 * a guest device.
Lines 4995-5007 Link Here
4995
		}
4998
		}
4996
	}
4999
	}
4997
5000
5001
	set_trackpoint_parameters(sc);
5002
4998
	return (TRUE);
5003
	return (TRUE);
4999
}
5004
}
5000
5005
5001
/* Interlink electronics VersaPad */
5006
/* Interlink electronics VersaPad */
5002
static int
5007
static int
5003
enable_versapad(KBDC kbdc, struct psm_softc *sc)
5008
enable_versapad(struct psm_softc *sc, enum probearg arg)
5004
{
5009
{
5010
	KBDC kbdc = sc->kbdc;
5005
	int data[3];
5011
	int data[3];
5006
5012
5007
	set_mouse_resolution(kbdc, PSMD_RES_MEDIUM_HIGH); /* set res. 2 */
5013
	set_mouse_resolution(kbdc, PSMD_RES_MEDIUM_HIGH); /* set res. 2 */

Return to bug 200938