From 2106233ae00ffdd683e5e8fb1f63e899649d2f43 Mon Sep 17 00:00:00 2001 From: Jan Altensen Date: Wed, 5 May 2021 13:53:33 +0200 Subject: [PATCH] exynos9610: shim: add better reverse engineered mixer_read_event * decompiled output more or less matches now with thats on stock Change-Id: I5b525342e0cf2b731f93bd3ac74b636fd533969d --- shims/libaudioproxy/shim.cpp | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/shims/libaudioproxy/shim.cpp b/shims/libaudioproxy/shim.cpp index 5c9c33f..fa79502 100644 --- a/shims/libaudioproxy/shim.cpp +++ b/shims/libaudioproxy/shim.cpp @@ -53,8 +53,26 @@ struct audio_route { struct mixer_path *mixer_path; }; -extern "C" int mixer_read_event(struct mixer *mixer, struct snd_ctl_event *ev) { - ssize_t count = read(mixer->fd, ev, sizeof(*ev)); +extern "C" int * mixer_read_event(struct mixer *mixer, uint param_2) { + struct snd_ctl_event *ev = NULL; + ssize_t count; - return (count >= 0) ? 0 : -errno; -} \ No newline at end of file + if (mixer && mixer->fd >= 0) { + ev = (struct snd_ctl_event *)calloc(1, sizeof(*ev)); + + if (ev) { + count = read(mixer->fd, ev, sizeof(*ev)); + + while (0 < count) { + if (ev->type == 0 && (ev->data.elem.mask & param_2) != 0) { + return (int *)ev; + } + + count = read(mixer->fd, ev, sizeof(*ev)); + } + free(ev); + } + } + + return NULL; +} -- 2.20.1