summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorSean Young <sean@mess.org>2017-02-25 06:51:32 -0500
committerTao Huang <huangtao@rock-chips.com>2018-12-10 20:36:27 +0800
commitde27c5a7ce23ebe408fcd2fa146654f276de6d31 (patch)
tree48387eeadbb1a3c8b2e8e2c92078e7c4b20b6cd6 /include
parent027c4f0dfe2f9befcd3a1fb2f50460b19a35be80 (diff)
UPSTREAM: media: lirc: implement reading scancode
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, keycode, toggle and repeat status in addition to just 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); } Signed-off-by: Sean Young <sean@mess.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com> (cherry picked from commit de142c32410649e64d44928505ffad2176a96a9e) Signed-off-by: Ziyuan Xu <xzy.xu@rock-chips.com>
Diffstat (limited to 'include')
-rw-r--r--include/media/rc-core.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/include/media/rc-core.h b/include/media/rc-core.h
index 9d636bb088e5..26204d9f7150 100644
--- a/include/media/rc-core.h
+++ b/include/media/rc-core.h
@@ -126,9 +126,12 @@ enum rc_filter_type {
* @gap: true if we're in a gap
* @send_timeout_reports: report timeouts in lirc raw IR.
* @rawir: queue for incoming raw IR
+ * @scancodes: queue for incoming decoded scancodes
* @wait_poll: poll struct for lirc device
* @send_mode: lirc mode for sending, either LIRC_MODE_SCANCODE or
* LIRC_MODE_PULSE
+ * @rec_mode: lirc mode for receiving, either LIRC_MODE_SCANCODE or
+ * LIRC_MODE_MODE2
* @registered: set to true by rc_register_device(), false by
* rc_unregister_device
* @change_protocol: allow changing the protocol used on hardware decoders
@@ -200,8 +203,10 @@ struct rc_dev {
bool gap;
bool send_timeout_reports;
DECLARE_KFIFO_PTR(rawir, unsigned int);
+ DECLARE_KFIFO_PTR(scancodes, struct lirc_scancode);
wait_queue_head_t wait_poll;
u8 send_mode;
+ u8 rec_mode;
#endif
bool registered;
int (*change_protocol)(struct rc_dev *dev, u64 *rc_proto);