Commit Graph

181 Commits

Author SHA1 Message Date
Robert Noland
910ac6da21 Teach psm about O_ASYNC
This makes Xorg happy if you aren't using moused.

MFC after:	3 days
2009-03-16 08:21:51 +00:00
Warner Losh
66a149db32 bus_add_child takes a const char *. 2009-02-05 18:38:39 +00:00
Jean-Sébastien Pédron
c9d986fe54 Synaptics touchpads must be reinitialized after suspend/resume.
This fixes touchpad resume on Asus EeePC among others.

Submitted by:	rpaulo
2008-12-17 10:42:53 +00:00
Jean-Sébastien Pédron
e3c46ebb60 Rephrase and/or fix some comments in Synaptics touchpad initialization
function.
2008-12-16 09:51:13 +00:00
Jean-Sébastien Pédron
19ff29fb35 Rewrite Synaptics touchpads support with the following goals in mind:
o  better quality of the movement smoothing
    o  more features such as tap-hold and virtual scrolling

Support must still be enabled with this line in your /boot/loader.conf:
    hw.psm.synaptics_support="1"

The following sysctls were removed:
    hw.psm.synaptics.low_speed_threshold
    hw.psm.synaptics.min_movement
    hw.psm.synaptics.squelch_level

An overview of this new driver and a short documentation about the added
sysctls is available on the wiki:
http://wiki.freebsd.org/SynapticsTouchpad
2008-10-14 17:48:36 +00:00
Ed Schouten
6bfa9a2d66 Replace all calls to minor() with dev2unit().
After I removed all the unit2minor()/minor2unit() calls from the kernel
yesterday, I realised calling minor() everywhere is quite confusing.
Character devices now only have the ability to store a unit number, not
a minor number. Remove the confusion by using dev2unit() everywhere.

This commit could also be considered as a bug fix. A lot of drivers call
minor(), while they should actually be calling dev2unit(). In -CURRENT
this isn't a problem, but it turns out we never had any problem reports
related to that issue in the past. I suspect not many people connect
more than 256 pieces of the same hardware.

Reviewed by:	kib
2008-09-27 08:51:18 +00:00
Tom Rhodes
ad291f81da Fill in sysctl descriptions.
Approved by:	philip
2008-07-26 00:01:19 +00:00
Philip Paeps
be38401738 Try to detect a Synaptics touchpad before IntelliMouse. Some touchpads will
pretend to be IntelliMouse (which have a few more features than generic mice)
causing the IntelliMouse probe to work and the Synaptics code never to be
called.

This should not break "real" IntelliMouse because the Synaptics detection code
is fairly specific.

PR:		kern/120833
Submitted by:	Eygene Ryabinkin <rea-fbsd -at- codelabs.ru>
MFC after:	1 week
2008-06-01 13:44:51 +00:00
Jung-uk Kim
fb4865e7de Clean up and fix style(9) nits. 2008-04-08 19:09:45 +00:00
Jung-uk Kim
ff0af72c39 - Add write(2) support for psm(4) in native operation level. Now arbitrary
commands can be written to /dev/psm%d and status can be read back from it.
- Reflect the change in psm(4) and bump version for ports.

MFC after:	1 week
2008-04-08 17:55:26 +00:00
Rink Springer
b1d8472a5b Some PS/2 mice (at least the A4Tech X-7xx) need to be set to Intelli mode
first before they can be set to Explorer mode.

PR:		kern/118578
Submitted by:	Andriy Gapon <avg@icyb.net.ua> (I added some comments)
Reviewed by:	philip
MFC after:	1 month
2008-02-25 13:57:18 +00:00
Wojciech A. Koszek
259699b294 Remove explicit calls to keyboard methods with their respective variants
implemented with macros. This patch improves code readability. Reasoning
behind kbdd_* is a "keyboard discipline".

List of macros is supposed to be complete--all methods of keyboard_switch
should have their respective macros from now on.

Functionally, this code should be no-op. My intention is to leave current
behaviour of code as is.

Glanced at by:	rwatson
Reviewed by:	emax, marcel
Approved by:	cognet
2007-12-29 21:55:25 +00:00
Matt Jacob
60a35d3afd Initialize mouse resolution to zero if converting from
OLD to NEW.
2007-06-17 04:32:18 +00:00
Paolo Pisati
ef544f6312 o break newbus api: add a new argument of type driver_filter_t to
bus_setup_intr()

