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

Re: *nix flash utility for BTC DVD recorders



On Thu, Apr 29, 2004 at 11:56:50PM +0200, Joerg Schilling wrote:
> Do you believe that the conversion from your *.cpp code to the
> .c version introduced the bug?

I think so... the original has:

        for (offset = 0; offset < FLASHSIZE; offset += 0x1000) {
                cmd[0] = 0x3B;  // WRITE BUFFER
                cmd[1] = 6;     // Download Microcode with Offsets
                cmd[2] = 0;     // Buffer ID 0
                cmd[3] = (offset >> 16) & 0xff;
                cmd[4] = (offset >> 8) & 0xff;
                cmd[5] = 0x20;
                cmd[6] = 0;     // Length 0x1000
                cmd[7] = 0x10;
                cmd[8] = 0;
                cmd[9] = 0;
                if (err = cmd.transport(WRITE, fwbuf + offset, 0x1000)) {
                        sperror("WRITE BUFFER[1]", err);
                        return 1;
                }
        }

while the libscg version is:

        // Upload firmware
        for (offset = 0; offset < FLASHSIZE; offset += 0x1000) {
                if (write_buffer(scgp,  6 /* Download Microcode with Offsets */,
                                        0 /* Buffer ID 0 */,
                                        offset, 0x1000, (char *)fwbuf + offset)
< 0) {
                        errmsgno(EX_BAD, "Cannot write microcode\n");
                        return 1;
                }
        }

Note the "cmd[5] = 0x20" line in the original--bytes 3-5 contain
(offset+0x20).

> As I cannot check the code (I don't have such a drive), could you please
> try to test the code?

Certainly... I should be able to test it tonight. (BTW, I also notice
that it uses C++ or C99-style // comments. Might be worth changing
those to /* */ for compilers that don't accept //).



Reply to: