History log of /haiku/src/add-ons/input_server/devices/mouse/MouseInputDevice.cpp
Revision Date Author Comments
# ba0a86ca 20-Jul-2022 Augustin Cavalier <waddlesplash@gmail.com>

input/mouse: Fetch the real ioctl error code from errno.

Should fix #17841.


# 5e596efe 15-Jul-2022 Augustin Cavalier <waddlesplash@gmail.com>

Refactor touchpad movement generation by migrating MovementMaker to userland.

This considerably overhauls touchpad event generation, simplifying and
cleaning it up considerably:

* Return the touchpad specifications through the MS_IS_TOUCHPAD ioctl.

* There is now a dedicated MS_READ_TOUCHPAD ioctl, as touchpads
can either return touchpad_movement structures or mouse_movement
ones depending on what mode they are operating in.

* Event repeating on timeouts is now handled in MovementMaker and
the input_server control thread, so MS_READ_TOUCHPAD takes
a timeout value. This means we can drop all the EventProducers.

* Use the real floating-point math functions in MovementMaker now
that we are running in userland.

* Drop unused structures, constants, headers, and other things
related to touchpad support.

Change-Id: I28cdb28e4100393a9338a8ebb865573cec13fc1e
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5455
Reviewed-by: waddlesplash <waddlesplash@gmail.com>


# 68d1b97e 25-Apr-2022 Augustin Cavalier <waddlesplash@gmail.com>

Clean up mouse functions in InterfaceDefs.

* Fully remove unused and deprecated functions.
* Comment as to which functions are deprecated.
* Rename _by_name functions to be without the suffix, as this is C++
and there's no reason not to use overloads here.

Change-Id: I4e2152f17806605eb965795417013cea800e661e


# 84d27c65 08-Apr-2022 scph <scph1000@protonmail.com>

mouse: get/set acceleration factor by mouse name

* Create and use *_mouse_acceleration_by_name functions to replace older *_mouse_acceleration functions. Now consistent with related functions (such as *_mouse_speed_by_name).
* Passing mouse_name to HandleGetSetMouseAcceleration in the BMessage fixes mouse acceleration changes not applying properly.

Change-Id: I668cdbbbb81e3cb9069a3fc2ce77e6ef75ba8476
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5189
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>


# 02ad22d6 04-Aug-2020 Preetpal Kaur <preetpalok123@gmail.com>

Input: declare BString to get the Mouse Name

Change-Id: I3476f58839202a6fd8c93e325a15045963a9b7b2
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3125
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>


# 37d79323 04-Aug-2020 Preetpal Kaur <preetpalok123@gmail.com>

Added get_set_mulitple_mouse_type() functions

Change-Id: I95f85a15a77c3a548bb672cb966ae7b13fcefcc8
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3127
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>


# f32bcfd5 14-Jun-2020 Adrien Destugues <pulkomandy@pulkomandy.tk>

Mouse add-one: Fix touchpads detection.

The "touchpad" string is part of the path, not of the device name.

Regression introduced in hrev53835.


# 5bbf7f1b 05-Feb-2020 Adrien Destugues <pulkomandy@pulkomandy.tk>

Actually handle more than 3 mouse buttons

The code in input_server was pretty much all set for this, but there was
no way to configure the extra buttons. Add them to the mouse view in
Input preferences (up to 5 buttons are handled now)

Define a new B_MOUSE_BUTTON(n) macro to generate the bitmask for a given
button (numbered from 1).

Change-Id: I9091082277937d89b08464ff474e7bbb5db82401
Reviewed-on: https://review.haiku-os.org/c/haiku/+/180
Reviewed-by: waddlesplash <waddlesplash@gmail.com>


# ffd6c2f4 05-Feb-2020 Adrien Destugues <pulkomandy@pulkomandy.tk>

input_server: use a better name for trackpoint devices

Now that the names are visible in Input preferences, let's try to have
better ones

Change-Id: Ia67e57c449e0ad292ce573b50a1e533d84c90d68
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2209
Reviewed-by: waddlesplash <waddlesplash@gmail.com>


# fdad31e6 05-Jun-2011 Michael Lotz <mmlr@mlotz.ch>

Small cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41945 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 308e87fc 03-Jun-2011 Rene Gollent <anevilyak@gmail.com>

The ioctl for reading mouse parameters was missing the structure size. This would cause it to randomly fail and exit the loop, resulting in the mouse going unresponsive.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41894 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 14a12acc 28-Dec-2010 Fredrik Holmqvist <fredrik.holmqvist@gmail.com>

Only close device if it's a valid fd. CID 3466.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39982 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 2c494653 14-Apr-2010 Axel Dörfler <axeld@pinc-software.de>

* Removed the at_kbd_io and AT keyboard stuff; this is now done within the PS/2
driver, and that driver is using the raw_key_info structure as well.
* Renamed kb_mouse_driver.h to keyboard_mouse_driver.h.
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36267 a95241bf-73f2-0310-859d-f6bbb57e9c96


# fc548b41 06-Oct-2009 Axel Dörfler <axeld@pinc-software.de>

* Removed the pretty useless "Multifinger scrolling" option - it's now always
the same as the two finger scrolling option (could be disabled, too, opinions
welcome).
* Added a new settings to disable horizontal two finger scrolling, since it's
not that easy to only scroll in one direction with this. Maybe a higher
starting boundary would also be an option for this instead, Clemens what do
you think?
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33468 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 3bf47305 06-Oct-2009 Axel Dörfler <axeld@pinc-software.de>

* Cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33451 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 155b8260 05-Sep-2009 Philippe Houdoin <philippe.houdoin@gmail.com>

Mouse watching thread name computation wasn't following the same
Upperize/Capitalize on the bus name than in keyboard one.
"USB Keyboard" but "Usb Mouse".
No functional change. Really.

