- if (this_tx > dev->data_bytes_per_chunk)
- this_tx = dev->data_bytes_per_chunk;
- memcpy(buffer, sum_buffer, this_tx);
- tags.n_bytes = this_tx;
+ if (this_tx > sum_bytes_per_chunk)
+ this_tx = sum_bytes_per_chunk;
+ memcpy(buffer, &hdr, sizeof(hdr));
+ memcpy(buffer + sizeof(hdr), sum_buffer, this_tx);
+ tags.n_bytes = this_tx + sizeof(hdr);