mirror of
				https://github.com/mer-hybris/ofono-ril-binder-plugin
				synced 2025-11-04 06:45:34 +08:00 
			
		
		
		
	[rilbinderplugin] Initial commit. JB#42359
Not fully functional yet but good enough as a starting point.
This commit is contained in:
		
							
								
								
									
										2
									
								
								.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,2 @@
 | 
			
		||||
*~
 | 
			
		||||
build
 | 
			
		||||
							
								
								
									
										146
									
								
								Makefile
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										146
									
								
								Makefile
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,146 @@
 | 
			
		||||
# -*- Mode: makefile-gmake -*-
 | 
			
		||||
 | 
			
		||||
.PHONY: clean all release
 | 
			
		||||
 | 
			
		||||
#
 | 
			
		||||
# Required packages
 | 
			
		||||
#
 | 
			
		||||
# ofono.pc adds -export-symbols-regex linker option which doesn't  work
 | 
			
		||||
# on all platforms. 
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
LDPKGS = libgrilio libgbinder libglibutil gobject-2.0 glib-2.0
 | 
			
		||||
PKGS = ofono $(LDPKGS)
 | 
			
		||||
 | 
			
		||||
#
 | 
			
		||||
# Default target
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
all: debug release
 | 
			
		||||
 | 
			
		||||
#
 | 
			
		||||
# Library name
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
NAME = rilbinderplugin
 | 
			
		||||
LIB_NAME = $(NAME)
 | 
			
		||||
LIB_SONAME = $(LIB_NAME).so
 | 
			
		||||
LIB = $(LIB_SONAME)
 | 
			
		||||
 | 
			
		||||
#
 | 
			
		||||
# Sources
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
SRC = \
 | 
			
		||||
  ril-binder-oemhook-qcom.c \
 | 
			
		||||
  ril-binder-plugin.c \
 | 
			
		||||
  ril-binder-radio.c
 | 
			
		||||
 | 
			
		||||
#
 | 
			
		||||
# Directories
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
SRC_DIR = src
 | 
			
		||||
BUILD_DIR = build
 | 
			
		||||
DEBUG_BUILD_DIR = $(BUILD_DIR)/debug
 | 
			
		||||
RELEASE_BUILD_DIR = $(BUILD_DIR)/release
 | 
			
		||||
 | 
			
		||||
#
 | 
			
		||||
# Tools and flags
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
CC = $(CROSS_COMPILE)gcc
 | 
			
		||||
LD = $(CC)
 | 
			
		||||
WARNINGS = -Wall
 | 
			
		||||
BASE_FLAGS = -fPIC -fvisibility=hidden
 | 
			
		||||
FULL_CFLAGS = $(BASE_FLAGS) $(CFLAGS) $(DEFINES) $(WARNINGS) -MMD -MP \
 | 
			
		||||
  $(shell pkg-config --cflags $(PKGS))
 | 
			
		||||
FULL_LDFLAGS = $(BASE_FLAGS) $(LDFLAGS) -shared \
 | 
			
		||||
  $(shell pkg-config --libs $(LDPKGS))
 | 
			
		||||
DEBUG_FLAGS = -g
 | 
			
		||||
RELEASE_FLAGS =
 | 
			
		||||
 | 
			
		||||
ifndef KEEP_SYMBOLS
 | 
			
		||||
KEEP_SYMBOLS = 0
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
ifneq ($(KEEP_SYMBOLS),0)
 | 
			
		||||
RELEASE_FLAGS += -g
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
DEBUG_LDFLAGS = $(FULL_LDFLAGS) $(DEBUG_FLAGS)
 | 
			
		||||
RELEASE_LDFLAGS = $(FULL_LDFLAGS) $(RELEASE_FLAGS)
 | 
			
		||||
DEBUG_CFLAGS = $(FULL_CFLAGS) $(DEBUG_FLAGS) -DDEBUG
 | 
			
		||||
RELEASE_CFLAGS = $(FULL_CFLAGS) $(RELEASE_FLAGS) -O2
 | 
			
		||||
 | 
			
		||||
