Re: [PATCH] Fix Hauppauge Nova-T 500 USB disconnects

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



El Martes, 24 de Julio de 2007, Christophe Thommeret escribió:
> Le mardi 24 juillet 2007 14:27, Jose Alberto Reguero a écrit :
> > El Martes, 24 de Julio de 2007, Torgeir Veimo escribió:
> > > On Tue, 2007-07-24 at 12:55 +0200, Jose Alberto Reguero wrote:
> > > > This patch fix Hauppauge Nova-T 500 USB disconnects.
> > >
> > > Hallelujah!
> > >
> > > Do you have some other code for the nova-t 500 up your sleeve as well,
> > > like some remote control support code? :))
> >
> > I don't have remote control support.
> >
> > Respect the patch, it works for me. I have not any disconnect in some
> > days, althought it is dificult to say that the problem is 100% solved,
> > because disconnects are random.
>
> Relying on device name seems somewhat hackish, however, and doesn't fix
> anything for nova-t stick ;)

This patch is only for the  Nova-T 500. The device name is for not break 
anything for other devices that use the dib3000mc frontend. Perhaps there are 
a better way to do that. The nova-t stik use dib7000m or dib7000p. I have not 
this device.  Attached is a patch  that extends to all dibcom devices like 
the nova-t stik, untested.

Jose Alberto

diff -r cdf3d32494a7 linux/drivers/media/dvb/dvb-usb/dib0700.h
--- a/linux/drivers/media/dvb/dvb-usb/dib0700.h	Mon Jul 23 11:34:34 2007 -0300
+++ b/linux/drivers/media/dvb/dvb-usb/dib0700.h	Mon Jul 23 20:32:14 2007 +0200
@@ -37,6 +37,8 @@ struct dib0700_state {
 	u16 mt2060_if1[2];
 
 	u8 is_dib7000pc;
+
+	int (*streaming_ctrl)  (struct dvb_usb_adapter *, int);
 };
 
 extern int dib0700_set_gpio(struct dvb_usb_device *, enum dib07x0_gpios gpio, u8 gpio_dir, u8 gpio_val);
diff -r cdf3d32494a7 linux/drivers/media/dvb/dvb-usb/dib0700_devices.c
--- a/linux/drivers/media/dvb/dvb-usb/dib0700_devices.c	Mon Jul 23 11:34:34 2007 -0300
+++ b/linux/drivers/media/dvb/dvb-usb/dib0700_devices.c	Tue Jul 24 15:48:43 2007 +0200
@@ -84,6 +84,7 @@ static int bristol_frontend_attach(struc
 		}
 	}
 	st->mt2060_if1[adap->id] = 1220;
+	st->streaming_ctrl = dib0700_streaming_ctrl;
 	return (adap->fe = dvb_attach(dib3000mc_attach, &adap->dev->i2c_adap,
 		(10 + adap->id) << 1, &bristol_dib3000mc_config[adap->id])) == NULL ? -ENODEV : 0;
 }
