dfu-util pull request
lists.tormod at gmail.com
Sun Apr 22 11:02:36 CEST 2012
On Sun, Apr 22, 2012 at 12:07 AM, Tormod Volden wrote:
> On Sat, Apr 21, 2012 at 11:01 PM, Stefan Schmidt wrote:
>>> dfu-suffix: Check for availability of truncate() function
>> You happen to know which platforms are missing this?
> No, but I would guess everything non-posix. I believe, unless you are
> using cygwin, the posix layer on Windows is not so complete. I know
> that when compiling with MinGW, truncate() is not available. I just
> found this http://stackoverflow.com/questions/584639/truncate-file so
> it looks like we can use SetEndOfFile() on Windows instead. I will
> look into that another day.
I found ftruncate() on MinGW, so I changed to use that (with help of
fileno() to avoid reopening the file this got much cleaner too). For
non-MinGW Windows, it seems like _chsize_s is an equivalent (forget
about SetEndOfFile() which acts on Windows file handles). Since I can
not test that variant, and MinGW works fine, I am not including it.
>>> Check for availability of getpagesize()
>>> Replace usleep() and sleep() by milli_sleep() macro
>> Is HAVE_WINDOWS_H really the preferred way to check for windows? Satz
>> used ENV_WINDOWS (which also looked odd to me). Could be that it
>> really depends on what you are using to create the executable. MinGW
>> vs. Windows compiler. Anyway, as you have tested this under Windows
>> and I also have no problems with it under Linux thats fine.
> says that you should include windows.h to use the Sleep() function. So
> maybe not the preferred way to check for Windows but seems a good
> guess for checking for Sleep().
Since we are using HAVE_WINDOWS_H it implies auto-tools is being used,
so it could seem like checking for Sleep() would be the proper way.
However that does not work when cross-compiling on MinGW. Similar to
the getpagesize() issue this might be a bug in auto-tools or I don't
know how to use it properly.
>> The squashing of the bug fix in the previous change is the only thing
>> that would block me from pulling this in. If you could fix this up I
>> would happily pull in an updated pull request.
Done again, rebased with the ftruncate fix. Before repulling, do a
fetch so you can git diff the small difference.
>> From my side we would be ready for a 0.6 release afterwards. :)
> We could maybe wait to see if I can get suffix truncation work on
> Windows easily, that would save some documentation and make dfu-util
> fully consistent across architectures.
Should be fine now.
More information about the devel