All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sean Young <sean@mess.org>
To: Laurent Tramoy <laurenttramoy@gmail.com>
Cc: linux-media@vger.kernel.org
Subject: Re: [PATCH v4l-utils] ir-ctl: fix UNSET sentinel checks for send carrier
Date: Sun, 29 Nov 2026 11:22:06 +0000	[thread overview]
Message-ID: <awwK3mtZQb5feJSu@extorris.mess.org> (raw)
In-Reply-To: <20261127171051.1500269-1-laurenttramoy@gmail.com>

On Fri, Nov 27, 2026 at 06:10:50PM +0100, Laurent Tramoy wrote:
> struct send::carrier uses UNSET (UINT32_MAX) to mean "not specified".
> Two checks compare against the wrong sentinel instead:
> 
> - read_file_pulse_space() tests "if (f->carrier)" instead of
>   "!= UNSET", so it always treats carrier as already set and never
>   applies the carrier implied by the scancode's protocol.
> 
> - convert_keycode() defaults a missing keymap carrier to 0 instead of
>   UNSET, so lirc_send() treats it as an explicit 0 Hz and reprograms
>   the hardware carrier to 0, silently breaking transmission.
> 
> Compare against UNSET in both places, like the existing "carrier"
> keyword branch already does.
> 
> Signed-off-by: Laurent Tramoy <laurenttramoy@gmail.com>
> ---
> Hi,
> 
> This is the first patch I submit through email. I hit this while
> testing IR transmission, happy to adjust anything about the patch
> if needed.
> 
> Thanks,
> Laurent

Hi Laurent,

Thank you for your patch. Nice catch - this is an old problem you
solved. Very nice, good stuff!

I've applied it.

Sean

> 
>  utils/ir-ctl/ir-ctl.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/utils/ir-ctl/ir-ctl.c b/utils/ir-ctl/ir-ctl.c
> index d2ff77e4..63aaa803 100644
> --- a/utils/ir-ctl/ir-ctl.c
> +++ b/utils/ir-ctl/ir-ctl.c
> @@ -296,7 +296,7 @@ static struct send *read_file_pulse_space(struct arguments *args, const char *fn
>  			}
>  
>  			carrier = protocol_carrier(proto);
> -			if (f->carrier && f->carrier != carrier)
> +			if (f->carrier != UNSET && f->carrier != carrier)
>  				fprintf(stderr, _("error: %s:%d: carrier already specified\n"), fname, lineno);
>  			else
>  				f->carrier = carrier;
> @@ -756,7 +756,7 @@ static struct send* convert_keycode(struct keymap *map, const char *keycode)
>  				s->len = re->raw_length;
>  				memcpy(s->buf, re->raw, s->len * sizeof(int));
>  				s->ty = SEND_RAW;
> -				s->carrier = keymap_param(map, "carrier", 0);
> +				s->carrier = keymap_param(map, "carrier", UNSET);
>  				s->next = NULL;
>  			}
>  		}
> @@ -788,7 +788,7 @@ static struct send* convert_keycode(struct keymap *map, const char *keycode)
>  				s->len = length;
>  				memcpy(s->buf, buf, length * sizeof(int));
>  				s->ty = SEND_RAW;
> -				s->carrier = keymap_param(map, "carrier", 0);
> +				s->carrier = keymap_param(map, "carrier", UNSET);
>  				s->next = NULL;
>  			} else {
>  				fprintf(stderr, _("error: protocol '%s' not supported\n"), proto_str);
> -- 
> 2.56.1
> 

      reply	other threads:[~2026-11-29 11:22 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-27 17:10 [PATCH v4l-utils] ir-ctl: fix UNSET sentinel checks for send carrier Laurent Tramoy
2026-11-29 11:22 ` Sean Young [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=awwK3mtZQb5feJSu@extorris.mess.org \
    --to=sean@mess.org \
    --cc=laurenttramoy@gmail.com \
    --cc=linux-media@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.