From 309952ee8d533c72d1e9a8ee27d806bea02019dd Mon Sep 17 00:00:00 2001
From: Vidyakumar Athota <vathota@codeaurora.org>
Date: Thu, 27 Apr 2017 22:09:11 -0700
Subject: [PATCH] tinyalsa: add mixer_read() api to read event information

Add mixer_read() API to get the event information.
---
 git/src/mixer.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/tinyalsa-git/src/mixer.c b/tinyalsa-git/src/mixer.c
index 0e48c6f..f1b5a30 100644
--- a/tinyalsa-git/src/mixer.c
+++ b/tinyalsa-git/src/mixer.c
@@ -963,3 +963,23 @@ int mixer_ctl_set_enum_by_string(struct mixer_ctl *ctl, const char *string)
     return -EINVAL;
 }
 
+/** Read the event information of the mixer control
+ * @param mixer An initialized mixer handle.
+ * @param event pointer to copy the data.
+ * @returns On success, zero.
+ *  -1 on failure.
+ * @ingroup libtinyalsa-mixer
+ */
+int mixer_read(struct mixer *mixer, struct snd_ctl_event *event)
+{
+    int ret;
+
+    if (!mixer || !event)
+        return -EINVAL;
+
+    ret = read(mixer->fd, (char *)event, sizeof(struct snd_ctl_event));
+    if (ret < 0)
+        ret = -errno;
+
+    return ret;
+}
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,\na Linux Foundation Collaborative Project

