Commit 7e45d660 authored by Sean Young's avatar Sean Young Committed by Mauro Carvalho Chehab

media: lirc: allow lirc device to be opened more than once

This makes it possible for lircd to read from a lirc chardev, and not
keep it busy.

Note that this changes the default for timeout reports to on. lircd
already enables timeout reports when it opens a lirc device, leaving
them on until the next reboot.
Signed-off-by: default avatarSean Young <sean@mess.org>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent aefb5e34
This diff is collapsed.
...@@ -68,6 +68,33 @@ enum rc_filter_type { ...@@ -68,6 +68,33 @@ enum rc_filter_type {
RC_FILTER_MAX RC_FILTER_MAX
}; };
/**
* struct lirc_fh - represents an open lirc file
* @list: list of open file handles
* @rc: rcdev for this lirc chardev
* @carrier_low: when setting the carrier range, first the low end must be
* set with an ioctl and then the high end with another ioctl
* @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
*/
struct lirc_fh {
struct list_head list;
struct rc_dev *rc;
int carrier_low;
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;
};
/** /**
* struct rc_dev - represents a remote control device * struct rc_dev - represents a remote control device
* @dev: driver model's view of this device * @dev: driver model's view of this device
...@@ -118,20 +145,11 @@ enum rc_filter_type { ...@@ -118,20 +145,11 @@ enum rc_filter_type {
* @tx_resolution: resolution (in ns) of output sampler * @tx_resolution: resolution (in ns) of output sampler
* @lirc_dev: lirc device * @lirc_dev: lirc device
* @lirc_cdev: lirc char cdev * @lirc_cdev: lirc char cdev
* @lirc_open: count of the number of times the device has been opened
* @carrier_low: when setting the carrier range, first the low end must be
* set with an ioctl and then the high end with another ioctl
* @gap_start: time when gap starts * @gap_start: time when gap starts
* @gap_duration: duration of initial gap * @gap_duration: duration of initial gap
* @gap: true if we're in a gap * @gap: true if we're in a gap
* @send_timeout_reports: report timeouts in lirc raw IR. * @lirc_fh_lock: protects lirc_fh list
* @rawir: queue for incoming raw IR * @lirc_fh: list of open files
* @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 * @registered: set to true by rc_register_device(), false by
* rc_unregister_device * rc_unregister_device
* @change_protocol: allow changing the protocol used on hardware decoders * @change_protocol: allow changing the protocol used on hardware decoders
...@@ -196,17 +214,11 @@ struct rc_dev { ...@@ -196,17 +214,11 @@ struct rc_dev {
#ifdef CONFIG_LIRC #ifdef CONFIG_LIRC
struct device lirc_dev; struct device lirc_dev;
struct cdev lirc_cdev; struct cdev lirc_cdev;
int lirc_open;
int carrier_low;
ktime_t gap_start; ktime_t gap_start;
u64 gap_duration; u64 gap_duration;
bool gap; bool gap;
bool send_timeout_reports; spinlock_t lirc_fh_lock;
DECLARE_KFIFO_PTR(rawir, unsigned int); struct list_head lirc_fh;
DECLARE_KFIFO_PTR(scancodes, struct lirc_scancode);
wait_queue_head_t wait_poll;
u8 send_mode;
u8 rec_mode;
#endif #endif
bool registered; bool registered;
int (*change_protocol)(struct rc_dev *dev, u64 *rc_proto); int (*change_protocol)(struct rc_dev *dev, u64 *rc_proto);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment