Allow libx52 calls to return TRY_AGAIN

Some libx52 APIs, notably the clock related ones, can return
LIBX52_ERROR_TRY_AGAIN. This is not a real error, but it is useful
information. It indicates to the application that there is no change
applied to the internal state, and that it should wait until trying
again.

Given that the clock thread calls the libx52_set_clock method every
second, treating the TRY_AGAIN state as a failure and logging it causes
a lot of spurious noise in the logs.  This change ensures that the API
returns a real error before logging it.
reverse-scroll
nirenjan 2021-07-23 09:43:02 -07:00
parent 6175dcabe6
commit ae13480717
1 changed files with 4 additions and 2 deletions

View File

@ -132,8 +132,10 @@ void x52d_dev_exit(void)
rc = func; \ rc = func; \
pthread_mutex_unlock(&device_mutex); \ pthread_mutex_unlock(&device_mutex); \
if (rc != LIBX52_SUCCESS) { \ if (rc != LIBX52_SUCCESS) { \
if (rc != LIBX52_ERROR_TRY_AGAIN) { \
PINELOG_ERROR(_("Error %d when updating X52 parameter: %s"), \ PINELOG_ERROR(_("Error %d when updating X52 parameter: %s"), \
rc, libx52_strerror(rc)); \ rc, libx52_strerror(rc)); \
} \
} else { \ } else { \
device_update_needed = true; \ device_update_needed = true; \
} \ } \