improved debug output
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20868 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
f1a5bab268
commit
9a8812999e
@ -41,7 +41,7 @@ ps2_read_data(void)
|
||||
void
|
||||
ps2_write_ctrl(uint8 ctrl)
|
||||
{
|
||||
TRACE("ps2_write_ctrl 0x%02x\n", ctrl);
|
||||
TRACE("ps2: ps2_write_ctrl 0x%02x\n", ctrl);
|
||||
|
||||
gIsa->write_io_8(PS2_PORT_CTRL, ctrl);
|
||||
}
|
||||
@ -50,7 +50,7 @@ ps2_write_ctrl(uint8 ctrl)
|
||||
void
|
||||
ps2_write_data(uint8 data)
|
||||
{
|
||||
TRACE("ps2_write_data 0x%02x\n", data);
|
||||
TRACE("ps2: ps2_write_data 0x%02x\n", data);
|
||||
|
||||
gIsa->write_io_8(PS2_PORT_DATA, data);
|
||||
}
|
||||
@ -259,7 +259,7 @@ ps2_interrupt(void* cookie)
|
||||
return B_UNHANDLED_INTERRUPT;
|
||||
|
||||
if (atomic_get(&sIgnoreInterrupts)) {
|
||||
TRACE("ps2_interrupt: ignoring, ctrl 0x%02x (%s)\n", ctrl, (ctrl & PS2_STATUS_AUX_DATA) ? "aux" : "keyb");
|
||||
TRACE("ps2: ps2_interrupt ignoring, ctrl 0x%02x (%s)\n", ctrl, (ctrl & PS2_STATUS_AUX_DATA) ? "aux" : "keyb");
|
||||
return B_HANDLED_INTERRUPT;
|
||||
}
|
||||
|
||||
@ -270,15 +270,15 @@ ps2_interrupt(void* cookie)
|
||||
if (gActiveMultiplexingEnabled) {
|
||||
idx = ctrl >> 6;
|
||||
error = (ctrl & 0x04) != 0;
|
||||
TRACE("ps2_interrupt: ctrl 0x%02x, data 0x%02x (mouse %d)\n", ctrl, data, idx);
|
||||
TRACE("ps2: ps2_interrupt ctrl 0x%02x, data 0x%02x (mouse %d)\n", ctrl, data, idx);
|
||||
} else {
|
||||
idx = 0;
|
||||
error = (ctrl & 0xC0) != 0;
|
||||
TRACE("ps2_interrupt: ctrl 0x%02x, data 0x%02x (aux)\n", ctrl, data);
|
||||
TRACE("ps2: ps2_interrupt ctrl 0x%02x, data 0x%02x (aux)\n", ctrl, data);
|
||||
}
|
||||
dev = &ps2_device[PS2_DEVICE_MOUSE + idx];
|
||||
} else {
|
||||
TRACE("ps2_interrupt: ctrl 0x%02x, data 0x%02x (keyb)\n", ctrl, data);
|
||||
TRACE("ps2: ps2_interrupt ctrl 0x%02x, data 0x%02x (keyb)\n", ctrl, data);
|
||||
dev = &ps2_device[PS2_DEVICE_KEYB];
|
||||
error = (ctrl & 0xC0) != 0;
|
||||
|
||||
|
@ -61,7 +61,7 @@ void
|
||||
ps2_dev_publish(ps2_dev *dev)
|
||||
{
|
||||
status_t status;
|
||||
TRACE("ps2_dev_publish %s\n", dev->name);
|
||||
TRACE("ps2: ps2_dev_publish %s\n", dev->name);
|
||||
|
||||
if (dev->active)
|
||||
return;
|
||||
@ -79,7 +79,7 @@ void
|
||||
ps2_dev_unpublish(ps2_dev *dev)
|
||||
{
|
||||
status_t status;
|
||||
TRACE("ps2_dev_unpublish %s\n", dev->name);
|
||||
TRACE("ps2: ps2_dev_unpublish %s\n", dev->name);
|
||||
|
||||
if (!dev->active)
|
||||
return;
|
||||
@ -193,9 +193,9 @@ ps2_dev_command(ps2_dev *dev, uint8 cmd, const uint8 *out, int out_count, uint8
|
||||
int32 sem_count;
|
||||
int i;
|
||||
|
||||
TRACE("ps2: ps2_dev_command cmd 0x%02x, out %d, in %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 out 0x%02x\n", out[i]);
|
||||
TRACE("ps2: ps2_dev_command tx: 0x%02x\n", out[i]);
|
||||
|
||||
res = get_sem_count(dev->result_sem, &sem_count);
|
||||
if (res == B_OK && sem_count != 0) {
|
||||
@ -245,10 +245,11 @@ ps2_dev_command(ps2_dev *dev, uint8 cmd, const uint8 *out, int out_count, uint8
|
||||
|
||||
start = system_time();
|
||||
res = acquire_sem_etc(dev->result_sem, 1, B_RELATIVE_TIMEOUT, 4000000);
|
||||
TRACE("ps2: ps2_dev_command wait for ack res 0x%08lx, wait-time %Ld\n", res, system_time() - start);
|
||||
|
||||
if (res != B_OK)
|
||||
break;
|
||||
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);
|
||||
|
||||
if (atomic_get(&dev->flags) & PS2_FLAG_ACK) {
|
||||
TRACE("ps2: ps2_dev_command got ACK\n");
|
||||
@ -256,30 +257,38 @@ ps2_dev_command(ps2_dev *dev, uint8 cmd, const uint8 *out, int out_count, uint8
|
||||
|
||||
if (atomic_get(&dev->flags) & PS2_FLAG_NACK) {
|
||||
TRACE("ps2: ps2_dev_command got NACK\n");
|
||||
res = B_ERROR;
|
||||
res = B_IO_ERROR;
|
||||
}
|
||||
|
||||
if (res != B_OK)
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (res == B_OK && in_count != 0) {
|
||||
start = system_time();
|
||||
res = acquire_sem_etc(dev->result_sem, 1, B_RELATIVE_TIMEOUT, 4000000);
|
||||
TRACE("ps2: ps2_dev_command wait for input res 0x%08lx, wait-time %Ld\n", res, system_time() - start);
|
||||
|
||||
if (dev->result_buf_cnt != 0) {
|
||||
TRACE("ps2: ps2_dev_command error: %d input bytes not received\n", dev->result_buf_cnt);
|
||||
dev->result_buf_cnt = 0;
|
||||
}
|
||||
if (res == B_OK) {
|
||||
if (in_count == 0) {
|
||||
atomic_and(&dev->flags, ~PS2_FLAG_CMD);
|
||||
} else {
|
||||
start = system_time();
|
||||
res = acquire_sem_etc(dev->result_sem, 1, B_RELATIVE_TIMEOUT, 4000000);
|
||||
|
||||
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);
|
||||
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);
|
||||
|
||||
for (i = 0; i < in_count; i++)
|
||||
TRACE("ps2: ps2_dev_command in 0x%02x\n", in[i]);
|
||||
for (i = 0; i < in_count; i++)
|
||||
TRACE("ps2: ps2_dev_command rx: 0x%02x\n", in[i]);
|
||||
}
|
||||
}
|
||||
|
||||
TRACE("ps2: ps2_dev_command result 0x%08lx\n", res);
|
||||
|
||||
atomic_and(&dev->flags, ~PS2_FLAG_CMD);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
@ -101,11 +101,11 @@ keyboard_handle_int(ps2_dev *dev)
|
||||
|
||||
if (scancode == EXTENDED_KEY) {
|
||||
sIsExtended = true;
|
||||
TRACE("Extended key\n");
|
||||
// TRACE("Extended key\n");
|
||||
return B_HANDLED_INTERRUPT;
|
||||
}
|
||||
|
||||
TRACE("scancode: %x\n", scancode);
|
||||
// TRACE("scancode: %x\n", scancode);
|
||||
|
||||
if (scancode & 0x80) {
|
||||
keyInfo.is_keydown = false;
|
||||
@ -138,7 +138,7 @@ read_keyboard_packet(at_kbd_io *packet)
|
||||
{
|
||||
status_t status;
|
||||
|
||||
TRACE("ps2: read_keyboard_packet\n");
|
||||
TRACE("ps2: read_keyboard_packet: enter\n");
|
||||
|
||||
status = acquire_sem_etc(sKeyboardSem, 1, B_CAN_INTERRUPT, 0);
|
||||
if (status < B_OK)
|
||||
@ -154,7 +154,7 @@ read_keyboard_packet(at_kbd_io *packet)
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
TRACE("scancode: %x, keydown: %s\n", packet->scancode, packet->is_keydown ? "true" : "false");
|
||||
TRACE("ps2: read_keyboard_packet: scancode: %x, keydown: %s\n", packet->scancode, packet->is_keydown ? "true" : "false");
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
@ -227,6 +227,8 @@ keyboard_open(const char *name, uint32 flags, void **_cookie)
|
||||
goto err1;
|
||||
}
|
||||
|
||||
INFO("ps2: keyboard found\n");
|
||||
|
||||
sKeyboardSem = create_sem(0, "keyboard_sem");
|
||||
if (sKeyboardSem < 0) {
|
||||
status = sKeyboardSem;
|
||||
@ -261,7 +263,7 @@ err1:
|
||||
static status_t
|
||||
keyboard_close(void *cookie)
|
||||
{
|
||||
TRACE("ps2: keyboard_close\n");
|
||||
TRACE("ps2: keyboard_close enter\n");
|
||||
|
||||
delete_packet_buffer(sKeyBuffer);
|
||||
delete_sem(sKeyboardSem);
|
||||
@ -270,6 +272,7 @@ keyboard_close(void *cookie)
|
||||
|
||||
atomic_and(&sKeyboardOpenMask, 0);
|
||||
|
||||
TRACE("ps2: keyboard_close done\n");
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
@ -302,13 +305,12 @@ keyboard_write(void *cookie, off_t pos, const void *buffer, size_t *_length)
|
||||
static status_t
|
||||
keyboard_ioctl(void *cookie, uint32 op, void *buffer, size_t length)
|
||||
{
|
||||
TRACE("ps2: keyboard ioctl\n");
|
||||
switch (op) {
|
||||
case KB_READ:
|
||||
{
|
||||
at_kbd_io packet;
|
||||
status_t status;
|
||||
TRACE("ps2: KB_READ\n");
|
||||
TRACE("ps2: ioctl KB_READ\n");
|
||||
if ((status = read_keyboard_packet(&packet)) < B_OK)
|
||||
return status;
|
||||
return user_memcpy(buffer, &packet, sizeof(packet));
|
||||
@ -317,7 +319,7 @@ keyboard_ioctl(void *cookie, uint32 op, void *buffer, size_t length)
|
||||
case KB_SET_LEDS:
|
||||
{
|
||||
led_info info;
|
||||
TRACE("ps2: KB_SET_LEDS\n");
|
||||
TRACE("ps2: ioctl KB_SET_LEDS\n");
|
||||
if (user_memcpy(&info, buffer, sizeof(led_info)) < B_OK)
|
||||
return B_BAD_ADDRESS;
|
||||
return set_leds(&info);
|
||||
@ -325,12 +327,14 @@ keyboard_ioctl(void *cookie, uint32 op, void *buffer, size_t length)
|
||||
|
||||
case KB_SET_KEY_REPEATING:
|
||||
{
|
||||
TRACE("ps2: ioctl KB_SET_KEY_REPEATING\n");
|
||||
// 0xFA (Set All Keys Typematic/Make/Break) - Keyboard responds with "ack" (0xFA).
|
||||
return ps2_dev_command(&ps2_device[PS2_DEVICE_KEYB], 0xfa, NULL, 0, NULL, 0);
|
||||
}
|
||||
|
||||
case KB_SET_KEY_NONREPEATING:
|
||||
{
|
||||
TRACE("ps2: ioctl KB_SET_KEY_NONREPEATING\n");
|
||||
// 0xF8 (Set All Keys Make/Break) - Keyboard responds with "ack" (0xFA).
|
||||
return ps2_dev_command(&ps2_device[PS2_DEVICE_KEYB], 0xf8, NULL, 0, NULL, 0);
|
||||
}
|
||||
@ -338,9 +342,9 @@ keyboard_ioctl(void *cookie, uint32 op, void *buffer, size_t length)
|
||||
case KB_SET_KEY_REPEAT_RATE:
|
||||
{
|
||||
int32 key_repeat_rate;
|
||||
TRACE("ps2: ioctl KB_SET_KEY_REPEAT_RATE\n");
|
||||
if (user_memcpy(&key_repeat_rate, buffer, sizeof(key_repeat_rate)) < B_OK)
|
||||
return B_BAD_ADDRESS;
|
||||
TRACE("ps2: KB_SET_KEY_REPEAT_RATE %ld\n", key_repeat_rate);
|
||||
if (set_typematic(key_repeat_rate, sKeyboardRepeatDelay) < B_OK)
|
||||
return B_ERROR;
|
||||
sKeyboardRepeatRate = key_repeat_rate;
|
||||
@ -349,15 +353,16 @@ keyboard_ioctl(void *cookie, uint32 op, void *buffer, size_t length)
|
||||
|
||||
case KB_GET_KEY_REPEAT_RATE:
|
||||
{
|
||||
TRACE("ps2: ioctl KB_GET_KEY_REPEAT_RATE\n");
|
||||
return user_memcpy(buffer, &sKeyboardRepeatRate, sizeof(sKeyboardRepeatRate));
|
||||
}
|
||||
|
||||
case KB_SET_KEY_REPEAT_DELAY:
|
||||
{
|
||||
bigtime_t key_repeat_delay;
|
||||
TRACE("ps2: ioctl KB_SET_KEY_REPEAT_DELAY\n");
|
||||
if (user_memcpy(&key_repeat_delay, buffer, sizeof(key_repeat_delay)) < B_OK)
|
||||
return B_BAD_ADDRESS;
|
||||
TRACE("ps2: KB_SET_KEY_REPEAT_DELAY %Ld\n", key_repeat_delay);
|
||||
if (set_typematic(sKeyboardRepeatRate, key_repeat_delay) < B_OK)
|
||||
return B_ERROR;
|
||||
sKeyboardRepeatDelay = key_repeat_delay;
|
||||
@ -367,6 +372,7 @@ keyboard_ioctl(void *cookie, uint32 op, void *buffer, size_t length)
|
||||
|
||||
case KB_GET_KEY_REPEAT_DELAY:
|
||||
{
|
||||
TRACE("ps2: ioctl KB_GET_KEY_REPEAT_DELAY\n");
|
||||
return user_memcpy(buffer, &sKeyboardRepeatDelay, sizeof(sKeyboardRepeatDelay));
|
||||
}
|
||||
|
||||
|
@ -88,17 +88,17 @@ ps2_reset_mouse(mouse_cookie *cookie)
|
||||
uint8 data[2];
|
||||
status_t status;
|
||||
|
||||
TRACE("ps2_reset_mouse\n");
|
||||
TRACE("ps2: ps2_reset_mouse\n");
|
||||
|
||||
status = ps2_dev_command(cookie->dev, PS2_CMD_RESET, NULL, 0, data, 2);
|
||||
|
||||
if (status == B_OK && data[0] != 0xAA && data[1] != 0x00) {
|
||||
TRACE("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("reset mouse failed\n");
|
||||
TRACE("ps2: reset mouse failed\n");
|
||||
} else {
|
||||
TRACE("reset mouse success\n");
|
||||
TRACE("ps2: reset mouse success\n");
|
||||
}
|
||||
|
||||
return status;
|
||||
@ -159,7 +159,7 @@ ps2_packet_to_movement(mouse_cookie *cookie, uint8 packet[], mouse_movement *pos
|
||||
pos->wheel_ydelta = (int)wheel_ydelta;
|
||||
pos->wheel_xdelta = (int)wheel_xdelta;
|
||||
|
||||
TRACE("xdelta: %d, ydelta: %d, buttons %x, clicks: %d, timestamp %Ld\n",
|
||||
TRACE("ps2: ps2_packet_to_movement xdelta: %d, ydelta: %d, buttons %x, clicks: %d, timestamp %Ld\n",
|
||||
xDelta, yDelta, buttons, cookie->click_count, currentTime);
|
||||
}
|
||||
}
|
||||
@ -219,7 +219,7 @@ mouse_handle_int(ps2_dev *dev)
|
||||
const uint8 data = dev->history[0].data;
|
||||
|
||||
if (cookie->packet_index == 0 && !(data & 8)) {
|
||||
TRACE("bad mouse data, trying resync\n");
|
||||
TRACE("ps2: bad mouse data, trying resync\n");
|
||||
return B_HANDLED_INTERRUPT;
|
||||
}
|
||||
|
||||
@ -290,7 +290,7 @@ probe_mouse(mouse_cookie *cookie, size_t *probed_packet_size)
|
||||
if (probed_packet_size)
|
||||
*probed_packet_size = PS2_PACKET_INTELLIMOUSE;
|
||||
} else {
|
||||
// Something's wrong. Better quit
|
||||
INFO("ps2: probe_mouse Something's wrong.\n");
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
@ -320,7 +320,7 @@ mouse_open(const char *name, uint32 flags, void **_cookie)
|
||||
}
|
||||
|
||||
if (dev == NULL) {
|
||||
TRACE("dev = NULL\n");
|
||||
TRACE("ps2: dev = NULL\n");
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
@ -348,7 +348,7 @@ mouse_open(const char *name, uint32 flags, void **_cookie)
|
||||
|
||||
cookie->mouse_buffer = create_packet_buffer(MOUSE_HISTORY_SIZE * cookie->packet_size);
|
||||
if (cookie->mouse_buffer == NULL) {
|
||||
TRACE("can't allocate mouse actions buffer\n");
|
||||
TRACE("ps2: can't allocate mouse actions buffer\n");
|
||||
goto err2;
|
||||
}
|
||||
|
||||
@ -356,7 +356,7 @@ mouse_open(const char *name, uint32 flags, void **_cookie)
|
||||
// the interrupt handler and the read operation
|
||||
cookie->mouse_sem = create_sem(0, "ps2_mouse_sem");
|
||||
if (cookie->mouse_sem < 0) {
|
||||
TRACE("failed creating PS/2 mouse semaphore!\n");
|
||||
TRACE("ps2: failed creating PS/2 mouse semaphore!\n");
|
||||
goto err3;
|
||||
}
|
||||
|
||||
@ -390,7 +390,7 @@ mouse_close(void *_cookie)
|
||||
{
|
||||
mouse_cookie *cookie = _cookie;
|
||||
|
||||
TRACE("ps2: mouse_close %s\n", cookie->dev->name);
|
||||
TRACE("ps2: mouse_close %s enter\n", cookie->dev->name);
|
||||
|
||||
ps2_dev_command(cookie->dev, PS2_CMD_DISABLE, NULL, 0, NULL, 0);
|
||||
|
||||
@ -400,6 +400,7 @@ mouse_close(void *_cookie)
|
||||
atomic_and(&cookie->dev->flags, ~PS2_FLAG_OPEN);
|
||||
atomic_and(&cookie->dev->flags, ~PS2_FLAG_ENABLED);
|
||||
|
||||
TRACE("ps2: mouse_close %s done\n", cookie->dev->name);
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
@ -438,7 +439,7 @@ mouse_ioctl(void *_cookie, uint32 op, void *buffer, size_t length)
|
||||
case MS_NUM_EVENTS:
|
||||
{
|
||||
int32 count;
|
||||
TRACE("MS_NUM_EVENTS\n");
|
||||
TRACE("ps2: ioctl MS_NUM_EVENTS\n");
|
||||
get_sem_count(cookie->mouse_sem, &count);
|
||||
return count;
|
||||
}
|
||||
@ -447,7 +448,7 @@ mouse_ioctl(void *_cookie, uint32 op, void *buffer, size_t length)
|
||||
{
|
||||
mouse_movement movement;
|
||||
status_t status;
|
||||
TRACE("MS_READ\n");
|
||||
TRACE("ps2: ioctl MS_READ\n");
|
||||
if ((status = mouse_read_event(cookie, &movement)) < B_OK)
|
||||
return status;
|
||||
// TRACE("%s %d %d %d %d\n", cookie->dev->name,
|
||||
@ -456,27 +457,27 @@ mouse_ioctl(void *_cookie, uint32 op, void *buffer, size_t length)
|
||||
}
|
||||
|
||||
case MS_SET_TYPE:
|
||||
TRACE("MS_SET_TYPE not implemented\n");
|
||||
TRACE("ps2: ioctl MS_SET_TYPE not implemented\n");
|
||||
return B_BAD_VALUE;
|
||||
|
||||
case MS_SET_MAP:
|
||||
TRACE("MS_SET_MAP (set mouse mapping) not implemented\n");
|
||||
TRACE("ps2: ioctl MS_SET_MAP (set mouse mapping) not implemented\n");
|
||||
return B_BAD_VALUE;
|
||||
|
||||
case MS_GET_ACCEL:
|
||||
TRACE("MS_GET_ACCEL (get mouse acceleration) not implemented\n");
|
||||
TRACE("ps2: ioctl MS_GET_ACCEL (get mouse acceleration) not implemented\n");
|
||||
return B_BAD_VALUE;
|
||||
|
||||
case MS_SET_ACCEL:
|
||||
TRACE("MS_SET_ACCEL (set mouse acceleration) not implemented\n");
|
||||
TRACE("ps2: ioctl MS_SET_ACCEL (set mouse acceleration) not implemented\n");
|
||||
return B_BAD_VALUE;
|
||||
|
||||
case MS_SET_CLICKSPEED:
|
||||
TRACE("MS_SETCLICK (set click speed)\n");
|
||||
TRACE("ps2: ioctl MS_SETCLICK (set click speed)\n");
|
||||
return user_memcpy(&cookie->click_speed, buffer, sizeof(bigtime_t));
|
||||
|
||||
default:
|
||||
TRACE("unknown opcode: %ld\n", op);
|
||||
TRACE("ps2: ioctl unknown mouse opcode: %ld\n", op);
|
||||
return B_BAD_VALUE;
|
||||
}
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ ps2_service_notify_device_added(ps2_dev *dev)
|
||||
{
|
||||
ps2_service_cmd cmd;
|
||||
|
||||
TRACE("ps2_service_notify_device_added %s\n", dev->name);
|
||||
TRACE("ps2: ps2_service_notify_device_added %s\n", dev->name);
|
||||
|
||||
cmd.id = PS2_SERVICE_NOTIFY_DEVICE_ADDED;
|
||||
cmd.dev = dev;
|
||||
@ -41,7 +41,7 @@ ps2_service_notify_device_added(ps2_dev *dev)
|
||||
packet_buffer_write(sServiceCmdBuffer, (const uint8 *)&cmd, sizeof(cmd));
|
||||
release_sem_etc(sServiceSem, 1, B_DO_NOT_RESCHEDULE);
|
||||
|
||||
TRACE("ps2_service_notify_device_added done\n");
|
||||
TRACE("ps2: ps2_service_notify_device_added done\n");
|
||||
}
|
||||
|
||||
|
||||
@ -50,7 +50,7 @@ ps2_service_notify_device_removed(ps2_dev *dev)
|
||||
{
|
||||
ps2_service_cmd cmd;
|
||||
|
||||
TRACE("ps2_service_notify_device_removed %s\n", dev->name);
|
||||
TRACE("ps2: ps2_service_notify_device_removed %s\n", dev->name);
|
||||
|
||||
cmd.id = PS2_SERVICE_NOTIFY_DEVICE_REMOVED;
|
||||
cmd.dev = dev;
|
||||
@ -58,14 +58,14 @@ ps2_service_notify_device_removed(ps2_dev *dev)
|
||||
packet_buffer_write(sServiceCmdBuffer, (const uint8 *)&cmd, sizeof(cmd));
|
||||
release_sem_etc(sServiceSem, 1, B_DO_NOT_RESCHEDULE);
|
||||
|
||||
TRACE("ps2_service_notify_device_removed done\n");
|
||||
TRACE("ps2: ps2_service_notify_device_removed done\n");
|
||||
}
|
||||
|
||||
|
||||
static int32
|
||||
ps2_service_thread(void *arg)
|
||||
{
|
||||
TRACE("ps2_service_thread started\n");
|
||||
TRACE("ps2: ps2_service_thread started\n");
|
||||
|
||||
for (;;) {
|
||||
status_t status;
|
||||
@ -79,21 +79,21 @@ ps2_service_thread(void *arg)
|
||||
packet_buffer_read(sServiceCmdBuffer, (uint8 *)&cmd, sizeof(cmd));
|
||||
switch (cmd.id) {
|
||||
case PS2_SERVICE_NOTIFY_DEVICE_ADDED:
|
||||
TRACE("PS2_SERVICE_NOTIFY_DEVICE_ADDED %s\n", cmd.dev->name);
|
||||
TRACE("ps2: PS2_SERVICE_NOTIFY_DEVICE_ADDED %s\n", cmd.dev->name);
|
||||
ps2_dev_publish(cmd.dev);
|
||||
break;
|
||||
|
||||
case PS2_SERVICE_NOTIFY_DEVICE_REMOVED:
|
||||
TRACE("PS2_SERVICE_NOTIFY_DEVICE_REMOVED %s\n", cmd.dev->name);
|
||||
TRACE("ps2: PS2_SERVICE_NOTIFY_DEVICE_REMOVED %s\n", cmd.dev->name);
|
||||
ps2_dev_unpublish(cmd.dev);
|
||||
break;
|
||||
|
||||
default:
|
||||
TRACE("PS2_SERVICE: unknown id %lu\n", cmd.id);
|
||||
TRACE("ps2: PS2_SERVICE: unknown id %lu\n", cmd.id);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
INFO("ps2_service_thread: Error, status 0x%08lx, terminating\n", status);
|
||||
INFO("ps2: ps2_service_thread: Error, status 0x%08lx, terminating\n", status);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -104,7 +104,7 @@ ps2_service_thread(void *arg)
|
||||
status_t
|
||||
ps2_service_init(void)
|
||||
{
|
||||
TRACE("ps2_service_init\n");
|
||||
TRACE("ps2: ps2_service_init\n");
|
||||
sServiceCmdBuffer = create_packet_buffer(sizeof(ps2_service_cmd) * 50);
|
||||
if (sServiceCmdBuffer == NULL)
|
||||
goto err1;
|
||||
@ -116,7 +116,7 @@ ps2_service_init(void)
|
||||
goto err3;
|
||||
sServiceTerminate = false;
|
||||
resume_thread(sServiceThread);
|
||||
TRACE("ps2_service_init done\n");
|
||||
TRACE("ps2: ps2_service_init done\n");
|
||||
return B_OK;
|
||||
|
||||
err3:
|
||||
@ -124,7 +124,7 @@ err3:
|
||||
err2:
|
||||
delete_packet_buffer(sServiceCmdBuffer);
|
||||
err1:
|
||||
TRACE("ps2_service_init failed\n");
|
||||
TRACE("ps2: ps2_service_init failed\n");
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
@ -132,10 +132,11 @@ err1:
|
||||
void
|
||||
ps2_service_exit(void)
|
||||
{
|
||||
TRACE("ps2_service_exit\n");
|
||||
TRACE("ps2: ps2_service_exit enter\n");
|
||||
sServiceTerminate = true;
|
||||
release_sem(sServiceSem);
|
||||
wait_for_thread(sServiceThread, NULL);
|
||||
delete_sem(sServiceSem);
|
||||
delete_packet_buffer(sServiceCmdBuffer);
|
||||
TRACE("ps2: ps2_service_exit done\n");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user