vfs: check userland buffers before reading them.
[haiku.git] / src / add-ons / kernel / bus_managers / ps2 / ps2_standard_mouse.h
blob53e08ced544d64df8d8e0acecd6745bbbbbe4495
1 /*
2 * Copyright 2001-2014 Haiku, Inc. All rights reserved.
3 * Distributed under the terms of the MIT License.
5 * Authors (in chronological order):
6 * Elad Lahav, elad@eldarshany.com
7 * Stefano Ceccherini, burton666@libero.it
8 * Axel Dörfler, axeld@pinc-software.de
9 * Marcus Overhagen, marcus@overhagen.de
10 * Clemens Zeidler, czeidler@gmx.de
11 * John Scipione, jscipione@gmail.com
13 #ifndef __PS2_STANDARD_MOUSE_H
14 #define __PS2_STANDARD_MOUSE_H
17 #include <Drivers.h>
19 #include "packet_buffer.h"
22 #define MOUSE_HISTORY_SIZE 256
23 // we record that many mouse packets before we start to drop them
25 #define F_MOUSE_TYPE_STANDARD 0x1
26 #define F_MOUSE_TYPE_INTELLIMOUSE 0x2
28 typedef struct {
29 ps2_dev* dev;
31 sem_id standard_mouse_sem;
32 struct packet_buffer* standard_mouse_buffer;
33 bigtime_t click_last_time;
34 bigtime_t click_speed;
35 int click_count;
36 int buttons_state;
37 int flags;
38 size_t packet_index;
39 uint8 buffer[PS2_MAX_PACKET_SIZE];
40 } standard_mouse_cookie;
43 status_t probe_standard_mouse(ps2_dev* dev);
45 status_t standard_mouse_open(const char* name, uint32 flags, void** _cookie);
46 status_t standard_mouse_close(void* _cookie);
47 status_t standard_mouse_freecookie(void* _cookie);
48 status_t standard_mouse_ioctl(void* _cookie, uint32 op, void* buffer,
49 size_t length);
51 int32 standard_mouse_handle_int(ps2_dev* dev);
52 void standard_mouse_disconnect(ps2_dev* dev);
54 extern device_hooks gStandardMouseDeviceHooks;
57 #endif /* __PS2_STANDARD_MOUSE_H */