aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDenis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>2020-01-23 18:02:52 +0100
committerDenis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>2020-01-30 03:45:24 +0100
commitac9895e996e563cff42bb18e717cc44677f39066 (patch)
tree8990a56de7af32580edce327b62b417f0cf023d1
parent767c37c124f83317635cce69bbb176a9795549c0 (diff)
downloadhardware_replicant_libsamsung-ipc-ac9895e996e563cff42bb18e717cc44677f39066.tar.gz
hardware_replicant_libsamsung-ipc-ac9895e996e563cff42bb18e717cc44677f39066.tar.bz2
hardware_replicant_libsamsung-ipc-ac9895e996e563cff42bb18e717cc44677f39066.zip
Add IPC_CLIENT_TYPE_DUMMY
The libsamsung-ipc logging system depends on having a valid ipc_client struct which is created by ipc_client_create. This enable libsamsung-ipc to be reused accross software stacks that use different logging systems. For instance the libsamsung-ipc can be used by libsamsung-ril which integrates libsamsung-ipc logging to the Android logging system. However this has several side effects: - Standalone tools like nv_data-md5 that may not necessarily run on a device with a compatible modem and driver end up not printing many of the information it should be printing. - As ipc_client_create tries to autodetect hardware and software configurations, and that logging is only available after it succeed, the early intialisation prints are not forwarded to the logging system. This can be an issue on Android as users and developers expect the logging to go to 'logcat' and getting the early logs require more extesive modification of the system. This enables to create a dummy ipc_client with working logging. Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
-rw-r--r--include/samsung-ipc.h1
-rw-r--r--samsung-ipc/ipc.c26
2 files changed, 26 insertions, 1 deletions
diff --git a/include/samsung-ipc.h b/include/samsung-ipc.h
index 9d638ec..d495ba2 100644
--- a/include/samsung-ipc.h
+++ b/include/samsung-ipc.h
@@ -30,6 +30,7 @@
#define IPC_CLIENT_TYPE_FMT 0x00
#define IPC_CLIENT_TYPE_RFS 0x01
+#define IPC_CLIENT_TYPE_DUMMY 0x02
/*
* Structures
diff --git a/samsung-ipc/ipc.c b/samsung-ipc/ipc.c
index f7e0379..5387611 100644
--- a/samsung-ipc/ipc.c
+++ b/samsung-ipc/ipc.c
@@ -153,7 +153,18 @@ complete:
return index;
}
-struct ipc_client *ipc_client_create(int type)
+
+static struct ipc_client *ipc_dummy_client_create(void)
+{
+ struct ipc_client *client = NULL;
+
+ client = (struct ipc_client *) calloc(1, sizeof(struct ipc_client));
+ client->type = IPC_CLIENT_TYPE_DUMMY;
+
+ return client;
+}
+
+static struct ipc_client *ipc_transport_client_create(int type)
{
struct ipc_client *client = NULL;
unsigned int device_index;
@@ -205,6 +216,19 @@ complete:
return client;
}
+struct ipc_client *ipc_client_create(int type)
+{
+ switch (type) {
+ case IPC_CLIENT_TYPE_RFS:
+ case IPC_CLIENT_TYPE_FMT:
+ return ipc_transport_client_create(type);
+ case IPC_CLIENT_TYPE_DUMMY:
+ return ipc_dummy_client_create();
+ default:
+ return NULL;
+ }
+}
+
int ipc_client_destroy(struct ipc_client *client)
{
if (client == NULL)