add: sPacketIndex = 0;
context: mouse_open(const char *name, uint32 flags, void **_cookie){	status_t status;		int8 commandByte;	TRACE(("mouse_open()\n"));		if (atomic_or(&sOpenMask, 1) != 0)		return B_BUSY;	acquire_sem(gDeviceOpenSemaphore);	status = probe_mouse();	if (status != B_OK)		goto err1;	status = ps2_common_initialize();	if (status != B_OK)		goto err1;	sMouseBuffer = create_packet_buffer(MOUSE_HISTORY_SIZE * sPacketSize);	if (sMouseBuffer == NULL) {		TRACE(("can't allocate mouse actions buffer\n"));		status = B_NO_MEMORY;		goto err2;	}	// create the mouse semaphore, used for synchronization between	// the interrupt handler and the read operation	sMouseSem = create_sem(0, "ps2_mouse_sem");	if (sMouseSem < 0) {		TRACE(("failed creating PS/2 mouse semaphore!\n"));		status = sMouseSem;		goto err3;	}	*_cookie = NULL;	commandByte = ps2_get_command_byte() | PS2_BITS_AUX_INTERRUPT;	commandByte &= ~PS2_BITS_MOUSE_DISABLED;	status = ps2_set_command_byte(commandByte);	if (status < B_OK) {		TRACE(("mouse_open(): sending command byte failed\n"));		goto err4;	}	status = set_mouse_enabled(true);	if (status < B_OK) {		TRACE(("mouse_open(): cannot enable PS/2 mouse\n"));			goto err4;	}	status = install_io_interrupt_handler(INT_PS2_MOUSE,		handle_mouse_interrupt, NULL, 0);	if (status < B_OK) {		TRACE(("mouse_open(): cannot install interrupt handler\n"));		goto err4;	}	release_sem(gDeviceOpenSemaphore);	TRACE(("mouse_open(): mouse succesfully enabled\n"));	return B_OK;err4:	delete_sem(sMouseSem);err3:	delete_packet_buffer(sMouseBuffer);err2:	ps2_common_uninitialize();err1:	atomic_and(&sOpenMask, 0);	release_sem(gDeviceOpenSemaphore);	return status;}