<p></p>
<p><b>@ldv-alt</b> requested changes on this pull request.</p>

<p dir="auto">Thank you for your contribution, but the decoder looks too old-fashioned,<br>
please have a look at other ioctl decoders, e.g. src/gpio_ioctl.c and tests/<em>gpio</em>.</p><hr>

<p>In <a href="https://github.com/strace/strace/pull/208#discussion_r796466397">src/lirc.c</a>:</p>
<pre style='color:#555'>> @@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 2022 Sean Young <sean@mess.org>
+ *
+ * SPDX-License-Identifier: LGPL-2.1-or-later
+ */
+
+#include "defs.h"
+#include <linux/lirc.h>
</pre>
<p dir="auto"><linux/lirc.h> was introduced by Linux kernel commit v4.5-rc1<del>115^2</del>360, but strace supports build with older kernel headers.  Consider bundling lirc.h into bundled/linux/include/uapi/linux/.</p>

<hr>

<p>In <a href="https://github.com/strace/strace/pull/208#discussion_r796471847">src/lirc.c</a>:</p>
<pre style='color:#555'>> +static const struct features {
+       int flag;
+       const char *name;
+} features[] = {
+       { LIRC_CAN_REC_SCANCODE, "LIRC_CAN_REC_SCANCODE" },
+       { LIRC_CAN_REC_MODE2, "LIRC_CAN_REC_MODE2" },
+       { LIRC_CAN_GET_REC_RESOLUTION, "LIRC_CAN_GET_REC_RESOLUTION" },
+       { LIRC_CAN_SEND_PULSE, "LIRC_CAN_SEND_PULSE" },
+       { LIRC_CAN_SET_TRANSMITTER_MASK, "LIRC_CAN_SET_TRANSMITTER_MASK" },
+       { LIRC_CAN_SET_SEND_CARRIER, "LIRC_CAN_SET_SEND_CARRIER" },
+       { LIRC_CAN_SET_SEND_DUTY_CYCLE, "LIRC_CAN_SET_SEND_DUTY_CYCLE" },
+       { LIRC_CAN_SET_REC_CARRIER, "LIRC_CAN_SET_REC_CARRIER" },
+       { LIRC_CAN_SET_REC_CARRIER_RANGE, "LIRC_CAN_SET_REC_CARRIER_RANGE" },
+       { LIRC_CAN_USE_WIDEBAND_RECEIVER, "LIRC_CAN_USE_WIDEBAND_RECEIVER" },
+       { LIRC_CAN_MEASURE_CARRIER, "LIRC_CAN_MEASURE_CARRIER" },
+       { LIRC_CAN_SET_REC_TIMEOUT, "LIRC_CAN_SET_REC_TIMEOUT" },
+};
</pre>
<p dir="auto">We replaced this approach with xlat files roughly 8 years ago, please create a xlat file instead.</p>

<hr>

<p>In <a href="https://github.com/strace/strace/pull/208#discussion_r796473986">src/lirc.c</a>:</p>
<pre style='color:#555'>> +            bool needs_or = false;
+               unsigned long i;
+
+               tprintf(", features=");
+
+               for (i = 0; i < ARRAY_SIZE(features); i++) {
+                       if (value & features[i].flag) {
+                               if (needs_or)
+                                       tprintf("|");
+                               tprintf("%s", features[i].name);
+                               needs_or = true;
+                       }
+               }
</pre>
<p dir="auto">Please use printflags instead.</p>

<hr>

<p>In <a href="https://github.com/strace/strace/pull/208#discussion_r796476570">src/lirc.c</a>:</p>
<pre style='color:#555'>> +            switch (value) {
+               case LIRC_MODE_RAW:
+                       tprintf(", mode=raw");
+                       break;
+               case LIRC_MODE_PULSE:
+                       tprintf(", mode=pulse");
+                       break;
+               case LIRC_MODE_MODE2:
+                       tprintf(", mode=mode2");
+                       break;
+               case LIRC_MODE_SCANCODE:
+                       tprintf(", mode=scancode");
+                       break;
+               case LIRC_MODE_LIRCCODE:
+                       tprintf(", mode=lirccode");
+                       break;
+               default:
+                       tprintf(", mode=%d", value);
+                       break;
+               }
</pre>
<p dir="auto">Please use printxval instead.</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />Reply to this email directly, <a href="https://github.com/strace/strace/pull/208#pullrequestreview-868945966">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AOVBTR56RI6OKXVHAPMDRNLUY636HANCNFSM5M2WOHAQ">unsubscribe</a>.<br />Triage notifications on the go with GitHub Mobile for <a href="https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675">iOS</a> or <a href="https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub">Android</a>.
<br />You are receiving this because you are subscribed to this thread.<img src="https://github.com/notifications/beacon/AOVBTRZ5TE4UQZWJBDZR4H3UY636HA5CNFSM5M2WOHA2YY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOGPFRALQ.gif" height="1" width="1" alt="" /><span style="color: transparent; font-size: 0; display: none; visibility: hidden; overflow: hidden; opacity: 0; width: 0; height: 0; max-width: 0; max-height: 0; mso-hide: all">Message ID: <span><strace/strace/pull/208/review/868945966</span><span>@</span><span>github</span><span>.</span><span>com></span></span></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/strace/strace/pull/208#pullrequestreview-868945966",
"url": "https://github.com/strace/strace/pull/208#pullrequestreview-868945966",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>