xref: /haiku/src/add-ons/kernel/bus_managers/ps2/ps2_trackpoint.cpp (revision 820dca4df6c7bf955c46e8f6521b9408f50b2900)
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 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"
23 };
24 
25 
26 status_t
27 probe_trackpoint(ps2_dev* dev)
28 {
29 	uint8 val[2];
30 
31 	TRACE("TRACKPOINT: probe\n");
32 	ps2_dev_command(dev, 0xE1, NULL, 0, val, 2);
33 
34 	if (val[0] != 0x01) {
35 		TRACE("TRACKPOINT: not found\n");
36 		return B_ERROR;
37 	}
38 	dev->name = kTrackpointPath[dev->idx];
39 	dev->packet_size = 3;
40 	TRACE("TRACKPOINT: version 0x%x found\n", val[1]);
41 
42 	return B_OK;
43 }
44