2000-09-07 20:39:51 +02:00
|
|
|
/*
|
|
|
|
* Server-side serial port communications management
|
|
|
|
*
|
|
|
|
* Copyright (C) 1998 Alexandre Julliard
|
2001-12-20 01:07:05 +01:00
|
|
|
* Copyright (C) 2000,2001 Mike McCormack
|
2000-09-07 20:39:51 +02:00
|
|
|
*
|
2002-03-10 00:29:33 +01:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
2000-09-07 20:39:51 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
2002-04-26 20:31:19 +02:00
|
|
|
#include "wine/port.h"
|
2000-09-07 20:39:51 +02:00
|
|
|
|
|
|
|
#include <assert.h>
|
|
|
|
#include <fcntl.h>
|
2003-09-06 01:08:26 +02:00
|
|
|
#include <stdarg.h>
|
2000-09-07 20:39:51 +02:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <sys/time.h>
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <time.h>
|
|
|
|
#include <unistd.h>
|
2003-02-11 23:27:13 +01:00
|
|
|
#ifdef HAVE_UTIME_H
|
2000-09-07 20:39:51 +02:00
|
|
|
#include <utime.h>
|
2003-02-11 23:27:13 +01:00
|
|
|
#endif
|
|
|
|
#ifdef HAVE_TERMIOS_H
|
2000-09-07 20:39:51 +02:00
|
|
|
#include <termios.h>
|
2003-02-11 23:27:13 +01:00
|
|
|
#endif
|
|
|
|
#ifdef HAVE_SYS_IOCTL_H
|
2000-09-07 20:39:51 +02:00
|
|
|
#include <sys/ioctl.h>
|
2003-02-11 23:27:13 +01:00
|
|
|
#endif
|
2005-03-04 13:38:36 +01:00
|
|
|
#ifdef HAVE_POLL_H
|
|
|
|
#include <poll.h>
|
|
|
|
#endif
|
2000-09-07 20:39:51 +02:00
|
|
|
|
2005-11-28 17:32:54 +01:00
|
|
|
#include "ntstatus.h"
|
|
|
|
#define WIN32_NO_STATUS
|
2003-09-06 01:08:26 +02:00
|
|
|
#include "windef.h"
|
2004-03-18 05:08:48 +01:00
|
|
|
#include "winternl.h"
|
2000-09-07 20:39:51 +02:00
|
|
|
|
2003-01-30 01:26:44 +01:00
|
|
|
#include "file.h"
|
2000-09-07 20:39:51 +02:00
|
|
|
#include "handle.h"
|
|
|
|
#include "thread.h"
|
|
|
|
#include "request.h"
|
|
|
|
|
|
|
|
static void serial_dump( struct object *obj, int verbose );
|
2003-02-19 01:33:32 +01:00
|
|
|
static struct fd *serial_get_fd( struct object *obj );
|
2005-12-12 16:46:17 +01:00
|
|
|
static unsigned int serial_map_access( struct object *obj, unsigned int access );
|
2003-02-14 21:27:09 +01:00
|
|
|
static void serial_destroy(struct object *obj);
|
|
|
|
|
|
|
|
static int serial_get_poll_events( struct fd *fd );
|
|
|
|
static void serial_poll_event( struct fd *fd, int event );
|
2004-08-18 02:04:58 +02:00
|
|
|
static int serial_get_info( struct fd *fd );
|
2003-05-15 06:22:45 +02:00
|
|
|
static int serial_flush( struct fd *fd, struct event **event );
|
2005-01-14 20:54:38 +01:00
|
|
|
static void serial_queue_async( struct fd *fd, void *apc, void *user, void *iosb, int type, int count );
|
|
|
|
static void serial_cancel_async( struct fd *fd );
|
2000-09-07 20:39:51 +02:00
|
|
|
|
|
|
|
struct serial
|
|
|
|
{
|
|
|
|
struct object obj;
|
2003-02-19 01:33:32 +01:00
|
|
|
struct fd *fd;
|
2004-03-18 05:08:48 +01:00
|
|
|
unsigned int options;
|
2000-09-07 20:39:51 +02:00
|
|
|
|
|
|
|
/* timeout values */
|
|
|
|
unsigned int readinterval;
|
|
|
|
unsigned int readconst;
|
|
|
|
unsigned int readmult;
|
|
|
|
unsigned int writeconst;
|
|
|
|
unsigned int writemult;
|
|
|
|
|
|
|
|
unsigned int eventmask;
|
|
|
|
unsigned int commerror;
|
|
|
|
|
|
|
|
struct termios original;
|
|
|
|
|
2005-02-24 18:06:31 +01:00
|
|
|
struct list read_q;
|
|
|
|
struct list write_q;
|
|
|
|
struct list wait_q;
|
2001-12-20 01:07:05 +01:00
|
|
|
|
2000-09-07 20:39:51 +02:00
|
|
|
/* FIXME: add dcb, comm status, handler module, sharing */
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct object_ops serial_ops =
|
|
|
|
{
|
|
|
|
sizeof(struct serial), /* size */
|
|
|
|
serial_dump, /* dump */
|
2003-01-30 01:26:44 +01:00
|
|
|
default_fd_add_queue, /* add_queue */
|
|
|
|
default_fd_remove_queue, /* remove_queue */
|
|
|
|
default_fd_signaled, /* signaled */
|
2000-09-07 20:39:51 +02:00
|
|
|
no_satisfied, /* satisfied */
|
2005-04-24 19:35:52 +02:00
|
|
|
no_signal, /* signal */
|
2003-02-19 01:33:32 +01:00
|
|
|
serial_get_fd, /* get_fd */
|
2005-12-12 16:46:17 +01:00
|
|
|
serial_map_access, /* map_access */
|
2005-11-22 15:55:42 +01:00
|
|
|
no_lookup_name, /* lookup_name */
|
2005-06-09 17:39:52 +02:00
|
|
|
no_close_handle, /* close_handle */
|
2003-02-14 21:27:09 +01:00
|
|
|
serial_destroy /* destroy */
|
2003-01-30 01:26:44 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
static const struct fd_ops serial_fd_ops =
|
|
|
|
{
|
2000-09-07 20:39:51 +02:00
|
|
|
serial_get_poll_events, /* get_poll_events */
|
2001-12-20 01:07:05 +01:00
|
|
|
serial_poll_event, /* poll_event */
|
2002-07-16 03:20:38 +02:00
|
|
|
serial_flush, /* flush */
|
2000-09-07 20:39:51 +02:00
|
|
|
serial_get_info, /* get_file_info */
|
2005-01-14 20:54:38 +01:00
|
|
|
serial_queue_async, /* queue_async */
|
|
|
|
serial_cancel_async /* cancel_async */
|
2000-09-07 20:39:51 +02:00
|
|
|
};
|
|
|
|
|
2004-03-18 05:08:48 +01:00
|
|
|
/* check if the given fd is a serial port */
|
|
|
|
int is_serial_fd( struct fd *fd )
|
2000-09-07 20:39:51 +02:00
|
|
|
{
|
2000-10-15 02:40:25 +02:00
|
|
|
struct termios tios;
|
|
|
|
|
2004-03-18 05:08:48 +01:00
|
|
|
return !tcgetattr( get_unix_fd(fd), &tios );
|
|
|
|
}
|
2001-08-21 19:01:48 +02:00
|
|
|
|
2004-03-18 05:08:48 +01:00
|
|
|
/* create a serial object for a given fd */
|
|
|
|
struct object *create_serial( struct fd *fd, unsigned int options )
|
|
|
|
{
|
|
|
|
struct serial *serial;
|
|
|
|
int unix_fd;
|
2000-10-15 02:40:25 +02:00
|
|
|
|
2004-03-18 05:08:48 +01:00
|
|
|
if ((unix_fd = dup( get_unix_fd(fd) )) == -1) return NULL;
|
2000-09-07 20:39:51 +02:00
|
|
|
|
2001-10-08 22:40:57 +02:00
|
|
|
/* set the fd back to blocking if necessary */
|
2004-03-18 05:08:48 +01:00
|
|
|
if (options & (FILE_SYNCHRONOUS_IO_ALERT | FILE_SYNCHRONOUS_IO_NONALERT))
|
|
|
|
fcntl( unix_fd, F_SETFL, 0 );
|
2001-10-08 22:40:57 +02:00
|
|
|
|
2003-03-12 23:38:14 +01:00
|
|
|
if (!(serial = alloc_object( &serial_ops )))
|
2000-10-15 02:40:25 +02:00
|
|
|
{
|
2004-03-18 05:08:48 +01:00
|
|
|
close( unix_fd );
|
2003-03-12 23:38:14 +01:00
|
|
|
return NULL;
|
|
|
|
}
|
2004-03-18 05:08:48 +01:00
|
|
|
serial->options = options;
|
2003-03-12 23:38:14 +01:00
|
|
|
serial->readinterval = 0;
|
|
|
|
serial->readmult = 0;
|
|
|
|
serial->readconst = 0;
|
|
|
|
serial->writemult = 0;
|
|
|
|
serial->writeconst = 0;
|
|
|
|
serial->eventmask = 0;
|
|
|
|
serial->commerror = 0;
|
2005-02-24 18:06:31 +01:00
|
|
|
list_init( &serial->read_q );
|
|
|
|
list_init( &serial->write_q );
|
|
|
|
list_init( &serial->wait_q );
|
2004-03-18 05:08:48 +01:00
|
|
|
if (!(serial->fd = create_anonymous_fd( &serial_fd_ops, unix_fd, &serial->obj )))
|
2003-03-12 23:38:14 +01:00
|
|
|
{
|
|
|
|
release_object( serial );
|
|
|
|
return NULL;
|
2000-10-15 02:40:25 +02:00
|
|
|
}
|
2004-03-18 05:08:48 +01:00
|
|
|
return &serial->obj;
|
2000-09-07 20:39:51 +02:00
|
|
|
}
|
|
|
|
|
2003-02-19 01:33:32 +01:00
|
|
|
static struct fd *serial_get_fd( struct object *obj )
|
|
|
|
{
|
|
|
|
struct serial *serial = (struct serial *)obj;
|
|
|
|
return (struct fd *)grab_object( serial->fd );
|
|
|
|
}
|
|
|
|
|
2005-12-12 16:46:17 +01:00
|
|
|
static unsigned int serial_map_access( struct object *obj, unsigned int access )
|
|
|
|
{
|
|
|
|
if (access & GENERIC_READ) access |= FILE_GENERIC_READ;
|
|
|
|
if (access & GENERIC_WRITE) access |= FILE_GENERIC_WRITE;
|
|
|
|
if (access & GENERIC_EXECUTE) access |= FILE_GENERIC_EXECUTE;
|
|
|
|
if (access & GENERIC_ALL) access |= FILE_ALL_ACCESS;
|
|
|
|
return access & ~(GENERIC_READ | GENERIC_WRITE | GENERIC_EXECUTE | GENERIC_ALL);
|
|
|
|
}
|
|
|
|
|
2003-02-14 21:27:09 +01:00
|
|
|
static void serial_destroy( struct object *obj)
|
2001-12-20 01:07:05 +01:00
|
|
|
{
|
|
|
|
struct serial *serial = (struct serial *)obj;
|
|
|
|
|
2005-01-14 20:54:38 +01:00
|
|
|
async_terminate_queue( &serial->read_q, STATUS_CANCELLED );
|
|
|
|
async_terminate_queue( &serial->write_q, STATUS_CANCELLED );
|
|
|
|
async_terminate_queue( &serial->wait_q, STATUS_CANCELLED );
|
2003-02-19 01:33:32 +01:00
|
|
|
if (serial->fd) release_object( serial->fd );
|
2001-12-20 01:07:05 +01:00
|
|
|
}
|
|
|
|
|
2000-10-15 02:40:25 +02:00
|
|
|
static void serial_dump( struct object *obj, int verbose )
|
2000-09-07 20:39:51 +02:00
|
|
|
{
|
2000-10-15 02:40:25 +02:00
|
|
|
struct serial *serial = (struct serial *)obj;
|
2000-09-07 20:39:51 +02:00
|
|
|
assert( obj->ops == &serial_ops );
|
2003-02-19 01:33:32 +01:00
|
|
|
fprintf( stderr, "Port fd=%p mask=%x\n", serial->fd, serial->eventmask );
|
2000-09-07 20:39:51 +02:00
|
|
|
}
|
|
|
|
|
2003-02-19 01:33:32 +01:00
|
|
|
static struct serial *get_serial_obj( struct process *process, obj_handle_t handle, unsigned int access )
|
2000-09-07 20:39:51 +02:00
|
|
|
{
|
|
|
|
return (struct serial *)get_handle_obj( process, handle, access, &serial_ops );
|
|
|
|
}
|
|
|
|
|
2003-02-14 21:27:09 +01:00
|
|
|
static int serial_get_poll_events( struct fd *fd )
|
2000-09-07 20:39:51 +02:00
|
|
|
{
|
2003-02-14 21:27:09 +01:00
|
|
|
struct serial *serial = get_fd_user( fd );
|
2000-09-07 20:39:51 +02:00
|
|
|
int events = 0;
|
2003-02-14 21:27:09 +01:00
|
|
|
assert( serial->obj.ops == &serial_ops );
|
2001-12-20 01:07:05 +01:00
|
|
|
|
2005-02-24 18:06:31 +01:00
|
|
|
if (!list_empty( &serial->read_q )) events |= POLLIN;
|
|
|
|
if (!list_empty( &serial->write_q )) events |= POLLOUT;
|
|
|
|
if (!list_empty( &serial->wait_q )) events |= POLLIN;
|
2001-12-20 01:07:05 +01:00
|
|
|
|
|
|
|
/* fprintf(stderr,"poll events are %04x\n",events); */
|
|
|
|
|
2000-09-07 20:39:51 +02:00
|
|
|
return events;
|
|
|
|
}
|
|
|
|
|
2004-08-18 02:04:58 +02:00
|
|
|
static int serial_get_info( struct fd *fd )
|
2000-09-07 20:39:51 +02:00
|
|
|
{
|
2004-08-18 02:04:58 +02:00
|
|
|
int flags = 0;
|
2003-02-14 21:27:09 +01:00
|
|
|
struct serial *serial = get_fd_user( fd );
|
|
|
|
assert( serial->obj.ops == &serial_ops );
|
2001-10-08 22:40:57 +02:00
|
|
|
|
2004-03-18 05:08:48 +01:00
|
|
|
if (!(serial->options & (FILE_SYNCHRONOUS_IO_ALERT | FILE_SYNCHRONOUS_IO_NONALERT)))
|
2004-08-18 02:04:58 +02:00
|
|
|
flags |= FD_FLAG_OVERLAPPED;
|
2004-08-18 01:37:55 +02:00
|
|
|
else if (!(serial->readinterval == MAXDWORD &&
|
|
|
|
serial->readmult == 0 && serial->readconst == 0))
|
2004-08-18 02:04:58 +02:00
|
|
|
flags |= FD_FLAG_TIMEOUT;
|
|
|
|
if (serial->readinterval == MAXDWORD &&
|
2004-08-18 01:37:55 +02:00
|
|
|
serial->readmult == 0 && serial->readconst == 0)
|
2004-08-18 02:04:58 +02:00
|
|
|
flags |= FD_FLAG_AVAILABLE;
|
2001-10-08 22:40:57 +02:00
|
|
|
|
2004-08-18 02:04:58 +02:00
|
|
|
return flags;
|
2000-09-07 20:39:51 +02:00
|
|
|
}
|
|
|
|
|
2003-02-14 21:27:09 +01:00
|
|
|
static void serial_poll_event(struct fd *fd, int event)
|
2001-12-20 01:07:05 +01:00
|
|
|
{
|
2003-02-14 21:27:09 +01:00
|
|
|
struct serial *serial = get_fd_user( fd );
|
2001-12-20 01:07:05 +01:00
|
|
|
|
|
|
|
/* fprintf(stderr,"Poll event %02x\n",event); */
|
|
|
|
|
2005-02-24 18:06:31 +01:00
|
|
|
if (!list_empty( &serial->read_q ) && (POLLIN & event) )
|
|
|
|
async_terminate_head( &serial->read_q, STATUS_ALERTED );
|
2001-12-20 01:07:05 +01:00
|
|
|
|
2005-02-24 18:06:31 +01:00
|
|
|
if (!list_empty( &serial->write_q ) && (POLLOUT & event) )
|
|
|
|
async_terminate_head( &serial->write_q, STATUS_ALERTED );
|
2001-12-20 01:07:05 +01:00
|
|
|
|
2005-02-24 18:06:31 +01:00
|
|
|
if (!list_empty( &serial->wait_q ) && (POLLIN & event) )
|
|
|
|
async_terminate_head( &serial->wait_q, STATUS_ALERTED );
|
2001-12-20 01:07:05 +01:00
|
|
|
|
2003-02-19 01:33:32 +01:00
|
|
|
set_fd_events( fd, serial_get_poll_events(fd) );
|
2001-12-20 01:07:05 +01:00
|
|
|
}
|
|
|
|
|
2005-01-14 20:54:38 +01:00
|
|
|
static void serial_queue_async( struct fd *fd, void *apc, void *user, void *iosb,
|
|
|
|
int type, int count )
|
2000-11-13 20:27:21 +01:00
|
|
|
{
|
2003-02-14 21:27:09 +01:00
|
|
|
struct serial *serial = get_fd_user( fd );
|
2005-02-24 18:06:31 +01:00
|
|
|
struct list *queue;
|
2001-12-20 01:07:05 +01:00
|
|
|
int timeout;
|
2005-01-14 20:54:38 +01:00
|
|
|
int events;
|
2000-11-13 20:27:21 +01:00
|
|
|
|
2003-02-14 21:27:09 +01:00
|
|
|
assert(serial->obj.ops == &serial_ops);
|
2000-11-13 20:27:21 +01:00
|
|
|
|
2005-01-14 20:54:38 +01:00
|
|
|
switch (type)
|
2000-11-13 20:27:21 +01:00
|
|
|
{
|
|
|
|
case ASYNC_TYPE_READ:
|
2005-02-24 18:06:31 +01:00
|
|
|
queue = &serial->read_q;
|
2001-12-20 01:07:05 +01:00
|
|
|
timeout = serial->readconst + serial->readmult*count;
|
|
|
|
break;
|
|
|
|
case ASYNC_TYPE_WAIT:
|
2005-02-24 18:06:31 +01:00
|
|
|
queue = &serial->wait_q;
|
2001-12-20 01:07:05 +01:00
|
|
|
timeout = 0;
|
|
|
|
break;
|
2000-11-13 20:27:21 +01:00
|
|
|
case ASYNC_TYPE_WRITE:
|
2005-02-24 18:06:31 +01:00
|
|
|
queue = &serial->write_q;
|
2001-12-20 01:07:05 +01:00
|
|
|
timeout = serial->writeconst + serial->writemult*count;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
set_error(STATUS_INVALID_PARAMETER);
|
2002-04-24 23:29:54 +02:00
|
|
|
return;
|
2001-12-20 01:07:05 +01:00
|
|
|
}
|
|
|
|
|
2005-03-29 13:40:10 +02:00
|
|
|
if (!create_async( current, &timeout, queue, apc, user, iosb ))
|
2005-01-14 20:54:38 +01:00
|
|
|
return;
|
2002-04-24 23:29:54 +02:00
|
|
|
|
2005-01-14 20:54:38 +01:00
|
|
|
/* Check if the new pending request can be served immediately */
|
|
|
|
events = check_fd_events( fd, serial_get_poll_events( fd ) );
|
|
|
|
if (events)
|
2001-12-20 01:07:05 +01:00
|
|
|
{
|
2005-01-14 20:54:38 +01:00
|
|
|
/* serial_poll_event() calls set_select_events() */
|
|
|
|
serial_poll_event( fd, events );
|
|
|
|
return;
|
|
|
|
}
|
2002-04-24 23:29:54 +02:00
|
|
|
|
2005-01-14 20:54:38 +01:00
|
|
|
set_fd_events( fd, serial_get_poll_events( fd ) );
|
|
|
|
}
|
2002-04-26 20:31:19 +02:00
|
|
|
|
2005-01-14 20:54:38 +01:00
|
|
|
static void serial_cancel_async( struct fd *fd )
|
|
|
|
{
|
|
|
|
struct serial *serial = get_fd_user( fd );
|
|
|
|
assert(serial->obj.ops == &serial_ops);
|
2000-11-13 20:27:21 +01:00
|
|
|
|
2005-01-14 20:54:38 +01:00
|
|
|
async_terminate_queue( &serial->read_q, STATUS_CANCELLED );
|
|
|
|
async_terminate_queue( &serial->write_q, STATUS_CANCELLED );
|
|
|
|
async_terminate_queue( &serial->wait_q, STATUS_CANCELLED );
|
2001-12-20 01:07:05 +01:00
|
|
|
}
|
2000-11-13 20:27:21 +01:00
|
|
|
|
2003-05-15 06:22:45 +02:00
|
|
|
static int serial_flush( struct fd *fd, struct event **event )
|
2002-07-16 03:20:38 +02:00
|
|
|
{
|
|
|
|
/* MSDN says: If hFile is a handle to a communications device,
|
|
|
|
* the function only flushes the transmit buffer.
|
|
|
|
*/
|
2003-02-14 21:27:09 +01:00
|
|
|
int ret = (tcflush( get_unix_fd(fd), TCOFLUSH ) != -1);
|
2002-07-16 03:20:38 +02:00
|
|
|
if (!ret) file_set_error();
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2000-09-16 22:55:12 +02:00
|
|
|
DECL_HANDLER(get_serial_info)
|
|
|
|
{
|
|
|
|
struct serial *serial;
|
|
|
|
|
|
|
|
if ((serial = get_serial_obj( current->process, req->handle, 0 )))
|
|
|
|
{
|
|
|
|
/* timeouts */
|
2001-11-30 19:46:42 +01:00
|
|
|
reply->readinterval = serial->readinterval;
|
|
|
|
reply->readconst = serial->readconst;
|
|
|
|
reply->readmult = serial->readmult;
|
|
|
|
reply->writeconst = serial->writeconst;
|
|
|
|
reply->writemult = serial->writemult;
|
2000-09-16 22:55:12 +02:00
|
|
|
|
|
|
|
/* event mask */
|
2001-11-30 19:46:42 +01:00
|
|
|
reply->eventmask = serial->eventmask;
|
2000-09-16 22:55:12 +02:00
|
|
|
|
|
|
|
/* comm port error status */
|
2001-11-30 19:46:42 +01:00
|
|
|
reply->commerror = serial->commerror;
|
2000-09-16 22:55:12 +02:00
|
|
|
|
|
|
|
release_object( serial );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
DECL_HANDLER(set_serial_info)
|
|
|
|
{
|
|
|
|
struct serial *serial;
|
|
|
|
|
|
|
|
if ((serial = get_serial_obj( current->process, req->handle, 0 )))
|
|
|
|
{
|
|
|
|
/* timeouts */
|
2005-01-14 20:54:38 +01:00
|
|
|
if (req->flags & SERIALINFO_SET_TIMEOUTS)
|
2000-09-16 22:55:12 +02:00
|
|
|
{
|
|
|
|
serial->readinterval = req->readinterval;
|
|
|
|
serial->readconst = req->readconst;
|
|
|
|
serial->readmult = req->readmult;
|
|
|
|
serial->writeconst = req->writeconst;
|
|
|
|
serial->writemult = req->writemult;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* event mask */
|
2005-01-14 20:54:38 +01:00
|
|
|
if (req->flags & SERIALINFO_SET_MASK)
|
2000-09-16 22:55:12 +02:00
|
|
|
{
|
|
|
|
serial->eventmask = req->eventmask;
|
2005-01-14 20:54:38 +01:00
|
|
|
if (!serial->eventmask)
|
2002-03-12 20:19:57 +01:00
|
|
|
{
|
2005-01-14 20:54:38 +01:00
|
|
|
async_terminate_queue( &serial->wait_q, STATUS_SUCCESS );
|
2002-03-12 20:19:57 +01:00
|
|
|
}
|
2000-09-16 22:55:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* comm port error status */
|
2005-01-14 20:54:38 +01:00
|
|
|
if (req->flags & SERIALINFO_SET_ERROR)
|
2000-09-16 22:55:12 +02:00
|
|
|
{
|
|
|
|
serial->commerror = req->commerror;
|
|
|
|
}
|
|
|
|
|
|
|
|
release_object( serial );
|
|
|
|
}
|
|
|
|
}
|