• Sean Young's avatar
    media: lirc: implement scancode sending · 9b619258
    Sean Young authored
    This introduces a new lirc mode: scancode. Any device which can send raw IR
    can now also send scancodes.
    
    int main()
    {
    	int mode, fd = open("/dev/lirc0", O_RDWR);
    
            mode = LIRC_MODE_SCANCODE;
    	if (ioctl(fd, LIRC_SET_SEND_MODE, &mode)) {
    		// kernel too old or lirc does not support transmit
    	}
    	struct lirc_scancode scancode = {
    		.scancode = 0x1e3d,
    		.rc_proto = RC_PROTO_RC5,
    	};
    	write(fd, &scancode, sizeof(scancode));
    	close(fd);
    }
    
    The other fields of lirc_scancode must be set to 0.
    
    Note that toggle (rc5, rc6) and repeats (nec) are not implemented. Nor is
    there a method for holding down a key for a period.
    Signed-off-by: default avatarSean Young <sean@mess.org>
    Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
    9b619258
ir-lirc-codec.c 10.6 KB