diff options
Diffstat (limited to 'proto-iokit-foohid/iokitprotocol.cpp')
-rw-r--r-- | proto-iokit-foohid/iokitprotocol.cpp | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/proto-iokit-foohid/iokitprotocol.cpp b/proto-iokit-foohid/iokitprotocol.cpp index 4af6ad5b..693ce31e 100644 --- a/proto-iokit-foohid/iokitprotocol.cpp +++ b/proto-iokit-foohid/iokitprotocol.cpp @@ -20,9 +20,22 @@ IOKitProtocol::IOKitProtocol() qWarning("%s\n", qPrintable(joystick->errorMessage())); } -bool IOKitProtocol::correct() +module_status IOKitProtocol::check_status() { - return joystick && !joystick->hasError(); + if (!joystick) + return QCoreApplication::translate("foohid", "Load failure"); + + if (joystick->hasError()) + { + QString msg = joystick->errorMessage(); + + if (msg.isEmpty()) + msg = QCoreApplication::translate("foohid", "Unknown error"); + + return error(msg); + } + + return status_ok(); } static uint8_t valueToStick(FooHIDJoystick *stick, double min, double value, double max) |