Hello. On Sat, 2011-05-21 at 01:49, Tormod Volden wrote: > From: Tormod Volden <debian.tor...@gmail.com> > > If a DFU file suffix is detected, it will be stripped off and > not sent to the device. > > The length of the suffix is available in file.suffixlen so it > can be used to calculate how much of the file is left to send.
Great that will help people with firmware files with suffix a lot. > For this the download function call interface is changed to pass > the dfu_file structure instead of only a file descriptor. > > Also some sanity checks could be removed since they are already > taken care of by parse_dfu_suffix(). > > Signed-off-by: Tormod Volden <debian.tor...@gmail.com> > --- > > This could need even more testing... I will test it with modified firmware files for the freerunner containing the suffix and flashing them. > - while (bytes_sent < st.st_size /* - DFU_HDR */) { > + while (bytes_sent < file.size - file.suffixlen) { > int hashes_todo; > + int chunk_size; > > - ret = read(fd, buf, xfer_size); > + chunk_size = file.size - file.suffixlen - bytes_sent; > + if (chunk_size > xfer_size) > + chunk_size = xfer_size; > + ret = read(file.fd, buf, chunk_size); The rest are pretty obvious changes due to the new struct but this jumped in my eye. Did you hit an actual bug with a to large xfer_size? regards Stefan Schmidt _______________________________________________ devel mailing list devel@lists.openmoko.org https://lists.openmoko.org/mailman/listinfo/devel