/*
* This file is part of the sigrok project.
*
- * Copyright (C) 2010 Bert Vermeulen <bert@biot.com>
+ * Copyright (C) 2010-2012 Bert Vermeulen <bert@biot.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#endif
#include <stdlib.h>
#include <glib.h>
-#include "sigrok.h"
-#include "sigrok-internal.h"
+#include "libsigrok.h"
+#include "libsigrok-internal.h"
// FIXME: Must be moved, or rather passed as function argument.
#ifdef _WIN32
#ifdef _WIN32
/* TODO */
ports = NULL;
- ports = g_slist_append(ports, strdup("COM1"));
+ ports = g_slist_append(ports, g_strdup("COM1"));
#else
glob_t g;
unsigned int i, j;
if (glob(serial_port_glob[i], 0, NULL, &g))
continue;
for (j = 0; j < g.gl_pathc; j++)
- ports = g_slist_append(ports, strdup(g.gl_pathv[j]));
+ ports = g_slist_append(ports, g_strdup(g.gl_pathv[j]));
globfree(&g);
}
#endif
* flowcontrol: 1 = rts/cts, 2 = xon/xoff
* parity: 0 = none, 1 = even, 2 = odd
*/
-SR_PRIV int serial_set_params(int fd, int speed, int bits, int parity,
+SR_PRIV int serial_set_params(int fd, int baudrate, int bits, int parity,
int stopbits, int flowcontrol)
{
#ifdef _WIN32
return SR_ERR;
}
- /* TODO: Rename 'speed' to 'baudrate'. */
- switch(speed) {
+ switch (baudrate) {
/* TODO: Support for higher baud rates. */
case 115200:
dcb.BaudRate = CBR_115200;
struct termios term;
speed_t baud;
- switch (speed) {
+ switch (baudrate) {
case 9600:
baud = B9600;
break;
term.c_iflag &= ~IGNPAR;
term.c_cflag &= ~(PARODD | PARENB);
switch (parity) {
- case 0:
+ case SERIAL_PARITY_NONE:
term.c_iflag |= IGNPAR;
break;
- case 1:
+ case SERIAL_PARITY_EVEN:
term.c_cflag |= PARENB;
break;
- case 2:
+ case SERIAL_PARITY_ODD:
term.c_cflag |= PARENB | PARODD;
break;
default: