chan_dect: adapt to libdect IO changes
Use dect_fd_priv() and dect_handle_fd(). Also fix a compilation error from the debugging changes. Signed-off-by: Patrick McHardy <kaber@trash.net>
This commit is contained in:
parent
d818c6a4c4
commit
1c68400dff
|
@ -29,6 +29,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision")
|
||||||
|
|
||||||
#include <dect/libdect.h>
|
#include <dect/libdect.h>
|
||||||
#include <dect/terminal.h>
|
#include <dect/terminal.h>
|
||||||
|
#include <dect/debug.h>
|
||||||
|
|
||||||
#define CONFIG_FILE "dect.conf"
|
#define CONFIG_FILE "dect.conf"
|
||||||
|
|
||||||
|
@ -1390,7 +1391,6 @@ static void dect_show_debug(enum dect_debug_subsys subsys,
|
||||||
const char *fmt, va_list ap)
|
const char *fmt, va_list ap)
|
||||||
{
|
{
|
||||||
ast_verbose_ap(fmt, ap);
|
ast_verbose_ap(fmt, ap);
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int dect_load_config(void)
|
static int dect_load_config(void)
|
||||||
|
@ -1625,14 +1625,14 @@ static int dect_io_callback(int *id, int fd, short io_events, void *data)
|
||||||
events |= DECT_FD_READ;
|
events |= DECT_FD_READ;
|
||||||
if (io_events & AST_IO_OUT)
|
if (io_events & AST_IO_OUT)
|
||||||
events |= DECT_FD_WRITE;
|
events |= DECT_FD_WRITE;
|
||||||
dfd->callback(dh, dfd, events);
|
dect_handle_fd(dh, dfd, events);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int dect_register_fd(const struct dect_handle *dh, struct dect_fd *dfd,
|
static int dect_register_fd(const struct dect_handle *dh, struct dect_fd *dfd,
|
||||||
uint32_t events)
|
uint32_t events)
|
||||||
{
|
{
|
||||||
struct dect_fd_priv *priv = (struct dect_fd_priv *)dfd->priv;
|
struct dect_fd_priv *priv = dect_fd_priv(dfd);
|
||||||
short io_events = 0;
|
short io_events = 0;
|
||||||
|
|
||||||
if (events & DECT_FD_READ)
|
if (events & DECT_FD_READ)
|
||||||
|
@ -1640,13 +1640,14 @@ static int dect_register_fd(const struct dect_handle *dh, struct dect_fd *dfd,
|
||||||
if (events & DECT_FD_WRITE)
|
if (events & DECT_FD_WRITE)
|
||||||
io_events |= AST_IO_OUT;
|
io_events |= AST_IO_OUT;
|
||||||
|
|
||||||
priv->id = ast_io_add(io, dfd->fd, dect_io_callback, io_events, dfd);;
|
priv->id = ast_io_add(io, dect_fd_num(dfd), dect_io_callback,
|
||||||
|
io_events, dfd);;
|
||||||
return priv->id ? 0 : -1;
|
return priv->id ? 0 : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void dect_unregister_fd(const struct dect_handle *dh, struct dect_fd *dfd)
|
static void dect_unregister_fd(const struct dect_handle *dh, struct dect_fd *dfd)
|
||||||
{
|
{
|
||||||
struct dect_fd_priv *priv = (struct dect_fd_priv *)dfd->priv;
|
struct dect_fd_priv *priv = dect_fd_priv(dfd);
|
||||||
|
|
||||||
ast_io_remove(io, priv->id);
|
ast_io_remove(io, priv->id);
|
||||||
}
|
}
|
||||||
|
|
Reference in New Issue