// Read analog inputs
static void ATCReadAnalogInputs( int fd, unsigned char *analog_in_bytes ) {
+#if defined( unix ) || defined( __CYGWIN__ )
// rewind
lseek( fd, 0, SEEK_SET );
SG_LOG( SG_IO, SG_ALERT, "Read failed" );
exit( -1 );
}
+#endif
}
// Read status of radio switches and knobs
static void ATCReadRadios( int fd, unsigned char *switch_data ) {
+#if defined( unix ) || defined( __CYGWIN__ )
// rewind
lseek( fd, 0, SEEK_SET );
SG_LOG( SG_IO, SG_ALERT, "Read failed" );
exit( -1 );
}
+#endif
}
// Read switch inputs
static void ATCReadSwitches( int fd, unsigned char *switch_bytes ) {
+#if defined( unix ) || defined( __CYGWIN__ )
// rewind
lseek( fd, 0, SEEK_SET );
SG_LOG( SG_IO, SG_ALERT, "Read failed" );
exit( -1 );
}
+#endif
}
init_config();
SG_LOG( SG_IO, SG_ALERT,
- "Initializing ATC 610x hardware, please wait ..." );
+ "Initializing ATC input hardware, please wait ..." );
- snprintf( lock_file, 256, "/proc/atc610x/board%d/lock", board );
- snprintf( analog_in_file, 256, "/proc/atc610x/board%d/analog_in", board );
- snprintf( radios_file, 256, "/proc/atc610x/board%d/radios", board );
- snprintf( switches_file, 256, "/proc/atc610x/board%d/switches", board );
+ snprintf( analog_in_file, 256,
+ "/proc/atcflightsim/board%d/analog_in", board );
+ snprintf( radios_file, 256,
+ "/proc/atcflightsim/board%d/radios", board );
+ snprintf( switches_file, 256,
+ "/proc/atcflightsim/board%d/switches", board );
#if defined( unix ) || defined( __CYGWIN__ )
// Open the /proc files
/////////////////////////////////////////////////////////////////////
- lock_fd = ::open( lock_file, O_RDWR );
- if ( lock_fd == -1 ) {
- SG_LOG( SG_IO, SG_ALERT, "errno = " << errno );
- char msg[256];
- snprintf( msg, 256, "Error opening %s", lock_file );
- perror( msg );
- exit( -1 );
- }
-
analog_in_fd = ::open( analog_in_file, O_RDONLY );
if ( analog_in_fd == -1 ) {
SG_LOG( SG_IO, SG_ALERT, "errno = " << errno );
/////////////////////////////////////////////////////////////////////
SG_LOG( SG_IO, SG_ALERT,
- "Done initializing ATC 610x hardware." );
+ "Done initializing ATC input hardware." );
is_open = true;
#if defined( unix ) || defined( __CYGWIN__ )
- int result;
-
- result = ::close( lock_fd );
- if ( result == -1 ) {
- SG_LOG( SG_IO, SG_ALERT, "errno = " << errno );
- char msg[256];
- snprintf( msg, 256, "Error closing %s", lock_file );
- perror( msg );
- exit( -1 );
+ if ( !is_open ) {
+ return true;
}
+ int result;
+
result = ::close( analog_in_fd );
if ( result == -1 ) {
SG_LOG( SG_IO, SG_ALERT, "errno = " << errno );