qmimodem: Add support for QMI control point handling

This commit is contained in:
Marcel Holtmann 2012-06-21 15:18:36 -07:00
parent 5e3945fb32
commit 0e6fc7aee4
7 changed files with 1943 additions and 2 deletions

View File

@ -152,8 +152,12 @@ builtin_sources += plugins/u8500.c
endif
if QMIMODEM
qmi_sources = drivers/qmimodem/qmi.h drivers/qmimodem/qmi.c \
drivers/qmimodem/ctl.h
builtin_modules += qmimodem
builtin_sources += $(qmi_sources) \
drivers/qmimodem/util.h \
drivers/qmimodem/qmimodem.h \
drivers/qmimodem/qmimodem.c

55
drivers/qmimodem/ctl.h Normal file
View File

@ -0,0 +1,55 @@
/*
*
* oFono - Open Source Telephony
*
* Copyright (C) 2011-2012 Intel Corporation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#define QMI_CTL_SET_INSTANCE_ID 32 /* Set the unique link instance ID */
#define QMI_CTL_GET_VERSION_INFO 33 /* Get supported service version info */
#define QMI_CTL_GET_CLIENT_ID 34 /* Get a unique client ID */
#define QMI_CTL_RELEASE_CLIENT_ID 35 /* Release the unique client ID */
#define QMI_CTL_REVOKE_CLIENT_ID 36 /* Indication of client ID revocation */
#define QMI_CTL_INVALID_CLIENT_ID 37 /* Indication of invalid client ID */
#define QMI_CTL_SET_DATA_FORMAT 38 /* Set host driver data format */
#define QMI_CTL_SYNC 39 /* Synchronize client/server */
#define QMI_CTL_SET_EVENT 40 /* Set event report conditions */
#define QMI_CTL_SET_POWER_SAVE_CONFIG 41 /* Set power save config */
#define QMI_CTL_SET_POWER_SAVE_MODE 42 /* Set power save mode */
#define QMI_CTL_GET_POWER_SAVE_MODE 43 /* Get power save mode */
struct qmi_result_code {
uint16_t result;
uint16_t error;
} __attribute__ ((packed));
#define QMI_RESULT_CODE_SIZE 4
struct qmi_service_list {
uint8_t count;
struct {
uint8_t type;
uint16_t major;
uint16_t minor;
} __attribute__((__packed__)) services[0];
} __attribute__((__packed__));
#define QMI_SERVICE_LIST_SIZE 1
struct qmi_client_id {
uint8_t service;
uint8_t client;
} __attribute__ ((packed));
#define QMI_CLIENT_ID_SIZE 2

1681
drivers/qmimodem/qmi.c Normal file

File diff suppressed because it is too large Load Diff

143
drivers/qmimodem/qmi.h Normal file
View File

