[-]
[+]
|
Changed |
_service:tar_git:audiosystem-passthrough.changes
|
|
[-]
[+]
|
Changed |
_service:tar_git:audiosystem-passthrough.spec
^
|
|
[-]
[+]
|
Changed |
_service
^
|
@@ -2,7 +2,7 @@
<service name="tar_git">
<param name="url">https://github.com/mer-hybris/audiosystem-passthrough.git</param>
<param name="branch">master</param>
- <param name="revision">98164bd582d4ec8455541cde4082e6fdac4fbbdd</param>
+ <param name="revision">1.1.2</param>
<param name="token"/>
<param name="debian"/>
<param name="dumb"/>
|
[-]
[+]
|
Added |
_service:tar_git:audiosystem-passthrough-1.1.2.tar.bz2/.gitignore
^
|
@@ -0,0 +1,3 @@
+RPMS
+build
+documentation.list
|
[-]
[+]
|
Changed |
_service:tar_git:audiosystem-passthrough-1.1.2.tar.bz2/Makefile
^
|
@@ -8,15 +8,16 @@
PKGS = glib-2.0 gio-2.0 libgbinder libglibutil
-PREFIX = /usr
+PREFIX ?= /usr
+LIBDIR ?= /usr/lib
EXE = audiosystem-passthrough
-SRC = passthrough-helper.c impl-af.c impl-qti.c dbus-comms.c
+SRC = passthrough-helper.c impl-af.c impl-qti.c impl-hw2_0.c dbus-comms.c
all: $(EXE) pkgconfig
-PCVERSION = 1.0.0
+PCVERSION = 1.1.0
SRC_DIR = src
BUILD_DIR = build
@@ -86,7 +87,7 @@
install: $(RELEASE_EXE)
mkdir -p $(DESTDIR)$(PREFIX)/libexec/$(EXE)
cp $< $(DESTDIR)$(PREFIX)/libexec/$(EXE)/$(EXE)
- mkdir -p $(DESTDIR)$(PREFIX)/lib/pkgconfig
- cp $(BUILD_DIR)/$(EXE).pc $(DESTDIR)$(PREFIX)/lib/pkgconfig
+ mkdir -p $(DESTDIR)$(LIBDIR)/pkgconfig
+ cp $(BUILD_DIR)/$(EXE).pc $(DESTDIR)$(LIBDIR)/pkgconfig
mkdir -p $(DESTDIR)$(PREFIX)/include/audiosystem-passthrough
cp $(SRC_DIR)/common.h $(DESTDIR)$(PREFIX)/include/audiosystem-passthrough
|
[-]
[+]
|
Changed |
_service:tar_git:audiosystem-passthrough-1.1.2.tar.bz2/README.md
^
|
@@ -1,6 +1,64 @@
audiosystem-passthrough
=======================
+**For new adaptations audioflingerglue (and pulseaudio-modules-droid-glue)
+should not be used!**
+
+Features and command line arguments
+-----------------------------------
+
+### Operation modes (types)
+
+ * af - AudioFlinger
+ * Normal mode
+ * Dummy mode - exposes the service but only replies OK to all method calls)
+ * qti - IQcRilAudio
+ * QCom devices which use vendor.qti.hardware.radio.am@1.0::IQcRilAudioCallback
+ hidl service for setting voice call related parameters
+ * hw2_0 - android.hardware.audio@2.0
+ * Devices which use android.hardware.audio@2.0::IDevicesFactory/default and
+ android.hardware.audio@2.0::IDevice services for setting voice call related parameters,
+ but it have only dummy implementation for now
+
+### Command line arguments
+
+ -v --verbose Verbose logging from audiosystem-passthrough
+ -a --address D-Bus address for PulseAudio module interface
+ -i --idx Starting index for binder calls, only applicable with operation type af
+ -t --type Passthrough type. Can be af or qti
+ --module Run as child process of PulseAudio module
+
+ Also passthrough type and idx arguments can be provided from environment variables
+ AUDIOSYSTEM_PASSTHROUGH_TYPE={qti,af,hw2_0}
+ AUDIOSYSTEM_PASSTHROUGH_IDX={17,18} # only applicable to af type
+
+How to use audiosystem-passthrough
+----------------------------------
+
+### As helper for pulseaudio-modules-droid-hidl
+
+When run from the droid-hidl module the module tries to autodetect correct
+configuration for the helper. If autodetection fails you can modify
+PulseAudio sysconfig file (/etc/sysconfig/pulseaudio) and add following
+environment variables:
+
+ AUDIOSYSTEM_PASSTHROUGH_TYPE={qti,af,hw2_0}
+ AUDIOSYSTEM_PASSTHROUGH_IDX={17,18} # only applicable to af type
+
+Type qti is for devices which have qti HIDL interface IQcRilAudio.
+
+### In standalone dummy mode
+
+Package audiosystem-passthrough-dummy-af contains a service file which starts
+audiosystem-passthrough in AudioFlinger dummy mode.
+This can be used on devices where AudioFlinger service needs to be present
+but isn't used for anything.
+
+Package audiosystem-passthrough-dummy-hw2_0 contain service file which
+starts audiosystem-passthrough in android.hardware.audio@2.0 dummy mode.
+This can be used on devices where android.hardware.audio@2.0 service
+needs to be present but isn't used for anything.
+
Configuration possibilites matrix
---------------------------------
@@ -28,12 +86,12 @@
#### AudioFlinger
For voice calls, one of
- * combination of pulseaudio-modules-droid-glue and audioflingerglue
- * combination of pulseaudio-modules-droid-hidl and audiosystem-passthrough
+ * pulseaudio-modules-droid-hidl and audiosystem-passthrough (with af type)
+ * pulseaudio-modules-droid-glue and audioflingerglue
For media, one of
- * audioflingerglue
* audiosystem-passthrough-dummy-af (from package audiosystem-passthrough)
+ * audioflingerglue
If device needs AudioFlinger for both voice calls and media and a combination
of pa-modules-droid-hidl and audiosystem-passthrough is used a single instance
@@ -43,25 +101,4 @@
#### IQcRilAudio
For voice calls,
- * combination of pulseaudio-modules-droid-hidl and audiosystem-passthrough
-
-Helper for pulseaudio-modules-droid-hidl
-----------------------------------------
-
-When run from the droid-hidl module the module tries to autodetect correct
-configuration for the helper. If this is not the case you can modify
-PulseAudio sysconfig file (/etc/sysconfig/pulseaudio) and add following
-environment variables:
-
- AUDIOSYSTEM_PASSTHROUGH_TYPE={qti,af}
- AUDIOSYSTEM_PASSTHROUGH_IDX={17,18} # only applicable to af type
-
-Type qti is for devices which have qti HIDL interface IQcRilAudio.
-
-Standalone dummy mode
----------------------
-
-Package audiosystem-passthrough-dummy-af contain service file which starts
-audiosystem-passthrough in AudioFlinger dummy mode.
-This can be used on devices where AudioFlinger service needs to be present
-but isn't used for anything.
+ * pulseaudio-modules-droid-hidl and audiosystem-passthrough (with qti type)
|
[-]
[+]
|
Changed |
_service:tar_git:audiosystem-passthrough-1.1.2.tar.bz2/src/common.h
^
|
@@ -47,6 +47,7 @@
#define AUDIOSYSTEM_PASSTHROUGH_IMPL_STR_QTI "qti"
#define AUDIOSYSTEM_PASSTHROUGH_IMPL_STR_AF "af"
+#define AUDIOSYSTEM_PASSTHROUGH_IMPL_STR_HW2_0 "hw2_0"
/* Read from ENV and command line arguments */
#define ENV_AUDIOSYSTEM_PASSTHROUGH_TYPE "AUDIOSYSTEM_PASSTHROUGH_TYPE"
|
[-]
[+]
|
Added |
_service:tar_git:audiosystem-passthrough-1.1.2.tar.bz2/src/impl-hw2_0.c
^
|
@@ -0,0 +1,245 @@
+/*
+ * Copyright (C) 2020 Open Mobile Platform LLC.
+ *
+ * You may use this file under the terms of BSD license as follows:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the names of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+
+#include <gbinder.h>
+#include <glib-unix.h>
+
+#include "common.h"
+#include "impl.h"
+#include "logging.h"
+#include "dbus-comms.h"
+
+#define BINDER_DEVICE GBINDER_DEFAULT_HWBINDER
+
+#define AUDIO_IFACE_2_0(x) "android.hardware.audio@2.0::" x
+#define AUDIO_FACTORY_2_0 AUDIO_IFACE_2_0("IDevicesFactory")
+#define AUDIO_DEVICE_2_0 AUDIO_IFACE_2_0("IDevice")
+#define AUDIO_SERVICE_NAME "default"
+
+enum i_devices_factory_methods {
+ IDEVICESFACTORY_OPEN_DEVICE = GBINDER_FIRST_CALL_TRANSACTION
+};
+
+enum i_device_methods {
+ IDEVICE_INIT_CHECK = GBINDER_FIRST_CALL_TRANSACTION,
+ IDEVICE_GET_PARAMETERS = GBINDER_FIRST_CALL_TRANSACTION + 17,
+ IDEVICE_SET_PARAMETERS
+};
+
+typedef struct hw2_0_app HW20App;
+
+struct hw2_0_app {
+ GMainLoop* loop;
+ const AppConfig *config;
+ gulong presence_id;
+ GBinderLocalObject* idevicefactory;
+ GBinderLocalObject* idevice;
+ GBinderServiceManager* sm;
+ DBusComms *dbus;
+};
+
+static HW20App _app;
+
+static GBinderLocalReply*
+handle_calls_cb(
+ GBinderLocalObject* obj,
+ GBinderRemoteRequest* req,
+ guint code,
+ guint flags,
+ int* status,
+ void* user_data);
+
+static void
+dbus_connected_cb(
+ DBusComms *c,
+ gboolean connected,
+ void *userdata)
+{
+ HW20App *app = userdata;
+
+ if (connected) {
+ DBG("DBus up, connect clients");
+ gbinder_servicemanager_add_service_sync(app->sm,
+ AUDIO_SERVICE_NAME, app->idevicefactory);
+ }
+}
+
+static GBinderLocalReply*
+handle_calls_cb(
+ GBinderLocalObject* obj,
+ GBinderRemoteRequest* req,
+ guint code,
+ guint flags,
+ int* status,
+ void* user_data)
+{
+ HW20App *app = user_data;
+ const char* iface = gbinder_remote_request_interface(req);
+ GBinderLocalReply* reply = NULL;
+
+ if (!g_strcmp0(iface, AUDIO_FACTORY_2_0)) {
+ switch (code) {
+ case IDEVICESFACTORY_OPEN_DEVICE: {
+ GBinderWriter writer;
+ DBG("openDevice method called");
+ reply = gbinder_local_object_new_reply(obj);
+ gbinder_local_reply_init_writer(reply, &writer);
+
+ if (!app->idevice) {
+ app->idevice = gbinder_servicemanager_new_local_object(app->sm,
+ AUDIO_DEVICE_2_0, handle_calls_cb, app);
+ }
+
+ gbinder_writer_append_int32(&writer, GBINDER_STATUS_OK);
+ gbinder_writer_append_local_object(&writer, app->idevice);
+ *status = GBINDER_STATUS_OK;
+ break;
+ }
+ default:
+ ERR("Unspecified method called: Number %u in IDevicesFactory.hal", code);
+ break;
+ }
+ }
+ else if (!g_strcmp0(iface, AUDIO_DEVICE_2_0)) {
+ switch (code) {
+ case IDEVICE_INIT_CHECK: {
+ GBinderWriter writer;
+ DBG("initCheck method called");
+ reply = gbinder_local_object_new_reply(obj);
+ gbinder_local_reply_init_writer(reply, &writer);
+ gbinder_writer_append_int32(&writer, GBINDER_STATUS_OK);
+ *status = GBINDER_STATUS_OK;
+ break;
+ }
+ case IDEVICE_GET_PARAMETERS: {
+ GBinderWriter writer;
+ DBG("getParameters method called");
+ reply = gbinder_local_object_new_reply(obj);
+ gbinder_local_reply_init_writer(reply, &writer);
+ gbinder_writer_append_int32(&writer, GBINDER_STATUS_OK);
+ *status = GBINDER_STATUS_OK;
+ break;
+ }
+ case IDEVICE_SET_PARAMETERS: {
+ DBG("setParameters method called");
+ reply = gbinder_local_object_new_reply(obj);
+ gbinder_local_reply_append_int32(reply, GBINDER_STATUS_OK);
+ *status = GBINDER_STATUS_OK;
+ break;
+ }
+ default: /* No need to do anything with other calls */
+ ERR("Unspecified method called: Number %u in IDevice.hal", code);
+ *status = GBINDER_STATUS_OK;
+ break;
+ }
+ }
+
+ return reply;
+}
+
+static void
+sm_presence_handler(
+ GBinderServiceManager* sm,
+ void* _app)
+{
+ HW20App* app = _app;
+
+ if (gbinder_servicemanager_is_present(app->sm)) {
+ DBG("Service manager has reappeared.");
+
+ gbinder_servicemanager_add_service_sync(app->sm,
+ AUDIO_SERVICE_NAME, app->idevicefactory);
+ } else {
+ DBG("Service manager has died.");
+ }
+}
+
+gboolean
+app_hw2_0_init(
+ GMainLoop *mainloop,
+ const AppConfig *config)
+{
+ memset(&_app, 0, sizeof(_app));
+ _app.loop = mainloop;
+ _app.config = config;
+ _app.sm = gbinder_servicemanager_new(BINDER_DEVICE);
+ _app.idevicefactory = gbinder_servicemanager_new_local_object(_app.sm,
+ AUDIO_FACTORY_2_0,
+ handle_calls_cb,
+ &_app);
+ _app.presence_id = gbinder_servicemanager_add_presence_handler(_app.sm,
|
[-]
[+]
|
Changed |
_service:tar_git:audiosystem-passthrough-1.1.2.tar.bz2/src/impl.h
^
|
@@ -40,6 +40,7 @@
enum app_type {
APP_QTI,
APP_AF,
+ APP_HW2_0,
APP_MAX
};
@@ -88,4 +89,17 @@
app_qti_done(
void);
+gboolean
+app_hw2_0_init(
+ GMainLoop *mainloop,
+ const AppConfig *config);
+
+gboolean
+app_hw2_0_wait(
+ void);
+
+gint
+app_hw2_0_done(
+ void);
+
#endif
|
[-]
[+]
|
Changed |
_service:tar_git:audiosystem-passthrough-1.1.2.tar.bz2/src/passthrough-helper.c
^
|
@@ -61,7 +61,8 @@
static AppImplementation app_implementations[APP_MAX] = {
{ AUDIOSYSTEM_PASSTHROUGH_IMPL_STR_QTI, app_qti_init, app_qti_wait, app_qti_done },
- { AUDIOSYSTEM_PASSTHROUGH_IMPL_STR_AF, app_af_init, app_af_wait, app_af_done },
+ { AUDIOSYSTEM_PASSTHROUGH_IMPL_STR_AF, app_af_init, app_af_wait, app_af_done },
+ { AUDIOSYSTEM_PASSTHROUGH_IMPL_STR_HW2_0, app_hw2_0_init, app_hw2_0_wait, app_hw2_0_done },
};
@@ -133,7 +134,7 @@
{ "idx", 'i', G_OPTION_FLAG_NONE, G_OPTION_ARG_INT,
&idx, "Starting index for binder calls, only applicable with type " AUDIOSYSTEM_PASSTHROUGH_IMPL_STR_AF ".", NULL },
{ "type", 't', G_OPTION_FLAG_NONE, G_OPTION_ARG_STRING,
- &type_str, "Passthrough type. Can be " AUDIOSYSTEM_PASSTHROUGH_IMPL_STR_AF ", " AUDIOSYSTEM_PASSTHROUGH_IMPL_STR_QTI, NULL },
+ &type_str, "Passthrough type. Can be " AUDIOSYSTEM_PASSTHROUGH_IMPL_STR_AF ", " AUDIOSYSTEM_PASSTHROUGH_IMPL_STR_QTI ", " AUDIOSYSTEM_PASSTHROUGH_IMPL_STR_HW2_0, NULL },
{ "module", 'm', G_OPTION_FLAG_NONE, G_OPTION_ARG_NONE,
&_app_module, "Run as child process.", NULL },
{ "verbose", 'v', G_OPTION_FLAG_NONE, G_OPTION_ARG_NONE,
|
[-]
[+]
|
Changed |
_service:tar_git:audiosystem-passthrough-dummy-af.service
^
|
@@ -1,6 +1,8 @@
[Unit]
Description=Binder AudioFlinger dummy service
-After=pre-user-session.target
+DefaultDependencies=no
+After=local-fs.target
+Before=droid-hal-init.service
[Service]
Environment=AUDIOSYSTEM_PASSTHROUGH_TYPE=af
@@ -9,4 +11,4 @@
Restart=always
[Install]
-WantedBy=user-session.target
+WantedBy=multi-user.target
|
[-]
[+]
|
Added |
_service:tar_git:audiosystem-passthrough-dummy-hw2_0.service
^
|
@@ -0,0 +1,12 @@
+[Unit]
+Description=Binder android.hardware.audio@2.0 dummy service
+After=pre-user-session.target
+
+[Service]
+Environment=AUDIOSYSTEM_PASSTHROUGH_TYPE=hw2_0
+EnvironmentFile=-/etc/sysconfig/audiosystem-passthrough-dummy-hw2_0
+ExecStart=/usr/libexec/audiosystem-passthrough/audiosystem-passthrough --address dummy
+Restart=always
+
+[Install]
+WantedBy=user-session.target
\ No newline at end of file
|