mirror of https://github.com/nirenjan/libx52.git
Add notifications when device is connected/disconnected
parent
8b2c0e4a2f
commit
4b411d6767
|
@ -15,6 +15,7 @@
|
|||
#include "x52d_const.h"
|
||||
#include "x52d_config.h"
|
||||
#include "x52d_device.h"
|
||||
#include "x52d_notify.h"
|
||||
#include "libx52.h"
|
||||
#include "pinelog.h"
|
||||
|
||||
|
@ -49,6 +50,7 @@ static void *x52_dev_thr(void *param)
|
|||
} else {
|
||||
/* Successfully connected */
|
||||
PINELOG_INFO(_("Device connected, writing configuration"));
|
||||
X52D_NOTIFY("CONNECTED");
|
||||
x52d_config_apply();
|
||||
}
|
||||
} else {
|
||||
|
@ -172,6 +174,7 @@ int x52d_dev_update(void)
|
|||
// pick it up.
|
||||
PINELOG_TRACE("Disconnecting detached device");
|
||||
libx52_disconnect(x52_dev);
|
||||
X52D_NOTIFY("DISCONNECTED");
|
||||
} else {
|
||||
PINELOG_ERROR(_("Error %d when updating X52 device: %s"),
|
||||
rc, libx52_strerror(rc));
|
||||
|
|
|
@ -13,5 +13,10 @@ void x52d_notify_init(const char *notify_sock_path);
|
|||
void x52d_notify_exit(void);
|
||||
void x52d_notify_send(int argc, const char **argv);
|
||||
|
||||
#define X52D_NOTIFY(...) do { \
|
||||
const char *argv ## __LINE__ [] = {__VA_ARGS__}; \
|
||||
x52d_notify_send(sizeof(argv ## __LINE__ )/sizeof(argv ## __LINE__ [0]), argv ## __LINE__ ); \
|
||||
} while(0)
|
||||
|
||||
#endif // !defined X52D_NOTIFY_H
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: libx52 0.2.3\n"
|
||||
"Report-Msgid-Bugs-To: https://github.com/nirenjan/libx52/issues\n"
|
||||
"POT-Creation-Date: 2022-09-22 21:22-0700\n"
|
||||
"POT-Creation-Date: 2022-09-23 14:57-0700\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
|
@ -782,38 +782,38 @@ msgstr ""
|
|||
msgid "Error processing override '%s.%s=%s'"
|
||||
msgstr ""
|
||||
|
||||
#: daemon/x52d_device.c:35
|
||||
#: daemon/x52d_device.c:36
|
||||
msgid "Starting X52 device manager thread"
|
||||
msgstr ""
|
||||
|
||||
#: daemon/x52d_device.c:42
|
||||
#: daemon/x52d_device.c:43
|
||||
#, c-format
|
||||
msgid "Error %d connecting to device: %s"
|
||||
msgstr ""
|
||||
|
||||
#: daemon/x52d_device.c:51
|
||||
#: daemon/x52d_device.c:52
|
||||
msgid "Device connected, writing configuration"
|
||||
msgstr ""
|
||||
|
||||
#: daemon/x52d_device.c:73
|
||||
#: daemon/x52d_device.c:75
|
||||
msgid "Initializing libx52"
|
||||
msgstr ""
|
||||
|
||||
#: daemon/x52d_device.c:77
|
||||
#: daemon/x52d_device.c:79
|
||||
#, c-format
|
||||
msgid "Failure %d initializing libx52: %s"
|
||||
msgstr ""
|
||||
|
||||
#: daemon/x52d_device.c:88
|
||||
#: daemon/x52d_device.c:90
|
||||
msgid "Shutting down X52 device manager thread"
|
||||
msgstr ""
|
||||
|
||||
#: daemon/x52d_device.c:101
|
||||
#: daemon/x52d_device.c:103
|
||||
#, c-format
|
||||
msgid "Error %d when updating X52 parameter: %s"
|
||||
msgstr ""
|
||||
|
||||
#: daemon/x52d_device.c:176
|
||||
#: daemon/x52d_device.c:179
|
||||
#, c-format
|
||||
msgid "Error %d when updating X52 device: %s"
|
||||
msgstr ""
|
||||
|
|
18
po/xx_PL.po
18
po/xx_PL.po
|
@ -7,7 +7,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: libx52 0.2.3\n"
|
||||
"Report-Msgid-Bugs-To: https://github.com/nirenjan/libx52/issues\n"
|
||||
"POT-Creation-Date: 2022-09-22 21:22-0700\n"
|
||||
"POT-Creation-Date: 2022-09-23 14:57-0700\n"
|
||||
"PO-Revision-Date: 2022-09-22 21:23-0700\n"
|
||||
"Last-Translator: Nirenjan Krishnan <nirenjan@gmail.com>\n"
|
||||
"Language-Team: Dummy Language for testing i18n\n"
|
||||
|
@ -835,38 +835,38 @@ msgstr "Onay aluevay oundfay inay overrideay ingstray '%s'"
|
|||
msgid "Error processing override '%s.%s=%s'"
|
||||
msgstr "Erroray ocessingpray overriday '%s.%s=%s'"
|
||||
|
||||
#: daemon/x52d_device.c:35
|
||||
#: daemon/x52d_device.c:36
|
||||
msgid "Starting X52 device manager thread"
|
||||
msgstr "Artingstay X52 eviceday anagermay eadthray"
|
||||
|
||||
#: daemon/x52d_device.c:42
|
||||
#: daemon/x52d_device.c:43
|
||||
#, c-format
|
||||
msgid "Error %d connecting to device: %s"
|
||||
msgstr "Erroray %d onnectingcay otay eviceday: %s"
|
||||
|
||||
#: daemon/x52d_device.c:51
|
||||
#: daemon/x52d_device.c:52
|
||||
msgid "Device connected, writing configuration"
|
||||
msgstr "Eviceday onnectedcay, itingwray onfigurationcay"
|
||||
|
||||
#: daemon/x52d_device.c:73
|
||||
#: daemon/x52d_device.c:75
|
||||
msgid "Initializing libx52"
|
||||
msgstr "Initializingay libx52"
|
||||
|
||||
#: daemon/x52d_device.c:77
|
||||
#: daemon/x52d_device.c:79
|
||||
#, c-format
|
||||
msgid "Failure %d initializing libx52: %s"
|
||||
msgstr "Ailurefay %d initializeay libx52: %s"
|
||||
|
||||
#: daemon/x52d_device.c:88
|
||||
#: daemon/x52d_device.c:90
|
||||
msgid "Shutting down X52 device manager thread"
|
||||
msgstr "Uttingshay ownday X52 eviceday anagermay eadthray"
|
||||
|
||||
#: daemon/x52d_device.c:101
|
||||
#: daemon/x52d_device.c:103
|
||||
#, c-format
|
||||
msgid "Error %d when updating X52 parameter: %s"
|
||||
msgstr "Erroray %d enwhay updatingay X52 arameterpay: %s"
|
||||
|
||||
#: daemon/x52d_device.c:176
|
||||
#: daemon/x52d_device.c:179
|
||||
#, c-format
|
||||
msgid "Error %d when updating X52 device: %s"
|
||||
msgstr "Erroray %d enwhay updatingay X52 eviceday: %s"
|
||||
|
|
Loading…
Reference in New Issue