diff options
| author | Michael Hunold <devnull@localhost> | 2003-12-21 15:18:44 +0000 |
|---|---|---|
| committer | Michael Hunold <devnull@localhost> | 2003-12-21 15:18:44 +0000 |
| commit | 56325ebe82f12b17a36ee96f5c0f4604dbd9dbe6 (patch) | |
| tree | 594d7de4f48086a43cb34e159b1422d2de551256 /linux/drivers/media/dvb/ttusb-dec | |
| parent | 28eae47f376c13563c02c2c3a368b20951c45009 (diff) | |
| download | mediapointer-dvb-s2-56325ebe82f12b17a36ee96f5c0f4604dbd9dbe6.tar.gz mediapointer-dvb-s2-56325ebe82f12b17a36ee96f5c0f4604dbd9dbe6.tar.bz2 | |
- apply dvb-ttpci/av7110 firmware removal from 2.6.0 patch here, too, but:
the firmware is still compiled into the driver for 2.4 by default,
the necessary files are created dynamically from the firmware file.
get it from http://www.linuxtv.org/download/dvb/dvb-ttpci-01.fw
- revamp fdump utility to be smarter when the source file isn't there
Diffstat (limited to 'linux/drivers/media/dvb/ttusb-dec')
| -rw-r--r-- | linux/drivers/media/dvb/ttusb-dec/fdump.c | 64 |
1 files changed, 36 insertions, 28 deletions
diff --git a/linux/drivers/media/dvb/ttusb-dec/fdump.c b/linux/drivers/media/dvb/ttusb-dec/fdump.c index 834314a45..0b478db3e 100644 --- a/linux/drivers/media/dvb/ttusb-dec/fdump.c +++ b/linux/drivers/media/dvb/ttusb-dec/fdump.c @@ -4,33 +4,41 @@ #include <fcntl.h> #include <unistd.h> - -int main (int argc, char **argv) +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; + unsigned char buf[8]; + unsigned int i, count, bytes = 0; + FILE *fd_in, *fd_out; + + if (argc != 4) { + fprintf(stderr, "\n\tusage: %s <ucode.bin> <array_name> <output_name>\n\n", argv[0]); + return -1; + } + + fd_in = fopen(argv[1], "rb"); + if (fd_in == NULL) { + fprintf(stderr, "firmware file '%s' not found\n", argv[1]); + return -1; + } + + fd_out = fopen(argv[3], "w+"); + if (fd_out == NULL) { + fprintf(stderr, "cannot create output file '%s'\n", argv[3]); + return -1; + } + + fprintf(fd_out, "\n#include <asm/types.h>\n\nu8 %s [] = {", argv[2]); + + while ((count = fread(buf, 1, 8, fd_in)) > 0) { + fprintf(fd_out, "\n\t"); + for (i = 0; i < count; i++, bytes++) + fprintf(fd_out, "0x%02x, ", buf[i]); + } + + fprintf(fd_out, "\n};\n\n"); + + fclose(fd_in); + fclose(fd_out); + + return 0; } - |
