Skip to contentSkip to conversation

Add two drivers for USB based DVB-T adapters

PATCH In review Michael Hunold (LinuxTV.org CVS maintainer) 2 participants 3 messages Jul 15, 2003 – Jul 18, 2003 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Add two drivers for USB based DVB-T adapters

This is part 17 of the patchset I send earlier. I guess the message was
eaten by the list server because of the size. I removed the data for the
firmware bootloader, so here it comes again.
[DVB] - add two new usb dvb drivers:
- dvb-ttusb-budget.c for Technotrend/Hauppauge Nova-USB devices (Thanks to Holger Waechtler <[email protected]> and elix Domke <[email protected]>)
- dvb-ttusb-dec.c for Technotrend/Hauppauge USB DEC2000-T devices (Thanks to Alex Woods <[email protected]>)

drivers/media/dvb/ttusb-budget/Kconfig +11 -0
diff -uNrwB --new-file linux-2.6.0-test1.work/drivers/media/dvb/ttusb-budget/Kconfig linux-2.6.0-test1.patch/drivers/media/dvb/ttusb-budget/Kconfig
@@ -0,0 +1,11 @@
+config DVB_TTUSB_BUDGET
+	tristate "Technotrend/Hauppauge Nova-USB devices"
+	depends on DVB_CORE && USB
+	help
+	  Support for external USB adapters designed by Technotrend and
+	  produced by Hauppauge, shipped under the brand name 'Nova-USB'.
+
+          These devices don't have a MPEG decoder built in, so you need
+	  an external software decoder to watch TV.	  
+
+	  Say Y if you own such a device and want to use it.
drivers/media/dvb/ttusb-budget/Makefile +3 -0
diff -uNrwB --new-file linux-2.6.0-test1.work/drivers/media/dvb/ttusb-budget/Makefile linux-2.6.0-test1.patch/drivers/media/dvb/ttusb-budget/Makefile
@@ -0,0 +1,3 @@
+obj-$(CONFIG_DVB_TTUSB_BUDGET) += dvb-ttusb-budget.o
+
+EXTRA_CFLAGS = -Idrivers/media/dvb/dvb-core/
drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c +1271 -0

1,271 lines not on this page · raw message

drivers/media/dvb/ttusb-budget/dvb-ttusb-dspbootcode.h +9 -0
diff -uNrwB --new-file linux-2.6.0-test1.work/drivers/media/dvb/ttusb-budget/dvb-ttusb-dspbootcode.h linux-2.6.0-test1.patch/drivers/media/dvb/ttusb-budget/dvb-ttusb-dspbootcode.h
@@ -0,0 +1,9 @@
+
+#include <asm/types.h>
+
+u8 dsp_bootcode [] __initdata = {
+	0x08, 0xaa, 0x00, 0x18, 0x00, 0x03, 0x08, 0x00, 
+ // firmware bootloader missing, this won't work!
+	0x07, 0xef, 0xf4, 0x95, 0xf4, 0x95, 0x00, 0x00, 
+};
+
drivers/media/dvb/ttusb-dec/Kconfig +24 -0
diff -uNrwB --new-file linux-2.6.0-test1.work/drivers/media/dvb/ttusb-dec/Kconfig linux-2.6.0-test1.patch/drivers/media/dvb/ttusb-dec/Kconfig
@@ -0,0 +1,24 @@
+config DVB_TTUSB_DEC
+	tristate "Technotrend/Hauppauge USB DEC2000-T devices"
+	depends on DVB_CORE && USB
+	help
+	  Support for external USB adapters designed by Technotrend and
+	  produced by Hauppauge, shipped under the brand name 'DEC2000-T'.
+
+          Even if these devices have a MPEG decoder built in, they transmit
+	  only compressed MPEG data over the USB bus, so you need
+	  an external software decoder to watch TV on your computer.	  
+
+	  Say Y if you own such a device and want to use it.
+
+config DVB_TTUSB_DEC_FIRMWARE_FILE
+	string "Full pathname of dec2000t.bin firmware file"
+	depends on DVB_TTUSB_DEC
+	default "/etc/dvb/dec2000t.bin"
+	help
+	  The DEC2000-T requires a firmware in order to boot into a mode in
+	  which it is a slave to the PC.  The firmware file can obtained as
+	  follows:
+	    wget http://hauppauge.lightpath.net/de/dec215a.exe
+	    unzip -j dec215a.exe Software/Oem/STB/App/Boot/STB_PC_T.bin
+	    mv STB_PC_T.bin /etc/dvb/dec2000t.bin
drivers/media/dvb/ttusb-dec/Makefile +11 -0
diff -uNrwB --new-file linux-2.6.0-test1.work/drivers/media/dvb/ttusb-dec/Makefile linux-2.6.0-test1.patch/drivers/media/dvb/ttusb-dec/Makefile
@@ -0,0 +1,11 @@
+
+obj-$(CONFIG_DVB_TTUSB_DEC) += ttusb_dec.o dec2000_frontend.o
+
+EXTRA_CFLAGS = -Idrivers/media/dvb/dvb-core/
+
+host-progs	:= fdump
+
+$(obj)/ttusb_dec.o: $(obj)/dsp_dec2000.h
+
+$(obj)/dsp_dec2000.h: $(patsubst "%", %, $(CONFIG_DVB_TTUSB_DEC_FIRMWARE_FILE)) $(obj)/fdump
+	$(obj)/fdump $< dsp_dec2000 > $@
drivers/media/dvb/ttusb-dec/dec2000_frontend.c +180 -0