#
 | 
			
		||||
# Files
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
DEBUG_OBJS = $(SRC:%.c=$(DEBUG_BUILD_DIR)/%.o)
 | 
			
		||||
RELEASE_OBJS = $(SRC:%.c=$(RELEASE_BUILD_DIR)/%.o)
 | 
			
		||||
 | 
			
		||||
#
 | 
			
		||||
# Dependencies
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
DEPS = \
 | 
			
		||||
  $(DEBUG_OBJS:%.o=%.d) \
 | 
			
		||||
  $(RELEASE_OBJS:%.o=%.d)
 | 
			
		||||
ifneq ($(MAKECMDGOALS),clean)
 | 
			
		||||
ifneq ($(strip $(DEPS)),)
 | 
			
		||||
-include $(DEPS)
 | 
			
		||||
endif
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
$(DEBUG_OBJS) $(DEBUG_LIB): | $(DEBUG_BUILD_DIR)
 | 
			
		||||
$(RELEASE_OBJS) $(RELEASE_LIB): | $(RELEASE_BUILD_DIR)
 | 
			
		||||
 | 
			
		||||
#
 | 
			
		||||
# Rules
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
DEBUG_LIB = $(DEBUG_BUILD_DIR)/$(LIB)
 | 
			
		||||
RELEASE_LIB = $(RELEASE_BUILD_DIR)/$(LIB)
 | 
			
		||||
 | 
			
		||||
debug: $(DEBUG_LIB)
 | 
			
		||||
 | 
			
		||||
release: $(RELEASE_LIB)
 | 
			
		||||
 | 
			
		||||
