PS/2 bus manager: style fixes only
This commit is contained in:
@@ -1,15 +1,15 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2005-2007 Haiku, Inc.
|
* Copyright 2005-2014 Haiku, Inc. All rights reserved.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* PS/2 bus manager
|
|
||||||
*
|
|
||||||
* Authors (in chronological order):
|
* Authors (in chronological order):
|
||||||
* Marcus Overhagen ([email protected])
|
* Marcus Overhagen ([email protected])
|
||||||
* Clemens Zeidler ([email protected])
|
* Clemens Zeidler ([email protected])
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*! PS/2 bus manager */
|
||||||
|
|
||||||
#include "ps2_dev.h"
|
#include "ps2_dev.h"
|
||||||
#include "ps2_service.h"
|
#include "ps2_service.h"
|
||||||
|
|
||||||
@@ -167,8 +167,10 @@ ps2_dev_init(void)
|
|||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
return B_OK;
|
return B_OK;
|
||||||
|
|
||||||
err:
|
err:
|
||||||
ps2_dev_exit();
|
ps2_dev_exit();
|
||||||
|
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -176,8 +178,7 @@ err:
|
|||||||
void
|
void
|
||||||
ps2_dev_exit(void)
|
ps2_dev_exit(void)
|
||||||
{
|
{
|
||||||
int i;
|
for (int i = 0; i < PS2_DEVICE_COUNT; i++) {
|
||||||
for (i = 0; i < PS2_DEVICE_COUNT; i++) {
|
|
||||||
ps2_dev* dev = &ps2_device[i];
|
ps2_dev* dev = &ps2_device[i];
|
||||||
if (dev->result_sem >= 0) {
|
if (dev->result_sem >= 0) {
|
||||||
delete_sem(dev->result_sem);
|
delete_sem(dev->result_sem);
|
||||||
@@ -503,19 +504,25 @@ ps2_dev_command_timeout(ps2_dev *dev, uint8 cmd, const uint8 *out,
|
|||||||
status_t
|
status_t
|
||||||
ps2_dev_sliced_command(ps2_dev* dev, uint8 cmd)
|
ps2_dev_sliced_command(ps2_dev* dev, uint8 cmd)
|
||||||
{
|
{
|
||||||
|
uint8 val;
|
||||||
if (ps2_dev_command(dev, PS2_CMD_MOUSE_SET_SCALE11) != B_OK)
|
if (ps2_dev_command(dev, PS2_CMD_MOUSE_SET_SCALE11) != B_OK)
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
uint8 val = (cmd >> 6) & 3;
|
|
||||||
|
val = (cmd >> 6) & 3;
|
||||||
if (ps2_dev_command(dev, PS2_CMD_MOUSE_SET_RES, &val, 1) != B_OK)
|
if (ps2_dev_command(dev, PS2_CMD_MOUSE_SET_RES, &val, 1) != B_OK)
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
|
|
||||||
val = (cmd >> 4) & 3;
|
val = (cmd >> 4) & 3;
|
||||||
if (ps2_dev_command(dev, PS2_CMD_MOUSE_SET_RES, &val, 1) != B_OK)
|
if (ps2_dev_command(dev, PS2_CMD_MOUSE_SET_RES, &val, 1) != B_OK)
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
|
|
||||||
val = (cmd >> 2) & 3;
|
val = (cmd >> 2) & 3;
|
||||||
if (ps2_dev_command(dev, PS2_CMD_MOUSE_SET_RES, &val, 1) != B_OK)
|
if (ps2_dev_command(dev, PS2_CMD_MOUSE_SET_RES, &val, 1) != B_OK)
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
|
|
||||||
val = cmd & 3;
|
val = cmd & 3;
|
||||||
if (ps2_dev_command(dev, PS2_CMD_MOUSE_SET_RES, &val, 1) != B_OK)
|
if (ps2_dev_command(dev, PS2_CMD_MOUSE_SET_RES, &val, 1) != B_OK)
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,10 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2005-2010 Haiku, Inc.
|
* Copyright 2005-2014 Haiku, Inc. All rights reserved.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* PS/2 bus manager
|
|
||||||
*
|
|
||||||
* Authors (in chronological order):
|
* Authors (in chronological order):
|
||||||
* Marcus Overhagen (marcus@overhagen.de)
|
* Marcus Overhagen (marcus@overhagen.de)
|
||||||
|
* Clemens Zeidler (haiku@clemens-zeidler.de)
|
||||||
*/
|
*/
|
||||||
#ifndef __PS2_DEV_H
|
#ifndef __PS2_DEV_H
|
||||||
#define __PS2_DEV_H
|
#define __PS2_DEV_H
|
||||||
@@ -82,7 +81,6 @@ 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);
|
int out_count, uint8 *in, int in_count, bigtime_t timeout);
|
||||||
status_t ps2_dev_sliced_command(ps2_dev *dev, uint8 cmd);
|
status_t ps2_dev_sliced_command(ps2_dev *dev, uint8 cmd);
|
||||||
|
|
||||||
|
|
||||||
status_t ps2_reset_mouse(ps2_dev *dev);
|
status_t ps2_reset_mouse(ps2_dev *dev);
|
||||||
|
|
||||||
void ps2_dev_publish(ps2_dev *dev);
|
void ps2_dev_publish(ps2_dev *dev);
|
||||||
|
|||||||
@@ -1,13 +1,14 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2001-2010 Haiku, Inc.
|
* Copyright 2001-2014 Haiku, Inc. All rights reserved.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* Authors (in chronological order):
|
* Authors (in chronological order):
|
||||||
* Elad Lahav (elad@eldarshany.com)
|
* Elad Lahav, elad@eldarshany.com
|
||||||
* Stefano Ceccherini (burton666@libero.it)
|
* Stefano Ceccherini, burton666@libero.it
|
||||||
* Axel Dörfler, axeld@pinc-software.de
|
* Axel Dörfler, axeld@pinc-software.de
|
||||||
* Marcus Overhagen <marcus@overhagen.de>
|
* Marcus Overhagen, marcus@overhagen.de
|
||||||
* Clemens Zeidler <czeidler@gmx.de>
|
* Clemens Zeidler, czeidler@gmx.de
|
||||||
|
* John Scipione, jscipione@gmail.com
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -69,6 +70,7 @@ const char* kStandardMousePath[4] = {
|
|||||||
"input/mouse/ps2/standard_2",
|
"input/mouse/ps2/standard_2",
|
||||||
"input/mouse/ps2/standard_3"
|
"input/mouse/ps2/standard_3"
|
||||||
};
|
};
|
||||||
|
|
||||||
const char* kIntelliMousePath[4] = {
|
const char* kIntelliMousePath[4] = {
|
||||||
"input/mouse/ps2/intelli_0",
|
"input/mouse/ps2/intelli_0",
|
||||||
"input/mouse/ps2/intelli_1",
|
"input/mouse/ps2/intelli_1",
|
||||||
@@ -77,8 +79,7 @@ const char* kIntelliMousePath[4] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/*! Set sampling rate of the ps2 port.
|
//! Set sampling rate of the ps2 port.
|
||||||
*/
|
|
||||||
static inline status_t
|
static inline status_t
|
||||||
ps2_set_sample_rate(ps2_dev* dev, uint8 rate)
|
ps2_set_sample_rate(ps2_dev* dev, uint8 rate)
|
||||||
{
|
{
|
||||||
@@ -86,8 +87,7 @@ ps2_set_sample_rate(ps2_dev *dev, uint8 rate)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*! Converts a packet received by the mouse to a "movement".
|
//! Converts a packet received by the mouse to a "movement".
|
||||||
*/
|
|
||||||
static void
|
static void
|
||||||
ps2_packet_to_movement(standard_mouse_cookie* cookie, uint8 packet[],
|
ps2_packet_to_movement(standard_mouse_cookie* cookie, uint8 packet[],
|
||||||
mouse_movement* pos)
|
mouse_movement* pos)
|
||||||
@@ -115,7 +115,7 @@ ps2_packet_to_movement(standard_mouse_cookie *cookie, uint8 packet[],
|
|||||||
if (packet[3] & 0x08)
|
if (packet[3] & 0x08)
|
||||||
yDeltaWheel |= ~0x07;
|
yDeltaWheel |= ~0x07;
|
||||||
}
|
}
|
||||||
/*
|
#if 0
|
||||||
if (cookie->flags & F_MOUSE_TYPE_2WHEELS) {
|
if (cookie->flags & F_MOUSE_TYPE_2WHEELS) {
|
||||||
switch (packet[3] & 0x0F) {
|
switch (packet[3] & 0x0F) {
|
||||||
case 0x01: yDeltaWheel = +1; break; // wheel 1 down
|
case 0x01: yDeltaWheel = +1; break; // wheel 1 down
|
||||||
@@ -124,14 +124,16 @@ ps2_packet_to_movement(standard_mouse_cookie *cookie, uint8 packet[],
|
|||||||
case 0x0E: xDeltaWheel = -1; break; // wheel 2 up
|
case 0x0E: xDeltaWheel = -1; break; // wheel 2 up
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
#endif
|
||||||
|
|
||||||
// TRACE("packet: %02x %02x %02x %02x: xd %d, yd %d, 0x%x (%d), w-xd %d, "
|
#if 0
|
||||||
// "w-yd %d\n", packet[0], packet[1], packet[2], packet[3],
|
TRACE("packet: %02x %02x %02x %02x: xd %d, yd %d, 0x%x (%d), w-xd %d, "
|
||||||
// xDelta, yDelta, buttons, cookie->click_count, xDeltaWheel,
|
"w-yd %d\n", packet[0], packet[1], packet[2], packet[3],
|
||||||
// yDeltaWheel);
|
xDelta, yDelta, buttons, cookie->click_count, xDeltaWheel,
|
||||||
|
yDeltaWheel);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (pos) {
|
if (pos != NULL) {
|
||||||
pos->xdelta = xDelta;
|
pos->xdelta = xDelta;
|
||||||
pos->ydelta = yDelta;
|
pos->ydelta = yDelta;
|
||||||
pos->buttons = buttons;
|
pos->buttons = buttons;
|
||||||
@@ -148,8 +150,7 @@ ps2_packet_to_movement(standard_mouse_cookie *cookie, uint8 packet[],
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*! Read a mouse event from the mouse events chain buffer.
|
//! Read a mouse event from the mouse events chain buffer.
|
||||||
*/
|
|
||||||
static status_t
|
static status_t
|
||||||
standard_mouse_read_event(standard_mouse_cookie* cookie,
|
standard_mouse_read_event(standard_mouse_cookie* cookie,
|
||||||
mouse_movement* movement)
|
mouse_movement* movement)
|
||||||
@@ -184,7 +185,7 @@ standard_mouse_read_event(standard_mouse_cookie *cookie,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// #pragma mark -
|
// #pragma mark - Interrupt handler functions
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -214,17 +215,18 @@ standard_mouse_handle_int(ps2_dev *dev)
|
|||||||
data >> 4 & 1, data >> 3 & 1, data >> 2 & 1,
|
data >> 4 & 1, data >> 3 & 1, data >> 2 & 1,
|
||||||
data >> 1 & 1, data >> 0 & 1);
|
data >> 1 & 1, data >> 0 & 1);
|
||||||
|
|
||||||
if (cookie->packet_index == 0 && !(data & 8)) {
|
if (cookie->packet_index == 0 && (data & 8) == 0) {
|
||||||
INFO("ps2: bad mouse data, trying resync\n");
|
INFO("ps2: bad mouse data, trying resync\n");
|
||||||
return B_HANDLED_INTERRUPT;
|
return B_HANDLED_INTERRUPT;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Workarounds for active multiplexing keyboard controllers
|
// Workarounds for active multiplexing keyboard controllers
|
||||||
// that lose data or send them to the wrong port.
|
// that lose data or send them to the wrong port.
|
||||||
if (cookie->packet_index == 0 && (data & 0xc0)) {
|
if (cookie->packet_index == 0 && (data & 0xc0) != 0) {
|
||||||
INFO("ps2: strange mouse data, x/y overflow, trying resync\n");
|
INFO("ps2: strange mouse data, x/y overflow, trying resync\n");
|
||||||
return B_HANDLED_INTERRUPT;
|
return B_HANDLED_INTERRUPT;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cookie->packet_index == 1) {
|
if (cookie->packet_index == 1) {
|
||||||
int xDelta
|
int xDelta
|
||||||
= ((cookie->buffer[0] & 0x10) ? 0xFFFFFF00 : 0) | data;
|
= ((cookie->buffer[0] & 0x10) ? 0xFFFFFF00 : 0) | data;
|
||||||
@@ -263,11 +265,12 @@ standard_mouse_handle_int(ps2_dev *dev)
|
|||||||
}
|
}
|
||||||
|
|
||||||
release_sem_etc(cookie->standard_mouse_sem, 1, B_DO_NOT_RESCHEDULE);
|
release_sem_etc(cookie->standard_mouse_sem, 1, B_DO_NOT_RESCHEDULE);
|
||||||
|
|
||||||
return B_INVOKE_SCHEDULER;
|
return B_INVOKE_SCHEDULER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// #pragma mark -
|
// #pragma mark - probe_standard_mouse()
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
@@ -337,11 +340,13 @@ standard_mouse_open(const char *name, uint32 flags, void **_cookie)
|
|||||||
dev = &ps2_device[i];
|
dev = &ps2_device[i];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
/*if (0 == strcmp(g_passthrough_dev.name, name)) {
|
#if 0
|
||||||
|
if (0 == strcmp(g_passthrough_dev.name, name)) {
|
||||||
dev = &g_passthrough_dev;
|
dev = &g_passthrough_dev;
|
||||||
isSynapticsPTDevice = true;
|
isSynapticsPTDevice = true;
|
||||||
break;
|
break;
|
||||||
}*/
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dev == NULL) {
|
if (dev == NULL) {
|
||||||
|
|||||||
@@ -1,15 +1,14 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2001-2010 Haiku, Inc.
|
* Copyright 2001-2014 Haiku, Inc. All rights reserved.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* PS/2 mouse device driver
|
|
||||||
*
|
|
||||||
* Authors (in chronological order):
|
* Authors (in chronological order):
|
||||||
* Elad Lahav (elad@eldarshany.com)
|
* Elad Lahav, elad@eldarshany.com
|
||||||
* Stefano Ceccherini (burton666@libero.it)
|
* Stefano Ceccherini, burton666@libero.it
|
||||||
* Axel Dörfler, axeld@pinc-software.de
|
* Axel Dörfler, axeld@pinc-software.de
|
||||||
* Marcus Overhagen <marcus@overhagen.de>
|
* Marcus Overhagen, marcus@overhagen.de
|
||||||
* Clemens Zeidler <czeidler@gmx.de>
|
* Clemens Zeidler, czeidler@gmx.de
|
||||||
|
* John Scipione, jscipione@gmail.com
|
||||||
*/
|
*/
|
||||||
#ifndef __PS2_STANDARD_MOUSE_H
|
#ifndef __PS2_STANDARD_MOUSE_H
|
||||||
#define __PS2_STANDARD_MOUSE_H
|
#define __PS2_STANDARD_MOUSE_H
|
||||||
|
|||||||
Reference in New Issue
Block a user