2 Copyright (C) 2006 by Michal Schulz
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU Library General Public License as
7 published by the Free Software Foundation; either version 2 of the
8 License, or (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU Library General Public
16 License along with this program; if not, write to the
17 Free Software Foundation, Inc.,
18 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 #include <aros/symbolsets.h>
23 #include <exec/types.h>
26 #include <dos/dosextens.h>
28 #include <hidd/hidd.h>
33 #include <proto/exec.h>
34 #include <proto/oop.h>
35 #include <proto/dos.h>
36 #include <aros/debug.h>
39 #include LC_LIBDEFS_FILE
42 #define SD(x) (&LIBBASE->sd)
44 static int HID_Init(LIBBASETYPEPTR LIBBASE
)
46 struct OOP_ABDescr attrbases
[] = {
47 { (STRPTR
)IID_Hidd
, &HiddAttrBase
},
48 { (STRPTR
)IID_Hidd_USB
, &HiddUSBAttrBase
},
49 { (STRPTR
)IID_Hidd_USBDevice
, &HiddUSBDeviceAttrBase
},
50 { (STRPTR
)IID_Hidd_USBHub
, &HiddUSBHubAttrBase
},
51 { (STRPTR
)IID_Hidd_USBHID
, &HiddUSBHIDAttrBase
},
52 { (STRPTR
)IID_Hidd_USBDrv
, &HiddUSBDrvAttrBase
},
56 D(bug("[HID] USB HID Init.\n"));
58 InitSemaphore(&LIBBASE
->sd
.Lock
);
60 if (OOP_ObtainAttrBases(attrbases
))
62 if ((LIBBASE
->sd
.MemPool
= CreatePool(MEMF_PUBLIC
|MEMF_CLEAR
|MEMF_SEM_PROTECTED
, 8192, 4096)) != NULL
)
64 D(bug("[HID] Init done.\n"));
66 OOP_Object
*usb
= OOP_NewObject(NULL
, CLID_Hidd_USB
, NULL
);
68 HIDD_USB_AddClass(usb
, MOD_NAME_STRING
);
69 OOP_DisposeObject(usb
);
74 OOP_ReleaseAttrBases(attrbases
);
80 static int HID_Expunge(LIBBASETYPEPTR LIBBASE
)
82 struct OOP_ABDescr attrbases
[] = {
83 { (STRPTR
)IID_Hidd
, &HiddAttrBase
},
84 { (STRPTR
)IID_Hidd_USB
, &HiddUSBAttrBase
},
85 { (STRPTR
)IID_Hidd_USBDevice
, &HiddUSBDeviceAttrBase
},
86 { (STRPTR
)IID_Hidd_USBHub
, &HiddUSBHubAttrBase
},
87 { (STRPTR
)IID_Hidd_USBHID
, &HiddUSBHIDAttrBase
},
88 { (STRPTR
)IID_Hidd_USBDrv
, &HiddUSBDrvAttrBase
},
92 D(bug("[HID] HID Expunge\n"));
94 OOP_ReleaseAttrBases(attrbases
);
96 DeletePool(LIBBASE
->sd
.MemPool
);
101 ADD2INITLIB(HID_Init
, 0)
102 ADD2EXPUNGELIB(HID_Expunge
, 0)