Sigma: Never send empty packets.

This commit is contained in:
Håvard Espeland 2011-01-18 22:17:43 +01:00
parent afa8f8449a
commit abda62ced8
1 changed files with 7 additions and 5 deletions

View File

@ -922,11 +922,13 @@ static int decode_chunk_ts(uint8_t *buf, uint16_t *lastts,
/* Send rest of the chunk to sigrok. */ /* Send rest of the chunk to sigrok. */
tosend = n - sent; tosend = n - sent;
if (tosend > 0) {
packet.type = DF_LOGIC; packet.type = DF_LOGIC;
packet.length = tosend * sizeof(uint16_t); packet.length = tosend * sizeof(uint16_t);
packet.unitsize = 2; packet.unitsize = 2;
packet.payload = samples + sent; packet.payload = samples + sent;
session_bus(sigma->session_id, &packet); session_bus(sigma->session_id, &packet);
}
*lastsample = samples[n - 1]; *lastsample = samples[n - 1];
} }