X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=hardware%2Fcommon%2Fserial.c;h=cd7002b8345d8be7e76d6624e7cac8a39fafa14f;hb=6e71ef3b6f27c3f3e1c5d5dc4e2f60caf54fc818;hp=4866230c0f204af79dd479330cb27745b2c10f95;hpb=1a081ca67d63a0bd933a3d715792d85afd437296;p=libsigrok.git diff --git a/hardware/common/serial.c b/hardware/common/serial.c index 4866230c..cd7002b8 100644 --- a/hardware/common/serial.c +++ b/hardware/common/serial.c @@ -1,7 +1,7 @@ /* * This file is part of the sigrok project. * - * Copyright (C) 2010 Bert Vermeulen + * Copyright (C) 2010-2012 Bert Vermeulen * * 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 @@ -57,7 +57,7 @@ SR_PRIV GSList *list_serial_ports(void) #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; @@ -67,7 +67,7 @@ SR_PRIV GSList *list_serial_ports(void) 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 @@ -190,7 +190,7 @@ SR_PRIV void serial_restore_params(int fd, void *backup) * 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 @@ -201,8 +201,7 @@ SR_PRIV int serial_set_params(int fd, int speed, int bits, int parity, return SR_ERR; } - /* TODO: Rename 'speed' to 'baudrate'. */ - switch(speed) { + switch (baudrate) { /* TODO: Support for higher baud rates. */ case 115200: dcb.BaudRate = CBR_115200; @@ -235,7 +234,7 @@ SR_PRIV int serial_set_params(int fd, int speed, int bits, int parity, struct termios term; speed_t baud; - switch (speed) { + switch (baudrate) { case 9600: baud = B9600; break;