[rtems commit] termios: Add IO control handler

Sebastian Huber sebh at rtems.org
Mon Sep 19 05:54:04 UTC 2016


Module:    rtems
Branch:    master
Commit:    e814a233ed93402b07f3ea5d1f55ec1af08fbb76
Changeset: http://git.rtems.org/rtems/commit/?id=e814a233ed93402b07f3ea5d1f55ec1af08fbb76

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Fri Sep 16 14:20:07 2016 +0200

termios: Add IO control handler

Update #2785.

---

 cpukit/libcsupport/include/rtems/termiostypes.h | 15 +++++++++++++++
 cpukit/libcsupport/src/termios.c                |  7 +++++--
 2 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/cpukit/libcsupport/include/rtems/termiostypes.h b/cpukit/libcsupport/include/rtems/termiostypes.h
index 80251a2..a852c1d 100644
--- a/cpukit/libcsupport/include/rtems/termiostypes.h
+++ b/cpukit/libcsupport/include/rtems/termiostypes.h
@@ -184,6 +184,21 @@ typedef struct {
   );
 
   /**
+   * @brief IO control handler.
+   *
+   * Invoked in case the Termios layer cannot deal with the IO request.
+   *
+   * @param[in] context The Termios device context.
+   * @param[in] request The IO control request.
+   * @param[in] buffer The IO control buffer.
+   */
+  int (*ioctl)(
+    rtems_termios_device_context *context,
+    ioctl_command_t               request,
+    void                         *buffer
+  );
+
+  /**
    * @brief Termios device mode.
    */
   rtems_termios_device_mode mode;
diff --git a/cpukit/libcsupport/src/termios.c b/cpukit/libcsupport/src/termios.c
index 3a6a389..b972b4f 100644
--- a/cpukit/libcsupport/src/termios.c
+++ b/cpukit/libcsupport/src/termios.c
@@ -781,8 +781,11 @@ rtems_termios_ioctl (void *arg)
   default:
     if (rtems_termios_linesw[tty->t_line].l_ioctl != NULL) {
       sc = rtems_termios_linesw[tty->t_line].l_ioctl(tty,args);
-    }
-    else {
+    } else if (tty->handler.ioctl) {
+      args->ioctl_return = (*tty->handler.ioctl) (tty->device_context,
+        args->command, args->buffer);
+      sc = RTEMS_SUCCESSFUL;
+    } else {
       sc = RTEMS_INVALID_NUMBER;
     }
     break;




More information about the vc mailing list