termios: Add IO control handler

Update #2785.
This commit is contained in:
Sebastian Huber
2016-09-16 14:20:07 +02:00
parent 55e0be3606
commit e814a233ed
2 changed files with 20 additions and 2 deletions

View File

@@ -183,6 +183,21 @@ typedef struct {
const struct termios *term
);
/**
* @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.
*/

View File

@@ -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;