3 * Open Hack'Ware BIOS ADB mouse support, ported to OpenBIOS
5 * Copyright (c) 2005 Jocelyn Mayer
6 * Copyright (c) 2005 Stefan Reinauer
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License V2
10 * as published by the Free Software Foundation
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA, 02110-1301 USA
23 #include "libopenbios/bindings.h"
24 #include "libc/byteorder.h"
25 #include "libc/vsprintf.h"
28 #include "adb_mouse.h"
30 DECLARE_UNNAMED_NODE( mouse
, INSTALL_OPEN
, sizeof(int));
43 NODE_METHODS( mouse
) = {
44 { "open", mouse_open
},
45 { "close", mouse_close
},
48 void adb_mouse_new (char *path
, void *private)
52 phandle_t ph
, aliases
;
53 adb_dev_t
*dev
= private;
55 snprintf(buf
, sizeof(buf
), "%s/mouse", path
);
56 REGISTER_NAMED_NODE( mouse
, buf
);
60 set_property(ph
, "device_type", "mouse", 6);
61 props
[0] = __cpu_to_be32(dev
->addr
);
62 set_property(ph
, "reg", (char *)&props
, sizeof(props
));
63 set_int_property(ph
, "#buttons", 3);
65 aliases
= find_dev("/aliases");
66 set_property(aliases
, "adb-mouse", buf
, strlen(buf
) + 1);