redrat3: errors on unplug
Sean Young
maintainerPATCH 1/1 redrat3: errors on unplug
In an usb disconnect handler, the urbs have already been cancelled so the attempt to disable the IR receiver just results in errors:
[ 899.638862] redrat3 7-2:1.0: redrat3_send_cmd: Error sending rr3 cmd res -110, data 0 [ 899.638870] redrat3 7-2:1.0: redrat3_disable_detector: detector status: 251, should be 0
--- drivers/media/rc/redrat3.c | 27 --------------------------- 1 file changed, 27 deletions(-)
drivers/media/rc/redrat3.c +0 -27
@@ -206,8 +206,6 @@ struct redrat3_dev {struct timer_list rx_timeout;u32 hw_timeout; -/* is the detector enabled*/ -bool det_enabled;/* Is the device currently transmitting?*/ bool transmitting;
@@ -472,32 +470,11 @@ static int redrat3_enable_detector(struct redrat3_dev *rr3)return -EIO ; } - rr3->det_enabled = true;redrat3_issue_async (rr3);return 0 ; } -/* Disables the rr3 long range detector */ -static void redrat3_disable_detector (struct redrat3_dev *rr3) -{ -struct device *dev = rr3->dev; -u8 ret; - -rr3_ftr (dev,"Entering %s\n" , __func__); - - ret =redrat3_send_cmd (RR3_RC_DET_DISABLE , rr3); -if (ret !=0 ) -dev_err (dev,"%s: failure!\n" , __func__); - - ret =redrat3_send_cmd (RR3_RC_DET_STATUS , rr3); -if (ret !=0 ) -dev_warn (dev,"%s: detector status: %d, should be 0\n" , - __func__, ret); - - rr3->det_enabled = false; -} -static inline void redrat3_delete (struct redrat3_dev *rr3,struct usb_device *udev) {
@@ -788,7 +765,6 @@ static int redrat3_transmit_ir(struct rc_dev *rcdev, unsigned *txbuf, count =min_t (unsigned, count,RR3_MAX_SIG_SIZE -RR3_TX_TRAILER_LEN );/* rr3 will disable rc detector on transmit */ - rr3->det_enabled = false; rr3->transmitting = true; sample_lens =kzalloc (sizeof (int ) *RR3_DRIVER_MAXLENS ,GFP_KERNEL );
@@ -868,7 +844,6 @@ out: rr3->transmitting = false;/* rr3 re-enables rc detector because it was enabled before */ - rr3->det_enabled = true;return ret; }
@@ -1048,8 +1023,6 @@ static void redrat3_dev_disconnect(struct usb_interface *intf)if (!rr3)return ; -redrat3_disable_detector (rr3); -usb_set_intfdata (intf,NULL );rc_unregister_device (rr3->rc);del_timer_sync (&rr3->rx_timeout);
Signature · 1 line
1.8.3.1
Sean Young
maintainerPATCH 1/1 rc: allowed_protos now is a bit field
This one must have missed the conversion "c003ab1b [media] rc-core:
add separate defines for protocol bitmaps and numbers".
--- drivers/media/usb/dvb-usb/m920x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/usb/dvb-usb/m920x.c +1 -1
@@ -1212,7 +1212,7 @@ static struct dvb_usb_device_properties vp7049_properties = { .rc_interval = 150, .rc_codes = RC_MAP_TWINHAN_VP1027_DVBS, .rc_query = m920x_rc_core_query, - .allowed_protos = RC_TYPE_UNKNOWN, + .allowed_protos = RC_BIT_UNKNOWN, }, .size_of_priv = sizeof(struct m920x_state),
Signature · 1 line
1.8.3.1
Sean Young
maintainerPATCH 1/1 lirc: validate transmission ir data
In reply to Sean YoungThe lirc interface allows 255 u32 spaces and pulses, which are usec. If the driver can handle this (e.g. winbond-cir) you can produce hours of meaningless IR data and there is no method of interrupting it.
--- drivers/media/rc/ir-lirc-codec.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
drivers/media/rc/ir-lirc-codec.c +10 -1
@@ -140,11 +140,20 @@ static ssize_t ir_lirc_transmit_ir(struct file *file, const char __user *buf, goto out; } +for (i =0 ; i < count; i++) { +if (txbuf[i] >IR_MAX_DURATION /1000 - duration || !txbuf[i]) { + ret = -EINVAL ; + goto out; + } + + duration += txbuf[i]; + } + ret = dev->tx_ir (dev, txbuf, count);if (ret <0 ) goto out; -for (i =0 ; i < ret; i++) +for (duration = i =0 ; i < ret; i++) duration += txbuf[i]; ret *=sizeof (unsigned int );
Signature · 1 line
1.8.3.1
Sean Young
maintainerPATCH 1/1 lirc: make transmit interface consistent
In reply to Sean YoungAll 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.
--- Documentation/DocBook/media/v4l/lirc_device_interface.xml | 4 +++- drivers/media/rc/iguanair.c | 4 ++-- drivers/media/rc/redrat3.c | 7 ++++--- 3 files changed, 9 insertions(+), 6 deletions(-)
Documentation/DocBook/media/v4l/lirc_device_interface.xml +3 -1
@@ -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 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 -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 id="lirc_ioctl">
drivers/media/rc/iguanair.c +2 -2
@@ -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 ); bytes =DIV_ROUND_UP (periods,127 );if (size + bytes > ir->bufsize) { - count = i; -break ; + rc = -EINVAL ; + goto out; }while (periods >127 ) { ir->packet->payload[size++] =127 | space;
drivers/media/rc/redrat3.c +4 -3
@@ -762,7 +762,8 @@ static int redrat3_transmit_ir(struct rc_dev *rcdev, unsigned *txbuf,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->transmitting = true;
@@ -801,8 +802,8 @@ static int redrat3_transmit_ir(struct rc_dev *rcdev, unsigned *txbuf, &irdata->lens[curlencheck]); curlencheck++; }else { - count = i -1 ; -break ; + ret = -EINVAL ; + goto out; } } irdata->sigdata[i] = lencheck;
Signature · 1 line
1.8.3.1