2 Copyright (C) 2004-2013, The AROS Development Team. All rights reserved.
6 #include <aros/debug.h>
9 #include <hidd/keyboard.h>
10 #include <proto/alib.h>
11 #include <proto/exec.h>
12 #include <proto/oop.h>
17 #define HWBase (LIBBASE->csd.hwMB)
19 static int KBD_InitClass(struct kbdbase
*LIBBASE
)
21 struct Library
*OOPBase
= LIBBASE
->csd
.cs_OOPBase
;
23 D(bug("[KBD] base class initialization\n"));
25 LIBBASE
->csd
.cs_UtilityBase
= OpenLibrary("utility.library", 0);
26 if (!LIBBASE
->csd
.cs_UtilityBase
)
29 LIBBASE
->csd
.hiddKbdAB
= OOP_ObtainAttrBase(IID_Hidd_Kbd
);
30 LIBBASE
->csd
.hwAB
= OOP_ObtainAttrBase(IID_HW
);
31 LIBBASE
->csd
.hwMB
= OOP_GetMethodID(IID_HW
, 0);
33 if (LIBBASE
->csd
.hiddKbdAB
&& LIBBASE
->csd
.hwAB
)
35 OOP_Object
*root
= OOP_NewObject(NULL
, CLID_HW_Root
, NULL
);
37 NewList((struct List
*)&LIBBASE
->csd
.callbacks
);
39 if (HW_AddDriver(root
, LIBBASE
->csd
.hwClass
, NULL
))
41 D(bug("[KBD] Everything OK\n"));
49 static int KBD_ExpungeClass(struct kbdbase
*LIBBASE
)
51 struct Library
*OOPBase
= LIBBASE
->csd
.cs_OOPBase
;
53 D(bug("[KBD] Base Class destruction\n"));
55 if (LIBBASE
->csd
.hiddKbdAB
)
56 OOP_ReleaseAttrBase(IID_Hidd_Kbd
);
57 if (LIBBASE
->csd
.cs_UtilityBase
)
58 CloseLibrary(LIBBASE
->csd
.cs_UtilityBase
);
63 ADD2INITLIB(KBD_InitClass
, 0)
64 ADD2EXPUNGELIB(KBD_ExpungeClass
, 0)