@ -0,0 +1,143 @@
/*
*
* oFono - Open Source Telephony
*
* Copyright (C) 2011-2012 Intel Corporation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#include <stdbool.h>
#include <stdint.h>
#define QMI_SERVICE_CONTROL 0 /* Control service */
#define QMI_SERVICE_WDS 1 /* Wireless data service */
#define QMI_SERVICE_DMS 2 /* Device management service */
#define QMI_SERVICE_NAS 3 /* Network access service */
#define QMI_SERVICE_QOS 4 /* Quality of service, error service */
#define QMI_SERVICE_WMS 5 /* Wireless messaging service */
#define QMI_SERVICE_PDS 6 /* Position determination service */
#define QMI_SERVICE_AUTH 7 /* Authentication service */
#define QMI_SERVICE_AT 8 /* AT command processor service */
#define QMI_SERVICE_VOICE 9 /* Voice service */
#define QMI_SERVICE_CAT 10 /* Card application toolkit service */
#define QMI_SERVICE_UIM 11 /* UIM service */
#define QMI_SERVICE_PBM 12 /* Phonebook service */
#define QMI_SERVICE_RMTFS 14 /* Remote file system service */
#define QMI_SERVICE_LOC 16 /* Location service */
#define QMI_SERVICE_SAR 17 /* Specific absorption rate service */
#define QMI_SERVICE_CSD 20 /* Core sound driver service */
#define QMI_SERVICE_EFS 21 /* Embedded file system service */
#define QMI_SERVICE_TS 23 /* Thermal sensors service */
#define QMI_SERVICE_TMD 24 /* Thermal mitigation device service */
#define QMI_SERVICE_CAT_OLD 224 /* Card application toolkit service */
#define QMI_SERVICE_RMS 225 /* Remote management service */
#define QMI_SERVICE_OMA 226 /* OMA device management service */
struct qmi_version {
uint8_t type;
uint16_t major;
uint16_t minor;
const char *name;
};
void qmi_free(void *ptr);
typedef void (*qmi_destroy_func_t)(void *user_data);
struct qmi_device;
typedef void (*qmi_debug_func_t)(const char *str, void *user_data);
typedef void (*qmi_shutdown_func_t)(void *user_data);
typedef void (*qmi_discover_func_t)(uint8_t count,
const struct qmi_version *list, void *user_data);
struct qmi_device *qmi_device_new(int fd);
struct qmi_device *qmi_device_ref(struct qmi_device *device);
void qmi_device_unref(struct qmi_device *device);
void qmi_device_set_debug(struct qmi_device *device,
qmi_debug_func_t func, void *user_data);
void qmi_device_set_close_on_unref(struct qmi_device *device, bool do_close);
bool qmi_device_discover(struct qmi_device *device, qmi_discover_func_t func,
void *user_data, qmi_destroy_func_t destroy);
bool qmi_device_shutdown(struct qmi_device *device, qmi_shutdown_func_t func,
void *user_data, qmi_destroy_func_t destroy);
struct qmi_param;
struct qmi_param *qmi_param_new(void);
void qmi_param_free(struct qmi_param *param);
bool qmi_param_append(struct qmi_param *param, uint8_t type,
uint16_t length, const void *data);
bool qmi_param_append_uint8(struct qmi_param *param, uint8_t type,
uint8_t value);
bool qmi_param_append_uint16(struct qmi_param *param, uint8_t type,
uint16_t value);
bool qmi_param_append_uint32(struct qmi_param *param, uint8_t type,
uint32_t value);
struct qmi_param *qmi_param_new_uint8(uint8_t type, uint8_t value);
struct qmi_param *qmi_param_new_uint16(uint8_t type, uint16_t value);
struct qmi_param *qmi_param_new_uint32(uint8_t type, uint32_t value);
struct qmi_result;
bool qmi_result_set_error(struct qmi_result *result, uint16_t *error);
const void *qmi_result_get(struct qmi_result *result, uint8_t type,
uint16_t *length);
char *qmi_result_get_string(struct qmi_result *result, uint8_t type);
bool qmi_result_get_uint8(struct qmi_result *result, uint8_t type,
uint8_t *value);
bool qmi_result_get_uint16(struct qmi_result *result, uint8_t type,
uint16_t *value);
bool qmi_result_get_uint32(struct qmi_result *result, uint8_t type,
uint32_t *value);
struct qmi_service;
typedef void (*qmi_result_func_t)(struct qmi_result *result, void *user_data);
typedef void (*qmi_create_func_t)(struct qmi_service *service, void *user_data);
bool qmi_service_create(struct qmi_device *device,
uint8_t type, qmi_create_func_t func,
void *user_data, qmi_destroy_func_t destroy);
struct qmi_service *qmi_service_ref(struct qmi_service *service);
void qmi_service_unref(struct qmi_service *service);
const char *qmi_service_get_identifier(struct qmi_service *service);
bool qmi_service_get_version(struct qmi_service *service,
uint16_t *major, uint16_t *minor);
unsigned int qmi_service_send(struct qmi_service *service,
uint16_t message, struct qmi_param *param,
qmi_result_func_t func,
void *user_data, qmi_destroy_func_t destroy);
unsigned int qmi_service_register(struct qmi_service *service,
uint16_t message, qmi_result_func_t func,
void *user_data, qmi_destroy_func_t destroy);
bool qmi_service_unregister_all(struct qmi_service *service);

View File

@ -2,7 +2,7 @@
*
* oFono - Open Source Telephony
*
* Copyright (C) 2008-2011 Intel Corporation. All rights reserved.
* Copyright (C) 2011-2012 Intel Corporation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as

View File

@ -2,7 +2,7 @@
*
* oFono - Open Source Telephony
*
* Copyright (C) 2008-2011 Intel Corporation. All rights reserved.
* Copyright (C) 2011-2012 Intel Corporation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
@ -19,3 +19,4 @@
*
*/
#include "util.h"

57
drivers/qmimodem/util.h Normal file
View File

@ -0,0 +1,57 @@
/*
*
* oFono - Open Source Telephony
*
* Copyright (C) 2011-2012 Intel Corporation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#include <glib.h>
struct cb_data {
void *cb;
void *data;
void *user;
};
static inline struct cb_data *cb_data_new(void *cb, void *data)
{
struct cb_data *ret;
ret = g_new0(struct cb_data, 1);
ret->cb = cb;
ret->data = data;
ret->user = NULL;
return ret;
}
#define CALLBACK_WITH_FAILURE(cb, args...) \
do { \
struct ofono_error cb_e; \
cb_e.type = OFONO_ERROR_TYPE_FAILURE; \
cb_e.error = 0; \
\
cb(&cb_e, ##args); \
} while (0) \
#define CALLBACK_WITH_SUCCESS(f, args...) \
do { \
struct ofono_error e; \
e.type = OFONO_ERROR_TYPE_NO_ERROR; \
e.error = 0; \
f(&e, ##args); \
} while (0)