[media] dvb_usb_v2: add .get_usb_stream_config()
authorAntti Palosaari <crope@iki.fi>
Tue, 29 May 2012 00:28:01 +0000 (21:28 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Sat, 4 Aug 2012 10:56:23 +0000 (07:56 -0300)
New callback to resolve current USB stream configuration.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/dvb/dvb-usb/dvb_usb.h
drivers/media/dvb/dvb-usb/dvb_usb_dvb.c
drivers/media/dvb/dvb-usb/dvb_usb_urb.c

index 0715e72259f65810857002eeba5fa97f2a8858f1..49df6fbeb1ad1c9b1fc6b88992f18e5e95dfb9aa 100644 (file)
@@ -240,6 +240,8 @@ struct dvb_usb_device_properties {
        int (*identify_state) (struct dvb_usb_device *);
        int (*init) (struct dvb_usb_device *);
        int (*get_rc_config) (struct dvb_usb_device *, struct dvb_usb_rc *);
+       int (*get_usb_stream_config) (struct dvb_frontend *,
+                       struct usb_data_stream_properties *);
 
        struct i2c_algorithm *i2c_algo;
 
index fd02be30b5323383fd70b07b4862600f8edb5e69..9ada473773d565e11c19b90c59712e9a3e580a5b 100644 (file)
@@ -56,8 +56,22 @@ static int dvb_usb_ctrl_feed(struct dvb_demux_feed *dvbdmxfeed, int onoff)
         * for reception.
         */
        if (adap->feedcount == onoff && adap->feedcount > 0) {
+               struct usb_data_stream_properties stream_props;
+
+               /* resolve USB stream configuration */
+               if (adap->dev->props.get_usb_stream_config) {
+                       ret = adap->dev->props.get_usb_stream_config(
+                                       adap->fe_adap[adap->active_fe].fe,
+                                       &stream_props);
+                       if (ret < 0)
+                               return ret;
+               } else {
+                       stream_props = adap->props.fe[adap->active_fe].stream;
+               }
+
                deb_ts("submitting all URBs\n");
-               usb_urb_submit(&adap->fe_adap[adap->active_fe].stream, NULL);
+               usb_urb_submit(&adap->fe_adap[adap->active_fe].stream,
+                               &stream_props);
 
                deb_ts("controlling pid parser\n");
                if (adap->props.fe[adap->active_fe].caps & DVB_USB_ADAP_HAS_PID_FILTER &&
index 8c98924a625aadb31b83a7a51d8dad7aa8f9a53e..903f77afb1425ffb1d54f664e59ee137a2988277 100644 (file)
@@ -94,8 +94,9 @@ static void dvb_usb_data_complete_raw(struct usb_data_stream *stream,
 int dvb_usb_adapter_stream_init(struct dvb_usb_adapter *adap)
 {
        int i, ret = 0;
-       for (i = 0; i < adap->props.num_frontends; i++) {
+       struct usb_data_stream_properties stream_props;
 
+       for (i = 0; i < adap->props.num_frontends; i++) {
                adap->fe_adap[i].stream.udev      = adap->dev->udev;
                if (adap->props.fe[i].caps & DVB_USB_ADAP_RECEIVES_204_BYTE_TS)
                        adap->fe_adap[i].stream.complete =
@@ -107,8 +108,18 @@ int dvb_usb_adapter_stream_init(struct dvb_usb_adapter *adap)
                else
                adap->fe_adap[i].stream.complete  = dvb_usb_data_complete;
                adap->fe_adap[i].stream.user_priv = adap;
-               ret = usb_urb_init(&adap->fe_adap[i].stream,
-                                  &adap->props.fe[i].stream);
+
+               /* resolve USB stream configuration */
+               if (adap->dev->props.get_usb_stream_config) {
+                       ret = adap->dev->props.get_usb_stream_config(NULL,
+                                       &stream_props);
+                       if (ret < 0)
+                               break;
+               } else {
+                       stream_props = adap->props.fe[i].stream;
+               }
+
+               ret = usb_urb_init(&adap->fe_adap[i].stream, &stream_props);
                if (ret < 0)
                        break;
        }