@@ -239,6 +240,7 @@ static int stk7700p_frontend_attach(stru
 	dib0700_set_gpio(adap->dev,  GPIO0, GPIO_OUT, 1);
 
 	st->mt2060_if1[0] = 1220;
+	st->streaming_ctrl = dib0700_streaming_ctrl;
 
 	if (dib7000pc_detection(&adap->dev->i2c_adap)) {
 		adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 18, &stk7700p_dib7000p_config);
@@ -295,7 +297,6 @@ MODULE_DEVICE_TABLE(usb, dib0700_usb_id_
 	.identify_state    = dib0700_identify_state
 
 #define DIB0700_DEFAULT_STREAMING_CONFIG(ep) \
-	.streaming_ctrl   = dib0700_streaming_ctrl, \
 	.stream = { \
 		.type = USB_BULK, \
 		.count = 4, \
diff -r cdf3d32494a7 linux/drivers/media/dvb/frontends/dib3000mc.c
--- a/linux/drivers/media/dvb/frontends/dib3000mc.c	Mon Jul 23 11:34:34 2007 -0300
+++ b/linux/drivers/media/dvb/frontends/dib3000mc.c	Mon Jul 23 21:28:52 2007 +0200
@@ -22,9 +22,13 @@
 
 #include "dib3000mc.h"
 
+#include "dib0700.h"
+
 static int debug;
 module_param(debug, int, 0644);
 MODULE_PARM_DESC(debug, "turn on debugging (default: 0)");
+
+#undef dprintk
 
 #define dprintk(args...) do { if (debug) { printk(KERN_DEBUG "DiB3000MC/P:"); printk(args); } } while (0)
 
@@ -316,6 +320,8 @@ static int dib3000mc_init(struct dvb_fro
 {
 	struct dib3000mc_state *state = demod->demodulator_priv;
 	struct dibx000_agc_config *agc = state->cfg->agc;
+	struct dvb_usb_adapter *adap = demod->dvb->priv;
+	struct dib0700_state *st = adap->dev->priv;
 
 	// Restart Configuration
 	dib3000mc_write_word(state, 1027, 0x8000);
@@ -429,12 +435,20 @@ static int dib3000mc_init(struct dvb_fro
 	/* close the i2c-gate */
 	dib3000mc_write_word(state, 769, (1 << 7) );
 
+	if (!strcmp (adap->dev->props.devices[0].name, "Hauppauge Nova-T 500 Dual DVB-T"))
+		st->streaming_ctrl(adap,1);
+
 	return 0;
 }
 
 static int dib3000mc_sleep(struct dvb_frontend *demod)
 {
 	struct dib3000mc_state *state = demod->demodulator_priv;
+	struct dvb_usb_adapter *adap = demod->dvb->priv;
+	struct dib0700_state *st = adap->dev->priv;
+
+	if (!strcmp (adap->dev->props.devices[0].name, "Hauppauge Nova-T 500 Dual DVB-T"))
+		st->streaming_ctrl(adap,0);
 
 	dib3000mc_write_word(state, 1031, 0xFFFF);
 	dib3000mc_write_word(state, 1032, 0xFFFF);
diff -r cdf3d32494a7 linux/drivers/media/dvb/frontends/dib7000m.c
--- a/linux/drivers/media/dvb/frontends/dib7000m.c	Mon Jul 23 11:34:34 2007 -0300
+++ b/linux/drivers/media/dvb/frontends/dib7000m.c	Tue Jul 24 16:01:06 2007 +0200
@@ -15,9 +15,13 @@
 
 #include "dib7000m.h"
 
+#include "dib0700.h"
+
 static int debug;
 module_param(debug, int, 0644);
 MODULE_PARM_DESC(debug, "turn on debugging (default: 0)");
+
+#undef dprintk
 
 #define dprintk(args...) do { if (debug) { printk(KERN_DEBUG "DiB7000M:"); printk(args); } } while (0)
 
@@ -803,6 +807,8 @@ static int dib7000m_init(struct dvb_fron
 static int dib7000m_init(struct dvb_frontend *demod)
 {
 	struct dib7000m_state *state = demod->demodulator_priv;
+	struct dvb_usb_adapter *adap = demod->dvb->priv;
+	struct dib0700_state *st = adap->dev->priv;
 	int ret = 0;
 	u8 o = state->reg_offs;
 
@@ -895,12 +901,19 @@ static int dib7000m_init(struct dvb_fron
 
 	ret |= dib7000m_write_word(state, 1817, 1);
 
+	st->streaming_ctrl(adap,1);
+
 	return ret;
 }
 
 static int dib7000m_sleep(struct dvb_frontend *demod)
 {
 	struct dib7000m_state *st = demod->demodulator_priv;
+	struct dvb_usb_adapter *adap = demod->dvb->priv;
+	struct dib0700_state *state = adap->dev->priv;
+
+	state->streaming_ctrl(adap,0);
+
 	dib7000m_set_output_mode(st, OUTMODE_HIGH_Z);
 	return dib7000m_set_power_mode(st, DIB7000M_POWER_INTERFACE_ONLY) |
 		dib7000m_set_adc_state(st, DIBX000_SLOW_ADC_OFF) |
diff -r cdf3d32494a7 linux/drivers/media/dvb/frontends/dib7000p.c
--- a/linux/drivers/media/dvb/frontends/dib7000p.c	Mon Jul 23 11:34:34 2007 -0300
+++ b/linux/drivers/media/dvb/frontends/dib7000p.c	Tue Jul 24 16:02:29 2007 +0200
@@ -14,9 +14,13 @@
 
 #include "dib7000p.h"
 
+#include "dib0700.h"
+
 static int debug;
 module_param(debug, int, 0644);
 MODULE_PARM_DESC(debug, "turn on debugging (default: 0)");
+
+#undef dprintk
 
 #define dprintk(args...) do { if (debug) { printk(KERN_DEBUG "DiB7000P:"); printk(args); } } while (0)
 
@@ -586,6 +590,8 @@ static int dib7000p_init(struct dvb_fron
 {
 	struct dibx000_agc_config *agc;
 	struct dib7000p_state *state = demod->demodulator_priv;
+	struct dvb_usb_adapter *adap = demod->dvb->priv;
+	struct dib0700_state *st = adap->dev->priv;
 	int ret = 0;
 
 	// Demodulator default configuration
@@ -701,12 +707,19 @@ static int dib7000p_init(struct dvb_fron
 	ret |= dib7000p_set_bandwidth(&state->demod, BANDWIDTH_8_MHZ);
 	dib7000p_sad_calib(state);
 
+	st->streaming_ctrl(adap,1);
+
 	return ret;
 }
 
 static int dib7000p_sleep(struct dvb_frontend *demod)
 {
 	struct dib7000p_state *state = demod->demodulator_priv;
+	struct dvb_usb_adapter *adap = demod->dvb->priv;
+	struct dib0700_state *st = adap->dev->priv;
+
+	st->streaming_ctrl(adap,0);
+
 	return dib7000p_set_output_mode(state, OUTMODE_HIGH_Z) | dib7000p_set_power_mode(state, DIB7000P_POWER_INTERFACE_ONLY);
 }
 
_______________________________________________
linux-dvb mailing list
linux-dvb@xxxxxxxxxxx
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb

[Index of Archives]     [Linux Media]     [Video 4 Linux]     [Asterisk]     [Samba]     [Xorg]     [Xfree86]     [Linux USB]

  Powered by Linux