clean:
 | 
			
		||||
	rm -f *~ $(SRC_DIR)/*~
 | 
			
		||||
	rm -fr $(BUILD_DIR) RPMS installroot
 | 
			
		||||
 | 
			
		||||
$(DEBUG_BUILD_DIR):
 | 
			
		||||
	mkdir -p $@
 | 
			
		||||
 | 
			
		||||
$(RELEASE_BUILD_DIR):
 | 
			
		||||
	mkdir -p $@
 | 
			
		||||
 | 
			
		||||
$(DEBUG_BUILD_DIR)/%.o : $(SRC_DIR)/%.c
 | 
			
		||||
	$(CC) -c $(DEBUG_CFLAGS) -MT"$@" -MF"$(@:%.o=%.d)" $< -o $@
 | 
			
		||||
 | 
			
		||||
$(RELEASE_BUILD_DIR)/%.o : $(SRC_DIR)/%.c
 | 
			
		||||
	$(CC) -c $(RELEASE_CFLAGS) -MT"$@" -MF"$(@:%.o=%.d)" $< -o $@
 | 
			
		||||
 | 
			
		||||
$(DEBUG_LIB): $(DEBUG_OBJS)
 | 
			
		||||
	$(LD) $(DEBUG_OBJS) $(DEBUG_LDFLAGS) -o $@
 | 
			
		||||
 | 
			
		||||
$(RELEASE_LIB): $(RELEASE_OBJS)
 | 
			
		||||
	$(LD) $(RELEASE_OBJS) $(RELEASE_LDFLAGS) -o $@
 | 
			
		||||
 | 
			
		||||
#
 | 
			
		||||
# Install
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
INSTALL_PERM  = 755
 | 
			
		||||
INSTALL = install
 | 
			
		||||
INSTALL_DIRS = $(INSTALL) -d
 | 
			
		||||
INSTALL_FILES = $(INSTALL) -m $(INSTALL_PERM)
 | 
			
		||||
INSTALL_LIB_DIR = $(DESTDIR)/usr/lib/ofono/plugins
 | 
			
		||||
 | 
			
		||||
install: $(INSTALL_LIB_DIR)
 | 
			
		||||
	$(INSTALL_FILES) $(RELEASE_LIB) $(INSTALL_LIB_DIR)
 | 
			
		||||
 | 
			
		||||
$(INSTALL_LIB_DIR):
 | 
			
		||||
	$(INSTALL_DIRS) $@
 | 
			
		||||
							
								
								
									
										2
									
								
								README
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								README
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,2 @@
 | 
			
		||||
Implements libgrilio transport which allows to use binder IPC
 | 
			
		||||
instead of RIL sockets.
 | 
			
		||||
							
								
								
									
										37
									
								
								rpm/ofono-ril-binder-plugin.spec
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										37
									
								
								rpm/ofono-ril-binder-plugin.spec
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,37 @@
 | 
			
		||||
Name: ofono-ril-binder-plugin
 | 
			
		||||
Version: 1.0.0
 | 
			
		||||
Release: 1
 | 
			
		||||
Summary: Ofono RIL binder transport plugin
 | 
			
		||||
Group: Development/Libraries
 | 
			
		||||
License: GPLv2
 | 
			
		||||
URL: https://git.merproject.org/mer-core/ofono-ril-binder-plugin
 | 
			
		||||
Source: %{name}-%{version}.tar.bz2
 | 
			
		||||
 | 
			
		||||
Requires: ofono >= 1.21+git28
 | 
			
		||||
Requires: libgrilio >= 1.0.25
 | 
			
		||||
BuildRequires: pkgconfig(libgbinder)
 | 
			
		||||
BuildRequires: pkgconfig(libgrilio) >= 1.0.25
 | 
			
		||||
BuildRequires: ofono-devel >= 1.21+git28
 | 
			
		||||
 | 
			
		||||
%define plugin_dir %{_libdir}/ofono/plugins
 | 
			
		||||
 | 
			
		||||
%description
 | 
			
		||||
This package contains ofono plugin which implements binder transport for RIL
 | 
			
		||||
 | 
			
		||||
%prep
 | 
			
		||||
%setup -q -n %{name}-%{version}
 | 
			
		||||
 | 
			
		||||
%build
 | 
			
		||||
make %{_smp_mflags} KEEP_SYMBOLS=1 release
 | 
			
		||||
 | 
			
		||||
%install
 | 
			
		||||
rm -rf %{buildroot}
 | 
			
		||||
%make_install
 | 
			
		||||
 | 
			
		||||
mkdir -p %{buildroot}/%{plugin_dir}
 | 
			
		||||
%preun
 | 
			
		||||
 | 
			
		||||
%files
 | 
			
		||||
%dir %{plugin_dir}
 | 
			
		||||
%defattr(-,root,root,-)
 | 
			
		||||
%{plugin_dir}/rilbinderplugin.so
 | 
			
		||||
							
								
								
									
										317
									
								
								src/ril-binder-oemhook-qcom.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										317
									
								
								src/ril-binder-oemhook-qcom.c
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,317 @@
 | 
			
		||||
/*
 | 
			
		||||
 * 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 name of Jolla Ltd 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-radio.h"
 | 
			
		||||
 | 
			
		||||
#include <ofono/log.h>
 | 
			
		||||
 | 
			
		||||
#include <gbinder.h>
 | 
			
		||||
#include <gutil_log.h>
 | 
			
		||||
#include <gutil_misc.h>
 | 
			
		||||
 | 
			
		||||
struct ril_binder_oemhook {
 | 
			
		||||
    char* name;
 | 
			
		||||
    char* fqname;
 | 
			
		||||
    RilBinderRadio* radio;
 | 
			
		||||
    GBinderClient* client;
 | 
			
		||||
    GBinderRemoteObject* remote;
 | 
			
		||||
    GBinderLocalObject* response;
 | 
			
		||||
    GBinderLocalObject* indication;
 | 
			
		||||
    gulong death_id;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#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")
 | 
			
		||||
 | 
			
		||||
#define DBG_(self,fmt,args...) DBG("%s " fmt, (self)->name, ##args)
 | 
			
		||||
 | 
			
		||||
/* android.hardware.radio.deprecated@1.0::IOemHook */
 | 
			
		||||
enum ril_binder_oemhook_req {
 | 
			