180 lines not on this page · raw message

drivers/media/dvb/ttusb-dec/fdump.c +36 -0
diff -uNrwB --new-file linux-2.6.0-test1.work/drivers/media/dvb/ttusb-dec/fdump.c linux-2.6.0-test1.patch/drivers/media/dvb/ttusb-dec/fdump.c
@@ -0,0 +1,36 @@
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
+
+
+int main (int argc, char **argv)
+{
+	unsigned char buf[8];
+	unsigned int i, count, bytes = 0;
+	int fd;
+
+	if (argc != 3) {
+		fprintf (stderr, "\n\tusage: %s <ucode.bin> <array_name>\n\n",
+			 argv[0]);
+		return -1;
+	}
+
+	fd = open (argv[1], O_RDONLY);
+
+	printf ("\n#include <asm/types.h>\n\nu8 %s [] __initdata = {",
+		argv[2]);
+
+	while ((count = read (fd, buf, 8)) > 0) {
+		printf ("\n\t");
+		for (i=0;i<count;i++, bytes++)
+			printf ("0x%02x, ", buf[i]);
+	}
+
+	printf ("\n};\n\n");
+	close (fd);
+
+	return 0;
+}
+
drivers/media/dvb/ttusb-dec/ttusb_dec.c +991 -0

991 lines not on this page · raw message

drivers/media/dvb/ttusb-dec/ttusb_dec.h +87 -0

87 lines not on this page · raw message

#1 lore raw
Quoted 20 lines · Michael Hunold
drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c +20 -0
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
+static void *ttusb_probe(struct usb_device *udev, unsigned int ifnum,
+		  const struct usb_device_id *id)
+{
+	struct ttusb *ttusb;
+	int result, channel;
+
+	if (ifnum != 0)
+		return NULL;
+
+	dprintk("%s: TTUSB DVB connected\n", __FUNCTION__);
+
+	if (!(ttusb = kmalloc(sizeof(struct ttusb), GFP_KERNEL)))
+		return NULL;
+
+#else
+static int ttusb_probe(struct usb_interface *intf, const struct usb_device_id *id)
+{
+	struct usb_device *udev;
+	struct ttusb *ttusb;

drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c line 1107

Quoted 10 lines
drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c +10 -0
+	int result, channel;
+
+	dprintk("%s: TTUSB DVB connected\n", __FUNCTION__);
+
+	udev = interface_to_usbdev(intf);
+
+	if (!(ttusb = kmalloc(sizeof(struct ttusb), GFP_KERNEL)))
+		return -ENOMEM;
+
+#endif

Ick, you don't really want to try to support all of the USB changes in the same driver, now do you? Why not just live with two different drivers.

The ALSA people eventually gave up trying to do this... :)

drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c line 1213

Quoted 7 lines
drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c +7 -0
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,69))
+#undef devfs_remove
+#define devfs_remove(x)	devfs_unregister(ttusb->stc_devfs_handle);
+#endif
+#if 0
+	devfs_remove(TTUSB_BUDGET_NAME);
+#endif

You end up with crud like this because of trying to support old kernels. Why do you care about kernels prior to 2.5.69? If so, your USB kernel checks are wrong, as 2.5.0 didn't have those API changes :)

thanks,

greg k-h

#2 lore raw

Hello Greg,

Quoted 8 lines

drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c line 1081

Quoted 4 lines
drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c +4 -0
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
+static void *ttusb_probe(struct usb_device *udev, unsigned int ifnum,
+		  const struct usb_device_id *id)
+{

Ick, you don't really want to try to support all of the USB changes in the same driver, now do you? Why not just live with two different drivers.

Because I'm the poor guy that has to test it with 2.4 and 2.5 and who's submitting the patches. 8-)

The author is mainly working with 2.4, I'm trying to compile it and test it for 2.5.

Quoted 1 line

The ALSA people eventually gave up trying to do this... :)

I agree, I'll separate the stuff now that it has gone into Linus' tree.

Quoted 11 lines

drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c line 1213

Quoted 7 lines
drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c +7 -0
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,69))
+#undef devfs_remove
+#define devfs_remove(x)	devfs_unregister(ttusb->stc_devfs_handle);
+#endif
+#if 0
+	devfs_remove(TTUSB_BUDGET_NAME);
+#endif

You end up with crud like this because of trying to support old kernels. Why do you care about kernels prior to 2.5.69? If so, your USB kernel checks are wrong, as 2.5.0 didn't have those API changes :)

I already wrote Linus that I'll remove this compatibility crap with the next patchset.

Quoted 2 lines

thanks,
greg k-h

Thanks for your feedback!

CU
Michael.