More coding style cleanups.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28433 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -77,8 +77,8 @@ ps2_reset_mouse(ps2_dev *dev)
|
||||
status = ps2_dev_command(dev, PS2_CMD_RESET, NULL, 0, data, 2);
|
||||
|
||||
if (status == B_OK && data[0] != 0xAA && data[1] != 0x00) {
|
||||
TRACE("ps2: reset mouse failed, response was: 0x%02x 0x%02x\n", data[0],
|
||||
data[1]);
|
||||
TRACE("ps2: reset mouse failed, response was: 0x%02x 0x%02x\n",
|
||||
data[0], data[1]);
|
||||
status = B_ERROR;
|
||||
} else if (status != B_OK) {
|
||||
TRACE("ps2: reset mouse failed\n");
|
||||
@@ -204,7 +204,8 @@ ps2_dev_unpublish(ps2_dev *dev)
|
||||
if ((dev->flags & PS2_FLAG_ENABLED) && dev->disconnect)
|
||||
dev->disconnect(dev);
|
||||
|
||||
INFO("ps2: devfs_unpublish_device %s, status = 0x%08lx\n", dev->name, status);
|
||||
INFO("ps2: devfs_unpublish_device %s, status = 0x%08lx\n", dev->name,
|
||||
status);
|
||||
}
|
||||
|
||||
|
||||
@@ -223,9 +224,12 @@ ps2_dev_handle_int(ps2_dev *dev)
|
||||
atomic_or(&dev->flags, PS2_FLAG_ACK);
|
||||
} else if (data == PS2_REPLY_RESEND || data == PS2_REPLY_ERROR) {
|
||||
atomic_or(&dev->flags, PS2_FLAG_NACK);
|
||||
} else if ((flags & PS2_FLAG_GETID) && (data == 0 || data == 3 || data == 4)) {
|
||||
// workaround for broken mice that don't ack the "get id" command
|
||||
TRACE("ps2: ps2_dev_handle_int: mouse didn't ack the 'get id' command\n");
|
||||
} else if ((flags & PS2_FLAG_GETID)
|
||||
&& (data == 0 || data == 3 || data == 4)) {
|
||||
// workaround for broken mice that don't ack the "get id"
|
||||
// command
|
||||
TRACE("ps2: ps2_dev_handle_int: mouse didn't ack the 'get id' "
|
||||
"command\n");
|
||||
atomic_or(&dev->flags, PS2_FLAG_ACK);
|
||||
if (dev->result_buf_cnt) {
|
||||
dev->result_buf[dev->result_buf_idx] = data;
|
||||
@@ -237,7 +241,8 @@ ps2_dev_handle_int(ps2_dev *dev)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// TRACE("ps2: ps2_dev_handle_int unexpected data 0x%02x while waiting for ack\n", data);
|
||||
// TRACE("ps2: ps2_dev_handle_int unexpected data 0x%02x while "
|
||||
// "waiting for ack\n", data);
|
||||
TRACE("ps2: int1 %02x\n", data);
|
||||
goto pass_to_handler;
|
||||
}
|
||||
@@ -253,7 +258,8 @@ ps2_dev_handle_int(ps2_dev *dev)
|
||||
return B_INVOKE_SCHEDULER;
|
||||
}
|
||||
} else {
|
||||
// TRACE("ps2: ps2_dev_handle_int unexpected data 0x%02x during command processing\n", data);
|
||||
// TRACE("ps2: ps2_dev_handle_int unexpected data 0x%02x during "
|
||||
// "command processing\n", data);
|
||||
TRACE("ps2: int2 %02x\n", data);
|
||||
goto pass_to_handler;
|
||||
}
|
||||
@@ -268,10 +274,12 @@ pass_to_handler:
|
||||
ps2_service_notify_device_removed(dev);
|
||||
return B_INVOKE_SCHEDULER;
|
||||
}
|
||||
if (data == 0x00 && dev->history[1].data == 0xaa && (dev->history[0].time - dev->history[1].time) < 50000) {
|
||||
if (data == 0x00 && dev->history[1].data == 0xaa
|
||||
&& (dev->history[0].time - dev->history[1].time) < 50000) {
|
||||
INFO("ps2: hot plugin of %s\n", dev->name);
|
||||
if (dev->active) {
|
||||
INFO("ps2: device %s still active, republishing...\n", dev->name);
|
||||
INFO("ps2: device %s still active, republishing...\n",
|
||||
dev->name);
|
||||
ps2_service_notify_device_republish(dev);
|
||||
} else {
|
||||
ps2_service_notify_device_added(dev);
|
||||
@@ -300,14 +308,16 @@ pass_to_handler:
|
||||
|
||||
|
||||
status_t
|
||||
standard_command_timeout(ps2_dev *dev, uint8 cmd, const uint8 *out, int out_count, uint8 *in, int in_count, bigtime_t timeout)
|
||||
standard_command_timeout(ps2_dev *dev, uint8 cmd, const uint8 *out,
|
||||
int out_count, uint8 *in, int in_count, bigtime_t timeout)
|
||||
{
|
||||
status_t res;
|
||||
bigtime_t start;
|
||||
int32 sem_count;
|
||||
int i;
|
||||
|
||||
TRACE("ps2: ps2_dev_command cmd 0x%02x, out-count %d, in-count %d, dev %s\n", cmd, out_count, in_count, dev->name);
|
||||
TRACE("ps2: ps2_dev_command cmd 0x%02x, out-count %d, in-count %d, "
|
||||
"dev %s\n", cmd, out_count, in_count, dev->name);
|
||||
for (i = 0; i < out_count; i++)
|
||||
TRACE("ps2: ps2_dev_command tx: 0x%02x\n", out[i]);
|
||||
|
||||
@@ -327,7 +337,8 @@ standard_command_timeout(ps2_dev *dev, uint8 cmd, const uint8 *out, int out_coun
|
||||
res = B_OK;
|
||||
for (i = -1; res == B_OK && i < out_count; i++) {
|
||||
|
||||
atomic_and(&dev->flags, ~(PS2_FLAG_ACK | PS2_FLAG_NACK | PS2_FLAG_GETID));
|
||||
atomic_and(&dev->flags,
|
||||
~(PS2_FLAG_ACK | PS2_FLAG_NACK | PS2_FLAG_GETID));
|
||||
|
||||
acquire_sem(gControllerSem);
|
||||
|
||||
@@ -363,7 +374,8 @@ standard_command_timeout(ps2_dev *dev, uint8 cmd, const uint8 *out, int out_coun
|
||||
if (res != B_OK)
|
||||
atomic_and(&dev->flags, ~PS2_FLAG_CMD);
|
||||
|
||||
TRACE("ps2: ps2_dev_command wait for ack res 0x%08lx, wait-time %Ld\n", res, system_time() - start);
|
||||
TRACE("ps2: ps2_dev_command wait for ack res 0x%08lx, wait-time %Ld\n",
|
||||
res, system_time() - start);
|
||||
|
||||
if (atomic_get(&dev->flags) & PS2_FLAG_ACK) {
|
||||
TRACE("ps2: ps2_dev_command got ACK\n");
|
||||
@@ -384,18 +396,21 @@ standard_command_timeout(ps2_dev *dev, uint8 cmd, const uint8 *out, int out_coun
|
||||
atomic_and(&dev->flags, ~PS2_FLAG_CMD);
|
||||
} else {
|
||||
start = system_time();
|
||||
res = acquire_sem_etc(dev->result_sem, 1, B_RELATIVE_TIMEOUT, timeout);
|
||||
res = acquire_sem_etc(dev->result_sem, 1, B_RELATIVE_TIMEOUT,
|
||||
timeout);
|
||||
|
||||
atomic_and(&dev->flags, ~PS2_FLAG_CMD);
|
||||
|
||||
if (dev->result_buf_cnt != 0) {
|
||||
TRACE("ps2: ps2_dev_command error: %d rx bytes not received\n", dev->result_buf_cnt);
|
||||
TRACE("ps2: ps2_dev_command error: %d rx bytes not received\n",
|
||||
dev->result_buf_cnt);
|
||||
in_count -= dev->result_buf_cnt;
|
||||
dev->result_buf_cnt = 0;
|
||||
res = B_IO_ERROR;
|
||||
}
|
||||
|
||||
TRACE("ps2: ps2_dev_command wait for input res 0x%08lx, wait-time %Ld\n", res, system_time() - start);
|
||||
TRACE("ps2: ps2_dev_command wait for input res 0x%08lx, "
|
||||
"wait-time %Ld\n", res, system_time() - start);
|
||||
|
||||
for (i = 0; i < in_count; i++)
|
||||
TRACE("ps2: ps2_dev_command rx: 0x%02x\n", in[i]);
|
||||
@@ -409,14 +424,17 @@ standard_command_timeout(ps2_dev *dev, uint8 cmd, const uint8 *out, int out_coun
|
||||
|
||||
|
||||
status_t
|
||||
ps2_dev_command(ps2_dev *dev, uint8 cmd, const uint8 *out, int out_count, uint8 *in, int in_count)
|
||||
ps2_dev_command(ps2_dev *dev, uint8 cmd, const uint8 *out, int out_count,
|
||||
uint8 *in, int in_count)
|
||||
{
|
||||
return ps2_dev_command_timeout(dev, cmd, out, out_count, in, in_count, 4000000);
|
||||
return ps2_dev_command_timeout(dev, cmd, out, out_count, in, in_count,
|
||||
4000000);
|
||||
}
|
||||
|
||||
|
||||
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)
|
||||
ps2_dev_command_timeout(ps2_dev *dev, uint8 cmd, const uint8 *out,
|
||||
int out_count, uint8 *in, int in_count, bigtime_t timeout)
|
||||
{
|
||||
return dev->command(dev, cmd, out, out_count, in, in_count, timeout);
|
||||
}
|
||||
|
||||
@@ -271,7 +271,8 @@ probe_standard_mouse(ps2_dev * dev)
|
||||
uint8 deviceId = 0;
|
||||
|
||||
// get device id
|
||||
status = ps2_dev_command(dev, PS2_CMD_GET_DEVICE_ID, NULL, 0, &deviceId, 1);
|
||||
status = ps2_dev_command(dev, PS2_CMD_GET_DEVICE_ID, NULL, 0,
|
||||
&deviceId, 1);
|
||||
if (status != B_OK) {
|
||||
INFO("ps2: probe_mouse get device id failed\n");
|
||||
return B_ERROR;
|
||||
@@ -311,8 +312,7 @@ probe_standard_mouse(ps2_dev * dev)
|
||||
}
|
||||
|
||||
|
||||
// #pragma mark -
|
||||
// Device functions
|
||||
// #pragma mark - Device functions
|
||||
|
||||
|
||||
status_t
|
||||
|
||||
@@ -54,7 +54,8 @@ synaptics_pt_set_packagesize(ps2_dev *dev, uint8 size)
|
||||
syn_cookie->mode&= ~SYN_FOUR_BYTE_CHILD;
|
||||
set_touchpad_mode(dev->parent_dev, syn_cookie->mode);
|
||||
|
||||
status = ps2_dev_command(dev->parent_dev, PS2_CMD_ENABLE, NULL, 0, NULL, 0);
|
||||
status = ps2_dev_command(dev->parent_dev, PS2_CMD_ENABLE, NULL, 0, NULL,
|
||||
0);
|
||||
if (status < B_OK) {
|
||||
INFO("SYNAPTICS: cannot enable touchpad %s\n", dev->parent_dev->name);
|
||||
return B_ERROR;
|
||||
@@ -76,8 +77,8 @@ send_touchpad_arg_timeout(ps2_dev *dev, uint8 arg, bigtime_t timeout)
|
||||
int8 i;
|
||||
uint8 val[8];
|
||||
for (i = 0; i < 4; i++) {
|
||||
val[2*i] = (arg >> (6-2*i)) & 3;
|
||||
val[2*i + 1] = 0xE8;
|
||||
val[2 * i] = (arg >> (6 - 2 * i)) & 3;
|
||||
val[2 * i + 1] = 0xE8;
|
||||
}
|
||||
return ps2_dev_command_timeout(dev, 0xE8, val, 7, NULL, 0, timeout);
|
||||
}
|
||||
@@ -142,7 +143,8 @@ passthrough_command(ps2_dev *dev, uint8 cmd, const uint8 *out, int out_count,
|
||||
in[i - 1] = pt_in[i * 6 + 1];
|
||||
}
|
||||
|
||||
status = ps2_dev_command(dev->parent_dev, PS2_CMD_ENABLE, NULL, 0, NULL, 0);
|
||||
status = ps2_dev_command(dev->parent_dev, PS2_CMD_ENABLE, NULL, 0, NULL,
|
||||
0);
|
||||
if (status != B_OK)
|
||||
return status;
|
||||
|
||||
@@ -456,13 +458,16 @@ query_capability(ps2_dev *dev)
|
||||
}
|
||||
|
||||
|
||||
// #pragma mark -
|
||||
|
||||
|
||||
status_t
|
||||
probe_synaptics(ps2_dev *dev)
|
||||
{
|
||||
uint8 val[3];
|
||||
uint8 deviceId;
|
||||
TRACE("SYNAPTICS: probe\n");
|
||||
|
||||
|
||||
send_touchpad_arg(dev, 0x00);
|
||||
ps2_dev_command(dev, 0xE9, NULL, 0, val, 3);
|
||||
|
||||
@@ -479,7 +484,7 @@ probe_synaptics(ps2_dev *dev)
|
||||
gTouchpadInfo.minorVersion);
|
||||
// version >= 4.0?
|
||||
if (gTouchpadInfo.minorVersion <= 2
|
||||
&& gTouchpadInfo.majorVersion <= 3) {
|
||||
&& gTouchpadInfo.majorVersion <= 3) {
|
||||
TRACE("SYNAPTICS: too old touchpad not supported\n");
|
||||
return B_ERROR;
|
||||
}
|
||||
@@ -488,6 +493,9 @@ probe_synaptics(ps2_dev *dev)
|
||||
}
|
||||
|
||||
|
||||
// #pragma mark - Device functions
|
||||
|
||||
|
||||
status_t
|
||||
synaptics_open(const char *name, uint32 flags, void **_cookie)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user