Commit 20f5a827 authored by Sean Young's avatar Sean Young Committed by Mauro Carvalho Chehab

[media] rc: make s_tx_mask consistent

When s_tx_mask is given an invalid bitmask, the number of transmitters
should be returned. See the LIRC_SET_TRANSMITTER_MASK lirc ioctl
documentation.
Signed-off-by: default avatarSean Young <sean@mess.org>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent 9e422f64
...@@ -887,6 +887,12 @@ static int mceusb_set_tx_mask(struct rc_dev *dev, u32 mask) ...@@ -887,6 +887,12 @@ static int mceusb_set_tx_mask(struct rc_dev *dev, u32 mask)
{ {
struct mceusb_dev *ir = dev->priv; struct mceusb_dev *ir = dev->priv;
/* return number of transmitters */
int emitters = ir->num_txports ? ir->num_txports : 2;
if (mask >= (1 << emitters))
return emitters;
if (ir->flags.tx_mask_normal) if (ir->flags.tx_mask_normal)
ir->tx_mask = mask; ir->tx_mask = mask;
else else
......
...@@ -615,6 +615,10 @@ wbcir_txmask(struct rc_dev *dev, u32 mask) ...@@ -615,6 +615,10 @@ wbcir_txmask(struct rc_dev *dev, u32 mask)
unsigned long flags; unsigned long flags;
u8 val; u8 val;
/* return the number of transmitters */
if (mask > 15)
return 4;
/* Four outputs, only one output can be enabled at a time */ /* Four outputs, only one output can be enabled at a time */
switch (mask) { switch (mask) {
case 0x1: case 0x1:
......
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