Patch by Olivier Coursiere: Reset the touchpad mode when closing the device.

Will be useful when (input) devices are closed during shutdown. (app_server
and input_server are never quit during shutdown, so the drivers are not closed
either.) Apparently, the touchpad will remain as configured before, on a soft
reset which confuses for example BeOS, when it's booted after Haiku.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29920 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus
2009-04-05 08:18:53 +00:00
parent 9200ccec5a
commit ab89b2f0c9
3 changed files with 13 additions and 1 deletions
@@ -66,7 +66,7 @@ ps2_dev ps2_device[PS2_DEVICE_COUNT] = {
};
static status_t
status_t
ps2_reset_mouse(ps2_dev *dev)
{
uint8 data[2];
@@ -74,6 +74,8 @@ status_t ps2_dev_command(ps2_dev *dev, uint8 cmd, const uint8 *out,
status_t ps2_dev_command_timeout(ps2_dev *dev, uint8 cmd, const uint8 *out,
int out_count, uint8 *in, int in_count, bigtime_t timeout);
status_t ps2_reset_mouse(ps2_dev *dev);
void ps2_dev_publish(ps2_dev *dev);
void ps2_dev_unpublish(ps2_dev *dev);
@@ -630,6 +630,7 @@ err1:
status_t
synaptics_close(void *_cookie)
{
status_t status;
synaptics_cookie *cookie = _cookie;
ps2_dev_command_timeout(cookie->dev, PS2_CMD_DISABLE, NULL, 0, NULL, 0,
@@ -641,6 +642,15 @@ synaptics_close(void *_cookie)
atomic_and(&cookie->dev->flags, ~PS2_FLAG_OPEN);
atomic_and(&cookie->dev->flags, ~PS2_FLAG_ENABLED);
// Reset the touchpad so it generate standard ps2 packets instead of
// extended ones. If not, BeOS is confused with such packets when rebooting
// without a complete shutdown.
status = ps2_reset_mouse(cookie->dev);
if (status != B_OK) {
INFO("ps2: reset failed\n");
return B_ERROR;
}
if (gTouchpadInfo.capPassThrough)
ps2_service_notify_device_removed(gPassthroughDevice);