irattach Command in Linux



The irattach command in Linux binds the Linux IrDA stack to the IrDA port. The IrDA stack in Linux is a protocol suite that enables infrared communication by managing drivers and application protocols. The IrDA port is the physical or virtual interface that connects to the stack, supporting SIR (slow) or FIR (fast) modes. The irattach command binds the stack to a port, activating infrared on the device.

The irattach is mainly used to configure low-level communication, which is necessary before using the higher-level layer of the IrDA stack.

Table of Contents

Here is a comprehensive guide to the options available with the irattach command −

Note − The irattach command and the irda-utils package are largely considered deprecated due to the decline in infrared technology usage, replaced by modern wireless communication methods like Bluetooth and Wi-Fi. Furthermore, the irda-utils package is not included in the latest Linux distributions, indicating its outdatedness compared to modern communication technologies.

Prerequisites for irattach Command

The irattach command may not be available by default in Linux. It is a part of the irda-utils packages. To install the irattach command, use the following instructions.

To install the irattach command on Ubuntu, Kali Linux, Debian, and other Debian-based distributions, use the command given below −

sudo apt install irda-utils

To install it on Fedora, use the following command −

sudo dnf install irda-utils

To check the availability of the irattach command, use the following command −

which irattach

If the output shows the irattach command binary path, the command is installed on Linux.

Syntax of irattach Command

The syntax of the Linux irattach command is as follows −

irattach <dev> [options]

The <dev> is an optional field used to specify the device, such as /dev/ttyS0, and the [options] field is used to specify the options, such as starting searching for the device or dongle.

irattach Command Options

The options of the irattach command are listed below −

Options Description
<dev>

Specifies a TTY, IrDA interface, or IrDA driver.

The irattach selects the appropriate driver based on this

TTY Name: Refers to the serial port for the irtty driver such as /dev/ttyS0. Only SIR mode is available; check your BIOS to identify the IrDA port for irattach.

Interface Name: The name of an IrDA interface such as irda0. irattach uses FIR drivers, which must be loaded first or aliased in /etc/modules.conf.

Module Name: The FIR driver module name such as nsc-ircc. New IrDA interfaces are configured after loading the module, but it won't work if already loaded. This feature is experimental.

-s Start discovery of remote IrDA devices
-v Show version information
-h Show help information
-d <dongle> Attach a dongle driver for serial infrared devices (SIR mode only), for example, esi, actisys, or tekram

Examples of irattach Command in Linux

This section demonstrates the usage of the irattach command in Linux with examples −

Attaching IrDA Stack to the Second Serial Port

To attach the IrDA stack to the second serial port, and start the discovery of nearby devices, use the following command −

sudo irattach /dev/ttyS1 -s

The above command specifies /dev/ttyS1 as the TTY device, instructing irattach to use the irtty driver, the default driver. The -s option starts the discovery process for remote IrDA devices.

Attach the IrDA Stack to the First Serial Port with a Dongle

To attach the IrDA stack to the first serial port where an external ACTiSYS serial dongle is connected, and start discovery, use the following command −

sudo irattach /dev/ttyS0 -d actisys+ -s

The /dev/ttyS0 is the TTY device for the external ACTiSYS dongle used in the above command. The -d actisys+ option specifies the dongle type. The -s option starts the discovery process. Here are some of the recognized serial dongles compatible with SIR drivers −

  • esi − Extended Systems JetEye PC ESI-9680
  • tekram − Tekram IrMate IR-210B dongle
  • actisys − ACTiSYS IR-220L dongle
  • actisys+ − ACTiSYS IR-220L+ dongle
  • girbil − Greenwich GIrBIL dongle
  • litelink − Parallax LiteLink dongle & Extended Systems JetEye PC ESI-9680B
  • airport − N. (specific model not identified)
  • old_belkin − Belkin (old) SmartBeam dongle or any dongle capable of only 9600 baud
  • ep7211 − IR port driver for the Cirrus Logic EP7211 processor (ARM based)
  • mcp2120 − Dongles based on the MCP2120 (Microchip)
  • act200l − ACTiSYS Ir-200L dongles
  • ma600 − Mobile Action ma600 dongles

Attaching the IrDA Stack to the First IrDA-USB Dongle

To attach the IrDA stack to the first IrDA-USB dongle and start discovery, use the command given below −

modprobe irda-usb
irattach irda0 -s

This first command loads the irda-usb module, which supports USB IrDA devices. The second command attaches the IrDA stack to irda0; the default name for the first IrDA interface and starts device discovery.

Conclusion

The irattach command in Linux binds the Linux-IrDA stack to a specified IrDA port, enabling infrared communication. To use irattach, the irda-utils package must be installed on Linux. However, it is important to note that both the irattach command and irda-utils are largely considered deprecated due to the decline in the usage of infrared technology.

Advertisements