lirc(4) Device Drivers Manual lirc(4) lirc - lirc /dev/lirc* (IR) . , . , . (, -) IR- . LIRC_MODE_SCANCODE. , IR-. , IR-, , , . / . LIRC_MODE_MODE2. () . LIRC_MODE_SCANCODE, . BPF ( bpf(2)) lirc. IR. ioctl LIRC_GET_FEATURES ( ) , , . LIRC_MODE_MODE2 In the LIRC_MODE_MODE2 mode, the data returned by read(2) provides 32-bit values representing a space or a pulse duration. The time of the duration (microseconds) is encoded in the lower 24 bits. Pulse (also known as flash) indicates a duration of infrared light being detected, and space (also known as gap) indicates a duration with no infrared. If the duration of space exceeds the inactivity timeout, a special timeout package is delivered, which marks the end of a message. The upper 8 bits indicate the type of package: LIRC_MODE2_SPACE (). LIRC_MODE2_PULSE (). LIRC_MODE2_FREQUENCY (); ioctl LIRC_SET_MEASURE_CARRIER_MODE. LIRC_MODE2_TIMEOUT (). ; ioctl LIRC_SET_REC_TIMEOUT_REPORTS. LIRC_MODE2_OVERFLOW The IR receiver encountered an overflow, and as a result data is missing (since Linux 5.18). LIRC_MODE_SCANCODE LIRC_MODE_SCANCODE , read(2) lirc_scancode, . scancode, IR -- rc_proto. enum rc_proto. LIRC_MODE_PULSE , write(2), / . . , . write(2) , . , , write(2) EINVAL. LIRC_MODE_SCANCODE , , lirc_scancode. scancode rc_proto, 0. IR- . , lirc . IOCTL #include /* But see BUGS */ int ioctl(int fd, int cmd, int *val); The following ioctl(2) operations are provided by the lirc character device to probe or change specific lirc hardware settings. /dev/lirc* : LIRC_GET_FEATURES (void) ; . LIRC_GET_FEATURES, , lirc. lirc , . , ENOTTY, , EINVAL, . , ioctl ENOTTY. LIRC_GET_REC_MODE (void) lirc , ENOTTY. , : LIRC_MODE_MODE2 / . LIRC_MODE_SCANCODE struct lirc_scancode, . LIRC_SET_REC_MODE (int) . val LIRC_MODE_SCANCODE LIRC_MODE_MODE2. lirc , ENOTTY. LIRC_GET_SEND_MODE (void) . LIRC_MODE_PULSE LIRC_MODE_SCANCODE. lirc , ENOTTY. LIRC_SET_SEND_MODE (int) . val LIRC_MODE_SCANCODE LIRC_MODE_PULSE. lirc , ENOTTY. LIRC_SET_SEND_CARRIER (int) . ( ). LIRC_SET_SEND_DUTY_CYCLE (int) (carrier duty cycle). val -- [0,100], . 0 100 - , . LIRC_GET_MIN_TIMEOUT(void) LIRC_GET_MAX_TIMEOUT(void) , IR. lircd(8) IR . / , ( ). . LIRC_GET_MIN_TIMEOUT LIRC_GET_MAX_TIMEOUT ENOTTY. LIRC_SET_REC_TIMEOUT (int) IR (). , LIRC_GET_MIN_TIMEOUT LIRC_GET_MAX_TIMEOUT. 0 ( ) . , . LIRC_GET_REC_TIMEOUT (void) ( ). Linux 4.18. LIRC_SET_REC_TIMEOUT_REPORTS (int) (val 1) (val 0) LIRC_MODE_MODE2. : o Since Linux 5.17: timeout packages are always enabled and this ioctl is a no-op. o Since Linux 4.16: timeout packages are enabled by default. Each time the lirc device is opened, the LIRC_SET_REC_TIMEOUT operation can be used to disable (and, if desired, to later re-enable) the timeout on the file descriptor. o In Linux 4.15 and earlier: timeout packages are disabled by default, and enabling them (via LIRC_SET_REC_TIMEOUT) on any file descriptor associated with the lirc device has the effect of enabling timeouts for all file descriptors referring to that device (until timeouts are disabled again). LIRC_SET_REC_CARRIER (int) (). LIRC_SET_REC_CARRIER_RANGE. LIRC_SET_REC_CARRIER_RANGE (int) (). ioctl LIRC_SET_REC_CARRIER_RANGE, ioctl LIRC_SET_REC_CARRIER. LIRC_SET_MEASURE_CARRIER_MODE (int) (val 1) (val 0) . , LIRC_MODE2_FREQUENCY. . LIRC_GET_REC_RESOLUTION (void) ( ). LIRC_SET_TRANSMITTER_MASK (int) , val , 1. . . , , , , . LIRC_SET_WIDEBAND_RECEIVER (int) , . ioctl (val 1) (val 0) . , . . , . : , . , . . ioctl LIRC_GET_FEATURES , . : LIRC_CAN_REC_MODE2 LIRC_MODE_MODE2. LIRC_CAN_REC_SCANCODE LIRC_MODE_SCANCODE. LIRC_CAN_SET_SEND_CARRIER LIRC_SET_SEND_CARRIER. LIRC_CAN_SET_SEND_DUTY_CYCLE LIRC_SET_SEND_DUTY_CYCLE. LIRC_CAN_SET_TRANSMITTER_MASK () LIRC_SET_TRANSMITTER_MASK. LIRC_CAN_SET_REC_CARRIER The driver supports setting the receive carrier frequency using LIRC_SET_REC_CARRIER. Any lirc device since the drivers were merged in Linux 2.6.36 must have LIRC_CAN_SET_REC_CARRIER_RANGE set if LIRC_CAN_SET_REC_CARRIER feature is set. LIRC_CAN_SET_REC_CARRIER_RANGE LIRC_SET_REC_CARRIER_RANGE. ioctl LIRC_SET_REC_CARRIER , ioctl LIRC_SET_REC_CARRIER_RANGE . LIRC_CAN_GET_REC_RESOLUTION LIRC_GET_REC_RESOLUTION. LIRC_CAN_SET_REC_TIMEOUT LIRC_SET_REC_TIMEOUT. LIRC_CAN_MEASURE_CARRIER LIRC_SET_MEASURE_CARRIER_MODE. LIRC_CAN_USE_WIDEBAND_RECEIVER LIRC_SET_WIDEBAND_RECEIVER. LIRC_CAN_SEND_PULSE LIRC_MODE_SCANCODE LIRC_MODE_SCANCODE. Using these devices requires the kernel source header file lirc.h. This file is not available before Linux 4.6. Users of older kernels could use the file bundled in . . ir-ctl(1), lircd(8), bpf(2) Artyom Kunyov , Azamat Hackimov , Dmitry Bolkhovskikh , Katrin Kutepova , Konstantin Shvaykovskiy , Yuri Kozlov ; GNU 3 , . . , , . Linux man-pages 6.06 31 2023 . lirc(4)