		||||
    /**
 | 
			
		||||
     * Set response functions for oem hook requests & oem hook indications.
 | 
			
		||||
     *
 | 
			
		||||
     * @param oemHookResponse Object containing response functions
 | 
			
		||||
     * @param oemHookIndication Object containing oem hook indications
 | 
			
		||||
     *
 | 
			
		||||
     * setResponseFunctions(IOemHookResponse oemHookResponse,
 | 
			
		||||
     *                      IOemHookIndication oemHookIndication);
 | 
			
		||||
     */
 | 
			
		||||
    OEMHOOK_REQ_SET_RESPONSE_FUNCTIONS = 1,
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * This request passes raw byte arrays between framework and vendor code.
 | 
			
		||||
     *
 | 
			
		||||
     * @param serial Serial number of request.
 | 
			
		||||
     * @param data data passed as raw bytes
 | 
			
		||||
     *
 | 
			
		||||
     * Response function is IOemHookResponse.sendRequestRawResponse()
 | 
			
		||||
     *
 | 
			
		||||
     * oneway sendRequestRaw(int32_t serial, vec<uint8_t> data);
 | 
			
		||||
     */
 | 
			
		||||
    OEMHOOK_REQ_SEND_REQUEST_RAW,
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * This request passes strings between framework and vendor code.
 | 
			
		||||
     *
 | 
			
		||||
     * @param serial Serial number of request.
 | 
			
		||||
     * @param data data passed as strings
 | 
			
		||||
     *
 | 
			
		||||
     * Response function is IOemHookResponse.sendRequestStringsResponse()
 | 
			
		||||
     *
 | 
			
		||||
     * oneway sendRequestStrings(int32_t serial, vec<string> data);
 | 
			
		||||
     */
 | 
			
		||||
    OEMHOOK_REQ_SEND_REQUEST_STRINGS
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
/* android.hardware.radio.deprecated@1.0::IOemHookIndication */
 | 
			
		||||
enum ril_binder_oemhook_ind {
 | 
			
		||||
   /**
 | 
			
		||||
    * This is for OEM specific use.
 | 
			
		||||
    *
 | 
			
		||||
    * @param type Type of radio indication
 | 
			
		||||
    * @param data data passed as raw bytes
 | 
			
		||||
    *
 | 
			
		||||
    * oneway oemHookRaw(RadioIndicationType type, vec<uint8_t> data);
 | 
			
		||||
    */
 | 
			
		||||
    OEMHOOK_IND_OEM_HOK_RAW = 1
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
static
 | 
			
		||||
void
 | 
			
		||||
ril_binder_oemhook_qcom_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;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static
 | 
			
		||||
void
 | 
			
		||||
ril_binder_oemhook_qcom_died(
 | 
			
		||||
    GBinderRemoteObject* obj,
 | 
			
		||||
    void* user_data)
 | 
			
		||||
{
 | 
			
		||||
    RilBinderOemHook* self = user_data;
 | 
			
		||||
 | 
			
		||||
    ofono_error("%s oemhook died", self->name);
 | 
			
		||||
    ril_binder_oemhook_qcom_drop_objects(self);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static
 | 
			
		||||
GBinderLocalReply*
 | 
			
		||||
ril_binder_oemhook_qcom_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)) {
 | 
			
		||||
        /* All these should be one-way transactions */
 | 
			
		||||
        GASSERT(flags & GBINDER_TX_FLAG_ONEWAY);
 | 
			
		||||
        DBG_(self, OEMHOOK_RESPONSE " %u", code);
 | 
			
		||||
        *status = GBINDER_STATUS_OK;
 | 
			
		||||
    } else {
 | 
			
		||||
        DBG_(self, "%s %u", iface, code);
 | 
			
		||||
        *status = GBINDER_STATUS_FAILED;
 | 
			
		||||
    }
 | 
			
		||||
    return NULL;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static
 | 
			
		||||
void
 | 
			
		||||
ril_binder_oemhook_qcom_handle_oem_hook_raw(
 | 
			
		||||
    RilBinderOemHook* self,
 | 
			
		||||
    GBinderReader* in)
 | 
			