alphabranch it as you want.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32943 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 5994d47a 07-Mar-2009 Stephan Aßmus <superstippi@gmx.de>

Since there are problems with VMWare, ioctl()ing at fixed intervals seems like
the better idea after all. The snoozing won't add an additional delay, if the
polling was already slow. Have not tested in VMWare myself, as I don't have a
working installation.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29436 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 7d1d7033 06-Mar-2009 Stephan Aßmus <superstippi@gmx.de>

Limit the number for ioctl()s per second to about 125 for mouse transfers. This
fixes the high CPU usage when using USB mice. I experimented with transfers
scheduled at fixed intervals, and with using a fixed pause between transfers.
The fixed pauses, though much less sophisticated, give the smoothest drawing
in WonderBrush. ;-)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29413 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 6e094221 16-Nov-2008 Stephan Aßmus <superstippi@gmx.de>

* Fixed the mouse movement when speed or acceleration where below default
values. The implementation needs to sum up fractional movement, not
truncate to zero. Before this change, the mouse would be pretty much unusable
at lower speeds/acceleration. Now it is guaranteed to move.
* No need to memset() before ioctl(), the driver does that anyways.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28669 a95241bf-73f2-0310-859d-f6bbb57e9c96


# e02ed691 14-Nov-2008 Rene Gollent <anevilyak@gmail.com>