o add an int return code to all fast handlers

o retire INTR_FAST/IH_FAST

For more info: http://docs.freebsd.org/cgi/getmsg.cgi?fetch=465712+0+current/freebsd-current

Reviewed by: many
Approved by: re@
2007-02-23 12:19:07 +00:00
Jean-Sébastien Pédron
5a10830e1a Synaptics TouchPad seems to go back to Relative Mode after the call
to set_controller_command_byte() call; by issueing a Read Mode Byte
command, the touchpad is in Absolute Mode again.

This problem occursed at least on Asus V6V laptops.
2007-02-04 12:47:52 +00:00
Giorgos Keramidas
7810d9c616 Spell "Kensington Thinking Mouse" correctly. 2006-12-18 18:48:28 +00:00
Ruslan Ermilov
ac3912b020 Fix LEDs not working when atkbd is an active keyboard and the physical
keyboard is attached only after the system has already booted.

If USB keyboard is also present, and there's no kbdmux(4), the problem
has been hiding itself because as soon as we get to multi-user, the
USB keyboard becomes an active keyboard (see devd.conf), thus marking
atkbd inactive and letting the old code initialize the keyboard.

With kbdmux(4), or if there's no USB keyboard, the atkbd keyboard is
always active, whether it's physically attached or not, thus it never
initialized itself properly on a physical attach.

To fix this, move block that initialized the keyboard on attach upper
so it doesn't depend on the (KBD_IS_ACTIVE(kbd) && KBD_IS_BUSY(kbd))
condition.  Also move KBD_FOUND_DEVICE() a few lines upper so that
KDSETLED and KDSETREPEAT that follow it propagate to the controller.

MFC after:	3 days
2006-10-25 13:35:42 +00:00
Ruslan Ermilov
9fddcc6661 Fix our ioctl(2) implementation when the argument is "int". New
ioctls passing integer arguments should use the _IOWINT() macro.
This fixes a lot of ioctl's not working on sparc64, most notable
being keyboard/syscons ioctls.

Full ABI compatibility is provided, with the bonus of fixing the
handling of old ioctls on sparc64.

Reviewed by:	bde (with contributions)
Tested by:	emax, marius
MFC after:	1 week
2006-09-27 19:57:02 +00:00
Doug White
9aeef36608 Avoid an infinite loop in empty_both_buffers() by adding a timeout.
This helps systems that don't actually have atkbd controllers, such as the Intel
SBX82 blade, boot without device.hints hacks.

Hardware for this fix provided by iXsystems.

PR:		94822
Submitted by:	Devon H. O'Dell <devon.odell@coyotepoint.com>
MFC After:	3 days
2006-09-04 00:19:31 +00:00
Jung-uk Kim
100656ed4e Make sure command/data port (0x60) and status port (0x64) are in correct
order.  Some brain-damaged ACPI BIOS has reversed resources.
2006-07-03 23:40:58 +00:00
Warner Losh
f58c578b36 MFp4: need machine/bus.h here since we use bus space macros. It used to
be brought in by name-space polluted sys/rman.h.

Pointy hat to: imp
2006-06-12 14:46:44 +00:00
Poul-Henning Kamp
f6ce2a64f7 Send the pcvt(4) driver off to retirement. 2006-05-17 09:33:15 +00:00
John Baldwin
73dbd3da73 Remove various bits of conditional Alpha code and fixup a few comments. 2006-05-12 05:04:46 +00:00
Maxim Sobolev
6621aa5cc7 Use the same method for detecting actual presence of AT-style keyboard
controller as we use in boot blocks (querying status register until
bit 1 goes off). If that doesn't happed during reasonable period assume
that the hardware doesn't have AT-style keyboard controller. This makes
FreeBSD working almost OOB on MacBook Pro (still there are issues with
putting second CPU core on-line, but since installation CD comes with
UP kernel with this change one should be able to install FreeBSD without
playing tricks with hints). Other legacy-free hardware (e.g. IBM NetVista
S40) should benefit from this as well, but since I don't have any I can't
verify.

