diff options
author | Alex Woods <devnull@localhost> | 2004-01-19 21:42:22 +0000 |
---|---|---|
committer | Alex Woods <devnull@localhost> | 2004-01-19 21:42:22 +0000 |
commit | e4b450ae2328d372ab0c6ccdbe883ee7f8b4a066 (patch) | |
tree | a3bc125372df00440d4889d99eef47b30d23ce98 | |
parent | 1a6ef703d53b75361e108eb5c72c939aacdab2dd (diff) | |
download | mediapointer-dvb-s2-e4b450ae2328d372ab0c6ccdbe883ee7f8b4a066.tar.gz mediapointer-dvb-s2-e4b450ae2328d372ab0c6ccdbe883ee7f8b4a066.tar.bz2 |
Check for presence of crc32 function.
Make unknown types of packet less likely to cause packet loss.
-rw-r--r-- | linux/drivers/media/dvb/ttusb-dec/ttusb_dec.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/linux/drivers/media/dvb/ttusb-dec/ttusb_dec.c b/linux/drivers/media/dvb/ttusb-dec/ttusb_dec.c index 0a2b388d8..93debe50e 100644 --- a/linux/drivers/media/dvb/ttusb-dec/ttusb_dec.c +++ b/linux/drivers/media/dvb/ttusb-dec/ttusb_dec.c @@ -20,7 +20,6 @@ */ #include <asm/semaphore.h> -#include <linux/crc32.h> #include <linux/list.h> #include <linux/module.h> #include <linux/pci.h> @@ -32,6 +31,11 @@ #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) #include <linux/firmware.h> #endif +#if defined(CONFIG_CRC32) || defined(CONFIG_CRC32_MODULE) +#include <linux/crc32.h> +#else +#warning "CRC checking of firmware not available" +#endif #include "dmxdev.h" #include "dvb_demux.h" @@ -553,13 +557,14 @@ static void ttusb_dec_process_urb_frame(struct ttusb_dec *dec, u8 *b, break; case 3: - if (*b++ == 0x00) { + if (*b == 0x00) { dec->packet_state++; dec->packet_length = 0; - } else { + } else if (*b != 0xaa) { dec->packet_state = 0; } + b++; length--; break; @@ -1188,7 +1193,9 @@ static int ttusb_dec_boot_dsp(struct ttusb_dec *dec) u16 firmware_csum = 0; u16 firmware_csum_ns; u32 firmware_size_nl; +#if defined(CONFIG_CRC32) || defined(CONFIG_CRC32_MODULE) u32 crc32_csum, crc32_check, tmp; +#endif #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) const struct firmware *fw_entry = NULL; #endif @@ -1232,6 +1239,7 @@ static int ttusb_dec_boot_dsp(struct ttusb_dec *dec) /* a 32 bit checksum over the first 56 bytes of the DSP Code is stored at offset 56 of file, so use it to check if the firmware file is valid. */ +#if defined(CONFIG_CRC32) || defined(CONFIG_CRC32_MODULE) crc32_csum = crc32(~0L, firmware, 56) ^ ~0L; memcpy(&tmp, &firmware[56], 4); crc32_check = htonl(tmp); @@ -1241,6 +1249,7 @@ static int ttusb_dec_boot_dsp(struct ttusb_dec *dec) __FUNCTION__, crc32_csum, crc32_check); return -1; } +#endif memcpy(idstring, &firmware[36], 20); idstring[20] = '\0'; printk(KERN_INFO "ttusb_dec: found DSP code \"%s\".\n", idstring); |