summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/usbg_common.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/usbg_common.c b/src/usbg_common.c
index 948cce8..d3040c8 100644
--- a/src/usbg_common.c
+++ b/src/usbg_common.c
@@ -451,6 +451,25 @@ int usbg_set_config_node_int(config_setting_t *root,
return ret == CONFIG_TRUE ? 0 : USBG_ERROR_OTHER_ERROR;
}
+int usbg_set_config_node_int_hex(config_setting_t *root,
+ const char *node_name, void *val)
+{
+ config_setting_t *node;
+ int ret = 0;
+
+ node = config_setting_add(root, node_name, CONFIG_TYPE_INT);
+ if (!node)
+ return USBG_ERROR_NO_MEM;
+
+ ret = config_setting_set_format(node, CONFIG_FORMAT_HEX);
+ if (ret != CONFIG_TRUE)
+ return USBG_ERROR_OTHER_ERROR;
+
+ ret = config_setting_set_int(node, *(int *)val);
+
+ return ret == CONFIG_TRUE ? 0 : USBG_ERROR_OTHER_ERROR;
+}
+
int usbg_set_config_node_bool(config_setting_t *root,
const char *node_name, void *val)
{