It should make no difference on the ordinary i386 hardware (since in
that case that hardware already would be having an issues with A20
routines in boot blocks). I don't know much about AT-style keyboard
controller on other platforms (and don't have dedicated access to one),
therefore, the code is restricted to i386 for now. I suspect that amd64
may need this as well, but I would rather leave this decision to someone
who knows better about the platform(s) in question.

I have tested this change on as many "ordinary i386 boxes" as I can get
my hands on, and it doesn't create any false negatives on hardware with
AT-style keyboard present.

MFC after:	1 month
2006-04-26 06:05:16 +00:00
Takanori Watanabe
3e7c5fe5b9 Add ALPS glide point ID and some compatibility IDs.
PR: kern/75008
2006-03-15 07:04:33 +00:00
Jean-Sébastien Pédron
dcde7cd573 Fix a bug in Synaptics Touchapd support where psm(4) will enter an infinite
loop if it receives an out of sync packet.

Reviewed by:	mux (mentor)
MFC after:	4 days
2006-01-05 19:24:01 +00:00
Ruslan Ermilov
f4e9888107 Fix -Wundef. 2005-12-04 02:12:43 +00:00
Marius Strobl
520b635320 - Hook up the new locations of the atkbdc(4), atkbd(4) and psm(4) source
files after they were repo-copied to sys/dev/atkbdc. The sources of
  atkbdc(4) and its children were moved to the new location in preparation
  for adding an EBus front-end to atkbdc(4) for use on sparc64; i.e. in
  order to not further scatter them over the whole tree which would have
  been the result of adding atkbdc_ebus.c in e.g. sys/sparc64/ebus. Another
  reason for the repo-copies was that some of the sources were misfiled,
  e.g. sys/isa/atkbd_isa.c wasn't ISA-specific at all but for hanging
  atkbd(4) off of atkbdc(4) and was renamed to atkbd_atkbdc.c accordingly.
  Most of sys/isa/psm.c, i.e. expect for its PSMC PNP part, also isn't
  ISA-specific.
- Separate the parts of atkbdc_isa.c which aren't actually ISA-specific
  but are shareable between different atkbdc(4) bus front-ends into
  atkbdc_subr.c (repo-copied from atkbdc_isa.c). While here use
  bus_generic_rl_alloc_resource() and bus_generic_rl_release_resource()
  respectively in atkbdc_isa.c instead of rolling own versions.
- Add sparc64 MD bits to atkbdc(4) and atkbd(4) and an EBus front-end for
  atkbdc(4). PS/2 controllers and input devices are used on a couple of
  Sun OEM boards and occur on either the EBus or the ISA bus. Depending on
  the board it's either the only on-board mean to connect a keyboard and
  mouse or an alternative to either RS232 or USB devices.
- Wrap the PSMC PNP part of psm.c in #ifdef DEV_ISA so it can be compiled
  without isa(4) (e.g. for EBus-only machines). This ISA-specific part
  isn't separated into its own source file, yet, as it requires more work
  than was feasible for 6.0 in order to do it in a clean way. Actually
  philip@ is working on a rewrite of psm(4) so a more comprehensive
  clean-up and separation of hardware dependent and independent parts is
  expected to happen after 6.0.

Tested on:	i386, sparc64 (AX1105, AXe and AXi boards)
Reviewed by:	philip
2005-06-10 20:56:38 +00:00
Marius Strobl
c016761c5e Delete a file that was meant to be renamed while repo-copying it but
wasn't and now is superfluous.
2005-06-10 17:36:34 +00:00
Yoshihiro Takahashi
d4fcf3cba5 Remove bus_{mem,p}io.h and related code for a micro-optimization on i386
and amd64.  The optimization is a trivial on recent machines.

Reviewed by:	-arch (imp, marcel, dfr)
2005-05-29 04:42:30 +00:00
Maxim Sobolev
0e9502aaaa Backout previous diffs - this functionality is already provided by the
hints to the atkbd(4).

PR:
Submitted by:   jhb
2005-04-07 23:59:37 +00:00
Maxim Sobolev
7ca67a6885 Make previous commit actually working by replacing TUNABLE_INT() with
TUNABLE_INT_FETCH(). Apparently keyboard init is performed earlier
in the boot process than fetching all static tunables.

MFC after:	1 day
2005-04-07 18:18:17 +00:00
Maxim Sobolev
9ec4f9e385 Provide a new tunable hw.atkbdc.broken_kit_cmd, which if set to 1
instructs the driver to avoid using Keyboard Interface Test command.
This command causes problems with some non-compliant hardware, resulting
in machine being abruptly powered down early in the boot process.

Particularly it's known that HP ZV5000 and Compaq R3000Z notebooks
are affected by this problem.

Due to popularity of those models this patch is good MFC5.4 candidate.

PR:		67745
Submitted by:	Jung-uk Kim jkim at niksun.com
MFC after:	1 days
2005-04-07 17:15:10 +00:00
Sam Leffler
ff69096233 plug memory leak
Noticed by:	Coverity Prevent analysis tool
2005-02-26 18:55:53 +00:00
Philip Paeps
df616c9022 Make life for owners of Synaptics Touchpads more pleasant :-)
o Implement a shiny new algorithm to keep track of finger movement at
   slow speeds.  This dramatically reduces the level of questionable
   language from users trying to resize windows.

 o Properly catch the many extra buttons and dials which manufacturers
   are known to screw onto Synaptics touchpad controllers.  Currently,
   up to seven buttons are known to work, more should work too.

 o Add a number of sysctls allowing one to tune the driver to taste in
   a simple way:

     # Should the extra buttons act as axes or as middle button
     hw.psm.synaptics.directional_scrolls

     # These control the 'stickiness' at low speeds
     hw.psm.synaptics.low_speed_threshold
     hw.psm.synaptics.min_movement
     hw.psm.synaptics.squelch_level

