On 05/10/17 10:45, Sean Young wrote:
> This implements LIRC_MODE_SCANCODE reading from the lirc device. The
> scancode can be read from the input device too, but with this interface
> you get the rc protocol, toggle and repeat status in addition too just

too -> to

Regards,

        Hans

> the scancode.
> 
> int main()
> {
>       int fd, mode, rc;
>       fd = open("/dev/lirc0", O_RDWR);
> 
>       mode = LIRC_MODE_SCANCODE;
>       if (ioctl(fd, LIRC_SET_REC_MODE, &mode)) {
>               // kernel too old or lirc does not support transmit
>       }
>       struct lirc_scancode scancode;
>       while (read(fd, &scancode, sizeof(scancode)) == sizeof(scancode)) {
>               printf("protocol:%d scancode:0x%x toggle:%d repeat:%d\n",
>                       scancode.rc_proto, scancode.scancode,
>                       !!(scancode.flags & LIRC_SCANCODE_FLAG_TOGGLE),
>                       !!(scancode.flags & LIRC_SCANCODE_FLAG_REPEAT));
>       }
>       close(fd);
> }
> 
> Note that the translated KEY_* is not included, that information is
> published to the input device.

Reply via email to