From: Uwe Hermann Date: Tue, 14 Jan 2014 18:52:26 +0000 (+0100) Subject: sysclk-lwla: Fix probe name issue. X-Git-Tag: libsigrok-0.3.0~289 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=1f98295dfa0e303e05b0472cb025c03d3b0cb42b;p=libsigrok.git sysclk-lwla: Fix probe name issue. The g_ascii_formatd() function expects the "format" argument to start with a '%' character, e.g. it should be "%f" or such (this is not clearly documented in the glib API docs, but visible from the source code). The usage of "CH%f" for example will trigger an assertion and thus make the LWLA device unusable in practice (e.g. in PulseView on Windows no probenames would be shown, and sampling wouldn't work). Example: GLib-CRITICAL **: g_ascii_formatd: assertion 'format[0] == '%'' failed (not exposed in all glib versions or builds of glib on all distros apparently, some may need G_MESSAGES_DEBUG=all or other measures) From the glib g_ascii_formatd() code: g_return_val_if_fail (format[0] == '%', NULL); We now use g_snprintf() instead for simplicity. This has been tested to fix this specific issue (i.e. the probenames now do show up in PulseView). This closes bug #270. --- diff --git a/hardware/sysclk-lwla/api.c b/hardware/sysclk-lwla/api.c index e20564a5..38e2e970 100644 --- a/hardware/sysclk-lwla/api.c +++ b/hardware/sysclk-lwla/api.c @@ -65,7 +65,7 @@ static GSList *gen_probe_list(int num_probes) for (i = num_probes; i > 0; --i) { /* The LWLA series simply number probes from CH1 to CHxx. */ - g_ascii_formatd(name, sizeof name, "CH%.0f", i); + g_snprintf(name, sizeof(name), "CH%d", i); probe = sr_probe_new(i - 1, SR_PROBE_LOGIC, TRUE, name); list = g_slist_prepend(list, probe);