From 2b29b6e1b90b05f1dc28258f8751cf8f1aa2c4e3 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Wed, 19 Aug 2020 11:25:03 +1000 Subject: [PATCH] libei: add ei_device_get/set_user_data Signed-off-by: Peter Hutterer --- src/libei-device.c | 4 ++++ src/libei-private.h | 1 + src/libei.h | 6 ++++++ 3 files changed, 11 insertions(+) diff --git a/src/libei-device.c b/src/libei-device.c index f8b6b4e..b949ae1 100644 --- a/src/libei-device.c +++ b/src/libei-device.c @@ -49,6 +49,10 @@ static OBJECT_IMPLEMENT_PARENT(ei_device, ei); _public_ OBJECT_IMPLEMENT_GETTER(ei_device, name, const char *); +_public_ +OBJECT_IMPLEMENT_GETTER(ei_device, user_data, void *); +_public_ +OBJECT_IMPLEMENT_SETTER(ei_device, user_data, void *); _public_ struct ei* ei_device_get_context(struct ei_device *device) diff --git a/src/libei-private.h b/src/libei-private.h index dd9620d..8353e05 100644 --- a/src/libei-private.h +++ b/src/libei-private.h @@ -66,6 +66,7 @@ enum ei_device_state { struct ei_device { struct object object; + void *user_data; struct list link; uint32_t id; enum ei_device_state state; diff --git a/src/libei.h b/src/libei.h index 6f62458..9c4d0a9 100644 --- a/src/libei.h +++ b/src/libei.h @@ -289,6 +289,12 @@ ei_device_unref(struct ei_device *device); struct ei_device * ei_device_new(struct ei *ei); +void +ei_device_set_user_data(struct ei_device *device, void *user_data); + +void * +ei_device_get_user_data(struct ei_device *device); + /** * Set the name for this device. This is a suggestion only, the server may * the name and assign a different one (or none). Use ei_device_get_name()