Patch by Adrian Panasiuk: fix broken TRACE macro definitions (ticket #3133). Thanks!



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28656 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 167f43a2 14-Nov-2008 Stephan Aßmus <superstippi@gmx.de>

Merged touchpad input_server device into mouse. This gets rid of a lot of
code duplication and will make maintaining it much easier.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28647 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 9195fe6e 13-Nov-2008 Stephan Aßmus <superstippi@gmx.de>

* Don't return B_OK from Start() if opening the device failed. Then Stop()
won't be called, the control thread will remove the device anyways.
* Turned off the debug output I left on accidentally in KeyboardInputDevice.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28642 a95241bf-73f2-0310-859d-f6bbb57e9c96


# cc442411 09-Nov-2008 Stephan Aßmus <superstippi@gmx.de>

Prepend the mouse name with "Extended " if the device path contains "intelli". This makes
sure that you can have an old style mouse without scroll wheel and one with attached at the
same time. For example, when I hot-plug my PS/2 mouse with wheel, the IBM trackpoint will
otherwise already use up the "PS/2 Mouse 1" name.

Unfortunately, hot-plugging the PS/2 mouse on my T60 docking station still does not work
quite right. The PS/2 driver detects everything correctly, the node monitoring works and I end
up with the correct device threads in the input_server. (The notebook is automatically removing
the touchpad and trackpoint devices in this event, which cannot be turned off in the BIOS.)
However, the mouse does not move. In the syslog, I see one message
"ps2: strange mouse data, x/y overflow, trying resync" after the the output from the add-on
manager in the input_server that it has added the new device. When I restart the input_server,
it works fine, even though the same devices are detected and polling threads are running.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28591 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 5125eae2 10-Nov-2008 Stephan Aßmus <superstippi@gmx.de>

* Cleanup and refactoring, made several Mouse-/Keyboard-/TouchpadDevice
functions private and moved them accordingly in the file.
* I forgot to initialize the BObjectList to own the items in
TouchpadInputDevice.
* Changed the methods that read and apply settings in all three addons to be
executed from the control threads only, which fixes race conditions.
* The success of opening a device is no longer checked in the Start() method
of the *Devices. Instead, the control thread checks the device before it
enters the polling loop and cleans up if there was an error. This fixes
non-running devices in the input_server because the PS/2 driver publishes
devices which is has not checked yet for other reasons. It is important,
however, to open() the devices in the Start() hook and not the control
thread, otherwise there are unwanted race conditions in case node monitoring
events are received more than once for the same device. That's the case
for some reason on one of my computers for the AT 0 keyboard.

TODO:
* Combine the Touchpad and Mouse device addon into one, it's almost the
same code except the Touchpad knows more settings and one more control
message.
* Refactor a common base class for Keyboard and Mouse device addon.
* Fix the mouse speed/acceleration. If the speed is lowered from the default
in the preflet, the mouse becomes almost unusable. To fix this, the same
trick should be used as I used in the touchpad kernel driver, which is to
sum up previous mouse moved fractional offsets.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28590 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 239fd643 01-Nov-2008 Stephan Aßmus <superstippi@gmx.de>

* Added Clemens Zeidler to list of authors of the Touchpad add-on.
* Added myself to Mouse and Keyboard add-ons for my recent work on them.
* Small cleanup in KeyboardInputDevice.h-


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28420 a95241bf-73f2-0310-859d-f6bbb57e9c96


# e01a0431 27-Oct-2008 Stephan Aßmus <superstippi@gmx.de>

Sorry for the confusing patch...
* Made KeyboardInputDevice more similar to MouseInputDevice, the object to
track individual keyboards has become the class KeyboardDevice. Moved
much functionality that used to be in KeyboardInputDevice into
KeyboardDevice.
Functionally, it should still be the same, but there are two important
changes:
- Each KeyboardDevice now has it's own Keymap. At first, it is not
visible by the user, since all KeyboardDevices still adopt the keymap
if the user reconfigures it. But it will make it easier to assign
individual keymaps to each attached keyboard (and perhaps associate them
with a vendor/product or some other means). The more immediate side effect
is that there is no longer a confusion about the keyboard locks. If
you press NumLock on your external keyboard, it will no longer enable
NumLock on your notebooks internal keyboard.
- KeyboardDevice now has a Stop() method, which it will call in it's
destructor. This will make sure that the control thread is cleanly
exited and does not end up invoking methods on a deleted object.
* Rewrote the tracing implementation in MouseInputDevice.cpp. At least it
helped track me down the following problem:
* Both KeyboardDevice and MouseDevice now set fActive to "false" *before*
closing the device. Since the control threads run at high priority, chances
are high that rescheduling happens as soon as the device unblocks in
ioctl() and returns an error. In that case, the control threads would
check fActive and it would still be "true" and the whole idea of bailing
out because we're already in Stop() would not work, causing a double free
in the end.

All of this is nice and more correct, but input_server is still crashing
when restarting it via "input_server -q"... :-(


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28352 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 9dd2d40e 27-Oct-2008 Stephan Aßmus <superstippi@gmx.de>

Fixed a race condition and resulting deadlock I introduced, which
resulted in the keyboard not working (at least on my Lenovo/IBM T60).
The device control thread could become aware of a dead device
at the time another thread (for example the add-on manager thread)
is already waiting for it. Then it tried to remove the device and
got stuck on locks that the other thread already holds (InputDeviceItem
list lock). Now the control threads check the "active" flag before
trying to remove the devices themselves, which, when set, is a sure
sign that the devices are already being removed and they don't need
to take care of it.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28342 a95241bf-73f2-0310-859d-f6bbb57e9c96


# c5555ad3 24-Oct-2008 Stephan Aßmus <superstippi@gmx.de>

* Ignore B_ENTRY_REMOVED node monitor messages.
* When the device watcher/control thread encounteres an error when
read()ing or ioctl()ing the device, don't just quit the thread and
leave a stale device add-on hanging there, but instead trigger
_RemoveDevice() to exit this cleanly. This also takes care of calling
_RemoveDevice() only from one thread. However, it adds a race condition
should a mouse or keyboard be unplugged and plugged at the same time.
I need to think about how to fix that cleanly, although the situation
may be theoretical only... This fix seems to fix another problem with
hot-plugging USB mice, before this change, the first mouse entry in
/dev/input/mouse/usb/ was never gone and I got two entries after unplugging
and replugging.
* When using BObjectList configured to own the entries - don't delete the
entries! Also don't call RemoveItem() before still using the item. Took
me all day to find this one, because the code looked so... correct. :-}
* In _AddDevice() call _RemoveDevice() just for the sake of it. It is really
important that no device with the same name is published twice. The PS/2
driver behaves strange in that it publishes device more than once, if
I understand correctly, until it decides that there is no device.
* Only StartMonitoringDevice() /after/ having performed the initial device
scan! Or else we may get ourselves confused. I don't know if this was
an actual problem, but the code was like that before and it seems saner
to me. Seeing there is no locking in the device add-on itself, we may
already enter the code from the node monitor thread.

This should fix #2894.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28321 a95241bf-73f2-0310-859d-f6bbb57e9c96


# b6a7b204 19-Oct-2008 Axel Dörfler <axeld@pinc-software.de>

* Removed the log file stuff; debug output is now using debug_printf() instead.
* Removed an inconsistency: both mouse and keyboad input device add-ons would
scan /dev/input/keyboard respectively /dev/input/mouse when loaded, but then
only monitor certain subdirectories from it. Now they monitor all.
* Made KeyboardInputDevice::InitCheck() do what the name says, ie. nothing
else.
* Now uses BObjectList instead of BList, which also simplifies the code a bit.
* Make use of the new BPathMonitor messages: as those contain a path, they
greatly simplify their handling.
* Cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28242 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 1ccc2f2d 03-Sep-2008 Jérôme Duval <korli@users.berlios.de>

fix debug build
on Stop(), close the device, then wait for our service thread to quit


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27309 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 45f11ce8 11-Jan-2008 Stephan Aßmus <superstippi@gmx.de>

* at least with the BeOS input_server it is important that the last
B_MOUSE_MOVED message does not already contain the same buttons as a
following B_MOUSE_DOWN message... fixes mouse clicks being ignored
when you are moving the mouse at the same time when clicking
(using Haiku's mouse input_server device on BeOS or ZETA)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23421 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 21631085 12-Dec-2007 Stephan Aßmus <superstippi@gmx.de>

* I think I needed this change to compile this for ZETA


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23119 a95241bf-73f2-0310-859d-f6bbb57e9c96


# d246d9be 10-Dec-2007 Stefano Ceccherini <stefano.ceccherini@gmail.com>

Some old changes I forgot to commit... BInputServerDevice::InitCheck()
now checks if the fOwner allocation went fine (and returns B_NO_MEMORY
in case it didn't). Since it can fail, inherited classes should call it
as well (I modified MouseInputDevice's and KeyboardInputDevice's
versions for now)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23106 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 218b5bbc 02-May-2007 Jérôme Duval <korli@users.berlios.de>

clean


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20983 a95241bf-73f2-0310-859d-f6bbb57e9c96


# fafab827 24-Aug-2006 Axel Dörfler <axeld@pinc-software.de>

This should actually fix the bug a bit nicer (as it no longer prevents the mouse
from moving at all when moved slowly).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18599 a95241bf-73f2-0310-859d-f6bbb57e9c96


# b6ba2359 24-Aug-2006 Stefano Ceccherini <stefano.ceccherini@gmail.com>

if the acceleration factor was more than 0, the mouse could only be moved every other pixel. Fixed (thanks to Jonathan Thompson for his help finding this). Axel, wouldn't it make more sense to move the acceleration computation to the input server, so it doesn't have to be implemented by every input device ?

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18594 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 5f3c5830 09-Aug-2006 Jérôme Duval <korli@users.berlios.de>

moved definition of B_FIRST_REAL_TIME_PRIORITY to HaikuBuildCompatibility.h


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18467 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 74ef1621 20-Jun-2006 Axel Dörfler <axeld@pinc-software.de>

Slowed down mouse acceleration quite a bit, but also made sure the minimal
acceleration factor is 1 which wasn't the case before.
The defaults now feel pretty good over here.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17884 a95241bf-73f2-0310-859d-f6bbb57e9c96


# b7670df3 16-Jun-2006 Axel Dörfler <axeld@pinc-software.de>

* The powers of two, revisited :-)
* Removed debug output.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17855 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 42b505fb 15-Jun-2006 Axel Dörfler <axeld@pinc-software.de>

* Implemented mouse acceleration - it's not as smooth as on BeOS (your mileage
may differ), but I think it's definitely an improvement. This fixes bug #402.
* Since there now is acceleration, I reduced the mouse speed by half.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17850 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 61604e48 15-Jun-2006 Axel Dörfler <axeld@pinc-software.de>

I wanted to work on mouse acceleration, but this had to come first:
* No longer calls _RecursiveScan() in InitCheck() (but in the constructor instead).
* Fixed a bug when a new device was started: the new thread got a stack allocated
structure pointer, but there were no handshake to make sure it was still valid.
* Now checks all BMessage allocation, as well as adding fields for success, and
doesn't enqueue partial messages.
* Big refactoring and cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17845 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 23b47e0b 14-Jun-2006 Jérôme Duval <korli@users.berlios.de>

now remap mouse buttons if the mouse driver doesn't remap itself
Remapping doesn't work on Haiku yet: it seems the mouse map isn't well updated for some unknown reason
update license


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17843 a95241bf-73f2-0310-859d-f6bbb57e9c96


# d323bbb2 29-Mar-2006 Marcus Overhagen <marcusoverhagen@gmail.com>

Cleanup:
- made 'active' variable volatile
Bugfixes:
- fixed deletion of mouse_device from fDevices list when the object is deleted.
- removed deadlock from RemoveDevice
- call UnregisterDevice from inside RemoveDevice
- terminate devicer watcher thread on read error
- skip "serial" directory always
- close file handle when initializing device watcher thread fails


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16927 a95241bf-73f2-0310-859d-f6bbb57e9c96


# f0bac935 19-Feb-2006 Jérôme Duval <korli@users.berlios.de>

completes fix for bug #155


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16469 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 4c0af4a8 17-Dec-2005 Stefano Ceccherini <stefano.ceccherini@gmail.com>

Cleanup. Removed the weird SingletonMouseDevice

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15575 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 106d748c 22-Oct-2005 Marcus Overhagen <marcusoverhagen@gmail.com>

Prevent input_server from hogging the CPU when input devices fail.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14476 a95241bf-73f2-0310-859d-f6bbb57e9c96


# e7b980ae 01-Jun-2005 Stefano Ceccherini <stefano.ceccherini@gmail.com>

now we send B_MOUSE_MOVED before any other message. This should fix the problem described in the TODO item. At least, it does over here.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12917 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 6af8fc09 27-May-2005 Stefano Ceccherini <stefano.ceccherini@gmail.com>

Added a TODO item with the possible solution to a bug (which I can't verify at the moment), improved error checking.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12856 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 497d01f0 25-Apr-2005 Axel Dörfler <axeld@pinc-software.de>

Some minor visual improvements: the keyboard input device now reports
"AT Keyboard" and "USB Keyboard", instead of "at|usb Keyboard".
Also, the mouse input device now reports a "PS/2 Mouse" instead of
a "ps2 Mouse".
Generally, both now capitalize the device name when reporting the name.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12465 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 5a23ac26 24-Oct-2004 Jérôme Duval <korli@users.berlios.de>

added debug and fixed style


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9493 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 7dcdcad2 18-Oct-2004 Jérôme Duval <korli@users.berlios.de>

Fixed mouse device naming, it now iterates from 1 :)


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9405 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 2895720c 07-Oct-2004 Jérôme Duval <korli@users.berlios.de>

init the button state


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9249 a95241bf-73f2-0310-859d-f6bbb57e9c96


# c2fbfb71 05-Oct-2004 Jérôme Duval <korli@users.berlios.de>

clean up, now avoid locking when shutdowning


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9208 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 6be0f7ef 01-Oct-2004 Jérôme Duval <korli@users.berlios.de>

reversed sign change, bad idea ...


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9149 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 6ed407d8 01-Oct-2004 Jérôme Duval <korli@users.berlios.de>

added log
added a sign change


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9146 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 7d5d344b 28-Sep-2004 Jérôme Duval <korli@users.berlios.de>

Some mice have two wheels


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9088 a95241bf-73f2-0310-859d-f6bbb57e9c96


# fc2045ee 26-Sep-2004 Jérôme Duval <korli@users.berlios.de>

added wheel support, changed to kb_mouse_driver.h mouse_movement to avoid crashing when the driver writes back the io


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9063 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 33efb919 06-Sep-2004 Stefano Ceccherini <stefano.ceccherini@gmail.com>

Almost rewrote the mouse input add-on to handle multiple devices, added usb devices monitoring (not tested as USB doesn't work on my machine).
Now it generates the device name from the folder name (i.e. /dev/input/mouse/serial/0 ---> "serial mouse 1").


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8860 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 3f8c0d7e 02-Sep-2004 Jérôme Duval <korli@users.berlios.de>

now button 2 is working


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8814 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 5c506d7f 02-Sep-2004 Jérôme Duval <korli@users.berlios.de>

change debug


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8812 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 0dbc4bef 03-Sep-2004 Stefano Ceccherini <stefano.ceccherini@gmail.com>

Changed the fQuit variable to a static sQuit. Removed the snooze() in the device watcher thread function.
Started implementing the "one thread per device" design.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8810 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 145a357d 03-Sep-2004 Stefano Ceccherini <stefano.ceccherini@gmail.com>

This fixes the crash when Debug is active (at least over here; Korli, can you check?)


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8809 a95241bf-73f2-0310-859d-f6bbb57e9c96


# e361bf69 01-Sep-2004 Jérôme Duval <korli@users.berlios.de>

fix buttons handling
seems doubleclick not handled yet
crash when debug is active (before this change)


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8797 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 3aa69c78 02-Sep-2004 Stefano Ceccherini <stefano.ceccherini@gmail.com>

Some changes to the Mouse Input Server Device add-on. B_MOUSE_UP/DOWN still don't work correctly


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8794 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 53d77642 01-Sep-2004 Jérôme Duval <korli@users.berlios.de>

Added mouse settings handling.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8779 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 61d7deee 01-Sep-2004 Jérôme Duval <korli@users.berlios.de>

added a mouse input server device courtesy of Stefano Ceccherini
basicly tested


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8766 a95241bf-73f2-0310-859d-f6bbb57e9c96


# fdad31e6a57f0797eab272bf2607ff9bca76298c 05-Jun-2011 Michael Lotz <mmlr@mlotz.ch>

Small cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41945 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 308e87fc1113b277c4b66cfa79afad15d30a55e4 03-Jun-2011 Rene Gollent <anevilyak@gmail.com>

The ioctl for reading mouse parameters was missing the structure size. This would cause it to randomly fail and exit the loop, resulting in the mouse going unresponsive.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41894 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 14a12acc765c2cf8159b9d41092ddbcb82072f82 28-Dec-2010 Fredrik Holmqvist <fredrik.holmqvist@gmail.com>

Only close device if it's a valid fd. CID 3466.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39982 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 2c4946532910e3cc9f66a92228a2334098e6de49 14-Apr-2010 Axel Dörfler <axeld@pinc-software.de>

* Removed the at_kbd_io and AT keyboard stuff; this is now done within the PS/2
driver, and that driver is using the raw_key_info structure as well.
* Renamed kb_mouse_driver.h to keyboard_mouse_driver.h.
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36267 a95241bf-73f2-0310-859d-f6bbb57e9c96


# fc548b41f3e8d8b849b186e16758321279300f8f 06-Oct-2009 Axel Dörfler <axeld@pinc-software.de>

* Removed the pretty useless "Multifinger scrolling" option - it's now always
the same as the two finger scrolling option (could be disabled, too, opinions
welcome).
* Added a new settings to disable horizontal two finger scrolling, since it's
not that easy to only scroll in one direction with this. Maybe a higher
starting boundary would also be an option for this instead, Clemens what do
you think?
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33468 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 3bf47305907131903552f4c57beda6d6cb8c5f58 06-Oct-2009 Axel Dörfler <axeld@pinc-software.de>

* Cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33451 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 155b82606567894e6f2f268973b48ddd17298b72 05-Sep-2009 Philippe Houdoin <philippe.houdoin@gmail.com>

Mouse watching thread name computation wasn't following the same
Upperize/Capitalize on the bus name than in keyboard one.
"USB Keyboard" but "Usb Mouse".
No functional change. Really.

alphabranch it as you want.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32943 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 5994d47ab4976e2ef63da6d282e627b9fd3207bc 07-Mar-2009 Stephan Aßmus <superstippi@gmx.de>

Since there are problems with VMWare, ioctl()ing at fixed intervals seems like
the better idea after all. The snoozing won't add an additional delay, if the
polling was already slow. Have not tested in VMWare myself, as I don't have a
working installation.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29436 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 7d1d70339a3afebf7c4c02510b61a17b8def113a 06-Mar-2009 Stephan Aßmus <superstippi@gmx.de>

Limit the number for ioctl()s per second to about 125 for mouse transfers. This
fixes the high CPU usage when using USB mice. I experimented with transfers
scheduled at fixed intervals, and with using a fixed pause between transfers.
The fixed pauses, though much less sophisticated, give the smoothest drawing
in WonderBrush. ;-)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29413 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 6e094221e8f89036e13e70bb68c24d19f02e3e74 16-Nov-2008 Stephan Aßmus <superstippi@gmx.de>

* Fixed the mouse movement when speed or acceleration where below default
values. The implementation needs to sum up fractional movement, not
truncate to zero. Before this change, the mouse would be pretty much unusable
at lower speeds/acceleration. Now it is guaranteed to move.
* No need to memset() before ioctl(), the driver does that anyways.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28669 a95241bf-73f2-0310-859d-f6bbb57e9c96


# e02ed691ca60a2f537dd60910649e9b78100e924 14-Nov-2008 Rene Gollent <anevilyak@gmail.com>

Patch by Adrian Panasiuk: fix broken TRACE macro definitions (ticket #3133). Thanks!



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28656 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 167f43a24c164422688311a76c4f69e0891ea994 14-Nov-2008 Stephan Aßmus <superstippi@gmx.de>

Merged touchpad input_server device into mouse. This gets rid of a lot of
code duplication and will make maintaining it much easier.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28647 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 9195fe6efef569af90d0c62a2c68d79b4b562033 13-Nov-2008 Stephan Aßmus <superstippi@gmx.de>

* Don't return B_OK from Start() if opening the device failed. Then Stop()
won't be called, the control thread will remove the device anyways.
* Turned off the debug output I left on accidentally in KeyboardInputDevice.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28642 a95241bf-73f2-0310-859d-f6bbb57e9c96


# cc44241143f3ac2997e50f09b56a851ec5c1bdc0 09-Nov-2008 Stephan Aßmus <superstippi@gmx.de>

Prepend the mouse name with "Extended " if the device path contains "intelli". This makes
sure that you can have an old style mouse without scroll wheel and one with attached at the
same time. For example, when I hot-plug my PS/2 mouse with wheel, the IBM trackpoint will
otherwise already use up the "PS/2 Mouse 1" name.

Unfortunately, hot-plugging the PS/2 mouse on my T60 docking station still does not work
quite right. The PS/2 driver detects everything correctly, the node monitoring works and I end
up with the correct device threads in the input_server. (The notebook is automatically removing
the touchpad and trackpoint devices in this event, which cannot be turned off in the BIOS.)
However, the mouse does not move. In the syslog, I see one message
"ps2: strange mouse data, x/y overflow, trying resync" after the the output from the add-on
manager in the input_server that it has added the new device. When I restart the input_server,
it works fine, even though the same devices are detected and polling threads are running.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28591 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 5125eae25d9089bf2961a33d69ce26761150b0aa 10-Nov-2008 Stephan Aßmus <superstippi@gmx.de>

* Cleanup and refactoring, made several Mouse-/Keyboard-/TouchpadDevice
functions private and moved them accordingly in the file.
* I forgot to initialize the BObjectList to own the items in
TouchpadInputDevice.
* Changed the methods that read and apply settings in all three addons to be
executed from the control threads only, which fixes race conditions.
* The success of opening a device is no longer checked in the Start() method
of the *Devices. Instead, the control thread checks the device before it
enters the polling loop and cleans up if there was an error. This fixes
non-running devices in the input_server because the PS/2 driver publishes
devices which is has not checked yet for other reasons. It is important,
however, to open() the devices in the Start() hook and not the control
thread, otherwise there are unwanted race conditions in case node monitoring
events are received more than once for the same device. That's the case
for some reason on one of my computers for the AT 0 keyboard.

TODO:
* Combine the Touchpad and Mouse device addon into one, it's almost the
same code except the Touchpad knows more settings and one more control
message.
* Refactor a common base class for Keyboard and Mouse device addon.
* Fix the mouse speed/acceleration. If the speed is lowered from the default
in the preflet, the mouse becomes almost unusable. To fix this, the same
trick should be used as I used in the touchpad kernel driver, which is to
sum up previous mouse moved fractional offsets.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28590 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 239fd643df005e1d41f6d7fd19c2b6020987c743 01-Nov-2008 Stephan Aßmus <superstippi@gmx.de>

* Added Clemens Zeidler to list of authors of the Touchpad add-on.
* Added myself to Mouse and Keyboard add-ons for my recent work on them.
* Small cleanup in KeyboardInputDevice.h-


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28420 a95241bf-73f2-0310-859d-f6bbb57e9c96


# e01a04319073ac6a9b55cf2afb857d78a41aa2c8 27-Oct-2008 Stephan Aßmus <superstippi@gmx.de>

Sorry for the confusing patch...
* Made KeyboardInputDevice more similar to MouseInputDevice, the object to
track individual keyboards has become the class KeyboardDevice. Moved
much functionality that used to be in KeyboardInputDevice into
KeyboardDevice.
Functionally, it should still be the same, but there are two important
changes:
- Each KeyboardDevice now has it's own Keymap. At first, it is not
visible by the user, since all KeyboardDevices still adopt the keymap
if the user reconfigures it. But it will make it easier to assign
individual keymaps to each attached keyboard (and perhaps associate them
with a vendor/product or some other means). The more immediate side effect
is that there is no longer a confusion about the keyboard locks. If
you press NumLock on your external keyboard, it will no longer enable
NumLock on your notebooks internal keyboard.
- KeyboardDevice now has a Stop() method, which it will call in it's
destructor. This will make sure that the control thread is cleanly
exited and does not end up invoking methods on a deleted object.
* Rewrote the tracing implementation in MouseInputDevice.cpp. At least it
helped track me down the following problem:
* Both KeyboardDevice and MouseDevice now set fActive to "false" *before*
closing the device. Since the control threads run at high priority, chances
are high that rescheduling happens as soon as the device unblocks in
ioctl() and returns an error. In that case, the control threads would
check fActive and it would still be "true" and the whole idea of bailing
out because we're already in Stop() would not work, causing a double free
in the end.

All of this is nice and more correct, but input_server is still crashing
when restarting it via "input_server -q"... :-(


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28352 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 9dd2d40e390a95d522ac9074ac9d0e46b894cab2 27-Oct-2008 Stephan Aßmus <superstippi@gmx.de>

Fixed a race condition and resulting deadlock I introduced, which
resulted in the keyboard not working (at least on my Lenovo/IBM T60).
The device control thread could become aware of a dead device
at the time another thread (for example the add-on manager thread)
is already waiting for it. Then it tried to remove the device and
got stuck on locks that the other thread already holds (InputDeviceItem
list lock). Now the control threads check the "active" flag before
trying to remove the devices themselves, which, when set, is a sure
sign that the devices are already being removed and they don't need
to take care of it.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28342 a95241bf-73f2-0310-859d-f6bbb57e9c96


# c5555ad3c04e295fccf9600cb0aa6eb45eadfbf5 24-Oct-2008 Stephan Aßmus <superstippi@gmx.de>

* Ignore B_ENTRY_REMOVED node monitor messages.
* When the device watcher/control thread encounteres an error when
read()ing or ioctl()ing the device, don't just quit the thread and
leave a stale device add-on hanging there, but instead trigger
_RemoveDevice() to exit this cleanly. This also takes care of calling
_RemoveDevice() only from one thread. However, it adds a race condition
should a mouse or keyboard be unplugged and plugged at the same time.
I need to think about how to fix that cleanly, although the situation
may be theoretical only... This fix seems to fix another problem with
hot-plugging USB mice, before this change, the first mouse entry in
/dev/input/mouse/usb/ was never gone and I got two entries after unplugging
and replugging.
* When using BObjectList configured to own the entries - don't delete the
entries! Also don't call RemoveItem() before still using the item. Took
me all day to find this one, because the code looked so... correct. :-}
* In _AddDevice() call _RemoveDevice() just for the sake of it. It is really
important that no device with the same name is published twice. The PS/2
driver behaves strange in that it publishes device more than once, if
I understand correctly, until it decides that there is no device.
* Only StartMonitoringDevice() /after/ having performed the initial device
scan! Or else we may get ourselves confused. I don't know if this was
an actual problem, but the code was like that before and it seems saner
to me. Seeing there is no locking in the device add-on itself, we may
already enter the code from the node monitor thread.

This should fix #2894.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28321 a95241bf-73f2-0310-859d-f6bbb57e9c96


# b6a7b20419195d04b1a157e45f745cf123d48a61 19-Oct-2008 Axel Dörfler <axeld@pinc-software.de>

* Removed the log file stuff; debug output is now using debug_printf() instead.
* Removed an inconsistency: both mouse and keyboad input device add-ons would
scan /dev/input/keyboard respectively /dev/input/mouse when loaded, but then
only monitor certain subdirectories from it. Now they monitor all.
* Made KeyboardInputDevice::InitCheck() do what the name says, ie. nothing
else.
* Now uses BObjectList instead of BList, which also simplifies the code a bit.
* Make use of the new BPathMonitor messages: as those contain a path, they
greatly simplify their handling.
* Cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28242 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 1ccc2f2d7b70f716db7d12fefc2ef16fe0e7fb00 03-Sep-2008 Jérôme Duval <korli@users.berlios.de>

fix debug build
on Stop(), close the device, then wait for our service thread to quit


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27309 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 45f11ce801a773fb45f7893dee9dcdd2e7b985a1 11-Jan-2008 Stephan Aßmus <superstippi@gmx.de>

* at least with the BeOS input_server it is important that the last
B_MOUSE_MOVED message does not already contain the same buttons as a
following B_MOUSE_DOWN message... fixes mouse clicks being ignored
when you are moving the mouse at the same time when clicking
(using Haiku's mouse input_server device on BeOS or ZETA)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23421 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 216310852f51c5183d2312ae899710559ae17cbd 12-Dec-2007 Stephan Aßmus <superstippi@gmx.de>

* I think I needed this change to compile this for ZETA


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23119 a95241bf-73f2-0310-859d-f6bbb57e9c96


# d246d9be8858c760576574109315332d6fd11f8a 10-Dec-2007 Stefano Ceccherini <stefano.ceccherini@gmail.com>

Some old changes I forgot to commit... BInputServerDevice::InitCheck()
now checks if the fOwner allocation went fine (and returns B_NO_MEMORY
in case it didn't). Since it can fail, inherited classes should call it
as well (I modified MouseInputDevice's and KeyboardInputDevice's
versions for now)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23106 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 218b5bbcc396d818161127ed8e21293cc79fc3bc 02-May-2007 Jérôme Duval <korli@users.berlios.de>

clean


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20983 a95241bf-73f2-0310-859d-f6bbb57e9c96


# fafab8272d6c38ecabd671a9fe8bc4b765836500 24-Aug-2006 Axel Dörfler <axeld@pinc-software.de>

This should actually fix the bug a bit nicer (as it no longer prevents the mouse
from moving at all when moved slowly).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18599 a95241bf-73f2-0310-859d-f6bbb57e9c96


# b6ba23596d74cc744c156de7edf718a72b4ab228 24-Aug-2006 Stefano Ceccherini <stefano.ceccherini@gmail.com>

if the acceleration factor was more than 0, the mouse could only be moved every other pixel. Fixed (thanks to Jonathan Thompson for his help finding this). Axel, wouldn't it make more sense to move the acceleration computation to the input server, so it doesn't have to be implemented by every input device ?

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18594 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 5f3c5830502e2bec98f2d800ac7e887c8d09ce78 09-Aug-2006 Jérôme Duval <korli@users.berlios.de>

moved definition of B_FIRST_REAL_TIME_PRIORITY to HaikuBuildCompatibility.h


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18467 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 74ef1621419da98237fe969f72de782629d030f6 20-Jun-2006 Axel Dörfler <axeld@pinc-software.de>

Slowed down mouse acceleration quite a bit, but also made sure the minimal
acceleration factor is 1 which wasn't the case before.
The defaults now feel pretty good over here.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17884 a95241bf-73f2-0310-859d-f6bbb57e9c96


# b7670df392267fcc1a709fb56c6e43979e39acef 16-Jun-2006 Axel Dörfler <axeld@pinc-software.de>

* The powers of two, revisited :-)
* Removed debug output.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17855 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 42b505fba3db19ba3e110c6cc3f05d796df65357 15-Jun-2006 Axel Dörfler <axeld@pinc-software.de>

* Implemented mouse acceleration - it's not as smooth as on BeOS (your mileage
may differ), but I think it's definitely an improvement. This fixes bug #402.
* Since there now is acceleration, I reduced the mouse speed by half.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17850 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 61604e487540ca4fe90f8d47e309e5b698bf23d0 15-Jun-2006 Axel Dörfler <axeld@pinc-software.de>

I wanted to work on mouse acceleration, but this had to come first:
* No longer calls _RecursiveScan() in InitCheck() (but in the constructor instead).
* Fixed a bug when a new device was started: the new thread got a stack allocated
structure pointer, but there were no handshake to make sure it was still valid.
* Now checks all BMessage allocation, as well as adding fields for success, and
doesn't enqueue partial messages.
* Big refactoring and cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17845 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 23b47e0b5e13933d497a70b2274e5623ca7d0910 14-Jun-2006 Jérôme Duval <korli@users.berlios.de>

now remap mouse buttons if the mouse driver doesn't remap itself
Remapping doesn't work on Haiku yet: it seems the mouse map isn't well updated for some unknown reason
update license


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17843 a95241bf-73f2-0310-859d-f6bbb57e9c96


# d323bbb26f8f4ab26e11461210f074bf67e5eeea 29-Mar-2006 Marcus Overhagen <marcusoverhagen@gmail.com>

Cleanup:
- made 'active' variable volatile
Bugfixes:
- fixed deletion of mouse_device from fDevices list when the object is deleted.
- removed deadlock from RemoveDevice
- call UnregisterDevice from inside RemoveDevice
- terminate devicer watcher thread on read error
- skip "serial" directory always
- close file handle when initializing device watcher thread fails


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16927 a95241bf-73f2-0310-859d-f6bbb57e9c96


# f0bac9353093a174f6f03b64610a0de44ad02312 19-Feb-2006 Jérôme Duval <korli@users.berlios.de>

completes fix for bug #155


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16469 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 4c0af4a82e555ed369edf65056ebc537a49248aa 17-Dec-2005 Stefano Ceccherini <stefano.ceccherini@gmail.com>

Cleanup. Removed the weird SingletonMouseDevice

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15575 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 106d748c458add4c752fd871b4f0bfc3ae51a605 22-Oct-2005 Marcus Overhagen <marcusoverhagen@gmail.com>

Prevent input_server from hogging the CPU when input devices fail.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14476 a95241bf-73f2-0310-859d-f6bbb57e9c96


# e7b980ae964927d027de68727baa34d6a54e4077 01-Jun-2005 Stefano Ceccherini <stefano.ceccherini@gmail.com>

now we send B_MOUSE_MOVED before any other message. This should fix the problem described in the TODO item. At least, it does over here.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12917 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 6af8fc09735b8cd7efc713db08f3fee0ded2aa6f 27-May-2005 Stefano Ceccherini <stefano.ceccherini@gmail.com>

Added a TODO item with the possible solution to a bug (which I can't verify at the moment), improved error checking.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12856 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 497d01f0b98027b73616cabbb37df775ab9a898a 25-Apr-2005 Axel Dörfler <axeld@pinc-software.de>

Some minor visual improvements: the keyboard input device now reports
"AT Keyboard" and "USB Keyboard", instead of "at|usb Keyboard".
Also, the mouse input device now reports a "PS/2 Mouse" instead of
a "ps2 Mouse".
Generally, both now capitalize the device name when reporting the name.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12465 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 5a23ac2600dea2f2defe98faef6a765c2a79905b 24-Oct-2004 Jérôme Duval <korli@users.berlios.de>

added debug and fixed style


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9493 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 7dcdcad2c026d10ad65fe787c44f7968361d269b 18-Oct-2004 Jérôme Duval <korli@users.berlios.de>

Fixed mouse device naming, it now iterates from 1 :)


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9405 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 2895720c82f8a72684cd76d6d8552664717458ff 07-Oct-2004 Jérôme Duval <korli@users.berlios.de>

init the button state


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9249 a95241bf-73f2-0310-859d-f6bbb57e9c96


# c2fbfb71f0f3834b2d53b1a98c75ea6672cb36d0 05-Oct-2004 Jérôme Duval <korli@users.berlios.de>

clean up, now avoid locking when shutdowning


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9208 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 6be0f7ef24faec671f7ec27e2da5260407787a8d 01-Oct-2004 Jérôme Duval <korli@users.berlios.de>

reversed sign change, bad idea ...


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9149 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 6ed407d8fa91adadd8f80742c4be32cf64952635 01-Oct-2004 Jérôme Duval <korli@users.berlios.de>

added log
added a sign change


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9146 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 7d5d344bf1c545c8cca88b75e40c571f99b5c9d2 28-Sep-2004 Jérôme Duval <korli@users.berlios.de>

Some mice have two wheels


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9088 a95241bf-73f2-0310-859d-f6bbb57e9c96


# fc2045ee7eceb042beb790a6c23f0a8a2e001492 26-Sep-2004 Jérôme Duval <korli@users.berlios.de>

added wheel support, changed to kb_mouse_driver.h mouse_movement to avoid crashing when the driver writes back the io


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9063 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 33efb919153cc2b04a507abfea8862758d2b3d72 06-Sep-2004 Stefano Ceccherini <stefano.ceccherini@gmail.com>

Almost rewrote the mouse input add-on to handle multiple devices, added usb devices monitoring (not tested as USB doesn't work on my machine).
Now it generates the device name from the folder name (i.e. /dev/input/mouse/serial/0 ---> "serial mouse 1").


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8860 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 3f8c0d7e75fe320478dcdff2ddff724cde6aa803 02-Sep-2004 Jérôme Duval <korli@users.berlios.de>

now button 2 is working


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8814 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 5c506d7fddd6c89d104636423ee4d774f2c0aef0 02-Sep-2004 Jérôme Duval <korli@users.berlios.de>

change debug


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8812 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 0dbc4bef4976e237dfc3ff3e3116582020e3d129 03-Sep-2004 Stefano Ceccherini <stefano.ceccherini@gmail.com>

Changed the fQuit variable to a static sQuit. Removed the snooze() in the device watcher thread function.
Started implementing the "one thread per device" design.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8810 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 145a357d37d4ab171d9270b812752fd20af8ed36 03-Sep-2004 Stefano Ceccherini <stefano.ceccherini@gmail.com>

This fixes the crash when Debug is active (at least over here; Korli, can you check?)


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8809 a95241bf-73f2-0310-859d-f6bbb57e9c96


# e361bf6901374d55d6e1d1288d94978ff2a771b5 01-Sep-2004 Jérôme Duval <korli@users.berlios.de>

fix buttons handling
seems doubleclick not handled yet
crash when debug is active (before this change)


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8797 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 3aa69c787fc9dd5fcf1a08e3e05f89fe616a53ec 02-Sep-2004 Stefano Ceccherini <stefano.ceccherini@gmail.com>

Some changes to the Mouse Input Server Device add-on. B_MOUSE_UP/DOWN still don't work correctly


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8794 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 53d77642d6390cbbd784872b12396ea863e990d8 01-Sep-2004 Jérôme Duval <korli@users.berlios.de>

Added mouse settings handling.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8779 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 61d7deee8a1d9a8cf88e96d3acd0be2c79234a62 01-Sep-2004 Jérôme Duval <korli@users.berlios.de>

added a mouse input server device courtesy of Stefano Ceccherini
basicly tested


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8766 a95241bf-73f2-0310-859d-f6bbb57e9c96