]> sigrok.org Git - libsigrok.git/blobdiff - hardware/openbench-logic-sniffer/ols.c
MinGW: Quickfix to make serial.c/ols.c compile.
[libsigrok.git] / hardware / openbench-logic-sniffer / ols.c
index cbe145d88a9901b8fab68232c11f532ce24e7670..d95e0827bbc1fe6a0af283a131ffe1d70d535e62 100644 (file)
 #include <glib.h>
 #include <sigrok.h>
 
+#ifdef _WIN32
+#define O_NONBLOCK FIONBIO
+#endif
+
 #define NUM_PROBES                     32
 #define NUM_TRIGGER_STAGES             4
 #define TRIGGER_TYPES                  "01"
@@ -604,8 +608,9 @@ static int receive_data(int fd, int revents, void *user_data)
                         */
                        if (trigger_at > 0) {
                                /* there are pre-trigger samples, send those first */
-                               packet.type = DF_LOGIC32;
+                               packet.type = DF_LOGIC;
                                packet.length = trigger_at * 4;
+                               packet.unitsize = 4;
                                packet.payload = raw_sample_buf;
                                session_bus(user_data, &packet);
                        }
@@ -614,13 +619,15 @@ static int receive_data(int fd, int revents, void *user_data)
                        packet.length = 0;
                        session_bus(user_data, &packet);
 
-                       packet.type = DF_LOGIC32;
+                       packet.type = DF_LOGIC;
                        packet.length = (limit_samples * 4) - (trigger_at * 4);
+                       packet.unitsize = 4;
                        packet.payload = raw_sample_buf + trigger_at * 4;
                        session_bus(user_data, &packet);
                } else {
-                       packet.type = DF_LOGIC32;
+                       packet.type = DF_LOGIC;
                        packet.length = limit_samples * 4;
+                       packet.unitsize = 4;
                        packet.payload = raw_sample_buf;
                        session_bus(user_data, &packet);
                }
@@ -757,7 +764,8 @@ static int hw_start_acquisition(int device_index, gpointer session_device_id)
        gettimeofday(&header->starttime, NULL);
        header->samplerate = cur_samplerate;
        header->protocol_id = PROTO_RAW;
-       header->num_probes = NUM_PROBES;
+       header->num_logic_probes = NUM_PROBES;
+       header->num_analog_probes = 0;
        session_bus(session_device_id, packet);
        g_free(header);
        g_free(packet);