Commit Graph

9 Commits (973348e5371542d16569228a2ae4c03639d47634)

Author SHA1 Message Date
nirenjan d9ae8d4b79 Add connect/disconnect methods to libx52
Prior to this change, libx52_init needed a supported joystick to be
plugged in, otherwise it would fail with LIBX52_ERROR_NO_DEVICE. This
change modifies the behavior so that libx52_init would still succeed,
but the application should call libx52_connect to make sure that the
device handle is valid. libx52_init still tries to connect to the
joystick, but absence is no longer treated as a failure.

This change also modifies x52cli to check that the joystick is actually
connected before calling the individual handlers. Because libx52_init no
longer fails if the joystick is absent, we need to rely on the return
code from libx52_connect.
2020-05-23 02:18:40 -07:00
nirenjan 16b4ad693b Fix error reporting in x52cli
Prior to this change, x52cli assumed that the return code from the
handler was a standard error code, but negated. This is an incorrect
assumption as the libx52 API returns a `libx52_error_code` enum, which
is a positive integer.

This change fixes the printing of the error message to call
`libx52_strerror`, which translates it correctly. It also adds error
printing to any failure of `libx52_init`, as well as explicitly
specifying `LIBX52_SUCCESS` instead of `0`.

Addresses #19.
2020-05-18 14:38:49 -07:00
nirenjan b1139806f5 Use X-macros for x52cli commands 2018-07-17 15:46:54 -07:00
nirenjan 7dcd3049ec Add SPDX license identifiers in all files 2018-04-18 12:19:29 -07:00
nirenjan f3270def9d API change for libx52
- libx52_init returns the libx52_device in an output parameter and
  returns a libx52_error_code
- Make all functions return libx52_error_code
- Update package version to indicate incompatible API change
2017-08-23 19:30:35 -07:00
nirenjan acdcebc52e Add CLI commands to access raw date and time APIs 2017-08-18 07:26:50 -07:00
nirenjan 533a472b10 Fix formatting for x52cli manual 2017-08-16 00:05:05 -07:00
Lars Wendler 44d46b70e0
x52_cli: Print error messages with trailing newline. 2017-08-04 11:12:24 +02:00
nirenjan f0a0a7dcaf Reorganize source layout 2017-07-27 17:56:51 -07:00