aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/rc/lirc_dev.c
diff options
context:
space:
mode:
authorSean Young <sean@mess.org>2017-12-11 17:12:09 -0500
committerMauro Carvalho Chehab <mchehab@s-opensource.com>2017-12-18 15:19:57 -0500
commitdde7edff359461d07074ef2f0c4dc85b775d493f (patch)
treed081dfb183cb520253a350ff4582d42a1a4c09dc /drivers/media/rc/lirc_dev.c
parentfb7ccc61802a7845ba1caa7e5c1f7fa8a62a2d80 (diff)
media: lirc: when transmitting scancodes, block until transmit is done
The semantics for lirc IR transmit with raw IR is that the write call should block until the IR is transmitted. Some drivers have no idea when this actually is (e.g. mceusb), so there is a wait. This is useful for userspace, as it might want to send a IR button press, a gap of a predefined number of milliseconds, and then send a repeat message. It turns out that for transmitting scancodes this feature is even more useful, as user space has no idea how long the IR is. So, maintain the existing semantics for IR scancode transmit. Signed-off-by: Sean Young <sean@mess.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Diffstat (limited to 'drivers/media/rc/lirc_dev.c')
-rw-r--r--drivers/media/rc/lirc_dev.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/drivers/media/rc/lirc_dev.c b/drivers/media/rc/lirc_dev.c
index 218658917cf6..6cedb546c3e0 100644
--- a/drivers/media/rc/lirc_dev.c
+++ b/drivers/media/rc/lirc_dev.c
@@ -354,18 +354,18 @@ static ssize_t ir_lirc_transmit_ir(struct file *file, const char __user *buf,
354 duration += txbuf[i]; 354 duration += txbuf[i];
355 355
356 ret *= sizeof(unsigned int); 356 ret *= sizeof(unsigned int);
357 }
357 358
358 /* 359 /*
359 * The lircd gap calculation expects the write function to 360 * The lircd gap calculation expects the write function to
360 * wait for the actual IR signal to be transmitted before 361 * wait for the actual IR signal to be transmitted before
361 * returning. 362 * returning.
362 */ 363 */
363 towait = ktime_us_delta(ktime_add_us(start, duration), 364 towait = ktime_us_delta(ktime_add_us(start, duration),
364 ktime_get()); 365 ktime_get());
365 if (towait > 0) { 366 if (towait > 0) {
366 set_current_state(TASK_INTERRUPTIBLE); 367 set_current_state(TASK_INTERRUPTIBLE);
367 schedule_timeout(usecs_to_jiffies(towait)); 368 schedule_timeout(usecs_to_jiffies(towait));
368 }
369 } 369 }
370 370
371out: 371out: