laforge has submitted this change and it was merged. ( 
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(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, approved



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 <lafo...@osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <lafo...@osmocom.org>
Gerrit-MessageType: merged

Reply via email to