mirror of git://git.sysmocom.de/ofono
Merge remote-tracking branch 'origin/master' into osmo-gsm-tester
This commit is contained in:
commit
2f74e7fc15
|
@ -668,7 +668,8 @@ doc_files = doc/overview.txt doc/ofono-paper.txt doc/release-faq.txt \
|
|||
doc/telit-modem.txt \
|
||||
doc/networkmonitor-api.txt \
|
||||
doc/allowed-apns-api.txt \
|
||||
doc/lte-api.txt
|
||||
doc/lte-api.txt \
|
||||
doc/cinterion-hardware-monitor-api.txt
|
||||
|
||||
|
||||
test_scripts = test/backtrace \
|
||||
|
|
|
@ -22,6 +22,7 @@ AC_DEFUN([COMPILER_FLAGS], [
|
|||
CFLAGS="$CFLAGS -Wmissing-declarations"
|
||||
CFLAGS="$CFLAGS -Wredundant-decls"
|
||||
CFLAGS="$CFLAGS -Wcast-align"
|
||||
CFLAGS="$CFLAGS -Wno-format-truncation"
|
||||
CFLAGS="$CFLAGS -DG_DISABLE_DEPRECATED"
|
||||
fi
|
||||
])
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
|
||||
HardwareMonitor hierarchy
|
||||
=========================
|
||||
|
||||
Service org.ofono
|
||||
Interface org.ofono.cinterion.HardwareMonitor
|
||||
Object path /{device0,device1,...}
|
||||
|
||||
Methods array{string,variant} GetStatistics
|
||||
|
||||
Returns an array of dict entries representing the
|
||||
current temperature and supply voltage of the modem.
|
||||
|
||||
Units:
|
||||
Temperature: Celsius
|
||||
Voltage: mV
|
|
@ -445,6 +445,7 @@ static void gprs_initialized(gboolean ok, GAtResult *result, gpointer user_data)
|
|||
FALSE, gprs, NULL);
|
||||
g_at_chat_send(gd->chat, "AT#PSNT=1", none_prefix,
|
||||
NULL, NULL, NULL);
|
||||
break;
|
||||
default:
|
||||
g_at_chat_register(gd->chat, "+CPSB:", cpsb_notify,
|
||||
FALSE, gprs, NULL);
|
||||
|
|
|
@ -283,7 +283,7 @@ static void setup_cb(gboolean ok, GAtResult *result, gpointer user_data)
|
|||
{
|
||||
struct ofono_gprs_context *gc = user_data;
|
||||
struct gprs_context_data *gcd = ofono_gprs_context_get_data(gc);
|
||||
char buf[128];
|
||||
char buf[384];
|
||||
|
||||
DBG("ok %d", ok);
|
||||
|
||||
|
|
|
@ -1026,6 +1026,23 @@ void qmi_device_set_close_on_unref(struct qmi_device *device, bool do_close)
|
|||
device->close_on_unref = do_close;
|
||||
}
|
||||
|
||||
void qmi_result_print_tlvs(struct qmi_result *result)
|
||||
{
|
||||
const void *ptr = result->data;
|
||||
uint16_t len = result->length;
|
||||
|
||||
while (len > QMI_TLV_HDR_SIZE) {
|
||||
const struct qmi_tlv_hdr *tlv = ptr;
|
||||
uint16_t tlv_length = GUINT16_FROM_LE(tlv->length);
|
||||
|
||||
DBG("tlv: 0x%02x len 0x%04x", tlv->type, tlv->length);
|
||||
|
||||
ptr += QMI_TLV_HDR_SIZE + tlv_length;
|
||||
len -= QMI_TLV_HDR_SIZE + tlv_length;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static const void *tlv_get(const void *data, uint16_t size,
|
||||
uint8_t type, uint16_t *length)
|
||||
{
|
||||
|
|
|
@ -136,7 +136,7 @@ bool qmi_result_get_uint32(struct qmi_result *result, uint8_t type,
|
|||
uint32_t *value);
|
||||
bool qmi_result_get_uint64(struct qmi_result *result, uint8_t type,
|
||||
uint64_t *value);
|
||||
|
||||
void qmi_result_print_tlvs(struct qmi_result *result);
|
||||
|
||||
struct qmi_service;
|
||||
|
||||
|
|
|
@ -411,7 +411,7 @@ static void get_routes_cb(struct qmi_result *result, void *user_data)
|
|||
new_list->count = GUINT16_TO_LE(1);
|
||||
new_list->route[0].msg_type = QMI_WMS_MSG_TYPE_P2P;
|
||||
new_list->route[0].msg_class = QMI_WMS_MSG_CLASS_NONE;
|
||||
new_list->route[0].storage_type = QMI_WMS_STORAGE_TYPE_NV;
|
||||
new_list->route[0].storage_type = QMI_WMS_STORAGE_TYPE_NONE;
|
||||
new_list->route[0].action = QMI_WMS_ACTION_TRANSFER_AND_ACK;
|
||||
|
||||
param = qmi_param_new();
|
||||
|
|
|
@ -62,6 +62,7 @@ struct qmi_wms_param_message {
|
|||
#define QMI_WMS_STORAGE_TYPE_UIM 0
|
||||
#define QMI_WMS_STORAGE_TYPE_NV 1
|
||||
#define QMI_WMS_STORAGE_TYPE_UNKNOWN 2
|
||||
#define QMI_WMS_STORAGE_TYPE_NONE 255
|
||||
|
||||
#define QMI_WMS_MESSAGE_MODE_GSMWCDMA 1
|
||||
|
||||
|
|
|
@ -267,7 +267,7 @@ static void setup_cb(gboolean ok, GAtResult *result, gpointer user_data)
|
|||
{
|
||||
struct ofono_gprs_context *gc = user_data;
|
||||
struct gprs_context_data *gcd = ofono_gprs_context_get_data(gc);
|
||||
char buf[128];
|
||||
char buf[384];
|
||||
|
||||
DBG("ok %d", ok);
|
||||
|
||||
|
|
|
@ -543,7 +543,7 @@ static void at_f_cb(GAtServer *server, GAtServerRequestType type,
|
|||
G_AT_SERVER_RESULT_ERROR);
|
||||
return;
|
||||
}
|
||||
/* intentional fallback here */
|
||||
/* fall through */
|
||||
|
||||
case G_AT_SERVER_REQUEST_TYPE_COMMAND_ONLY:
|
||||
/* default behavior on AT&F same as ATZ */
|
||||
|
|
|
@ -401,9 +401,11 @@ static enum rcr_result ipcp_client_rcr(struct ipcp_data *ipcp,
|
|||
break;
|
||||
|
||||
/*
|
||||
* Fall through, reject IP_ADDRESS if peer sends
|
||||
* us 0 (expecting us to provide its IP address)
|
||||
* Reject IP_ADDRESS if peer sends us 0 (expecting
|
||||
* us to provide its IP address)
|
||||
*/
|
||||
|
||||
/* fall through */
|
||||
default:
|
||||
if (options == NULL) {
|
||||
guint16 max_len = ntohs(packet->length) - 4;
|
||||
|
|
|
@ -189,9 +189,12 @@ static enum rcr_result ipv6cp_client_rcr(struct ipv6cp_data *ipv6cp,
|
|||
|
||||
if (ipv6cp->peer_addr != 0)
|
||||
break;
|
||||
|
||||
/*
|
||||
* Fall through, reject zero Interface ID
|
||||
* Reject zero Interface ID
|
||||
*/
|
||||
|
||||
/* fall through */
|
||||
default:
|
||||
if (options == NULL) {
|
||||
guint16 max_len = ntohs(packet->length) - 4;
|
||||
|
|
|
@ -29,8 +29,12 @@
|
|||
#include <glib.h>
|
||||
#include <gatchat.h>
|
||||
#include <gattty.h>
|
||||
#include <gdbus.h>
|
||||
|
||||
#include "ofono.h"
|
||||
|
||||
#define OFONO_API_SUBJECT_TO_CHANGE
|
||||
#include <ofono/dbus.h>
|
||||
#include <ofono/plugin.h>
|
||||
#include <ofono/log.h>
|
||||
#include <ofono/modem.h>
|
||||
|
@ -46,7 +50,17 @@
|
|||
#include <drivers/atmodem/atutil.h>
|
||||
#include <drivers/atmodem/vendor.h>
|
||||
|
||||
#define HARDWARE_MONITOR_INTERFACE OFONO_SERVICE ".cinterion.HardwareMonitor"
|
||||
|
||||
static const char *none_prefix[] = { NULL };
|
||||
static const char *sctm_prefix[] = { "^SCTM:", NULL };
|
||||
static const char *sbv_prefix[] = { "^SBV:", NULL };
|
||||
|
||||
struct gemalto_hardware_monitor {
|
||||
DBusMessage *msg;
|
||||
int32_t temperature;
|
||||
int32_t voltage;
|
||||
};
|
||||
|
||||
struct gemalto_data {
|
||||
GAtChat *app;
|
||||
|
@ -54,6 +68,7 @@ struct gemalto_data {
|
|||
struct ofono_sim *sim;
|
||||
gboolean have_sim;
|
||||
struct at_util_sim_state_query *sim_state_query;
|
||||
struct gemalto_hardware_monitor *hm;
|
||||
};
|
||||
|
||||
static int gemalto_probe(struct ofono_modem *modem)
|
||||
|
@ -142,6 +157,148 @@ static void cfun_enable(gboolean ok, GAtResult *result, gpointer user_data)
|
|||
NULL);
|
||||
}
|
||||
|
||||
static void gemalto_sctm_cb(gboolean ok, GAtResult *result, gpointer user_data)
|
||||
{
|
||||
struct gemalto_data *data = user_data;
|
||||
DBusMessage *reply;
|
||||
GAtResultIter iter;
|
||||
DBusMessageIter dbus_iter;
|
||||
DBusMessageIter dbus_dict;
|
||||
|
||||
if (data->hm->msg == NULL)
|
||||
return;
|
||||
|
||||
if (!ok)
|
||||
goto error;
|
||||
|
||||
g_at_result_iter_init(&iter, result);
|
||||
|
||||
if (!g_at_result_iter_next(&iter, "^SCTM:"))
|
||||
goto error;
|
||||
|
||||
if (!g_at_result_iter_skip_next(&iter))
|
||||
goto error;
|
||||
|
||||
if (!g_at_result_iter_skip_next(&iter))
|
||||
goto error;
|
||||
|
||||
if (!g_at_result_iter_next_number(&iter, &data->hm->temperature))
|
||||
goto error;
|
||||
|
||||
reply = dbus_message_new_method_return(data->hm->msg);
|
||||
|
||||
dbus_message_iter_init_append(reply, &dbus_iter);
|
||||
|
||||
dbus_message_iter_open_container(&dbus_iter, DBUS_TYPE_ARRAY,
|
||||
OFONO_PROPERTIES_ARRAY_SIGNATURE,
|
||||
&dbus_dict);
|
||||
|
||||
ofono_dbus_dict_append(&dbus_dict, "Temperature",
|
||||
DBUS_TYPE_INT32, &data->hm->temperature);
|
||||
|
||||
ofono_dbus_dict_append(&dbus_dict, "Voltage",
|
||||
DBUS_TYPE_UINT32, &data->hm->voltage);
|
||||
|
||||
dbus_message_iter_close_container(&dbus_iter, &dbus_dict);
|
||||
|
||||
__ofono_dbus_pending_reply(&data->hm->msg, reply);
|
||||
|
||||
return;
|
||||
|
||||
error:
|
||||
__ofono_dbus_pending_reply(&data->hm->msg,
|
||||
__ofono_error_failed(data->hm->msg));
|
||||
}
|
||||
|
||||
static void gemalto_sbv_cb(gboolean ok, GAtResult *result, gpointer user_data)
|
||||
{
|
||||
struct gemalto_data *data = user_data;
|
||||
GAtResultIter iter;
|
||||
|
||||
if (!ok)
|
||||
goto error;
|
||||
|
||||
g_at_result_iter_init(&iter, result);
|
||||
|
||||
if (!g_at_result_iter_next(&iter, "^SBV:"))
|
||||
goto error;
|
||||
|
||||
if (!g_at_result_iter_next_number(&iter, &data->hm->voltage))
|
||||
goto error;
|
||||
|
||||
if (g_at_chat_send(data->app, "AT^SCTM?", sctm_prefix, gemalto_sctm_cb,
|
||||
data, NULL) > 0)
|
||||
return;
|
||||
|
||||
error:
|
||||
__ofono_dbus_pending_reply(&data->hm->msg,
|
||||
__ofono_error_failed(data->hm->msg));
|
||||
}
|
||||
|
||||
static DBusMessage *hardware_monitor_get_statistics(DBusConnection *conn,
|
||||
DBusMessage *msg,
|
||||
void *user_data)
|
||||
{
|
||||
struct gemalto_data *data = user_data;
|
||||
|
||||
DBG("");
|
||||
|
||||
if (data->hm->msg != NULL)
|
||||
return __ofono_error_busy(msg);
|
||||
|
||||
if (!g_at_chat_send(data->app, "AT^SBV", sbv_prefix, gemalto_sbv_cb,
|
||||
data, NULL))
|
||||
return __ofono_error_failed(msg);
|
||||
|
||||
data->hm->msg = dbus_message_ref(msg);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static const GDBusMethodTable hardware_monitor_methods[] = {
|
||||
{ GDBUS_ASYNC_METHOD("GetStatistics",
|
||||
NULL, GDBUS_ARGS({ "Statistics", "a{sv}" }),
|
||||
hardware_monitor_get_statistics) },
|
||||
{}
|
||||
};
|
||||
|
||||
static void hardware_monitor_cleanup(void *user_data)
|
||||
{
|
||||
struct gemalto_data *data = user_data;
|
||||
struct gemalto_hardware_monitor *hm = data->hm;
|
||||
|
||||
g_free(hm);
|
||||
}
|
||||
|
||||
static int gemalto_hardware_monitor_enable(struct ofono_modem *modem)
|
||||
{
|
||||
struct gemalto_data *data = ofono_modem_get_data(modem);
|
||||
DBusConnection *conn = ofono_dbus_get_connection();
|
||||
const char *path = ofono_modem_get_path(modem);
|
||||
|
||||
DBG("");
|
||||
|
||||
/* Enable temperature output */
|
||||
g_at_chat_send(data->app, "AT^SCTM=0,1", none_prefix, NULL, NULL, NULL);
|
||||
|
||||
/* Create Hardware Monitor DBus interface */
|
||||
data->hm = g_try_new0(struct gemalto_hardware_monitor, 1);
|
||||
if (data->hm == NULL)
|
||||
return -EIO;
|
||||
|
||||
if (!g_dbus_register_interface(conn, path, HARDWARE_MONITOR_INTERFACE,
|
||||
hardware_monitor_methods, NULL, NULL,
|
||||
data, hardware_monitor_cleanup)) {
|
||||
ofono_error("Could not register %s interface under %s",
|
||||
HARDWARE_MONITOR_INTERFACE, path);
|
||||
g_free(data->hm);
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
ofono_modem_add_interface(modem, HARDWARE_MONITOR_INTERFACE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int gemalto_enable(struct ofono_modem *modem)
|
||||
{
|
||||
struct gemalto_data *data = ofono_modem_get_data(modem);
|
||||
|
@ -181,6 +338,8 @@ static int gemalto_enable(struct ofono_modem *modem)
|
|||
g_at_chat_send(data->app, "AT+CFUN=4", none_prefix,
|
||||
cfun_enable, modem, NULL);
|
||||
|
||||
gemalto_hardware_monitor_enable(modem);
|
||||
|
||||
return -EINPROGRESS;
|
||||
}
|
||||
|
||||
|
@ -203,12 +362,19 @@ static void gemalto_smso_cb(gboolean ok, GAtResult *result, gpointer user_data)
|
|||
static int gemalto_disable(struct ofono_modem *modem)
|
||||
{
|
||||
struct gemalto_data *data = ofono_modem_get_data(modem);
|
||||
DBusConnection *conn = ofono_dbus_get_connection();
|
||||
const char *path = ofono_modem_get_path(modem);
|
||||
|
||||
DBG("%p", modem);
|
||||
|
||||
g_at_chat_cancel_all(data->app);
|
||||
g_at_chat_unregister_all(data->app);
|
||||
|
||||
if (g_dbus_unregister_interface(conn, path,
|
||||
HARDWARE_MONITOR_INTERFACE))
|
||||
ofono_modem_remove_interface(modem,
|
||||
HARDWARE_MONITOR_INTERFACE);
|
||||
|
||||
/* Shutdown the modem */
|
||||
g_at_chat_send(data->app, "AT^SMSO", none_prefix, gemalto_smso_cb,
|
||||
modem, NULL);
|
||||
|
|
|
@ -365,7 +365,7 @@ static void get_rf_power_status_cb(struct ril_msg *message, gpointer user_data)
|
|||
}
|
||||
|
||||
power_status = parcel_r_string(&rilp);
|
||||
if (power_status == NULL || power_status == '\0')
|
||||
if (power_status == NULL || *power_status == '\0')
|
||||
return;
|
||||
|
||||
enabled = strtol(power_status, &endptr, 10);
|
||||
|
|
|
@ -127,6 +127,7 @@ static void set_power_by_mce_state(struct ofono_modem *modem,
|
|||
case MCE_NORMAL:
|
||||
if (isi->online_cbd)
|
||||
report_online(isi, mce_state == MCE_NORMAL);
|
||||
/* fall through */
|
||||
default:
|
||||
report_powered(modem, isi, TRUE);
|
||||
}
|
||||
|
|
|
@ -48,9 +48,9 @@ static const char *none_prefix[] = { NULL };
|
|||
|
||||
enum supported_models {
|
||||
SARA_G270 = 1102,
|
||||
TOBYL2_COMPATIBLE_MODE = 1141,
|
||||
TOBYL2_MEDIUM_THROUGHPUT_MODE = 1143,
|
||||
TOBYL2_HIGH_THROUGHPUT_MODE = 1146,
|
||||
TOBYL2_COMPATIBLE_MODE = 1141,
|
||||
TOBYL2_MEDIUM_THROUGHPUT_MODE = 1143,
|
||||
TOBYL2_HIGH_THROUGHPUT_MODE = 1146,
|
||||
};
|
||||
|
||||
struct ublox_data {
|
||||
|
@ -178,6 +178,7 @@ static int ublox_enable(struct ofono_modem *modem)
|
|||
break;
|
||||
case TOBYL2_MEDIUM_THROUGHPUT_MODE:
|
||||
DBG("low/medium throughtput profile unsupported");
|
||||
break;
|
||||
default:
|
||||
DBG("unknown ublox model id %d", data->model_id);
|
||||
return -EINVAL;
|
||||
|
|
19
src/gprs.c
19
src/gprs.c
|
@ -2006,6 +2006,12 @@ void ofono_gprs_cid_activated(struct ofono_gprs *gprs, unsigned int cid,
|
|||
return;
|
||||
}
|
||||
|
||||
if (strlen(apn) > OFONO_GPRS_MAX_APN_LENGTH
|
||||
|| is_valid_apn(apn) == FALSE) {
|
||||
ofono_error("Context activated with an invalid APN");
|
||||
return;
|
||||
}
|
||||
|
||||
pri_ctx = find_usable_context(gprs, apn);
|
||||
|
||||
if (!pri_ctx) {
|
||||
|
@ -2030,11 +2036,22 @@ void ofono_gprs_cid_activated(struct ofono_gprs *gprs, unsigned int cid,
|
|||
ofono_warn("Context activated for driver that doesn't support "
|
||||
"automatic context activation.");
|
||||
release_context(pri_ctx);
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* We weren't able to find a context with a matching APN and allocated
|
||||
* a brand new one instead. Set the APN accordingly
|
||||
*/
|
||||
if (strlen(pri_ctx->context.apn) == 0) {
|
||||
DBusConnection *conn = ofono_dbus_get_connection();
|
||||
pri_set_apn(pri_ctx, conn, NULL, apn);
|
||||
|
||||
strcpy(pri_ctx->context.apn, apn);
|
||||
|
||||
ofono_dbus_signal_property_changed(conn, pri_ctx->path,
|
||||
OFONO_CONNECTION_CONTEXT_INTERFACE,
|
||||
"AccessPointName",
|
||||
DBUS_TYPE_STRING, &apn);
|
||||
}
|
||||
|
||||
/* Prevent ofono_gprs_status_notify from changing the 'attached'
|
||||
|
|
|
@ -127,6 +127,7 @@ static void add_slash(char *dest, const char *src, int len_max, int len)
|
|||
case ';':
|
||||
case ',':
|
||||
dest[j++] = '\\';
|
||||
/* fall through */
|
||||
default:
|
||||
dest[j] = src[i];
|
||||
break;
|
||||
|
|
|
@ -856,9 +856,13 @@ static void radio_load_settings(struct ofono_radio_settings *rs,
|
|||
"GsmBand", rs->band_gsm);
|
||||
}
|
||||
|
||||
if (error) {
|
||||
g_error_free(error);
|
||||
error = NULL;
|
||||
}
|
||||
|
||||
rs->pending_band_gsm = rs->band_gsm;
|
||||
|
||||
error = NULL;
|
||||
rs->band_umts = g_key_file_get_integer(rs->settings, SETTINGS_GROUP,
|
||||
"UmtsBand", &error);
|
||||
|
||||
|
@ -868,9 +872,13 @@ static void radio_load_settings(struct ofono_radio_settings *rs,
|
|||
"UmtsBand", rs->band_umts);
|
||||
}
|
||||
|
||||
if (error) {
|
||||
g_error_free(error);
|
||||
error = NULL;
|
||||
}
|
||||
|
||||
rs->pending_band_umts = rs->band_umts;
|
||||
|
||||
error = NULL;
|
||||
rs->mode = g_key_file_get_integer(rs->settings, SETTINGS_GROUP,
|
||||
"TechnologyPreference", &error);
|
||||
|
||||
|
@ -880,6 +888,11 @@ static void radio_load_settings(struct ofono_radio_settings *rs,
|
|||
"TechnologyPreference", rs->mode);
|
||||
}
|
||||
|
||||
if (error) {
|
||||
g_error_free(error);
|
||||
error = NULL;
|
||||
}
|
||||
|
||||
DBG("TechnologyPreference: %d", rs->mode);
|
||||
DBG("GsmBand: %d", rs->band_gsm);
|
||||
DBG("UmtsBand: %d", rs->band_umts);
|
||||
|
|
|
@ -226,6 +226,9 @@ void sim_fs_notify_file_watches(struct sim_fs *fs, int id)
|
|||
struct ofono_sim_context *context = l->data;
|
||||
GSList *k;
|
||||
|
||||
if (context->file_watches == NULL)
|
||||
continue;
|
||||
|
||||
for (k = context->file_watches->items; k; k = k->next) {
|
||||
struct file_watch *w = k->data;
|
||||
ofono_sim_file_changed_cb_t notify = w->item.notify;
|
||||
|
|
|
@ -1443,8 +1443,10 @@ static void set_get_inkey_duration(struct stk_duration *duration,
|
|||
switch (duration->unit) {
|
||||
case STK_DURATION_TYPE_MINUTES:
|
||||
interval = (interval + 59) / 60;
|
||||
break;
|
||||
case STK_DURATION_TYPE_SECONDS:
|
||||
interval = (interval + 9) / 10;
|
||||
break;
|
||||
case STK_DURATION_TYPE_SECOND_TENTHS:
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -611,10 +611,11 @@ static DBusMessage *voicecall_hangup(DBusConnection *conn,
|
|||
}
|
||||
|
||||
/*
|
||||
* Fall through, we check if we have a single alerting,
|
||||
* dialing or active call and try to hang it up with
|
||||
* hangup_all or hangup_active
|
||||
* We check if we have a single alerting, dialing or activeo
|
||||
* call and try to hang it up with hangup_all or hangup_active
|
||||
*/
|
||||
|
||||
/* fall through */
|
||||
case CALL_STATUS_ACTIVE:
|
||||
if (single_call == TRUE && vc->driver->hangup_all != NULL) {
|
||||
vc->pending = dbus_message_ref(msg);
|
||||
|
|
Loading…
Reference in New Issue