Skip to content

Commit

Permalink
utils: Fix iio_attr passed as fprintf argument
Browse files Browse the repository at this point in the history
fprintf doesn't know what to do with a 'struct iio_attr *' pointer; it
wants the attribute's name instead.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
  • Loading branch information
pcercuei committed Nov 21, 2023
1 parent e3e4be7 commit 12b5134
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions utils/gen_code.c
Original file line number Diff line number Diff line change
Expand Up @@ -297,9 +297,11 @@ void gen_function(const char* prefix, const char* target,
if (wbuf) {
fprintf(fd, " # Write string to %s attribute:\n", prefix);
if (!strcmp(prefix, "device") || !strcmp(prefix, "channel")) {
fprintf(fd, " %s.attrs[\"%s\"].value = str(\"%s\")\n", target, attr, wbuf);
fprintf(fd, " %s.attrs[\"%s\"].value = str(\"%s\")\n",
target, iio_attr_get_name(attr), wbuf);
} else if (!strcmp(prefix, "device_debug")) {
fprintf(fd, " %s.debug_attrs[\"%s\"].value = str(\"%s\")\n", target, attr, wbuf);
fprintf(fd, " %s.debug_attrs[\"%s\"].value = str(\"%s\")\n",
target, iio_attr_get_name(attr), wbuf);
} else {
fprintf(fd, " # Write for %s / %s not implemented yet\n", prefix, target);
}
Expand Down

0 comments on commit 12b5134

Please sign in to comment.