PR:		kern/75725
Submitted by:	Jason Kuri <jay@oneway.com>
MFC after:	1 month
2005-01-10 13:05:58 +00:00
Philip Paeps
9fd851bb17 Reduce diffs to work in progress before checking in serious changes.
o Move the sysctls under debug.psm.* and hw.psm.* making them a bit
   clearer and more consistent with other drivers.

 o Remove the debug.psm_soft_timeout sysctl.  It was introduced many
   moons ago in r1.64 but never referenced anywhere.

 o Introduce hw.psm.tap_threshold and hw.psm.tap_timeout to control
   the behaviour of taps on touchpads.  People might like to fiddle
   with these if tapping seems to slow or too fast for them.

 o Add debug.psm.loglevel as a tunable so that verbosity can be set
   easily at boot-time (to watch probes and such) without having to
   compile a kernel with options PSM_DEBUG=N.
2005-01-03 13:19:49 +00:00
John Baldwin
f5517dc887 Add a new flag to the atkbd(4) driver to disable testing the keyboard
port during the device probe as this can cause hangs on some machines,
specifically Compaq R3000Z series amd64 laptops.  The flag is bit 3, or
0x8.

PR:		amd64/67745
Reported by:	Neil Winterbauer newntrbr at ucla dot edu, many others
Tested by:	ade, astrodog at gmail dot com, many others
MFC after:	1 week
2004-12-15 23:00:47 +00:00
Nate Lawson
e5979322ba Remove local hacks to set flags now that the device probe does this for us.
Tested on every device except sio_pci and the pc98 fd.c.  Perhaps something
similar should be done for the "disabled" hints also.

MFC after:	2 weeks
2004-10-14 22:21:59 +00:00
Philip Paeps
34ed91b45b Introduce a tunable to disable support for Synaptics touchpads. A number of
people have reported problems (stickyness, aiming difficulty) which is proving
difficult to fix, so this will default to disable until sometime after 5.3R.

To enable Synaptics support, set the 'hw.psm.synaptics_support=1' tunable.

MT5 candidate.

Approved by:	njl
2004-09-29 23:49:57 +00:00
Justin T. Gibbs
5fb0f52712 Improve sync recovery algorithm:
o Remove PSM_SYNCERR_THRESHOLD1.  This value specified how many sync
   errors were required before the mouse is re-initialised.
   Re-initialisation is now done after (packetsize * 2) sync errors as
   things aren't likely to improve after that.

 o Reset lastinputerror when re-initialisation occurs.  We don't want
   to continue to drop data after re-initialisation.

 o Count the number of failed packets independently of the syncerrors
   statistic.  syncerrors is useful for recovering sync within a single
   packet.  pkterrors allows us to detect when the mouse changes its
   packet mode due to some external event (e.g. KVM switch).

 o Reinitialize the mouse if we see more than psmpkterrthresh errors
   during the validation period.  The validation period begins as soon
   as a sync error is detected and continues until psmerrsecs/msecs
   time has elapsed.  The defaults for these two values force a reset
   if we see two packet errors in a 2 second period.  This allows rapid
   detection of packet framing errors caused by the mouse changing packet
   modes.

 o Export psmpkterrthresh as a sysctl

 o Export psmloglevel as a sysctl.

 o Enable more debugging code to be enabled at runtime via psmloglevel.

 o Simplify verbose conditioned loging by using a VLOG macro.

 o Add several comments describing the sync recovery algorithm of
   this driver.

