Check for SYS/GL during library init. Reason is that
[AROS.git] / workbench / devs / AHI / Drivers / AROS / aros-init.c
blob7fa82ee7627225e562c1a15593ee7673f4c9bdd7
2 #include <config.h>
4 #include "library.h"
5 #include "DriverData.h"
7 #define AHI_AROSQUIET
8 #define DEBUG 1
9 #include <aros/debug.h>
11 struct DosLibrary *DOSBase = NULL;
12 struct Library *OSSBase = NULL;
14 /******************************************************************************
15 ** Custom driver init *********************************************************
16 ******************************************************************************/
18 BOOL
19 DriverInit( struct DriverBase* AHIsubBase )
21 struct AROSBase* AROSBase = (struct AROSBase*) AHIsubBase;
23 DOSBase = OpenLibrary( DOSNAME, 37 );
25 if( DOSBase == NULL )
27 #ifndef AHI_AROSQUIET
28 Req( "Unable to open 'dos.library' version 37.\n" );
29 #else
30 D(bug("Unable to open 'dos.library' version 37.\n" ));
31 #endif
32 return FALSE;
35 OSSBase = OpenLibrary( "oss.library", 0 );
37 if( OSSBase == NULL )
39 #ifndef AHI_AROSQUIET
40 Req( "Unable to open 'oss.library'.\n" );
41 #endif
42 return FALSE;
45 // Fail if no hardware is present (this check prevents the audio
46 // modes from being added to the database if the driver cannot be
47 // used).
49 if( ! OSS_Open( "/dev/dsp", FALSE, TRUE, FALSE ) )
51 #ifndef AHI_AROSQUIET
52 Req( "No sound card present.\n" );
53 #else
54 D(bug( "No sound card present.\n" ));
55 #endif
56 return FALSE;
59 OSS_Close();
61 return TRUE;
65 /******************************************************************************
66 ** Custom driver clean-up *****************************************************
67 ******************************************************************************/
69 VOID
70 DriverCleanup( struct DriverBase* AHIsubBase )
72 struct AROSBase* AROSBase = (struct AROSBase*) AHIsubBase;
74 CloseLibrary( (struct Library*) DOSBase );
75 CloseLibrary( OSSBase );