X-Git-Url: http://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Fpipistrello-ols%2Fprotocol.c;h=f0ef680527abc48d925f9dae6b9bbcb1adeb5add;hb=968b1a23f23e1f22f7e438a39e3235b4f21b8b14;hp=66430acb9544ad25f6e148e4d3b895d86ef48e2e;hpb=ca314e060f653e6a0b5ec0f58914bac4d426217f;p=libsigrok.git diff --git a/src/hardware/pipistrello-ols/protocol.c b/src/hardware/pipistrello-ols/protocol.c index 66430acb..f0ef6805 100644 --- a/src/hardware/pipistrello-ols/protocol.c +++ b/src/hardware/pipistrello-ols/protocol.c @@ -210,7 +210,7 @@ SR_PRIV struct sr_dev_inst *p_ols_get_metadata(uint8_t *buf, int bytes_read, str uint8_t key, type, token; GString *tmp_str, *devname, *version; guchar tmp_c; - int index, i; + int index; sdi = g_malloc0(sizeof(struct sr_dev_inst)); sdi->status = SR_ST_INACTIVE; @@ -264,10 +264,8 @@ SR_PRIV struct sr_dev_inst *p_ols_get_metadata(uint8_t *buf, int bytes_read, str break; case 1: /* 32-bit unsigned integer */ - tmp_int = 0; - for (i = 0; i < 4; i++) { - tmp_int = (tmp_int << 8) | buf[index++]; - } + tmp_int = RB32(&buf[index]); + index += sizeof(uint32_t); sr_dbg("Got metadata key 0x%.2x value 0x%.8x.", key, tmp_int); switch (token) { @@ -638,8 +636,7 @@ SR_PRIV int p_ols_receive_data(int fd, int revents, void *cb_data) } /* Send the trigger. */ - packet.type = SR_DF_TRIGGER; - sr_session_send(sdi, &packet); + std_session_send_df_trigger(sdi); /* Send post-trigger samples. */ packet.type = SR_DF_LOGIC;