diff options
Diffstat (limited to 'drivers/media/rc/ir-lirc-codec.c')
-rw-r--r-- | drivers/media/rc/ir-lirc-codec.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/drivers/media/rc/ir-lirc-codec.c b/drivers/media/rc/ir-lirc-codec.c index c3277308a70b..8517d5153fcf 100644 --- a/drivers/media/rc/ir-lirc-codec.c +++ b/drivers/media/rc/ir-lirc-codec.c @@ -204,11 +204,17 @@ static long ir_lirc_ioctl(struct file *filep, unsigned int cmd, /* legacy support */ case LIRC_GET_SEND_MODE: - val = LIRC_CAN_SEND_PULSE & LIRC_CAN_SEND_MASK; + if (!dev->tx_ir) + return -ENOTTY; + + val = LIRC_MODE_PULSE; break; case LIRC_SET_SEND_MODE: - if (val != (LIRC_MODE_PULSE & LIRC_CAN_SEND_MASK)) + if (!dev->tx_ir) + return -ENOTTY; + + if (val != LIRC_MODE_PULSE) return -EINVAL; return 0; @@ -273,7 +279,7 @@ static long ir_lirc_ioctl(struct file *filep, unsigned int cmd, case LIRC_GET_MIN_TIMEOUT: if (!dev->max_timeout) return -ENOSYS; - val = dev->min_timeout / 1000; + val = DIV_ROUND_UP(dev->min_timeout, 1000); break; case LIRC_GET_MAX_TIMEOUT: @@ -341,7 +347,7 @@ static int ir_lirc_register(struct rc_dev *dev) struct lirc_driver *drv; struct lirc_buffer *rbuf; int rc = -ENOMEM; - unsigned long features; + unsigned long features = 0; drv = kzalloc(sizeof(struct lirc_driver), GFP_KERNEL); if (!drv) @@ -355,7 +361,8 @@ static int ir_lirc_register(struct rc_dev *dev) if (rc) goto rbuf_init_failed; - features = LIRC_CAN_REC_MODE2; + if (dev->driver_type != RC_DRIVER_IR_RAW_TX) + features |= LIRC_CAN_REC_MODE2; if (dev->tx_ir) { features |= LIRC_CAN_SEND_PULSE; if (dev->s_tx_mask) |