Change in ...osmo-ccid-firmware[master]: card_uart_ctrl: change from bool to integer argument

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

laforge gerrit-no-reply at lists.osmocom.org
Wed Oct 9 20:32:01 UTC 2019


laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ccid-firmware/+/15741


Change subject: card_uart_ctrl: change from bool to integer argument
......................................................................

card_uart_ctrl: change from bool to integer argument

This allows for control functions for e.g. baud rate or waiting time

Change-Id: Ifa8dde9dbcd27b79055aaac1a05bb040be616e05
---
M ccid_common/cuart.c
M ccid_common/cuart.h
M ccid_host/cuart_driver_tty.c
3 files changed, 9 insertions(+), 9 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-ccid-firmware refs/changes/41/15741/1

diff --git a/ccid_common/cuart.c b/ccid_common/cuart.c
index 895717a..fc3cfb6 100644
--- a/ccid_common/cuart.c
+++ b/ccid_common/cuart.c
@@ -53,20 +53,20 @@
 	return cuart->driver->ops->close(cuart);
 }
 
-int card_uart_ctrl(struct card_uart *cuart, enum card_uart_ctl ctl, bool enable)
+int card_uart_ctrl(struct card_uart *cuart, enum card_uart_ctl ctl, int arg)
 {
 	int rc;
 	OSMO_ASSERT(cuart);
 	OSMO_ASSERT(cuart->driver);
 	OSMO_ASSERT(cuart->driver->ops);
 	OSMO_ASSERT(cuart->driver->ops->ctrl);
-	rc = cuart->driver->ops->ctrl(cuart, ctl, enable);
+	rc = cuart->driver->ops->ctrl(cuart, ctl, arg);
 	if (rc < 0)
 		return rc;
 
 	switch (ctl) {
 	case CUART_CTL_RX:
-		cuart->rx_enabled = enable;
+		cuart->rx_enabled = arg ? true : false;
 		break;
 	default:
 		break;
diff --git a/ccid_common/cuart.h b/ccid_common/cuart.h
index 790c277..f35cdd2 100644
--- a/ccid_common/cuart.h
+++ b/ccid_common/cuart.h
@@ -33,7 +33,7 @@
 	int (*async_tx)(struct card_uart *cuart, const uint8_t *data, size_t len);
 	int (*async_rx)(struct card_uart *cuart, uint8_t *data, size_t len);
 
-	int (*ctrl)(struct card_uart *cuart, enum card_uart_ctl ctl, bool enable);
+	int (*ctrl)(struct card_uart *cuart, enum card_uart_ctl ctl, int arg);
 };
 
 /* Card UART driver */
@@ -98,7 +98,7 @@
 /*! Schedule (asynchronous) receive data via UART (after CUART_E_RX_COMPLETE) */
 int card_uart_rx(struct card_uart *cuart, uint8_t *data, size_t len);
 
-int card_uart_ctrl(struct card_uart *cuart, enum card_uart_ctl ctl, bool enable);
+int card_uart_ctrl(struct card_uart *cuart, enum card_uart_ctl ctl, int arg);
 
 /*! Set the Rx notification threshold in number of bytes received */
 void card_uart_set_rx_threshold(struct card_uart *cuart, size_t rx_threshold);
diff --git a/ccid_host/cuart_driver_tty.c b/ccid_host/cuart_driver_tty.c
index 3695b58..10ea60f 100644
--- a/ccid_host/cuart_driver_tty.c
+++ b/ccid_host/cuart_driver_tty.c
@@ -249,7 +249,7 @@
 	return i;
 }
 
-static int tty_uart_ctrl(struct card_uart *cuart, enum card_uart_ctl ctl, bool enable)
+static int tty_uart_ctrl(struct card_uart *cuart, enum card_uart_ctl ctl, int arg)
 {
 	struct termios tio;
 	int rc;
@@ -263,7 +263,7 @@
 		}
 		/* We do our best here, but lots of [USB] serial drivers seem to ignore
 		 * CREAD, see https://bugzilla.kernel.org/show_bug.cgi?id=205033 */
-		if (enable)
+		if (arg)
 			tio.c_cflag |= CREAD;
 		else
 			tio.c_cflag &= ~CREAD;
@@ -274,8 +274,8 @@
 		}
 		break;
 	case CUART_CTL_RST:
-		_set_rts(cuart->u.tty.ofd.fd, enable);
-		if (enable)
+		_set_rts(cuart->u.tty.ofd.fd, arg ? true : false);
+		if (arg)
 			_flush(cuart->u.tty.ofd.fd);
 		break;
 	case CUART_CTL_POWER:

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-ccid-firmware/+/15741
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ccid-firmware
Gerrit-Branch: master
Gerrit-Change-Id: Ifa8dde9dbcd27b79055aaac1a05bb040be616e05
Gerrit-Change-Number: 15741
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge at osmocom.org>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20191009/90a974f0/attachment.htm>


More information about the gerrit-log mailing list