dfu-rs / dfu-core

Sans IO core library (traits and tools) for DFU
16 stars 5 forks source link

Ensure full transfer size is used whenever possible #22

Closed sjoerdsimons closed 1 year ago

sjoerdsimons commented 1 year ago

Some dfu implementations misbehave if a DFUDNLOAD (apart from the last one) doesn't match the full transfer size as declared by the functional descriptor.

The current usage of a BufReader doesn't guarantee this as the underlying reader may not fully fill the buffer; This is uncommon/unlikely when reading from a local filesystem, but very likely when reading from a network stream.

Introduce a simple helper buffer which fully refills it's buffer from the underlying reader, but otherwise matches the use api from bufreader to get the intended semantics.

Signed-off-by: Sjoerd Simons sjoerd@collabora.com