Commit 671ea670 authored by Sean Young's avatar Sean Young Committed by Mauro Carvalho Chehab

[media] lirc: make transmit interface consistent

All lirc drivers that can transmit, return EINVAL when they are passed
more than IR data than they can send. That is, except for two drivers
which I touched.
Signed-off-by: default avatarSean Young <sean@mess.org>
Signed-off-by: default avatarMauro Carvalho Chehab <m.chehab@samsung.com>
parent 25379bf8
...@@ -46,7 +46,9 @@ describing an IR signal are read from the chardev.</para> ...@@ -46,7 +46,9 @@ describing an IR signal are read from the chardev.</para>
values. Pulses and spaces are only marked implicitly by their position. The values. Pulses and spaces are only marked implicitly by their position. The
data must start and end with a pulse, therefore, the data must always include data must start and end with a pulse, therefore, the data must always include
an uneven number of samples. The write function must block until the data has an uneven number of samples. The write function must block until the data has
been transmitted by the hardware.</para> been transmitted by the hardware. If more data is provided than the hardware
can send, the driver returns EINVAL.</para>
</section> </section>
<section id="lirc_ioctl"> <section id="lirc_ioctl">
......
...@@ -364,8 +364,8 @@ static int iguanair_tx(struct rc_dev *dev, unsigned *txbuf, unsigned count) ...@@ -364,8 +364,8 @@ static int iguanair_tx(struct rc_dev *dev, unsigned *txbuf, unsigned count)
periods = DIV_ROUND_CLOSEST(txbuf[i] * ir->carrier, 1000000); periods = DIV_ROUND_CLOSEST(txbuf[i] * ir->carrier, 1000000);
bytes = DIV_ROUND_UP(periods, 127); bytes = DIV_ROUND_UP(periods, 127);
if (size + bytes > ir->bufsize) { if (size + bytes > ir->bufsize) {
count = i; rc = -EINVAL;
break; goto out;
} }
while (periods > 127) { while (periods > 127) {
ir->packet->payload[size++] = 127 | space; ir->packet->payload[size++] = 127 | space;
......
...@@ -762,7 +762,8 @@ static int redrat3_transmit_ir(struct rc_dev *rcdev, unsigned *txbuf, ...@@ -762,7 +762,8 @@ static int redrat3_transmit_ir(struct rc_dev *rcdev, unsigned *txbuf,
return -EAGAIN; return -EAGAIN;
} }
count = min_t(unsigned, count, RR3_MAX_SIG_SIZE - RR3_TX_TRAILER_LEN); if (count > RR3_MAX_SIG_SIZE - RR3_TX_TRAILER_LEN)
return -EINVAL;
/* rr3 will disable rc detector on transmit */ /* rr3 will disable rc detector on transmit */
rr3->transmitting = true; rr3->transmitting = true;
...@@ -801,8 +802,8 @@ static int redrat3_transmit_ir(struct rc_dev *rcdev, unsigned *txbuf, ...@@ -801,8 +802,8 @@ static int redrat3_transmit_ir(struct rc_dev *rcdev, unsigned *txbuf,
&irdata->lens[curlencheck]); &irdata->lens[curlencheck]);
curlencheck++; curlencheck++;
} else { } else {
count = i - 1; ret = -EINVAL;
break; goto out;
} }
} }
irdata->sigdata[i] = lencheck; irdata->sigdata[i] = lencheck;
......
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