vfs: check userland buffers before reading them.
[haiku.git] / src / add-ons / kernel / bus_managers / ps2 / ps2_trackpoint.cpp
blobc2be0aea28e9365f348057dbfb41529e03e6057b
1 /*
2 * Copyright 2009-2010, Haiku, Inc.
3 * Distributed under the terms of the MIT License.
5 * Authors:
6 * Clemens Zeidler (haiku@Clemens-Zeidler.de)
7 */
10 #include <malloc.h>
11 #include <string.h>
13 #include <keyboard_mouse_driver.h>
15 #include "ps2_trackpoint.h"
18 const char* kTrackpointPath[4] = {
19 "input/mouse/ps2/ibm_trackpoint_0",
20 "input/mouse/ps2/ibm_trackpoint_1",
21 "input/mouse/ps2/ibm_trackpoint_2",
22 "input/mouse/ps2/ibm_trackpoint_3"
26 status_t
27 probe_trackpoint(ps2_dev* dev)
29 uint8 val[2];
31 TRACE("TRACKPOINT: probe\n");
32 ps2_dev_command(dev, 0xE1, NULL, 0, val, 2);
34 if (val[0] != 0x01) {
35 TRACE("TRACKPOINT: not found\n");
36 return B_ERROR;
38 dev->name = kTrackpointPath[dev->idx];
39 dev->packet_size = 3;
40 TRACE("TRACKPOINT: version 0x%x found\n", val[1]);
42 return B_OK;