		||||
{
 | 
			
		||||
    GBinderBuffer* buf = gbinder_reader_read_buffer(in);
 | 
			
		||||
 | 
			
		||||
    if (buf && buf->size == sizeof(RadioVector)) {
 | 
			
		||||
        const RadioVector* vec = buf->data;
 | 
			
		||||
 | 
			
		||||
        /* The contents comes in another buffer */
 | 
			
		||||
        gbinder_buffer_free(buf);
 | 
			
		||||
        buf = gbinder_reader_read_buffer(in);
 | 
			
		||||
 | 
			
		||||
        if (buf && buf->data == vec->data.ptr && buf->size == vec->count) {
 | 
			
		||||
            static struct ofono_debug_desc debug_desc OFONO_DEBUG_ATTR = {
 | 
			
		||||
                .file = __FILE__,
 | 
			
		||||
                .flags = OFONO_DEBUG_FLAG_DEFAULT,
 | 
			
		||||
            };
 | 
			
		||||
            if (debug_desc.flags & OFONO_DEBUG_FLAG_PRINT) {
 | 
			
		||||
                char hexbuf[GUTIL_HEXDUMP_BUFSIZE];
 | 
			
		||||
                const guint8* data = buf->data;
 | 
			
		||||
                char prefix = '>';
 | 
			
		||||
                guint off = 0;
 | 
			
		||||
 | 
			
		||||
                while (off < buf->size) {
 | 
			
		||||
                    off += gutil_hexdump(hexbuf, data + off, buf->size - off);
 | 
			
		||||
                    DBG_(self, "%c %s", prefix, hexbuf);
 | 
			
		||||
                    prefix = ' ';
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    gbinder_buffer_free(buf);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static
 | 
			
		||||
GBinderLocalReply*
 | 
			
		||||
ril_binder_oemhook_qcom_indication(
 | 
			
		||||
    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_INDICATION)) {
 | 
			
		||||
        GBinderReader reader;
 | 
			
		||||
        guint32 type;
 | 
			
		||||
 | 
			
		||||
        /* All these should be one-way */
 | 
			
		||||
        GASSERT(flags & GBINDER_TX_FLAG_ONEWAY);
 | 
			
		||||
 | 
			
		||||
        gbinder_remote_request_init_reader(req, &reader);
 | 
			
		||||
        if (gbinder_reader_read_uint32(&reader, &type) &&
 | 
			
		||||
            (type == IND_UNSOLICITED || type == IND_ACK_EXP)) {
 | 
			
		||||
            if (code == OEMHOOK_IND_OEM_HOK_RAW) {
 | 
			
		||||
                DBG_(self, OEMHOOK_INDICATION " %u oemHookRaw", code);
 | 
			
		||||
                ril_binder_oemhook_qcom_handle_oem_hook_raw(self, &reader);
 | 
			
		||||
            } else {
 | 
			
		||||
                DBG_(self, OEMHOOK_INDICATION " %u", code);
 | 
			
		||||
            }
 | 
			
		||||
            if (type == IND_ACK_EXP) {
 | 
			
		||||
                DBG_(self, "ack");
 | 
			
		||||
                ril_binder_radio_ack(self->radio);
 | 
			
		||||
            }
 | 
			
		||||
        } else {
 | 
			
		||||
            DBG_(self, OEMHOOK_INDICATION " %u", code);
 | 
			
		||||
            ofono_warn("Failed to decode indication %u", code);
 | 
			
		||||
        }
 | 
			
		||||
        *status = GBINDER_STATUS_OK;
 | 
			
		||||
    } else {
 | 
			
		||||
        DBG_(self, "%s %u", iface, code);
 | 
			
		||||
        *status = GBINDER_STATUS_FAILED;
 | 
			
		||||
    }
 | 
			
		||||
    return NULL;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
RilBinderOemHook*
 | 
			
		||||
ril_binder_oemhook_new_qcom(
 | 
			
		||||
    GBinderServiceManager* sm,
 | 
			
		||||
    RilBinderRadio* radio,
 | 
			
		||||
    const char* dev,
 | 
			
		||||
    const char* name)
 | 
			
		||||
{
 | 
			
		||||
    int status = 0;
 | 
			
		||||
    GBinderLocalRequest* req;
 | 
			
		||||
    GBinderRemoteReply* reply;
 | 
			
		||||
    RilBinderOemHook* self = g_new0(RilBinderOemHook, 1);
 | 
			
		||||
 | 
			
		||||
    /* Fetch remote reference from hwservicemanager */
 | 
			
		||||
    self->name = g_strdup(name);
 | 
			
		||||
    self->fqname = g_strconcat(OEMHOOK_REMOTE "/", name, NULL);
 | 
			
		||||
    self->remote = gbinder_servicemanager_get_service_sync(sm, self->fqname,
 | 
			
		||||
        &status);
 | 
			
		||||
    if (self->remote) {
 | 
			
		||||
        DBG_(self, "Connected to %s", self->fqname);
 | 
			
		||||
        /* get_service returns auto-released reference,
 | 
			
		||||
         * we need to add a reference of our own */
 | 
			
		||||
        gbinder_remote_object_ref(self->remote);
 | 
			
		||||
        self->radio = radio;
 | 
			
		||||
        self->client = gbinder_client_new(self->remote, OEMHOOK_REMOTE);
 | 
			
		||||
        self->death_id = gbinder_remote_object_add_death_handler(self->remote,
 | 
			
		||||
            ril_binder_oemhook_qcom_died, self);
 | 
			
		||||
        self->indication = gbinder_servicemanager_new_local_object(sm,
 | 
			
		||||
            OEMHOOK_INDICATION, ril_binder_oemhook_qcom_indication, self);
 | 
			
		||||
        self->response = gbinder_servicemanager_new_local_object(sm,
 | 
			
		||||
            OEMHOOK_RESPONSE, ril_binder_oemhook_qcom_response, self);
 | 
			
		||||
 | 
			
		||||
        /* IOemHook::setResponseFunctions */
 | 
			
		||||
        req = gbinder_client_new_request(self->client);
 | 
			
		||||
        gbinder_local_request_append_local_object(req, self->response);
 | 
			
		||||
        gbinder_local_request_append_local_object(req, self->indication);
 | 
			
		||||
        reply = gbinder_client_transact_sync_reply(self->client,
 | 
			
		||||
            OEMHOOK_REQ_SET_RESPONSE_FUNCTIONS, req, &status);
 | 
			
		||||
        DBG_(self, "setResponseFunctions status %d", status);
 | 
			
		||||
        gbinder_local_request_unref(req);
 | 
			
		||||
        gbinder_remote_reply_unref(reply);
 | 
			
		||||
 | 
			
		||||
        return self;
 | 
			
		||||
    }
 | 
			
		||||
    ril_binder_oemhook_free(self);
 | 
			
		||||
    return NULL;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
ril_binder_oemhook_free(
 | 
			
		||||
    RilBinderOemHook* self)
 | 
			
		||||
{
 | 
			
		||||
    if (self) {
 | 
			
		||||
        ril_binder_oemhook_qcom_drop_objects(self);
 | 
			
		||||
        gbinder_client_unref(self->client);
 | 
			
		||||
        g_free(self->fqname);
 | 
			
		||||
        g_free(self->name);
 | 
			
		||||
        g_free(self);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Local Variables:
 | 
			
		||||
 * mode: C
 | 
			
		||||
 * c-basic-offset: 4
 | 
			
		||||
 * indent-tabs-mode: nil
 | 
			
		||||
 * End:
 | 
			
		||||
 */
 | 
			
		||||
							
								
								
									
										59
									
								
								src/ril-binder-oemhook.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										59
									
								
								src/ril-binder-oemhook.h
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,59 @@
 | 
			
		||||
/*
 | 
			
		||||
 * 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 name of Jolla Ltd 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 "ril-binder-types.h"
 | 
			
		||||
 | 
			
		||||
#include <gbinder_types.h>
 | 
			
		||||
 | 
			
		||||
RilBinderOemHook*
 | 
			
		||||
ril_binder_oemhook_new_qcom(
 | 
			
		||||
    GBinderServiceManager* sm,
 | 
			
		||||
    RilBinderRadio* radio,
 | 
			
		||||
    const char* dev,
 | 
			
		||||
    const char* name);
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
ril_binder_oemhook_free(
 | 
			
		||||
    RilBinderOemHook* hook);
 | 
			
		||||
 | 
			
		||||
#endif /* RIL_BINDER_OEMHOOK_H */
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Local Variables:
 | 
			
		||||
 * mode: C
 | 
			
		||||
 * c-basic-offset: 4
 | 
			
		||||
 * indent-tabs-mode: nil
 | 
			
		||||
 * End:
 | 
			
		||||
 */
 | 
			
		||||
							
								
								
									
										91
									
								
								src/ril-binder-plugin.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										91
									
								
								src/ril-binder-plugin.c
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,91 @@
 | 
			
		||||
/*
 | 
			
		||||
 * 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 name of Jolla Ltd 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.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#define OFONO_API_SUBJECT_TO_CHANGE
 | 
			
		||||
#include <ofono/plugin.h>
 | 
			
		||||
#include <ofono/ril-transport.h>
 | 
			
		||||
#include <ofono/log.h>
 | 
			
		||||
 | 
			
		||||
#include "ril-binder-radio.h"
 | 
			
		||||
 | 
			
		||||
#define RIL_BINDER_DEFAULT_DEV  "/dev/hwbinder"
 | 
			
		||||
#define RIL_BINDER_DEFAULT_NAME "slot1"
 | 
			
		||||
 | 
			
		||||
static
 | 
			
		||||
struct grilio_transport*
 | 
			
		||||
ril_binder_transport_connect(
 | 
			
		||||
    GHashTable *args)
 | 
			
		||||
{
 | 
			
		||||
    const char* dev = g_hash_table_lookup(args, "dev");
 | 
			
		||||
    const char* name = g_hash_table_lookup(args, "name");
 | 
			
		||||
    const char* hook = g_hash_table_lookup(args, "oemhook");
 | 
			
		||||
 | 
			
		||||
    if (!dev) dev = RIL_BINDER_DEFAULT_DEV;
 | 
			
		||||
    if (!name) name = RIL_BINDER_DEFAULT_NAME;
 | 
			
		||||
    DBG("%s %s %s", dev, name, hook ? hook : "");
 | 
			
		||||
    return ril_binder_radio_new(dev, name, hook);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static const struct ofono_ril_transport ril_binder_transport = {
 | 
			
		||||
    .name = "binder",
 | 
			
		||||
    .api_version = OFONO_RIL_TRANSPORT_API_VERSION,
 | 
			
		||||
    .connect = ril_binder_transport_connect
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
static
 | 
			
		||||
int
 | 
			
		||||
ril_binder_plugin_init()
 | 
			
		||||
{
 | 
			
		||||
    ofono_info("Initializing RIL binder transport plugin.");
 | 
			
		||||
    ofono_ril_transport_register(&ril_binder_transport);
 | 
			
		||||
    return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static
 | 
			
		||||
void
 | 
			
		||||
ril_binder_plugin_exit()
 | 
			
		||||
{
 | 
			
		||||
    DBG("");
 | 
			
		||||
    ofono_ril_transport_unregister(&ril_binder_transport);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
OFONO_PLUGIN_DEFINE(ril_binder, "RIL binder transport plugin",
 | 
			
		||||
    OFONO_VERSION, OFONO_PLUGIN_PRIORITY_DEFAULT,
 | 
			
		||||
    ril_binder_plugin_init, ril_binder_plugin_exit)
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Local Variables:
 | 
			
		||||
 * mode: C
 | 
			
		||||
 * c-basic-offset: 4
 | 
			
		||||
 * indent-tabs-mode: nil
 | 
			
		||||
 * End:
 | 
			
		||||
 */
 | 
			
		||||
							
								
								
									
										3249
									
								
								src/ril-binder-radio.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3249
									
								
								src/ril-binder-radio.c
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										58
									
								
								src/ril-binder-radio.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										58
									
								
								src/ril-binder-radio.h
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,58 @@
 | 
			
		||||
/*
 | 
			
		||||
 * 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 name of Jolla Ltd 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_RADIO_H
 | 
			
		||||
#define RIL_BINDER_RADIO_H
 | 
			
		||||
 | 
			
		||||
#include "ril-binder-types.h"
 | 
			
		||||
 | 
			
		||||
#include <grilio_types.h>
 | 
			
		||||
 | 
			
		||||
GRilIoTransport*
 | 
			
		||||
ril_binder_radio_new(
 | 
			
		||||
    const char* dev,
 | 
			
		||||
    const char* name,
 | 
			
		||||
    const char* hook);
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
ril_binder_radio_ack(
 | 
			
		||||
    RilBinderRadio* radio);
 | 
			
		||||
 | 
			
		||||
#endif /* RIL_BINDER_RADIO_H */
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Local Variables:
 | 
			
		||||
 * mode: C
 | 
			
		||||
 * c-basic-offset: 4
 | 
			
		||||
 * indent-tabs-mode: nil
 | 
			
		||||
 * End:
 | 
			
		||||
 */
 | 
			
		||||
							
								
								
									
										86
									
								
								src/ril-binder-types.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										86
									
								
								src/ril-binder-types.h
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,86 @@
 | 
			
		||||
/*
 | 
			
		||||
 * 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 name of Jolla Ltd 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_TYPES_H
 | 
			
		||||
#define RIL_BINDER_TYPES_H
 | 
			
		||||
 | 
			
		||||
#include <gutil_types.h>
 | 
			
		||||
 | 
			
		||||
#define ALIGNED(x) __attribute__ ((aligned(x)))
 | 
			
		||||
 | 
			
		||||
typedef struct ril_binder_radio RilBinderRadio;
 | 
			
		||||
typedef struct ril_binder_oemhook RilBinderOemHook;
 | 
			
		||||
 | 
			
		||||
typedef struct radio_response_info {
 | 
			
		||||
    guint32 type;
 | 
			
		||||
    guint32 serial;
 | 
			
		||||
    guint32 error;
 | 
			
		||||
} RadioResponseInfo;
 | 
			
		||||
 | 
			
		||||
typedef enum radio_response_type {
 | 
			
		||||
    RESP_SOLICITED,
 | 
			
		||||
    RESP_SOLICITED_ACK,
 | 
			
		||||
    RESP_SOLICITED_ACK_EXP
 | 
			
		||||
} RadioResponseType;
 | 
			
		||||
 | 
			
		||||
typedef enum radio_indication_type {
 | 
			
		||||
    IND_UNSOLICITED,
 | 
			
		||||
    IND_ACK_EXP
 | 
			
		||||
} RadioIndicationType;
 | 
			
		||||
 | 
			
		||||
typedef struct radio_string {
 | 
			
		||||
    union {
 | 
			
		||||
        guint64 value;
 | 
			
		||||
        const char* str;
 | 
			
		||||
    } data;
 | 
			
		||||
    guint32 len;
 | 
			
		||||
    guint8 owns_buffer;
 | 
			
		||||
} ALIGNED(4) RadioString;
 | 
			
		||||
 | 
			
		||||
typedef struct radio_vector {
 | 
			
		||||
    union {
 | 
			
		||||
        guint64 value;
 | 
			
		||||
        const void* ptr;
 | 
			
		||||
    } data;
 | 
			
		||||
    guint32 count;
 | 
			
		||||
    guint8 owns_buffer;
 | 
			
		||||
} ALIGNED(4) RadioVector;
 | 
			
		||||
 | 
			
		||||
#endif /* RIL_BINDER_TYPES_H */
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Local Variables:
 | 
			
		||||
 * mode: C
 | 
			
		||||
 * c-basic-offset: 4
 | 
			
		||||
 * indent-tabs-mode: nil
 | 
			
		||||
 * End:
 | 
			
		||||
 */
 | 
			
		||||
		Reference in New Issue
	
	Block a user