]> sigrok.org Git - libsigrok.git/blobdiff - src/hardware/hameg-hmo/protocol.c
bt/bt_bluez: Implement retry if rfcomm sockets are busy
[libsigrok.git] / src / hardware / hameg-hmo / protocol.c
index b0875eb588e2bae2928608aeee6a0af08c38e7c7..d15d7a8924346ed5cf0d46d85daeaace078c0963 100644 (file)
@@ -183,6 +183,9 @@ static const char *logic_threshold_rtb200x_rtm300x[] = {
        "MAN", // overwritten by logic_threshold_custom
 };
 
+/* This might need updates whenever logic_threshold* above change. */
+#define MAX_NUM_LOGIC_THRESHOLD_ENTRIES ARRAY_SIZE(logic_threshold)
+
 /* RTC1002, HMO Compact2 and HMO1002/HMO1202 */
 static const char *an2_dig8_trigger_sources[] = {
        "CH1", "CH2",
@@ -942,7 +945,7 @@ static int digital_channel_state_get(struct sr_dev_inst *sdi,
 {
        unsigned int i, idx;
        int result = SR_ERR;
-       static char *logic_threshold_short[] = {};
+       char *logic_threshold_short[MAX_NUM_LOGIC_THRESHOLD_ENTRIES];
        char command[MAX_COMMAND_SIZE];
        struct sr_channel *ch;
        struct sr_scpi_dev_inst *scpi = sdi->conn;
@@ -1399,10 +1402,8 @@ SR_PRIV int hmo_receive_data(int fd, int revents, void *cb_data)
         * Send "frame begin" packet upon reception of data for the
         * first enabled channel.
         */
-       if (devc->current_channel == devc->enabled_channels) {
-               packet.type = SR_DF_FRAME_BEGIN;
-               sr_session_send(sdi, &packet);
-       }
+       if (devc->current_channel == devc->enabled_channels)
+               std_session_send_df_frame_begin(sdi);
 
        /*
         * Pass on the received data of the channel(s).
@@ -1523,8 +1524,7 @@ SR_PRIV int hmo_receive_data(int fd, int revents, void *cb_data)
         */
        hmo_cleanup_logic_data(devc);
 
-       packet.type = SR_DF_FRAME_END;
-       sr_session_send(sdi, &packet);
+       std_session_send_df_frame_end(sdi);
 
        /*
         * End of frame was reached. Stop acquisition after the specified