]> sigrok.org Git - libsigrok.git/blobdiff - src/hardware/openbench-logic-sniffer/api.c
Various #include file cosmetic fixes.
[libsigrok.git] / src / hardware / openbench-logic-sniffer / api.c
index 9d1e060720e2465f4043b2ae7f47bc968865b545..620f5e1bde9155df76996b36315e3b2b3f5c6e5b 100644 (file)
@@ -17,8 +17,8 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include "protocol.h"
 #include <libserialport.h>
+#include "protocol.h"
 
 #define SERIALCOMM "115200/8n1"
 
@@ -70,11 +70,10 @@ static const char *patterns[] = {
 };
 
 /* Channels are numbered 0-31 (on the PCB silkscreen). */
-SR_PRIV const char *ols_channel_names[NUM_CHANNELS + 1] = {
+SR_PRIV const char *ols_channel_names[] = {
        "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12",
        "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23",
        "24", "25", "26", "27", "28", "29", "30", "31",
-       NULL,
 };
 
 /* Default supported samplerates, can be overridden by device metadata. */
@@ -84,6 +83,8 @@ static const uint64_t samplerates[] = {
        SR_HZ(1),
 };
 
+#define RESPONSE_DELAY_US (10 * 1000)
+
 SR_PRIV struct sr_dev_driver ols_driver_info;
 
 static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx)
@@ -122,7 +123,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
        if (!conn)
                return NULL;
 
-       if (serialcomm == NULL)
+       if (!serialcomm)
                serialcomm = SERIALCOMM;
 
        serial = sr_serial_dev_inst_new(conn, serialcomm);
@@ -151,8 +152,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
        }
        send_shortcommand(serial, CMD_ID);
 
-       /* Wait 10ms for a response. */
-       g_usleep(10000);
+       g_usleep(RESPONSE_DELAY_US);
 
        if (sp_input_waiting(serial->data) == 0) {
                sr_dbg("Didn't get any reply.");
@@ -176,8 +176,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
         */
        send_shortcommand(serial, CMD_METADATA);
 
-       /* Wait 10ms for a response. */
-       g_usleep(10000);
+       g_usleep(RESPONSE_DELAY_US);
 
        if (sp_input_waiting(serial->data) != 0) {
                /* Got metadata. */