1 diff --git a/main.c b/main.c
2 index 190ff5f..08298e9 100644
5 @@ -101,8 +101,8 @@ static void combine(unsigned char *output,
6 const unsigned char *video, const unsigned char *osd,
7 unsigned int xres, unsigned int yres);
9 -enum {UNKNOWN,PALLAS,VULCAN,XILLEON,BRCM7401,BRCM7400,BRCM7405};
10 -static const char *stb_name[]={"unknown","Pallas","Vulcan","Xilleon","Brcm7401","Brcm7400","Brcm7405"};
11 +enum {UNKNOWN,PALLAS,VULCAN,XILLEON,BRCM7401,BRCM7400,BRCM7405,BRCM7335,BRCM7325};
12 +static const char *stb_name[]={"unknown","Pallas","Vulcan","Xilleon","Brcm7401","Brcm7400","Brcm7405","Brcm7335","Brcm7325"};
13 static int stb_type=UNKNOWN;
15 static const char *file_getline(const char *filename)
16 @@ -221,6 +221,22 @@ int main(int argc, char **argv) {
17 !strcmp(line, "dm800se") ||
18 !strcmp(line, "dm7020hd"))
21 + // CPU Detection. idea from pl
24 + line = file_getline("/proc/stb/info/chipset");
27 + if (!strcmp(line, "7335"))
28 + stb_type = BRCM7335;
29 + else if (!strcmp(line, "7325"))
30 + stb_type = BRCM7325;
31 + else if (!strcmp(line, "7405"))
32 + stb_type = BRCM7405;
36 } else if (strstr(line, "xilleonfb")) {
38 } else if (strstr(line, "Pallas FB")) {
39 @@ -564,7 +580,7 @@ static bool getvideo(unsigned char *video, unsigned int *xres, unsigned int *yre
43 - if (stb_type == BRCM7401 || stb_type == BRCM7400 || stb_type == BRCM7405)
44 + if (stb_type == BRCM7401 || stb_type == BRCM7400 || stb_type == BRCM7405 || stb_type == BRCM7335 || stb_type == BRCM7325)
46 // grab brcm7401 pic from decoder memory
47 unsigned char *memory = mmap(0, 100, PROT_READ, MAP_SHARED, mem_fd, 0x10100000);
48 @@ -609,7 +625,7 @@ static bool getvideo(unsigned char *video, unsigned int *xres, unsigned int *yre
51 // grabbing luma & chroma plane from the decoder memory
52 - if (stb_type == BRCM7401 || stb_type == BRCM7405) {
53 + if (stb_type == BRCM7401 || stb_type == BRCM7405 || stb_type == BRCM7325) {
54 // on dm800/dm500hd we have direct access to the decoder memory
55 memory = mmap(0, offset + stride*(ofs2+64), PROT_READ, MAP_SHARED, mem_fd, adr);
56 if (memory == MAP_FAILED) {
57 @@ -620,7 +636,7 @@ static bool getvideo(unsigned char *video, unsigned int *xres, unsigned int *yre
58 usleep(50000); // we try to get a full picture, its not possible to get a sync from the decoder so we use a delay
59 // and hope we get a good timing. dont ask me why, but every DM800 i tested so far produced a good
60 // result with a 50ms delay
61 - } else if (stb_type == BRCM7400) {
62 + } else if (stb_type == BRCM7400 || stb_type == BRCM7335) {
63 // on dm8000 we have to use dma, so dont change anything here until you really know what you are doing !
66 @@ -640,6 +656,7 @@ static bool getvideo(unsigned char *video, unsigned int *xres, unsigned int *yre
68 volatile unsigned long *mem_dma;
69 mem_dma = mmap(0, 0x1000, PROT_READ|PROT_WRITE, MAP_SHARED, mem_fd, 0x10c02000);
70 + mem_dma = mmap(0, 0x1000, PROT_READ|PROT_WRITE, MAP_SHARED, mem_fd, (stb_type==BRCM7400)? 0x10c02000:0x10c01000);
71 if (mem_dma == MAP_FAILED) {
74 @@ -676,7 +693,7 @@ static bool getvideo(unsigned char *video, unsigned int *xres, unsigned int *yre
75 unsigned int chr_luma_stride = 0x40;
78 - if (stb_type == BRCM7405)
79 + if (stb_type == BRCM7405 || stb_type == BRCM7325)
83 @@ -711,9 +728,9 @@ static bool getvideo(unsigned char *video, unsigned int *xres, unsigned int *yre
87 - if (stb_type == BRCM7401 || stb_type == BRCM7405)
88 + if (stb_type == BRCM7401 || stb_type == BRCM7405 || stb_type == BRCM7325)
89 munmap(memory, offset + stride * (ofs2 + 64));
90 - else if (stb_type == BRCM7400) {
91 + else if (stb_type == BRCM7400 || stb_type == BRCM7335) {
93 munmap(memory, DMA_BLOCKSIZE + 0x1000);