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.
This commit is contained in:
Uwe Hermann 2014-01-14 19:52:26 +01:00
parent 2379783d85
commit 1f98295dfa
1 changed files with 1 additions and 1 deletions

View File

@ -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);