简体   繁体   中英

How can I use a remote control to interact with a Linux C or C++ application?

I'd like to capture the input from a TV remote control and detect which buttons are pressed in my application. The operating system is Linux (Windows answers won't be much use to me, but may be to others). I'm using C++ but C code would work for me also.

I'd like to use the code in a fashion similar to this:

if (remoteControl.buttonPressed(PLAY_BUTTON))
{
    fooBar.doSomethingFun();
}

Also, I was thinking there may be a generic library I can use, which would with all remotes, or would I have to do some really low level coding?

First off you are going to need some hardware to detect the IR emissions, for example a USB-UIRT

On Linux, the USB-UIRT is support by LIRC which deals with the low level end of things for you.

There are a number of open source packages that work with this to provide control, so you can look at their code for examples, eg. Myth TV

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM