[-]
[+]
|
Changed |
_service:tar_git:ofono-ril-binder-plugin.changes
|
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-ril-binder-plugin.spec
^
|
|
[-]
[+]
|
Changed |
_service
^
|
@@ -6,7 +6,7 @@
<service name="tar_git">
<param name="url">https://github.com/mer-hybris/ofono-ril-binder-plugin.git</param>
<param name="branch">master</param>
- <param name="revision">ecf6f1d6def069b881db5e492f6829999457d337</param>
+ <param name="revision">cb6fc5b14bda068aa3ad79baf091843306636da5</param>
<param name="token"/>
<param name="debian">N</param>
<param name="dumb">N</param>
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-ril-binder-plugin-1.0.13.tar.bz2/Makefile
^
|
@@ -32,7 +32,7 @@
VERSION_MAJOR = 1
VERSION_MINOR = 0
-VERSION_RELEASE = 12
+VERSION_RELEASE = 13
# Version for pkg-config
PCVERSION = $(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_RELEASE)
@@ -65,6 +65,7 @@
ril_binder_plugin.c
LIB_SRC = \
+ ril_binder_oemhook.c \
ril_binder_radio.c
#
|
[-]
[+]
|
Added |
_service:tar_git:ofono-ril-binder-plugin-1.0.13.tar.bz2/src/ril_binder_log.h
^
|
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2018 Jolla Ltd.
+ * Copyright (C) 2018 Slava Monich <slava.monich@jolla.com>
+ *
+ * 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.
+ */
+
+#ifndef RIL_BINDER_LOG_H
+#define RIL_BINDER_LOG_H
+
+#define GLOG_MODULE_NAME ril_binder_radio_log
+#include <gutil_log.h>
+
+#endif /* RIL_BINDER_LOG_H */
+
+/*
+ * Local Variables:
+ * mode: C
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
|
[-]
[+]
|
Added |
_service:tar_git:ofono-ril-binder-plugin-1.0.13.tar.bz2/src/ril_binder_oemhook.c
^
|
@@ -0,0 +1,436 @@
+/*
+ * Copyright (C) 2020 Jolla Ltd.
+ * Copyright (C) 2020 Slava Monich <slava.monich@jolla.com>
+ *
+ * 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 "ril_binder_oemhook.h"
+#include "ril_binder_log.h"
+
+#include <radio_instance.h>
+#include <grilio_request.h>
+
+#include <gbinder.h>
+#include <gutil_log.h>
+#include <gutil_misc.h>
+
+typedef GObjectClass RilBinderOemHookClass;
+struct ril_binder_oemhook {
+ GObject parent;
+ const char* name;
+ RadioInstance* radio;
+ GBinderClient* client;
+ GBinderRemoteObject* remote;
+ GBinderLocalObject* response;
+ GBinderLocalObject* indication;
+ gulong death_id;
+};
+
+G_DEFINE_TYPE(RilBinderOemHook, ril_binder_oemhook, G_TYPE_OBJECT)
+#define RIL_BINDER_TYPE_OEMHOOK (ril_binder_oemhook_get_type())
+#define RIL_BINDER_OEMHOOK(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), \
+ RIL_BINDER_TYPE_OEMHOOK, RilBinderOemHook))
+
+enum ril_binder_oemhook_signal {
+ SIGNAL_RESP_SEND_REQUEST_RAW,
+ SIGNAL_COUNT
+};
+
+#define SIGNAL_RESP_SEND_REQUEST_RAW_NAME "oemhook-resp-send-request-raw"
+
+static guint ril_binder_oemhook_signals[SIGNAL_COUNT] = { 0 };
+
+/* Logging */
+#define OEMHOOK_LOG ril_binder_oemhook_log
+static const GLOG_MODULE_DEFINE2_(OEMHOOK_LOG, "oemhook", GLOG_MODULE_NAME);
+#undef GLOG_MODULE_NAME
+#define GLOG_MODULE_NAME OEMHOOK_LOG
+#define DBG_(self,fmt,args...) GDEBUG("%s " fmt, (self)->name, ##args)
+
+/* android.hardware.radio.deprecated@1.0::IOemHook */
+enum ril_binder_oemhook_req {
+ /* setResponseFunctions(IOemHookResponse, IOemHookIndication); */
+ OEMHOOK_REQ_SET_RESPONSE_FUNCTIONS = GBINDER_FIRST_CALL_TRANSACTION,
+ /* oneway sendRequestRaw(int32_t serial, vec<uint8_t> data); */
+ OEMHOOK_REQ_SEND_REQUEST_RAW,
+ /* oneway sendRequestStrings(int32_t serial, vec<string> data); */
+ OEMHOOK_REQ_SEND_REQUEST_STRINGS
+};
+
+/* android.hardware.radio.deprecated@1.0::IOemHookResponse */
+enum ril_binder_oemhook_resp {
+ /* oneway sendRequestRawResponse(RadioResponseInfo, vec<uint8_t>); */
+ OEMHOOK_RESP_SEND_REQUEST_RAW = GBINDER_FIRST_CALL_TRANSACTION,
+ /* oneway sendRequestStringsResponse(RadioResponseInfo, vec<string>); */
+ OEMHOOK_RESP_SEND_REQUEST_STRINGS
+};
+
+/* android.hardware.radio.deprecated@1.0::IOemHookIndication */
+enum ril_binder_oemhook_ind {
+ /* oneway oemHookRaw(RadioIndicationType, vec<uint8_t> data); */
+ OEMHOOK_IND_OEM_HOOK_RAW = GBINDER_FIRST_CALL_TRANSACTION
+};
+
+#define OEMHOOK_IFACE(x) "android.hardware.radio.deprecated@1.0::" x
+#define OEMHOOK_REMOTE OEMHOOK_IFACE("IOemHook")
+#define OEMHOOK_RESPONSE OEMHOOK_IFACE("IOemHookResponse")
+#define OEMHOOK_INDICATION OEMHOOK_IFACE("IOemHookIndication")
+
+static
+void
+ril_binder_oemhook_drop_objects(
+ RilBinderOemHook* self)
+{
+ if (self->indication) {
+ gbinder_local_object_drop(self->indication);
+ self->indication = NULL;
+ }
+ if (self->response) {
+ gbinder_local_object_drop(self->response);
+ self->response = NULL;
+ }
+ if (self->remote) {
+ gbinder_remote_object_remove_handler(self->remote, self->death_id);
+ gbinder_remote_object_unref(self->remote);
+ self->death_id = 0;
+ self->remote = NULL;
+ }
+ if (self->radio) {
+ radio_instance_unref(self->radio);
+ self->radio = NULL;
+ }
+ if (self->client) {
+ gbinder_client_unref(self->client);
+ self->client = NULL;
+ }
+}
+
+static
+void
+ril_binder_oemhook_died(
+ GBinderRemoteObject* obj,
+ void* user_data)
+{
+ RilBinderOemHook* self = user_data;
+
+ GERR("%s oemhook died", self->name);
+ ril_binder_oemhook_drop_objects(self);
+}
+
+/* oneway sendRequestRawResponse(RadioResponseInfo, vec<uint8_t>); */
+static
+void
+ril_binder_oemhook_handle_send_request_raw_response(
+ RilBinderOemHook* self,
+ const RadioResponseInfo* info,
+ GBinderReader* in)
+{
+ GUtilData data;
+
+ data.bytes = gbinder_reader_read_hidl_byte_vec(in, &data.size);
+ GASSERT(data.bytes);
+ if (data.bytes) {
+ g_signal_emit(self, ril_binder_oemhook_signals
+ [SIGNAL_RESP_SEND_REQUEST_RAW], 0, info, &data);
+ }
+}
+
+static
+GBinderLocalReply*
+ril_binder_oemhook_response(
+ GBinderLocalObject* obj,
+ GBinderRemoteRequest* req,
+ guint code,
+ guint flags,
+ int* status,
+ void* user_data)
+{
+ RilBinderOemHook* self = user_data;
+ const char* iface = gbinder_remote_request_interface(req);
+
+ if (!g_strcmp0(iface, OEMHOOK_RESPONSE)) {
+ GBinderReader reader;
+ const RadioResponseInfo* info;
+
+ /* All these should be one-way transactions */
+ GASSERT(flags & GBINDER_TX_FLAG_ONEWAY);
+
+ /* And have RadioResponseInfo as the first parameter */
+ gbinder_remote_request_init_reader(req, &reader);
+ info = gbinder_reader_read_hidl_struct(&reader, RadioResponseInfo);
+ GASSERT(info);
+ if (info) {
+ switch (code) {
+ case OEMHOOK_RESP_SEND_REQUEST_RAW:
+ DBG_(self, OEMHOOK_RESPONSE " %u sendRequestRawResponse", code);
+ ril_binder_oemhook_handle_send_request_raw_response(self,
+ info, &reader);
+ break;
+ case OEMHOOK_RESP_SEND_REQUEST_STRINGS:
+ /*
+ * No need to handle sendRequestStringsResponse() just yet
+ * because we never call sendRequestStrings()
+ *
|
[-]
[+]
|
Added |
_service:tar_git:ofono-ril-binder-plugin-1.0.13.tar.bz2/src/ril_binder_oemhook.h
^
|
@@ -0,0 +1,95 @@
+/*
+ * Copyright (C) 2020 Jolla Ltd.
+ * Copyright (C) 2020 Slava Monich <slava.monich@jolla.com>
+ *
+ * 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.
+ */
+
+#ifndef RIL_BINDER_OEMHOOK_H
+#define RIL_BINDER_OEMHOOK_H
+
+#include <radio_types.h>
+#include <gbinder_types.h>
+#include <grilio_types.h>
+
+typedef struct ril_binder_oemhook RilBinderOemHook;
+
+typedef
+void
+(*RilBinderOemHookRawResponseFunc)(
+ RilBinderOemHook* hook,
+ const RadioResponseInfo* info,
+ const GUtilData* data,
+ gpointer user_data);
+
+typedef
+gboolean
+(*RilBinderOemHookRawFunc)(
+ RilBinderOemHook* hook,
+ const GUtilData* data,
+ gpointer user_data);
+
+RilBinderOemHook*
+ril_binder_oemhook_new(
+ GBinderServiceManager* sm,
+ RadioInstance* radio)
+ G_GNUC_INTERNAL;
+
+void
+ril_binder_oemhook_free(
+ RilBinderOemHook* hook)
+ G_GNUC_INTERNAL;
+
+gboolean
+ril_binder_oemhook_send_request_raw(
+ RilBinderOemHook* hook,
+ GRilIoRequest* req)
+ G_GNUC_INTERNAL;
+
+gulong
+ril_binder_oemhook_add_raw_response_handler(
+ RilBinderOemHook* hook,
+ RilBinderOemHookRawResponseFunc func,
+ gpointer user_data)
+ G_GNUC_INTERNAL;
+
+void
+ril_binder_oemhook_remove_handler(
+ RilBinderOemHook* hook,
+ gulong id)
+ G_GNUC_INTERNAL;
+
+#endif /* RIL_BINDER_OEMHOOK_H */
+
+/*
+ * Local Variables:
+ * mode: C
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-ril-binder-plugin-1.0.13.tar.bz2/src/ril_binder_radio.c
^
|
@@ -34,9 +34,10 @@
#include "ril_binder_radio.h"
#include "ril_binder_radio_impl.h"
+#include "ril_binder_oemhook.h"
+#include "ril_binder_log.h"
#include <ofono/ril-constants.h>
-#include <ofono/log.h>
#include "grilio_channel.h"
#include "grilio_encode.h"
@@ -52,8 +53,6 @@
#include <gutil_misc.h>
/* Logging */
-#define GLOG_MODULE_NAME ril_binder_radio_log
-#include <gutil_log.h>
GLOG_MODULE_DEFINE("grilio-binder");
#define RIL_BINDER_KEY_MODEM "modem"
@@ -94,7 +93,8 @@
} RilBinderRadioFailureData;
struct ril_binder_radio_priv {
- char* modem;
+ RilBinderOemHook* oemhook;
+ gulong oemhook_raw_response_id;
GUtilIdleQueue* idle;
GHashTable* req_map; /* code -> RilBinderRadioCall */
GHashTable* resp_map; /* resp_tx -> RilBinderRadioCall */
@@ -3017,6 +3017,13 @@
radio_instance_unref(self->radio);
self->radio = NULL;
}
+ if (priv->oemhook) {
+ ril_binder_oemhook_remove_handler(priv->oemhook,
+ priv->oemhook_raw_response_id);
+ priv->oemhook_raw_response_id = 0;
+ ril_binder_oemhook_free(priv->oemhook);
+ priv->oemhook = NULL;
+ }
}
static
@@ -3030,7 +3037,7 @@
if (ril_binder_radio_decode_response(self, info, call->decode, reader)) {
return TRUE;
} else {
- ofono_warn("Failed to decode %s response", call->name);
+ GWARN("Failed to decode %s response", call->name);
return FALSE;
}
}
@@ -3047,7 +3054,7 @@
event->decode, reader)) {
return TRUE;
} else {
- ofono_warn("Failed to decode %s indication", event->name);
+ GWARN("Failed to decode %s indication", event->name);
return FALSE;
}
}
@@ -3118,7 +3125,7 @@
RilBinderRadio* self = RIL_BINDER_RADIO(user_data);
GRilIoTransport* transport = &self->parent;
- ofono_error("%sradio died", transport->log_prefix);
+ GERR("%sradio died", transport->log_prefix);
ril_binder_radio_drop_radio(self);
grilio_transport_signal_disconnected(transport);
}
@@ -3135,6 +3142,39 @@
radio_instance_set_enabled(self->radio, channel->enabled);
}
+static
+GRILIO_RESPONSE_TYPE
+ril_binder_radio_convert_resp_type(
+ RADIO_RESP_TYPE type)
+{
+ switch (type) {
+ case RADIO_RESP_SOLICITED:
+ return GRILIO_RESPONSE_SOLICITED;
+ case RADIO_RESP_SOLICITED_ACK:
+ return GRILIO_RESPONSE_SOLICITED_ACK;
+ case RADIO_RESP_SOLICITED_ACK_EXP:
+ return GRILIO_RESPONSE_SOLICITED_ACK_EXP;
+ }
+ GDEBUG("Unexpected response type %u", type);
+ return GRILIO_RESPONSE_NONE;
+}
+
+static
+void
+ril_binder_radio_handle_oemhook_raw_response(
+ RilBinderOemHook* hook,
+ const RadioResponseInfo* info,
+ const GUtilData* data,
+ gpointer user_data)
+{
+ GRILIO_RESPONSE_TYPE type = ril_binder_radio_convert_resp_type(info->type);
+
+ if (type != GRILIO_RESPONSE_NONE) {
+ grilio_transport_signal_response(GRILIO_TRANSPORT(user_data), type,
+ info->serial, info->error, data->bytes, data->size);
+ }
+}
+
/*==========================================================================*
* Methods
*==========================================================================*/
@@ -3160,7 +3200,7 @@
return ril_binder_radio_handle_known_response(self, call, info, ©);
} else {
DBG_(self, "IRadioResponse %u", code);
- ofono_warn("Unexpected response transaction %u", code);
+ GWARN("Unexpected response transaction %u", code);
return FALSE;
}
}
@@ -3230,11 +3270,23 @@
return GRILIO_SEND_OK;
}
} else {
- ofono_warn("Failed to encode %s() arguments", call->name);
+ GWARN("Failed to encode %s() arguments", call->name);
}
gbinder_local_request_unref(txreq);
+ } else if (code == RIL_REQUEST_OEM_HOOK_RAW) {
+ /*
+ * This needs to be special-cased, because OEM_HOOK functionality
+ * was moved to separate IOemHook interface.
+ */
+ if (priv->oemhook) {
+ if (ril_binder_oemhook_send_request_raw(priv->oemhook, req)) {
+ return GRILIO_SEND_OK;
+ }
+ } else {
+ GWARN("No OEM hook to handle OEM_HOOK_RAW request");
+ }
} else {
- ofono_warn("Unknown RIL command %u", code);
+ GWARN("Unknown RIL command %u", code);
}
/* All kinds of failures are mapped to RIL_E_GENERIC_FAILURE */
@@ -3326,23 +3378,8 @@
g_byte_array_set_size(buf, 0);
if (!decode || decode(reader, buf)) {
GRilIoTransport* transport = &self->parent;
- GRILIO_RESPONSE_TYPE type;
-
- switch (info->type) {
- default:
- DBG_(self, "Unexpected response type %u", info->type);
- type = GRILIO_RESPONSE_NONE;
- break;
- case RADIO_RESP_SOLICITED:
- type = GRILIO_RESPONSE_SOLICITED;
- break;
- case RADIO_RESP_SOLICITED_ACK:
- type = GRILIO_RESPONSE_SOLICITED_ACK;
- break;
- case RADIO_RESP_SOLICITED_ACK_EXP:
- type = GRILIO_RESPONSE_SOLICITED_ACK_EXP;
- break;
- }
+ GRILIO_RESPONSE_TYPE type = ril_binder_radio_convert_resp_type
+ (info->type);
if (type != GRILIO_RESPONSE_NONE) {
grilio_transport_signal_response(transport, type, info->serial,
@@ -3443,15 +3480,22 @@
GHashTable* args)
{
RilBinderRadioPriv* priv = self->priv;
- const char* modem = ril_binder_radio_arg_modem(args);
const char* dev = ril_binder_radio_arg_dev(args);
const char* name = ril_binder_radio_arg_name(args);
- DBG("%s %s %s", modem, dev, name);
-
- self->modem = priv->modem = g_strdup(modem);
+ GDEBUG("%s %s %s %s", self->parent.log_prefix,
+ ril_binder_radio_arg_modem(args), dev, name);
self->radio = radio_instance_new(dev, name);
if (self->radio) {
+ GBinderServiceManager* sm = gbinder_servicemanager_new(dev);
+
+ priv->oemhook = ril_binder_oemhook_new(sm, self->radio);
+ if (priv->oemhook) {
+ priv->oemhook_raw_response_id =
+ ril_binder_oemhook_add_raw_response_handler(priv->oemhook,
+ ril_binder_radio_handle_oemhook_raw_response, self);
+ }
+
priv->radio_event_id[RADIO_EVENT_INDICATION] =
radio_instance_add_indication_handler(self->radio, RADIO_IND_ANY,
ril_binder_radio_indication_handler, self);
|