Large Portions by: Brian Somers <brian@Awfulhak.org>
Inspired and Frustrated by: Belkin KVMs
Reviewed by: njl, philip
2004-08-27 21:25:16 +00:00
Justin T. Gibbs
e55a65d092 Defer the capture of the "expected sync bits" until the first "normal"
data packet is received from the mouse.  In the case of many KVM's,
this avoids a bug in their mouse emulation that sends back incorrect
sync when you explicitly request a data packet from the mouse.  Without
this change, you must force the driver into stock PS/2 mode or be flooded
with a never ending stream of "out of sync" messages on these KVMs.

Approved by: re
2004-08-17 18:12:37 +00:00
Philip Paeps
5459a0063b Don't initialize static variables to 0 (C should just take care of that).
Spotted by:	njl
2004-08-16 20:19:09 +00:00
Philip Paeps
8547e74f4f Update support for Synaptics Touchpads (Volume V)
o Add (long awaited) support for guest devices

Submitted by:	Arne Schwabe <arne@rfc2549.org>
Approved by:	njl (in a former revision)
2004-08-16 16:28:27 +00:00
Philip Paeps
c4dbfe3893 Assume a finger of regular width when no width value is reported by
the touchpad (which happens when it has no extended capabilities).

Spotted by:	dhw
Forgotten by:	philip
2004-08-08 01:26:00 +00:00
Philip Paeps
1b5dd3aee5 Update support for Synaptics Touchpads (Volume IV)
o Change the motion calculation to result in
   a more reasonable speed of motion

This should fix the 'aiming' problems people have reported.  It also
mitigates (but doesn't completely solve) the 'stalling' problems at
very low speeds.

Tested by:	many subscribers to -current
Approved by:	njl
2004-08-08 01:10:23 +00:00
Philip Paeps
bc1418f61c Update support for Synaptics Touchpads (Volume III)
o Catch 'taps' as button presses

 o One finger sends button1, two fingers send button3,
   three fingers send button2 (double-click)

Tested by:	many subscribers to -current
Approved by:	njl
2004-08-08 01:00:31 +00:00
Philip Paeps
7589cb5cae Update support for Synaptics Touchpads (Volume II)
o Handle the 'up/down' buttons some touchpads have as
   a z-axis (scrollwheel) as recommended by the specs

 o Report the buttons as button4 and button5 instead
   of button2 and button4, button2 can be emulated by
   pressing button1 and button3 simultaneously.  This
   allows one to use the two extra buttons for other
   purposes if one so desires.

Tested by:	many subscribers to -current
Approved by:	njl
2004-08-08 00:57:07 +00:00
Philip Paeps
4079d722ac Update support for Synaptics Touchpads (Volume I)
o Clean up whitespace and comments in the
   enable_synaptics() probing function

 o Only use (and rely on) the extended capability
   bits when we are told they actually exist

 o Partly ignore the (possibly dated?) part of the
   specification about the mode byte so that we
   can support 'guest devices' too.

Tested by:	many subscribers to -current
Approved by:	njl
2004-08-08 00:52:11 +00:00
Nate Lawson
a4cdf60c7d Add support for the Synaptics Touchpad mouse driver. I reworked the
submitted version with style cleanups and changes to comments.  I also
modified the ioctl interface.  This version only has one ioctl (to get
the Synaptics-specific config parameters) since this is the only
information a user might want.

Submitted by:	Arne Schwabe <arne -at- rfc2549.org>
2004-07-30 00:59:40 +00:00
Maxime Henrion
d49311a74f Ignore more strange return values of the test_aux_port() function,
because some notebooks (apparently Compaq, Toshiba and Acer ones)
erroneously return 2 or 3 there.

PR:		kern/61482, kern/54188
Submitted by:	Ulf Lilleengen <lulf@kerneled.org>,
		Victor Balada Diaz <victor@alf.dyndns.ws>
MFC after:	3 days
2004-07-16 22:04:29 +00:00