Event-input: Change reporting of failure to open
Don’t use an exception here, not needed and makes for noise on the reporting backedning.
This commit is contained in:
parent
e1caf04b41
commit
f5eadf2e37
1 changed files with 10 additions and 14 deletions
|
@ -481,22 +481,18 @@ unsigned FGEventInput::AddDevice( FGInputDevice * inputDevice )
|
||||||
|
|
||||||
inputDevice->Configure( deviceNode );
|
inputDevice->Configure( deviceNode );
|
||||||
|
|
||||||
try {
|
|
||||||
bool ok = inputDevice->Open();
|
bool ok = inputDevice->Open();
|
||||||
if (ok) {
|
if (!ok) {
|
||||||
input_devices[ deviceNode->getIndex() ] = inputDevice;
|
// TODO repot a better error here, to the user
|
||||||
} else {
|
SG_LOG(SG_INPUT, SG_ALERT, "can't open InputDevice " << inputDevice->GetUniqueName());
|
||||||
throw sg_exception("Opening input device failed");
|
delete inputDevice;
|
||||||
}
|
return INVALID_DEVICE_INDEX;
|
||||||
}
|
}
|
||||||
catch( ... ) {
|
|
||||||
SG_LOG(SG_INPUT, SG_ALERT, "can't open InputDevice " << inputDevice->GetUniqueName() );
|
|
||||||
delete inputDevice;
|
|
||||||
return INVALID_DEVICE_INDEX;
|
|
||||||
}
|
|
||||||
|
|
||||||
SG_LOG(SG_INPUT, SG_DEBUG, "using InputDevice " << inputDevice->GetUniqueName() );
|
input_devices[deviceNode->getIndex()] = inputDevice;
|
||||||
return deviceNode->getIndex();
|
|
||||||
|
SG_LOG(SG_INPUT, SG_DEBUG, "using InputDevice " << inputDevice->GetUniqueName());
|
||||||
|
return deviceNode->getIndex();
|
||||||
}
|
}
|
||||||
|
|
||||||
void FGEventInput::RemoveDevice( unsigned index )
|
void FGEventInput::RemoveDevice( unsigned index )
|
||||||
|
|
Loading…
Reference in a new issue