1/*
2 * Copyright 2009-2010, Haiku, Inc.
3 * Distributed under the terms of the MIT License.
4 *
5 * Authors:
6 *		Clemens Zeidler (haiku@Clemens-Zeidler.de)
7 */
8
9
10#include <malloc.h>
11#include <string.h>
12
13#include <keyboard_mouse_driver.h>
14
15#include "ps2_trackpoint.h"
16
17
18//#define TRACE_PS2_TRACKPOINT
19#ifdef TRACE_PS2_TRACKPOINT
20#	define TRACE(x...) dprintf(x)
21#else
22#	define TRACE(x...)
23#endif
24
25
26const char* kTrackpointPath[4] = {
27	"input/mouse/ps2/ibm_trackpoint_0",
28	"input/mouse/ps2/ibm_trackpoint_1",
29	"input/mouse/ps2/ibm_trackpoint_2",
30	"input/mouse/ps2/ibm_trackpoint_3"
31};
32
33
34status_t
35probe_trackpoint(ps2_dev* dev)
36{
37	uint8 val[2];
38
39	TRACE("TRACKPOINT: probe\n");
40	ps2_dev_command(dev, 0xE1, NULL, 0, val, 2);
41
42	if (val[0] != 0x01) {
43		TRACE("TRACKPOINT: not found\n");
44		return B_ERROR;
45	}
46	dev->name = kTrackpointPath[dev->idx];
47	dev->packet_size = 3;
48	TRACE("TRACKPOINT: version 0x%x found\n", val[1]);
49
50	return B_OK;
51}
52