return true;
}
+static int jaylink_log_handler(const struct jaylink_context *ctx, int level,
+ const char *format, va_list args, void *user_data)
+{
+ enum log_levels tmp;
+
+ switch (level) {
+ case JAYLINK_LOG_LEVEL_ERROR:
+ tmp = LOG_LVL_ERROR;
+ break;
+ case JAYLINK_LOG_LEVEL_WARNING:
+ tmp = LOG_LVL_WARNING;
+ break;
+ /*
+ * Forward info messages to the debug output because they are more verbose
+ * than info messages of OpenOCD.
+ */
+ case JAYLINK_LOG_LEVEL_INFO:
+ case JAYLINK_LOG_LEVEL_DEBUG:
+ tmp = LOG_LVL_DEBUG;
+ break;
+ default:
+ tmp = LOG_LVL_WARNING;
+ }
+
+ log_vprintf_lf(tmp, __FILE__, __LINE__, __func__, format, args);
+
+ return 0;
+}
+
static int jlink_init(void)
{
int ret;
return ERROR_JTAG_INIT_FAILED;
}
+ ret = jaylink_log_set_callback(jayctx, &jaylink_log_handler, NULL);
+
+ if (ret != JAYLINK_OK) {
+ LOG_ERROR("jaylink_log_set_callback() failed: %s.",
+ jaylink_strerror_name(ret));
+ jaylink_exit(jayctx);
+ return ERROR_JTAG_INIT_FAILED;
+ }
+
ret = jaylink_get_device_list(jayctx, &devs);
if (ret < 0) {