NAME

Protocol::IR::Format::LIRC - LIRC remote definition format (.lircd.conf) import and export

VERSION

version 1.2

SYNOPSIS

use Protocol::IR::Converter;

my $converter = Protocol::IR::Converter->new();

# Import a LIRC remote definition
my $codes = $converter->import_format('LIRC', $lirc_text);
for my $code (@$codes) {
    print $code->alias, ": ", $code->protocol, "\n";
}

# Export a code as a LIRC remote definition
my $lirc = $converter->export_code($code, 'LIRC',
    name => 'My Remote');

DESCRIPTION

Protocol::IR::Format::LIRC imports and exports LIRC remote definition files (.lircd.conf). The LIRC format is the de facto standard for sharing IR remote control definitions across the LIRC ecosystem (https://www.lirc.org/).

Example .lircd.conf (NEC transmission with timing template)
begin remote

  name  Samsung_TV
  bits           16
  flags SPACE_ENC|CONST_LENGTH
  eps            30
  aeps           100

  header         4500  4500
  one            550   1650
  zero           550   550
  gap            107000

      begin codes
          KEY_POWER 0xE0E040BF
      end codes

end remote

Import modes

decode handles two LIRC encoding modes:

  • Protocol-based (SPACE_ENC): The remote header defines timing parameters (header, one, zero, pre_data, post_data), and the codes section maps button names to hex values. The module infers the protocol from the timing parameters and decodes through the registered protocol handler.

  • Raw codes (RAW_CODES): The raw_codes section contains explicit pulse/space microsecond values for each button. These are decoded through the registered protocol timing decoders, with raw timings preserved for lossless re-export.

Export

export produces a LIRC remote definition with timing parameters matched to the code's protocol. Known protocols (NEC, Samsung, JVC) get protocol-based output with correct timing templates. Unknown protocols fall back to raw codes derived from the stored timings or a Pronto hex round-trip.

Options:

  • name -- remote name (default: 'exported')

METHODS

decode

my $codes = $class->decode($input, $registry);

Parses a LIRC remote definition and returns an arrayref of Protocol::IR::Code objects.

export

my $lirc = $class->export($codes, $registry, %opts);

Serializes one or more Protocol::IR::Code objects into a LIRC remote definition string.

SUPPORT

Source code: https://github.com/bwarden/perl-protocol-ir

Bug reports and feature requests: https://github.com/bwarden/perl-protocol-ir/issues

AUTHOR

Brett T. Warden <bwarden@cpan.org>

COPYRIGHT AND LICENSE

Copyright (c) 2026 Brett T. Warden

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License version 2.1 as published by the Free Software Foundation.