aboutsummaryrefslogtreecommitdiffstats
path: root/lib/libdvbv5/dvb-dev-local.c
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@s-opensource.com>2017-03-06 20:27:44 (GMT)
committerMauro Carvalho Chehab <mchehab@s-opensource.com>2017-03-06 20:55:42 (GMT)
commit9285e1b5e6757e4fc9079f9c3f126d2dfb9c6d22 (patch)
tree642f0a724b2ad35384f7e8a17d889dfe392e6503 /lib/libdvbv5/dvb-dev-local.c
parentd13b6066743a09b6b70845b3bd9b98fe4c6ade99 (diff)
dvb-dev: allow passing an optional void pointer parameter to dvb_dev_find()
The notify callback may need to use some context data on notifications. Add support for it. As the dvb-dev.h API was broken on the past versions, because it was including ./config.h header file on it, there's no actual API breakage on this patch. Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Diffstat (limited to 'lib/libdvbv5/dvb-dev-local.c')
-rw-r--r--lib/libdvbv5/dvb-dev-local.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/libdvbv5/dvb-dev-local.c b/lib/libdvbv5/dvb-dev-local.c
index 1e8d57f..91de577 100644
--- a/lib/libdvbv5/dvb-dev-local.c
+++ b/lib/libdvbv5/dvb-dev-local.c
@@ -50,6 +50,9 @@ struct dvb_dev_local_priv {
int udev_fd;
struct udev *udev;
struct udev_monitor *mon;
+
+ /* private user data, used by event notifier*/
+ void *user_priv;
};
static int handle_device_change(struct dvb_device_priv *dvb,
@@ -102,7 +105,7 @@ static int handle_device_change(struct dvb_device_priv *dvb,
if (!strcmp(action,"remove")) {
if (priv->notify_dev_change)
priv->notify_dev_change(strdup(sysname),
- DVB_DEV_REMOVE);
+ DVB_DEV_REMOVE, priv->user_priv);
return 0;
}
type = DVB_DEV_CHANGE;
@@ -222,7 +225,7 @@ static int handle_device_change(struct dvb_device_priv *dvb,
}
added:
if (priv->notify_dev_change)
- priv->notify_dev_change(strdup(dvb_dev->sysname), type);
+ priv->notify_dev_change(strdup(dvb_dev->sysname), type, priv->user_priv);
dvb_dev_dump_device(_("Found dvb %s device: %s"), parms, dvb_dev);
return 0;
@@ -265,7 +268,7 @@ static void *monitor_device_changes(void *privdata)
#endif
static int dvb_local_find(struct dvb_device_priv *dvb,
- dvb_dev_change_t handler)
+ dvb_dev_change_t handler, void *user_priv)
{
struct dvb_v5_fe_parms_priv *parms = (void *)dvb->d.fe_parms;
struct dvb_dev_local_priv *priv = dvb->priv;
@@ -285,6 +288,7 @@ static int dvb_local_find(struct dvb_device_priv *dvb,
return -ENOMEM;
}
+ priv->user_priv = user_priv;
priv->notify_dev_change = handler;
if (priv->notify_dev_change) {
#ifndef HAVE_PTHREAD

Privacy Policy