[-]
[+]
|
Changed |
_service:tar_git:ofono.changes
|
|
[-]
[+]
|
Changed |
_service:tar_git:ofono.spec
^
|
|
[-]
[+]
|
Changed |
_service
^
|
@@ -1,7 +1,7 @@
<services>
<service name="tar_git">
<param name="url">https://github.com/sailfish-on-dontbeevil/ofono-new</param>
- <param name="branch">branch-1.28-qmi</param>
+ <param name="branch">branch-1.30-qmi</param>
<param name="token"/>
<param name="debian">N</param>
<param name="dumb">N</param>
|
[-]
[+]
|
Deleted |
_service:tar_git:ofono-1.28+pp7.tar.bz2/upstream/src/idmap.c
^
|
@@ -1,213 +0,0 @@
-/*
- *
- * oFono - Open Source Telephony
- *
- * Copyright (C) 2008-2011 Intel Corporation. All rights reserved.
- * Copyright (C) 2004 Red Hat, Inc. 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
- *
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <string.h>
-
-#include <glib.h>
-
-#include "idmap.h"
-
-#define BITS_PER_LONG (sizeof(unsigned long) * 8)
-
-struct idmap {
- unsigned long *bits;
- unsigned int size;
- unsigned int min;
- unsigned int max;
-};
-
-static inline int ffz(unsigned long word)
-{
- return __builtin_ctzl(~word);
-}
-
-/*
- * Stolen from linux kernel lib/find_next_bit.c
- */
-static unsigned int find_next_zero_bit(const unsigned long *addr,
- unsigned int size,
- unsigned int offset)
-{
- const unsigned long *p = addr + offset / BITS_PER_LONG;
- unsigned int result = offset & ~(BITS_PER_LONG-1);
- unsigned long tmp;
-
- if (offset >= size)
- return size;
-
- size -= result;
- offset %= BITS_PER_LONG;
-
- if (offset) {
- tmp = *(p++);
- tmp |= ~0UL >> (BITS_PER_LONG - offset);
-
- if (size < BITS_PER_LONG)
- goto found_first;
-
- if (~tmp)
- goto found_middle;
-
- size -= BITS_PER_LONG;
- result += BITS_PER_LONG;
- }
-
- while (size & ~(BITS_PER_LONG-1)) {
- if (~(tmp = *(p++)))
- goto found_middle;
-
- size -= BITS_PER_LONG;
- result += BITS_PER_LONG;
- }
-
- if (!size)
- return result;
-
- tmp = *p;
-
-found_first:
- tmp |= ~0UL << size;
-
- if (tmp == ~0UL) /* Are any bits zero? */
- return result + size; /* Nope. */
-
-found_middle:
- return result + ffz(tmp);
-}
-
-struct idmap *idmap_new_from_range(unsigned int min, unsigned int max)
-{
- struct idmap *ret = g_new0(struct idmap, 1);
- unsigned int size = max - min + 1;
-
- ret->bits = g_new0(unsigned long,
- (size + BITS_PER_LONG - 1) / BITS_PER_LONG);
- ret->size = size;
- ret->min = min;
- ret->max = max;
-
- return ret;
-}
-
-struct idmap *idmap_new(unsigned int size)
-{
- return idmap_new_from_range(1, size);
-}
-
-void idmap_free(struct idmap *idmap)
-{
- g_free(idmap->bits);
- g_free(idmap);
-}
-
-void idmap_put(struct idmap *idmap, unsigned int id)
-{
- unsigned int offset = (id - idmap->min) / BITS_PER_LONG;
-
- id -= idmap->min;
-
- if (id > idmap->size)
- return;
-
- id %= BITS_PER_LONG;
-
- idmap->bits[offset] &= ~(1UL << id);
-}
-
-unsigned int idmap_alloc(struct idmap *idmap)
-{
- unsigned int bit;
- unsigned int offset;
-
- bit = find_next_zero_bit(idmap->bits, idmap->size, 0);
-
- if (bit >= idmap->size)
- return idmap->max + 1;
-
- offset = bit / BITS_PER_LONG;
- idmap->bits[offset] |= 1UL << (bit % BITS_PER_LONG);
-
- return bit + idmap->min;
-}
-
-void idmap_take(struct idmap *idmap, unsigned int id)
-{
- unsigned int bit = id - idmap->min;
- unsigned int offset;
-
- if (bit >= idmap->size)
- return;
-
- offset = bit / BITS_PER_LONG;
- idmap->bits[offset] |= 1UL << (bit % BITS_PER_LONG);
-}
-
-int idmap_find(struct idmap *idmap, unsigned int id)
-{
- unsigned int bit = id - idmap->min;
- unsigned int offset;
-
- if (bit >= idmap->size)
- return 0;
-
- offset = bit / BITS_PER_LONG;
- return (idmap->bits[offset] & (1UL << (bit % BITS_PER_LONG))) != 0;
-}
-
-/*
- * Allocate the next bit skipping the ids up to and including last. If there
- * is no free ids until the max id is encountered, the counter is wrapped back
- * to min and the search starts again.
- */
-unsigned int idmap_alloc_next(struct idmap *idmap, unsigned int last)
-{
- unsigned int bit;
- unsigned int offset;
-
- if (last < idmap->min || last > idmap->max)
- return idmap->max + 1;
-
- bit = find_next_zero_bit(idmap->bits, idmap->size,
- last - idmap->min + 1);
-
- if (bit >= idmap->size)
- return idmap_alloc(idmap);
-
- offset = bit / BITS_PER_LONG;
|
[-]
[+]
|
Deleted |
_service:tar_git:ofono-1.28+pp7.tar.bz2/upstream/src/idmap.h
^
|
@@ -1,33 +0,0 @@
-/*
- *
- * oFono - Open Source Telephony
- *
- * Copyright (C) 2008-2011 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
- *
- */
-
-struct idmap;
-
-struct idmap *idmap_new(unsigned int size);
-void idmap_free(struct idmap *idmap);
-void idmap_put(struct idmap *idmap, unsigned int id);
-void idmap_take(struct idmap *idmap, unsigned int id);
-int idmap_find(struct idmap *idmap, unsigned int id);
-unsigned int idmap_alloc(struct idmap *idmap);
-unsigned int idmap_alloc_next(struct idmap *idmap, unsigned int last);
-struct idmap *idmap_new_from_range(unsigned int min, unsigned int max);
-unsigned int idmap_get_min(struct idmap *idmap);
-unsigned int idmap_get_max(struct idmap *idmap);
|
[-]
[+]
|
Deleted |
_service:tar_git:ofono-1.28+pp7.tar.bz2/upstream/unit/test-idmap.c
^
|
@@ -1,121 +0,0 @@
-/*
- *
- * oFono - Open Source Telephony
- *
- * Copyright (C) 2008-2011 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
- *
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <glib.h>
-
-#include "idmap.h"
-
-static void test_alloc(void)
-{
- struct idmap *idmap;
- unsigned int bit;
-
- idmap = idmap_new(2);
-
- g_assert(idmap);
- g_assert(idmap_get_min(idmap) == 1);
-
- bit = idmap_alloc(idmap);
- g_assert(bit == 1);
- g_assert(idmap_find(idmap, bit));
- g_assert(!idmap_find(idmap, idmap_get_max(idmap) + 1));
-
- bit = idmap_alloc(idmap);
- g_assert(bit == 2);
-
- bit = idmap_alloc(idmap);
- g_assert(bit == 3);
-
- idmap_put(idmap, 3);
- bit = idmap_alloc(idmap);
- g_assert(bit == 3);
-
- idmap_put(idmap, 0);
- bit = idmap_alloc(idmap);
- g_assert(bit == 3);
-
- idmap_put(idmap, 1);
- bit = idmap_alloc(idmap);
- g_assert(bit == 1);
-
- idmap_put(idmap, 1);
- idmap_put(idmap, 2);
- bit = idmap_alloc(idmap);
- g_assert(bit == 1);
-
- idmap_put(idmap, 1);
- idmap_take(idmap, 1);
- idmap_take(idmap, 3);
- bit = idmap_alloc(idmap);
- g_assert(bit == 2);
-
- idmap_free(idmap);
-}
-
-static void test_alloc_next(void)
-{
- struct idmap *idmap;
- unsigned int bit;
-
- idmap = idmap_new(256);
-
- g_assert(idmap);
-
- bit = idmap_alloc_next(idmap, 255);
- g_assert(bit == 256);
-
- bit = idmap_alloc_next(idmap, 255);
- g_assert(bit == 1);
-
- while (idmap_alloc(idmap) < (sizeof(unsigned long) * 8) + 1);
- bit = idmap_alloc_next(idmap, 1);
- g_assert(bit == (sizeof(unsigned long) * 8) + 2);
-
- idmap_free(idmap);
-
- idmap = idmap_new(2);
-
- g_assert(idmap);
- g_assert(idmap_alloc_next(idmap, 0) == 3);
- g_assert(idmap_alloc_next(idmap, 3) == 3);
-
- bit = idmap_alloc_next(idmap, 1);
- g_assert(bit == 2);
-
- bit = idmap_alloc_next(idmap, 2);
- g_assert(bit == 1);
-
- idmap_free(idmap);
-}
-
-int main(int argc, char **argv)
-{
- g_test_init(&argc, &argv, NULL);
-
- g_test_add_func("/testidmap/alloc", test_alloc);
- g_test_add_func("/testidmap/alloc_next", test_alloc_next);
-
- return g_test_run();
-}
|
[-]
[+]
|
Added |
_service:tar_git:ofono-1.30+pp1.tar.bz2/linux/gpio.h
^
|
@@ -0,0 +1,158 @@
+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
+/*
+ * <linux/gpio.h> - userspace ABI for the GPIO character devices
+ *
+ * Copyright (C) 2016 Linus Walleij
+ *
+ * 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.
+ */
+#ifndef _GPIO_H_
+#define _GPIO_H_
+
+#include <linux/ioctl.h>
+#include <linux/types.h>
+
+/**
+ * struct gpiochip_info - Information about a certain GPIO chip
+ * @name: the Linux kernel name of this GPIO chip
+ * @label: a functional name for this GPIO chip, such as a product
+ * number, may be NULL
+ * @lines: number of GPIO lines on this chip
+ */
+struct gpiochip_info {
+ char name[32];
+ char label[32];
+ __u32 lines;
+};
+
+/* Informational flags */
+#define GPIOLINE_FLAG_KERNEL (1UL << 0) /* Line used by the kernel */
+#define GPIOLINE_FLAG_IS_OUT (1UL << 1)
+#define GPIOLINE_FLAG_ACTIVE_LOW (1UL << 2)
+#define GPIOLINE_FLAG_OPEN_DRAIN (1UL << 3)
+#define GPIOLINE_FLAG_OPEN_SOURCE (1UL << 4)
+
+/**
+ * struct gpioline_info - Information about a certain GPIO line
+ * @line_offset: the local offset on this GPIO device, fill this in when
+ * requesting the line information from the kernel
+ * @flags: various flags for this line
+ * @name: the name of this GPIO line, such as the output pin of the line on the
+ * chip, a rail or a pin header name on a board, as specified by the gpio
+ * chip, may be NULL
+ * @consumer: a functional name for the consumer of this GPIO line as set by
+ * whatever is using it, will be NULL if there is no current user but may
+ * also be NULL if the consumer doesn't set this up
+ */
+struct gpioline_info {
+ __u32 line_offset;
+ __u32 flags;
+ char name[32];
+ char consumer[32];
+};
+
+/* Maximum number of requested handles */
+#define GPIOHANDLES_MAX 64
+
+/* Linerequest flags */
+#define GPIOHANDLE_REQUEST_INPUT (1UL << 0)
+#define GPIOHANDLE_REQUEST_OUTPUT (1UL << 1)
+#define GPIOHANDLE_REQUEST_ACTIVE_LOW (1UL << 2)
+#define GPIOHANDLE_REQUEST_OPEN_DRAIN (1UL << 3)
+#define GPIOHANDLE_REQUEST_OPEN_SOURCE (1UL << 4)
+
+/**
+ * struct gpiohandle_request - Information about a GPIO handle request
+ * @lineoffsets: an array of desired lines, specified by offset index for the
+ * associated GPIO device
+ * @flags: desired flags for the desired GPIO lines, such as
+ * GPIOHANDLE_REQUEST_OUTPUT, GPIOHANDLE_REQUEST_ACTIVE_LOW etc, OR:ed
+ * together. Note that even if multiple lines are requested, the same flags
+ * must be applicable to all of them, if you want lines with individual
+ * flags set, request them one by one. It is possible to select
+ * a batch of input or output lines, but they must all have the same
+ * characteristics, i.e. all inputs or all outputs, all active low etc
+ * @default_values: if the GPIOHANDLE_REQUEST_OUTPUT is set for a requested
+ * line, this specifies the default output value, should be 0 (low) or
+ * 1 (high), anything else than 0 or 1 will be interpreted as 1 (high)
+ * @consumer_label: a desired consumer label for the selected GPIO line(s)
+ * such as "my-bitbanged-relay"
+ * @lines: number of lines requested in this request, i.e. the number of
+ * valid fields in the above arrays, set to 1 to request a single line
+ * @fd: if successful this field will contain a valid anonymous file handle
+ * after a GPIO_GET_LINEHANDLE_IOCTL operation, zero or negative value
+ * means error
+ */
+struct gpiohandle_request {
+ __u32 lineoffsets[GPIOHANDLES_MAX];
+ __u32 flags;
+ __u8 default_values[GPIOHANDLES_MAX];
+ char consumer_label[32];
+ __u32 lines;
+ int fd;
+};
+
+/**
+ * struct gpiohandle_data - Information of values on a GPIO handle
+ * @values: when getting the state of lines this contains the current
+ * state of a line, when setting the state of lines these should contain
+ * the desired target state
+ */
+struct gpiohandle_data {
+ __u8 values[GPIOHANDLES_MAX];
+};
+
+#define GPIOHANDLE_GET_LINE_VALUES_IOCTL _IOWR(0xB4, 0x08, struct gpiohandle_data)
+#define GPIOHANDLE_SET_LINE_VALUES_IOCTL _IOWR(0xB4, 0x09, struct gpiohandle_data)
+
+/* Eventrequest flags */
+#define GPIOEVENT_REQUEST_RISING_EDGE (1UL << 0)
+#define GPIOEVENT_REQUEST_FALLING_EDGE (1UL << 1)
+#define GPIOEVENT_REQUEST_BOTH_EDGES ((1UL << 0) | (1UL << 1))
+
+/**
+ * struct gpioevent_request - Information about a GPIO event request
+ * @lineoffset: the desired line to subscribe to events from, specified by
+ * offset index for the associated GPIO device
+ * @handleflags: desired handle flags for the desired GPIO line, such as
+ * GPIOHANDLE_REQUEST_ACTIVE_LOW or GPIOHANDLE_REQUEST_OPEN_DRAIN
+ * @eventflags: desired flags for the desired GPIO event line, such as
+ * GPIOEVENT_REQUEST_RISING_EDGE or GPIOEVENT_REQUEST_FALLING_EDGE
+ * @consumer_label: a desired consumer label for the selected GPIO line(s)
+ * such as "my-listener"
+ * @fd: if successful this field will contain a valid anonymous file handle
+ * after a GPIO_GET_LINEEVENT_IOCTL operation, zero or negative value
+ * means error
+ */
+struct gpioevent_request {
+ __u32 lineoffset;
+ __u32 handleflags;
+ __u32 eventflags;
+ char consumer_label[32];
+ int fd;
+};
+
+/**
+ * GPIO event types
+ */
+#define GPIOEVENT_EVENT_RISING_EDGE 0x01
+#define GPIOEVENT_EVENT_FALLING_EDGE 0x02
+
+/**
+ * struct gpioevent_data - The actual event being pushed to userspace
+ * @timestamp: best estimate of time of event occurrence, in nanoseconds
+ * @id: event identifier
+ */
+struct gpioevent_data {
+ __u64 timestamp;
+ __u32 id;
+};
+
+#define GPIO_GET_CHIPINFO_IOCTL _IOR(0xB4, 0x01, struct gpiochip_info)
+#define GPIO_GET_LINEINFO_IOCTL _IOWR(0xB4, 0x02, struct gpioline_info)
+#define GPIO_GET_LINEHANDLE_IOCTL _IOWR(0xB4, 0x03, struct gpiohandle_request)
+#define GPIO_GET_LINEEVENT_IOCTL _IOWR(0xB4, 0x04, struct gpioevent_request)
+
+#endif /* _GPIO_H_ */
|
[-]
[+]
|
Added |
_service:tar_git:ofono-1.30+pp1.tar.bz2/linux/gsmmux.h
^
|
@@ -0,0 +1,41 @@
+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
+#ifndef _LINUX_GSMMUX_H
+#define _LINUX_GSMMUX_H
+
+#include <linux/if.h>
+#include <linux/ioctl.h>
+#include <linux/types.h>
+
+struct gsm_config
+{
+ unsigned int adaption;
+ unsigned int encapsulation;
+ unsigned int initiator;
+ unsigned int t1;
+ unsigned int t2;
+ unsigned int t3;
+ unsigned int n2;
+ unsigned int mru;
+ unsigned int mtu;
+ unsigned int k;
+ unsigned int i;
+ unsigned int unused[8]; /* Padding for expansion without
+ breaking stuff */
+};
+
+#define GSMIOC_GETCONF _IOR('G', 0, struct gsm_config)
+#define GSMIOC_SETCONF _IOW('G', 1, struct gsm_config)
+
+struct gsm_netconfig {
+ unsigned int adaption; /* Adaption to use in network mode */
+ unsigned short protocol;/* Protocol to use - only ETH_P_IP supported */
+ unsigned short unused2;
+ char if_name[IFNAMSIZ]; /* interface name format string */
+ __u8 unused[28]; /* For future use */
+};
+
+#define GSMIOC_ENABLE_NET _IOW('G', 2, struct gsm_netconfig)
+#define GSMIOC_DISABLE_NET _IO('G', 3)
+
+
+#endif
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/ofono/.gitignore
^
|
@@ -36,7 +36,6 @@
test-suite.log
unit/test-common
unit/test-util
-unit/test-idmap
unit/test-sms
unit/test-sms-root
unit/test-simutil
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/ofono/AUTHORS
^
|
@@ -126,6 +126,7 @@
Jonas Bonn <jonas@southpole.se>
Matthijs Kooijman <matthijs@stdin.nl>
Clayton Craft <clayton@craftyguy.net>
+Alexander Couzens <lynxis@fe80.eu>
Joey Hewitt <joey@joeyhewitt.com>
Richard Röjfors <richard.rojfors@gmail.com>
Philippe De Swert <philippe.deswert@nomovok.com>
@@ -139,5 +140,8 @@
Julien Tournier <tournier.julien@gmail.com>
Nandini Rebello <nandini.rebello@intel.com>
Giacinto Cifelli <gciofono@gmail.com>
+Pau Espin Pedrol <pespin@sysmocom.de>
Khaled Romdhani <khaledromdhani216@gmail.com>
Pavel Machek <pavel@ucw.cz>
+Tom Nguyen <tomirq@earthlink.net>
+Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/ofono/ChangeLog
^
|
@@ -1,3 +1,15 @@
+ver 1.30:
+ Fix issue with handling of IPv6 address and xmm7xxx modems.
+ Fix issue with default context creation with an empty APN.
+ Fix issue with activation of context with CID zero.
+ Add support for Quectel MC60 modems.
+
+ver 1.29:
+ Fix issue with QMI and SIM initialized notification.
+ Add support for multiple PDP contexts and xmm7xxx modems.
+ Add support for handling Dual SIM Single Active feature
+ Add support for SIM PIN caching feature.
+
ver 1.28:
Fix issue with SIM initialization and Gemalto modems.
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/ofono/Makefile.am
^
|
@@ -269,6 +269,7 @@
drivers/atmodem/cbs.c \
drivers/atmodem/call-forwarding.c \
drivers/atmodem/call-meter.c \
+ drivers/atmodem/network-registration.h \
drivers/atmodem/network-registration.c \
drivers/atmodem/sim.c \
drivers/atmodem/stk.c \
@@ -407,6 +408,7 @@
drivers/ubloxmodem/ubloxmodem.h \
drivers/ubloxmodem/ubloxmodem.c \
drivers/ubloxmodem/gprs-context.c \
+ drivers/ubloxmodem/network-registration.c \
drivers/ubloxmodem/netmon.c \
drivers/ubloxmodem/lte.c
@@ -698,7 +700,8 @@
sbin_PROGRAMS = src/ofonod
-src_ofonod_SOURCES = $(builtin_sources) $(gatchat_sources) src/ofono.ver \
+src_ofonod_SOURCES = $(builtin_sources) $(gatchat_sources) \
+ linux/gsmmux.h linux/gpio.h src/ofono.ver \
src/main.c src/ofono.h src/log.c src/plugin.c \
src/modem.c src/common.h src/common.c \
src/manager.c src/dbus.c src/util.h src/util.c \
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/ofono/configure.ac
^
|
@@ -1,5 +1,5 @@
AC_PREREQ(2.60)
-AC_INIT(ofono, 1.28)
+AC_INIT(ofono, 1.30)
AM_INIT_AUTOMAKE([foreign subdir-objects color-tests])
AC_CONFIG_HEADERS(config.h)
@@ -55,6 +55,8 @@
fi
])
+AC_CHECK_FUNCS(explicit_bzero)
+
AC_CHECK_FUNC(signalfd, dummy=yes,
AC_MSG_ERROR(signalfd support is required))
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/ofono/doc/networkmonitor-api.txt
^
|
@@ -22,6 +22,23 @@
are available, their valid value ranges and
applicability to different cell types.
+ a{a{sv}} GetNeighbouringCellsInformation()
+
+ Requests the neighbouring cells information and basic
+ measurements from oFono. The returned value is a
+ dictionary with the possible key / values documented
+ below. The type of cell is given by the 'Technology'
+ property.
+
+ Based on the type of cell, the dictionary will contain
+ additional key/value pairs. If a given key/value pair
+ is not present, then it is not known or unsupported
+ by the underlying driver.
+
+ Refer to the sections below for which property types
+ are available, their valid value ranges and
+ applicability to different cell types.
+
void RegisterAgent(object path)
Registers an agent which will be called whenever the
|
[-]
[+]
|
Added |
_service:tar_git:ofono-1.30+pp1.tar.bz2/ofono/doc/quectel-hardware-api.txt
^
|
@@ -0,0 +1,51 @@
+Hardware hierarchy
+==================
+
+Service org.ofono
+Interface org.ofono.quectel.Hardware
+Object path /{device0,device1,...}
+
+Methods array{string,variant} GetProperties
+
+ Returns hardware properties for the modem object. See
+ the properties section for available properties.
+
+Signals PowerDown(string reason)
+
+ This signal is emitted on gracefull shutdowns initiated
+ by the modem.
+
+ Possible reasons:
+ "VoltageLow" The supply voltage is too low
+ "Normal" The PWRKEY pin was asserted
+ "VoltageHigh" The supply voltage is too high
+
+ PowerWarning(string reason)
+
+ This signal is emitted when the modem detects its supply
+ voltage is close to its supported limits.
+
+ Possible reasons:
+ "VoltageLow" The supply voltage is low
+ "VoltageHigh" The supply voltage is high
+
+Properties int32 Voltage [readonly]
+
+ Integer with the modem supply voltage in mV.
+
+ int32 ChargeStatus [readonly,optional]
+
+ Integer with one of either:
+
+ 0: Modem is not charging
+ 1: Modem is charging
+ 2: Charging is finished
+
+ This property is available on UC15
+
+ int32 ChargeLevel [readonly,optional]
+
+ Integer representing the battery charge level in
+ percent (from 0 to 100).
+
+ This property is available on UC15
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/ofono/doc/radio-settings-api.txt
^
|
@@ -44,6 +44,12 @@
"gsm" Only GSM used for radio access.
"umts" Only UMTS used for radio access.
"lte" Only LTE used for radio access.
+ "umts,gsm" Dual mode operation with UMTS
+ and GSM radio access whith preference
+ for UMTS.
+ "lte,umts" Dual mode operation with LTE
+ and UMTS radio access with preference
+ for LTE.
array{string} AvailableTechnologies [readonly, optional]
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/ofono/doc/sim-api.txt
^
|
@@ -205,3 +205,15 @@
Contains the SIM's ImsPrivateIdentity, read from the
ISIM.
+
+ uint32 CardSlotCount [readonly, experimental]
+
+ Contains the count of number of SIM card slots available.
+
+ uint32 ActiveCardSlot [readwrite, experimental]
+
+ Contains the index of the currently active SIM card slot
+ for dual SIM single active mode.
+
+ This property will range from 1 (default) to
+ CardSlotCount (max) value.
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/ofono/drivers/atmodem/atutil.c
^
|
@@ -24,15 +24,17 @@
#include <config.h>
#endif
-#include <glib.h>
-#include <gatchat.h>
#include <string.h>
#include <stdlib.h>
#include <errno.h>
+#include <glib.h>
+#include <gattty.h>
+
#define OFONO_API_SUBJECT_TO_CHANGE
#include <ofono/log.h>
#include <ofono/types.h>
+#include <ofono/modem.h>
#include <drivers/common/call_list.h>
@@ -619,6 +621,45 @@
return ret;
}
+/*
+ * CGCONTRDP returns addr + netmask in the same string in the form
+ * of "a1.a2.a3.a4.a5.a6.a7.a8.a9.a10.a11.a12.a13.a14.a15.a16.m1.m2.
+ * m3.m4.m5.m6.m7.m8.m9.m10.m11.m12.m13.m14.m15.m16" for IPv6.
+ * address/netmask must be able to hold 64 characters.
+ */
+int at_util_get_ipv6_address_and_netmask(const char *addrnetmask,
+ char *address, char *netmask)
+{
+ const char *s = addrnetmask;
+ const char *net = NULL;
+
+ int ret = -EINVAL;
+ int i;
+
+ /* Count 31 dots for ipv6, less or more means error. */
+ for (i = 0; i < 33; i++, s++) {
+ s = strchr(s, '.');
+
+ if (!s)
+ break;
+
+ if (i == 15) {
+ /* set netmask ptr and break the string */
+ net = s + 1;
+ }
+ }
+
+ if (i == 31) {
+ memcpy(address, addrnetmask, net - addrnetmask);
+ address[net - addrnetmask - 1] = '\0';
+ strcpy(netmask, net);
+
+ ret = 0;
+ }
+
+ return ret;
+}
+
int at_util_gprs_auth_method_to_auth_prot(
enum ofono_gprs_auth_method auth_method)
{
@@ -661,3 +702,54 @@
return g_strdup_printf("AT+CGDCONT=%u,\"%s\",\"%s\"", cid, pdp_type,
apn);
}
+
+GAtChat *at_util_open_device(struct ofono_modem *modem, const char *key,
+ GAtDebugFunc debug_func, char *debug_prefix,
+ char *tty_option, ...)
+{
+ const char *device;
+ va_list args;
+ GIOChannel *channel;
+ GAtSyntax *syntax;
+ GAtChat *chat;
+ GHashTable *options = NULL;
+
+ device = ofono_modem_get_string(modem, key);
+ if (device == NULL)
+ return NULL;
+
+ if (tty_option) {
+ options = g_hash_table_new(g_str_hash, g_str_equal);
+ if (options == NULL)
+ return NULL;
+
+ va_start(args, tty_option);
+ while (tty_option) {
+ gpointer value = (gpointer) va_arg(args, const char *);
+
+ g_hash_table_insert(options, tty_option, value);
+ tty_option = (gpointer) va_arg(args, const char *);
+ }
+ }
+
+ channel = g_at_tty_open(device, options);
+
+ if (options)
+ g_hash_table_destroy(options);
+
+ if (channel == NULL)
+ return NULL;
+
+ syntax = g_at_syntax_new_gsm_permissive();
+ chat = g_at_chat_new(channel, syntax);
+ g_at_syntax_unref(syntax);
+ g_io_channel_unref(channel);
+
+ if (chat == NULL)
+ return NULL;
+
+ if (getenv("OFONO_AT_DEBUG"))
+ g_at_chat_set_debug(chat, debug_func, debug_prefix);
+
+ return chat;
+}
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/ofono/drivers/atmodem/atutil.h
^
|
@@ -20,6 +20,10 @@
*
*/
+#include <gatchat.h>
+
+struct ofono_modem;
+
enum at_util_sms_store {
AT_UTIL_SMS_STORE_SM = 0,
AT_UTIL_SMS_STORE_ME = 1,
@@ -84,6 +88,9 @@
int at_util_get_ipv4_address_and_netmask(const char *addrnetmask,
char *address, char *netmask);
+int at_util_get_ipv6_address_and_netmask(const char *addrnetmask,
+ char *address, char *netmask);
+
int at_util_gprs_auth_method_to_auth_prot(
enum ofono_gprs_auth_method auth_method);
@@ -164,3 +171,7 @@
e.error = 0; \
f(&e, ##args); \
} while (0)
+
+GAtChat *at_util_open_device(struct ofono_modem *modem, const char *key,
+ GAtDebugFunc debug_func, char *debug_prefix,
+ char *tty_option, ...);
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/ofono/drivers/atmodem/gprs-context.c
^
|
@@ -285,35 +285,36 @@
len = snprintf(buf, sizeof(buf), "AT+CGDCONT=%u,\"IP\"", ctx->cid);
- if (ctx->apn) {
- switch (gcd->vendor) {
- case OFONO_VENDOR_UBLOX:
- /*
- * U-blox modems require a magic prefix to the APN to
- * specify the authentication method to use in the
- * network. See UBX-13002752 - R21.
- *
- * As the response of the read command omits this magic
- * prefix, this is the least invasive place to set it.
- */
- switch (ctx->auth_method) {
- case OFONO_GPRS_AUTH_METHOD_ANY:
- case OFONO_GPRS_AUTH_METHOD_NONE:
- case OFONO_GPRS_AUTH_METHOD_CHAP:
- snprintf(buf + len, sizeof(buf) - len - 3,
- ",\"CHAP:%s\"", ctx->apn);
- break;
- case OFONO_GPRS_AUTH_METHOD_PAP:
- snprintf(buf + len, sizeof(buf) - len - 3,
- ",\"PAP:%s\"", ctx->apn);
- break;
- }
+ switch (gcd->vendor) {
+ case OFONO_VENDOR_UBLOX:
+ /*
+ * U-blox modems require a magic prefix to the APN to
+ * specify the authentication method to use in the
+ * network. See UBX-13002752 - R21.
+ *
+ * As the response of the read command omits this magic
+ * prefix, this is the least invasive place to set it.
+ */
+ switch (ctx->auth_method) {
+ case OFONO_GPRS_AUTH_METHOD_ANY:
+ case OFONO_GPRS_AUTH_METHOD_CHAP:
+ snprintf(buf + len, sizeof(buf) - len - 3,
+ ",\"CHAP:%s\"", ctx->apn);
break;
- default:
- snprintf(buf + len, sizeof(buf) - len - 3, ",\"%s\"",
- ctx->apn);
+ case OFONO_GPRS_AUTH_METHOD_PAP:
+ snprintf(buf + len, sizeof(buf) - len - 3,
+ ",\"PAP:%s\"", ctx->apn);
+ break;
+ case OFONO_GPRS_AUTH_METHOD_NONE:
+ snprintf(buf + len, sizeof(buf) - len - 3,
+ ",\"%s\"", ctx->apn);
break;
}
+ break;
+ default:
+ snprintf(buf + len, sizeof(buf) - len - 3, ",\"%s\"",
+ ctx->apn);
+ break;
}
if (g_at_chat_send(gcd->chat, buf, none_prefix,
@@ -405,9 +406,11 @@
goto error;
}
- if (!g_at_result_iter_open_list(&iter)) {
- DBG("no list found");
- goto error;
+ if (gcd->vendor != OFONO_VENDOR_QUECTEL_SERIAL) {
+ if (!g_at_result_iter_open_list(&iter)) {
+ DBG("no list found");
+ goto error;
+ }
}
while (!found && g_at_result_iter_next_string(&iter, &data_type)) {
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/ofono/drivers/atmodem/gprs.c
^
|
@@ -43,12 +43,13 @@
static const char *cgreg_prefix[] = { "+CGREG:", NULL };
static const char *cgdcont_prefix[] = { "+CGDCONT:", NULL };
+static const char *cgact_prefix[] = { "+CGACT:", NULL };
static const char *none_prefix[] = { NULL };
struct gprs_data {
GAtChat *chat;
unsigned int vendor;
- unsigned int last_auto_context_id;
+ int last_auto_context_id;
gboolean telit_try_reattach;
int attached;
};
@@ -161,6 +162,11 @@
return;
}
+ if (gd->last_auto_context_id == -1) {
+ DBG("Context got deactivated while calling CGDCONT");
+ return;
+ }
+
g_at_result_iter_init(&iter, result);
while (g_at_result_iter_next(&iter, "+CGDCONT:")) {
@@ -187,6 +193,48 @@
activated_cid);
}
+static void at_cgact_cb(gboolean ok, GAtResult *result, gpointer user_data)
+{
+ struct ofono_gprs *gprs = user_data;
+ struct gprs_data *gd = ofono_gprs_get_data(gprs);
+ GAtResultIter iter;
+
+ DBG("ok %d", ok);
+
+ if (!ok) {
+ ofono_warn("Can't read CGACT contexts.");
+ return;
+ }
+
+ g_at_result_iter_init(&iter, result);
+
+ while (g_at_result_iter_next(&iter, "+CGACT:")) {
+ int read_cid = -1;
+ int read_status = -1;
+
+ if (!g_at_result_iter_next_number(&iter, &read_cid))
+ break;
+
+ if (!g_at_result_iter_next_number(&iter, &read_status))
+ break;
+
+ if (read_status != 1)
+ continue;
+
+ /* Flag this as auto context as it was obviously active */
+ if (gd->last_auto_context_id == 0)
+ gd->last_auto_context_id = read_cid;
+
+ if (read_cid != gd->last_auto_context_id)
+ continue;
+
+ g_at_chat_send(gd->chat, "AT+CGDCONT?", cgdcont_prefix,
+ at_cgdcont_read_cb, gprs, NULL);
+
+ break;
+ }
+}
+
static void cgreg_notify(GAtResult *result, gpointer user_data)
{
struct ofono_gprs *gprs = user_data;
@@ -251,6 +299,12 @@
g_at_chat_send(gd->chat, "AT+CGDCONT?", cgdcont_prefix,
at_cgdcont_read_cb, gprs, NULL);
+ } else if (g_str_has_prefix(event, "ME PDN DEACT")) {
+ int context_id;
+ sscanf(event, "%*s %*s %*s %u", &context_id);
+ /* Indicate that this cid is not activated anymore */
+ if (gd->last_auto_context_id == context_id)
+ gd->last_auto_context_id = -1;
}
}
@@ -455,7 +509,6 @@
FALSE, gprs, NULL);
break;
case OFONO_VENDOR_UBLOX:
- case OFONO_VENDOR_UBLOX_TOBY_L2:
g_at_chat_register(gd->chat, "+UREG:", ublox_ureg_notify,
FALSE, gprs, NULL);
g_at_chat_send(gd->chat, "AT+UREG=1", none_prefix,
@@ -485,6 +538,10 @@
break;
}
+ /* Check if there is any already activated contexts at init */
+ g_at_chat_send(gd->chat, "AT+CGACT?", cgact_prefix,
+ at_cgact_cb, gprs, NULL);
+
ofono_gprs_register(gprs);
}
@@ -622,6 +679,7 @@
gd->chat = g_at_chat_clone(chat);
gd->vendor = vendor;
+ gd->last_auto_context_id = -1;
ofono_gprs_set_data(gprs, gd);
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/ofono/drivers/atmodem/network-registration.c
^
|
@@ -41,6 +41,8 @@
#include "atmodem.h"
#include "vendor.h"
+#include "network-registration.h"
+
static const char *none_prefix[] = { NULL };
static const char *creg_prefix[] = { "+CREG:", NULL };
static const char *cops_prefix[] = { "+COPS:", NULL };
@@ -51,20 +53,6 @@
static const char *zpas_prefix[] = { "+ZPAS:", NULL };
static const char *option_tech_prefix[] = { "_OCTI:", "_OUWCTI:", NULL };
-struct netreg_data {
- GAtChat *chat;
- char mcc[OFONO_MAX_MCC_LENGTH + 1];
- char mnc[OFONO_MAX_MNC_LENGTH + 1];
- int signal_index; /* If strength is reported via CIND */
- int signal_min; /* min strength reported via CIND */
- int signal_max; /* max strength reported via CIND */
- int signal_invalid; /* invalid strength reported via CIND */
- int tech;
- struct ofono_network_time time;
- guint nitz_timeout;
- unsigned int vendor;
-};
-
struct tech_query {
int status;
int lac;
@@ -209,7 +197,7 @@
ofono_netreg_status_cb_t cb = cbd->cb;
int status, lac, ci, tech;
struct ofono_error error;
- struct netreg_data *nd = cbd->user;
+ struct at_netreg_data *nd = cbd->user;
decode_at_error(&error, g_at_result_final_response(result));
@@ -250,7 +238,7 @@
{
struct cb_data *cbd = user_data;
struct ofono_netreg *netreg = cbd->data;
- struct netreg_data *nd = ofono_netreg_get_data(netreg);
+ struct at_netreg_data *nd = ofono_netreg_get_data(netreg);
if (ok)
nd->tech = zte_parse_tech(result);
@@ -262,7 +250,7 @@
{
struct cb_data *cbd = user_data;
struct ofono_netreg *netreg = cbd->data;
- struct netreg_data *nd = ofono_netreg_get_data(netreg);
+ struct at_netreg_data *nd = ofono_netreg_get_data(netreg);
if (ok)
nd->tech = option_parse_tech(result);
@@ -270,11 +258,11 @@
nd->tech = -1;
}
-static void at_registration_status(struct ofono_netreg *netreg,
+void at_registration_status(struct ofono_netreg *netreg,
ofono_netreg_status_cb_t cb,
void *data)
{
- struct netreg_data *nd = ofono_netreg_get_data(netreg);
+ struct at_netreg_data *nd = ofono_netreg_get_data(netreg);
struct cb_data *cbd = cb_data_new(cb, data);
cbd->user = nd;
@@ -337,7 +325,7 @@
static void cops_cb(gboolean ok, GAtResult *result, gpointer user_data)
{
struct cb_data *cbd = user_data;
- struct netreg_data *nd = ofono_netreg_get_data(cbd->user);
+ struct at_netreg_data *nd = ofono_netreg_get_data(cbd->user);
ofono_netreg_operator_cb_t cb = cbd->cb;
struct ofono_network_operator op;
GAtResultIter iter;
@@ -398,7 +386,7 @@
static void cops_numeric_cb(gboolean ok, GAtResult *result, gpointer user_data)
{
struct cb_data *cbd = user_data;
- struct netreg_data *nd = ofono_netreg_get_data(cbd->user);
+ struct at_netreg_data *nd = ofono_netreg_get_data(cbd->user);
ofono_netreg_operator_cb_t cb = cbd->cb;
GAtResultIter iter;
const char *str;
@@ -450,10 +438,10 @@
g_free(cbd);
}
-static void at_current_operator(struct ofono_netreg *netreg,
+void at_current_operator(struct ofono_netreg *netreg,
ofono_netreg_operator_cb_t cb, void *data)
{
- struct netreg_data *nd = ofono_netreg_get_data(netreg);
+ struct at_netreg_data *nd = ofono_netreg_get_data(netreg);
struct cb_data *cbd = cb_data_new(cb, data);
gboolean ok;
@@ -589,10 +577,10 @@
g_free(list);
}
-static void at_list_operators(struct ofono_netreg *netreg,
+void at_list_operators(struct ofono_netreg *netreg,
ofono_netreg_operator_list_cb_t cb, void *data)
{
- struct netreg_data *nd = ofono_netreg_get_data(netreg);
+ struct at_netreg_data *nd = ofono_netreg_get_data(netreg);
struct cb_data *cbd = cb_data_new(cb, data);
if (g_at_chat_send(nd->chat, "AT+COPS=?", cops_prefix,
@@ -615,10 +603,10 @@
cb(&error, cbd->data);
}
-static void at_register_auto(struct ofono_netreg *netreg,
+void at_register_auto(struct ofono_netreg *netreg,
ofono_netreg_register_cb_t cb, void *data)
{
- struct netreg_data *nd = ofono_netreg_get_data(netreg);
+ struct at_netreg_data *nd = ofono_netreg_get_data(netreg);
struct cb_data *cbd = cb_data_new(cb, data);
if (g_at_chat_send(nd->chat, "AT+COPS=0", none_prefix,
@@ -630,11 +618,11 @@
CALLBACK_WITH_FAILURE(cb, data);
}
-static void at_register_manual(struct ofono_netreg *netreg,
+void at_register_manual(struct ofono_netreg *netreg,
const char *mcc, const char *mnc,
ofono_netreg_register_cb_t cb, void *data)
{
- struct netreg_data *nd = ofono_netreg_get_data(netreg);
+ struct at_netreg_data *nd = ofono_netreg_get_data(netreg);
struct cb_data *cbd = cb_data_new(cb, data);
char buf[128];
@@ -723,7 +711,7 @@
static void ifx_xreg_notify(GAtResult *result, gpointer user_data)
{
struct ofono_netreg *netreg = user_data;
- struct netreg_data *nd = ofono_netreg_get_data(netreg);
+ struct at_netreg_data *nd = ofono_netreg_get_data(netreg);
int state;
const char *band;
GAtResultIter iter;
@@ -822,7 +810,7 @@
static void ciev_notify(GAtResult *result, gpointer user_data)
{
struct ofono_netreg *netreg = user_data;
- struct netreg_data *nd = ofono_netreg_get_data(netreg);
+ struct at_netreg_data *nd = ofono_netreg_get_data(netreg);
int strength, ind;
GAtResultIter iter;
@@ -851,7 +839,7 @@
static void telit_ciev_notify(GAtResult *result, gpointer user_data)
{
struct ofono_netreg *netreg = user_data;
- struct netreg_data *nd = ofono_netreg_get_data(netreg);
+ struct at_netreg_data *nd = ofono_netreg_get_data(netreg);
const char *signal_identifier = "rssi";
const char *ind_str;
int strength;
@@ -882,7 +870,7 @@
static void gemalto_ciev_notify(GAtResult *result, gpointer user_data)
{
struct ofono_netreg *netreg = user_data;
- struct netreg_data *nd = ofono_netreg_get_data(netreg);
+ struct at_netreg_data *nd = ofono_netreg_get_data(netreg);
const char *signal_identifier = "rssi";
const char *ind_str;
int strength;
@@ -915,7 +903,7 @@
static void ctzv_notify(GAtResult *result, gpointer user_data)
{
struct ofono_netreg *netreg = user_data;
- struct netreg_data *nd = ofono_netreg_get_data(netreg);
+ struct at_netreg_data *nd = ofono_netreg_get_data(netreg);
const char *tz;
GAtResultIter iter;
@@ -937,7 +925,7 @@
static void tlts_notify(GAtResult *result, gpointer user_data)
{
struct ofono_netreg *netreg = user_data;
- struct netreg_data *nd = ofono_netreg_get_data(netreg);
+ struct at_netreg_data *nd = ofono_netreg_get_data(netreg);
int year, mon, mday, hour, min, sec;
char tz[4];
const char *time;
@@ -972,7 +960,7 @@
static gboolean notify_time(gpointer user_data)
{
struct ofono_netreg *netreg = user_data;
|
[-]
[+]
|
Added |
_service:tar_git:ofono-1.30+pp1.tar.bz2/ofono/drivers/atmodem/network-registration.h
^
|
@@ -0,0 +1,31 @@
+#pragma once
+
+struct at_netreg_data {
+ GAtChat *chat;
+ char mcc[OFONO_MAX_MCC_LENGTH + 1];
+ char mnc[OFONO_MAX_MNC_LENGTH + 1];
+ int signal_index; /* If strength is reported via CIND */
+ int signal_min; /* min strength reported via CIND */
+ int signal_max; /* max strength reported via CIND */
+ int signal_invalid; /* invalid strength reported via CIND */
+ int tech;
+ struct ofono_network_time time;
+ guint nitz_timeout;
+ unsigned int vendor;
+};
+
+void at_registration_status(struct ofono_netreg *netreg,
+ ofono_netreg_status_cb_t cb,
+ void *data);
+void at_current_operator(struct ofono_netreg *netreg,
+ ofono_netreg_operator_cb_t cb, void *data);
+void at_list_operators(struct ofono_netreg *netreg,
+ ofono_netreg_operator_list_cb_t cb, void *data);
+void at_register_auto(struct ofono_netreg *netreg,
+ ofono_netreg_register_cb_t cb, void *data);
+void at_register_manual(struct ofono_netreg *netreg,
+ const char *mcc, const char *mnc,
+ ofono_netreg_register_cb_t cb, void *data);
+void at_signal_strength(struct ofono_netreg *netreg,
+ ofono_netreg_strength_cb_t cb, void *data);
+void at_netreg_remove(struct ofono_netreg *netreg);
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/ofono/drivers/atmodem/sim.c
^
|
@@ -75,6 +75,7 @@
static const char *ccho_prefix[] = { "+CCHO:", NULL };
static const char *crla_prefix[] = { "+CRLA:", NULL };
static const char *cgla_prefix[] = { "+CGLA:", NULL };
+static const char *xcmscsc_prefix[] = { "+XCMSCSC:", NULL};
static const char *none_prefix[] = { NULL };
static void append_file_path(char *buf, const unsigned char *path,
@@ -1160,6 +1161,7 @@
DBG("");
switch (sd->vendor) {
+ case OFONO_VENDOR_XMM:
case OFONO_VENDOR_IFX:
if (g_at_chat_send(sd->chat, "AT+XPINCNT", xpincnt_prefix,
xpincnt_cb, cbd, g_free) > 0)
@@ -1215,13 +1217,12 @@
at_qpinc_cb, cbd, g_free) > 0)
return;
break;
- case OFONO_VENDOR_QUECTEL_M95:
+ case OFONO_VENDOR_QUECTEL_SERIAL:
if (g_at_chat_send(sd->chat, "AT+QTRPIN", qtrpin_prefix,
at_qtrpin_cb, cbd, g_free) > 0)
return;
break;
case OFONO_VENDOR_UBLOX:
- case OFONO_VENDOR_UBLOX_TOBY_L2:
if (g_at_chat_send(sd->chat, "AT+UPINCNT", upincnt_prefix,
upincnt_cb, cbd, g_free) > 0)
return;
@@ -1353,7 +1354,7 @@
case OFONO_VENDOR_HUAWEI:
case OFONO_VENDOR_SIMCOM:
case OFONO_VENDOR_SIERRA:
- case OFONO_VENDOR_QUECTEL_M95:
+ case OFONO_VENDOR_QUECTEL_SERIAL:
/*
* On ZTE modems, after pin is entered, SIM state is checked
* by polling CPIN as their modem doesn't provide unsolicited
@@ -1921,6 +1922,83 @@
CALLBACK_WITH_FAILURE(cb, NULL, 0, data);
}
+static void xcmscsc_query_cb(gboolean ok, GAtResult *result, gpointer user)
+{
+ struct ofono_sim *sim = user;
+ struct sim_data *sd = ofono_sim_get_data(sim);
+ GAtResultIter iter;
+ int active_slot;
+
+ if (!ok)
+ goto done;
+
+ g_at_result_iter_init(&iter, result);
+
+ if (!g_at_result_iter_next(&iter, "+XCMSCSC:"))
+ goto done;
+
+ g_at_result_iter_skip_next(&iter);
+ g_at_result_iter_skip_next(&iter);
+
+ g_at_result_iter_next_number(&iter, &active_slot);
+
+ /* set active SIM slot */
+ ofono_sim_set_active_card_slot(sim, active_slot + 1);
+
+done:
+ /* Query supported <fac>s */
+ g_at_chat_send(sd->chat, "AT+CLCK=?", clck_prefix,
+ at_clck_query_cb, sim, NULL);
+}
+
+static void at_xcmscsc_test_cb(gboolean ok, GAtResult *result, gpointer user)
+{
+ struct ofono_sim *sim = user;
+ struct sim_data *sd = ofono_sim_get_data(sim);
+ GAtResultIter iter;
+ int card_slot_count;
+
+ if (!ok)
+ goto done;
+
+ g_at_result_iter_init(&iter, result);
+
+ if (!g_at_result_iter_next(&iter, "+XCMSCSC:"))
+ goto done;
+
+ g_at_result_iter_skip_next(&iter);
+ g_at_result_iter_skip_next(&iter);
+
+ if (!g_at_result_iter_open_list(&iter))
+ goto done;
+
+ g_at_result_iter_skip_next(&iter);
+
+ if (!g_at_result_iter_next_number(&iter, &card_slot_count))
+ goto done;
+
+ /* Set num slots */
+ ofono_sim_set_card_slot_count(sim, card_slot_count + 1);
+
+ /*
+ * enable reporting of MSIM remap status information
+ * and enable automatic acceptance of MSIM Remap
+ * acknowledgement
+ */
+ g_at_chat_send(sd->chat, "AT+XCMSRS=2", none_prefix,
+ NULL, NULL, NULL);
+
+ /* Query active card slot */
+ g_at_chat_send(sd->chat, "AT+XCMSCSC?", xcmscsc_prefix,
+ xcmscsc_query_cb, sim, NULL);
+ return;
+
+done:
+ /* Query supported <fac>s */
+ g_at_chat_send(sd->chat, "AT+CLCK=?", clck_prefix,
+ at_clck_query_cb, sim, NULL);
+}
+
static int at_sim_probe(struct ofono_sim *sim, unsigned int vendor,
void *data)
{
@@ -1939,6 +2017,10 @@
if (at_clck_cpwd_fac[i])
sd->passwd_type_mask |= (1 << i);
+ if (sd->vendor == OFONO_VENDOR_XMM)
+ return g_at_chat_send(sd->chat, "AT+XCMSCSC=?", xcmscsc_prefix,
+ at_xcmscsc_test_cb, sim, NULL) ? 0 : -1;
+
/* Query supported <fac>s */
return g_at_chat_send(sd->chat, "AT+CLCK=?", clck_prefix,
at_clck_query_cb, sim, NULL) ? 0 : -1;
@@ -1958,6 +2040,46 @@
g_free(sd);
}
+static void xcmscsc_cb(gboolean ok, GAtResult *result,
+ gpointer user_data)
+{
+ struct cb_data *cbd = user_data;
+ ofono_sim_set_active_card_slot_cb_t cb = cbd->cb;
+ struct ofono_error error;
+
+ decode_at_error(&error, g_at_result_final_response(result));
+
+ if (cb)
+ cb(&error, cbd->data);
+}
+
+static void at_set_active_card_slot(struct ofono_sim *sim, unsigned int index,
+ ofono_sim_set_active_card_slot_cb_t cb, void *data)
+{
+ struct sim_data *sd = ofono_sim_get_data(sim);
+ struct cb_data *cbd = cb_data_new(cb, data);
+ char cmd[43];
+
+ if (sd->vendor != OFONO_VENDOR_XMM) {
+ struct ofono_error error;
+ error.type = OFONO_ERROR_TYPE_CME;
+ error.error = 4;
+
+ cb(&error, data);
+ return;
+ }
+
+ /* Enable single SIM mode for indicated card slot id */
+ snprintf(cmd, sizeof(cmd), "AT+XCMSCSC=1,0,%u,1", index);
+
+ if (g_at_chat_send(sd->chat, cmd, none_prefix, xcmscsc_cb,
+ cbd, g_free) > 0)
+ return;
+
+ g_free(cbd);
+ CALLBACK_WITH_FAILURE(cb, data);
+}
+
static const struct ofono_sim_driver driver = {
.name = "atmodem",
.probe = at_sim_probe,
@@ -1983,7 +2105,8 @@
.session_read_binary = at_session_read_binary,
.session_read_record = at_session_read_record,
.session_read_info = at_session_read_info,
- .logical_access = at_logical_access
+ .logical_access = at_logical_access,
+ .set_active_card_slot = at_set_active_card_slot
};
static const struct ofono_sim_driver driver_noef = {
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/ofono/drivers/atmodem/sms.c
^
|
@@ -338,6 +338,9 @@
case OFONO_VENDOR_GEMALTO:
snprintf(buf, sizeof(buf), "AT+CNMA=1");
break;
+ case OFONO_VENDOR_QUECTEL_SERIAL:
+ snprintf(buf, sizeof(buf), "AT+CNMA");
+ break;
default:
snprintf(buf, sizeof(buf), "AT+CNMA=1,%d\r%s",
data->cnma_ack_pdu_len,
@@ -1237,7 +1240,7 @@
if (!g_at_result_iter_next_number(&iter, &mo))
goto out;
- if (service == 1)
+ if (service == 1 || service == 128)
data->cnma_enabled = TRUE;
if (mt == 1 && mo == 1)
@@ -1268,10 +1271,10 @@
{
struct ofono_sms *sms = user_data;
struct sms_data *data = ofono_sms_get_data(sms);
- gboolean cnma_supported = FALSE;
GAtResultIter iter;
int status_min, status_max;
char buf[128];
+ int csms = 0;
if (!ok)
return at_sms_not_supported(sms);
@@ -1284,14 +1287,25 @@
if (!g_at_result_iter_open_list(&iter))
goto out;
- while (g_at_result_iter_next_range(&iter, &status_min, &status_max))
+ switch (data->vendor) {
+ case OFONO_VENDOR_QUECTEL_SERIAL:
+ g_at_result_iter_next_number(&iter, &status_min);
+ g_at_result_iter_next_number(&iter, &status_max);
if (status_min <= 1 && 1 <= status_max)
- cnma_supported = TRUE;
+ csms = 128;
+ break;
+ default:
+ while (g_at_result_iter_next_range(&iter, &status_min,
+ &status_max))
+ if (status_min <= 1 && 1 <= status_max)
+ csms = 1;
+ break;
+ }
DBG("CSMS query parsed successfully");
out:
- snprintf(buf, sizeof(buf), "AT+CSMS=%d", cnma_supported ? 1 : 0);
+ snprintf(buf, sizeof(buf), "AT+CSMS=%d", csms);
g_at_chat_send(data->chat, buf, csms_prefix,
at_csms_set_cb, sms, NULL);
}
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/ofono/drivers/atmodem/stk.c
^
|
@@ -191,6 +191,19 @@
g_at_chat_register(sd->chat, "*HCMD:", phonesim_hcmd_notify,
FALSE, stk, NULL);
+ if (sd->vendor == OFONO_VENDOR_XMM) {
+ /* enabling stk */
+ g_at_chat_send(sd->chat, "AT+CFUN=6", none_prefix,
+ NULL, NULL, NULL);
+ /* Here ofono has missed stk menu proactive command
+ * that comes after sim initialization only. Doing a
+ * sim reset will enable the stk driver to get the
+ * missed +CUSATP notifications.
+ */
+ g_at_chat_send(sd->chat, "AT+CFUN=27,1", none_prefix,
+ NULL, NULL, NULL);
+ }
+
ofono_stk_register(stk);
return FALSE;
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/ofono/drivers/atmodem/vendor.h
^
|
@@ -44,9 +44,8 @@
OFONO_VENDOR_WAVECOM_Q2XXX,
OFONO_VENDOR_ALCATEL,
OFONO_VENDOR_QUECTEL,
- OFONO_VENDOR_QUECTEL_M95,
+ OFONO_VENDOR_QUECTEL_SERIAL,
OFONO_VENDOR_UBLOX,
- OFONO_VENDOR_UBLOX_TOBY_L2,
OFONO_VENDOR_XMM,
OFONO_VENDOR_GEMALTO,
};
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/ofono/drivers/hsomodem/gprs-context.c
^
|
@@ -150,7 +150,6 @@
struct gprs_context_data *gcd = ofono_gprs_context_get_data(gc);
struct cb_data *cbd = cb_data_new(cb, data);
char buf[AUTH_BUF_LENGTH];
- int len;
/* IPv6 support not implemented */
if (ctx->proto != OFONO_GPRS_PROTO_IP)
@@ -173,11 +172,8 @@
NULL, NULL, NULL) == 0)
goto error;
- len = snprintf(buf, sizeof(buf), "AT+CGDCONT=%u,\"IP\"", ctx->cid);
-
- if (ctx->apn)
- snprintf(buf + len, sizeof(buf) - len - 3, ",\"%s\"",
- ctx->apn);
+ snprintf(buf, sizeof(buf), "AT+CGDCONT=%u,\"IP\",\"%s\"",
+ ctx->cid, ctx->apn);
if (g_at_chat_send(gcd->chat, buf, none_prefix,
hso_cgdcont_cb, cbd, g_free) > 0)
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/ofono/drivers/huaweimodem/gprs-context.c
^
|
@@ -256,7 +256,6 @@
struct gprs_context_data *gcd = ofono_gprs_context_get_data(gc);
struct cb_data *cbd = cb_data_new(cb, data);
char buf[64];
- int len;
/* IPv6 support not implemented */
if (ctx->proto != OFONO_GPRS_PROTO_IP)
@@ -265,14 +264,10 @@
DBG("cid %u", ctx->cid);
gcd->active_context = ctx->cid;
-
cbd->user = gc;
- len = snprintf(buf, sizeof(buf), "AT+CGDCONT=%u,\"IP\"", ctx->cid);
-
- if (ctx->apn)
- snprintf(buf + len, sizeof(buf) - len - 3, ",\"%s\"",
- ctx->apn);
+ snprintf(buf, sizeof(buf), "AT+CGDCONT=%u,\"IP\",\"%s\"",
+ ctx->cid, ctx->apn);
if (g_at_chat_send(gcd->chat, buf, none_prefix,
at_cgdcont_cb, cbd, g_free) > 0)
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/ofono/drivers/iceramodem/gprs-context.c
^
|
@@ -332,9 +332,7 @@
break;
}
- if (ctx->apn)
- snprintf(buf + len, sizeof(buf) - len - 3,
- ",\"%s\"", ctx->apn);
+ snprintf(buf + len, sizeof(buf) - len - 3, ",\"%s\"", ctx->apn);
if (g_at_chat_send(gcd->chat, buf, none_prefix,
at_cgdcont_cb, cbd, g_free) > 0)
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/ofono/drivers/ifxmodem/gprs-context.c
^
|
@@ -44,6 +44,7 @@
#define TUN_DEV "/dev/net/tun"
#define STATIC_IP_NETMASK "255.255.255.255"
+#define IPV6_DEFAULT_PREFIX_LEN 8
static const char *none_prefix[] = { NULL };
static const char *xdns_prefix[] = { "+XDNS:", NULL };
@@ -260,6 +261,45 @@
failed_setup(gc, NULL, TRUE);
}
+static void cgdata_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);
+
+ DBG("ok %d", ok);
+
+ if (!ok) {
+ ofono_error("Failed to establish session");
+ failed_setup(gc, result, TRUE);
+ return;
+ }
+
+ CALLBACK_WITH_SUCCESS(gcd->cb, gcd->cb_data);
+}
+
+static const char *get_datapath(struct ofono_modem *modem,
+ const char *interface)
+{
+ static char datapath[256];
+ char n;
+
+ if (!strcmp(interface,
+ ofono_modem_get_string(modem, "NetworkInterface")))
+ n = '0';
+ else if (!strcmp(interface,
+ ofono_modem_get_string(modem, "NetworkInterface2")))
+ n = '1';
+ else if (!strcmp(interface,
+ ofono_modem_get_string(modem, "NetworkInterface3")))
+ n = '2';
+ else
+ return NULL;
+
+ snprintf(datapath, sizeof(datapath), "%s%c",
+ ofono_modem_get_string(modem, "DataPath"), n);
+ return datapath;
+}
+
static void cgcontrdp_cb(gboolean ok, GAtResult *result, gpointer user_data)
{
struct ofono_gprs_context *gc = user_data;
@@ -269,8 +309,11 @@
const char *laddrnetmask = NULL;
const char *gw = NULL;
- const char *interface;
const char *dns[3];
+ const char *ctrlpath;
+ const char *datapath;
+ char buf[512];
+ const char *interface;
DBG("ok %d", ok);
@@ -310,10 +353,41 @@
DBG("DNS: %s, %s\n", gcd->dns1, gcd->dns2);
- if (!laddrnetmask || at_util_get_ipv4_address_and_netmask(laddrnetmask,
+ if (gcd->proto == OFONO_GPRS_PROTO_IP) {
+ if (!laddrnetmask ||
+ at_util_get_ipv4_address_and_netmask(laddrnetmask,
gcd->address, gcd->netmask) < 0) {
- failed_setup(gc, NULL, TRUE);
- return;
+ failed_setup(gc, NULL, TRUE);
+ return;
+ }
+
+ ofono_gprs_context_set_ipv4_address(gc, gcd->address, TRUE);
+
+ if (gcd->netmask[0])
+ ofono_gprs_context_set_ipv4_netmask(gc, gcd->netmask);
+
+ if (gcd->gateway[0])
+ ofono_gprs_context_set_ipv4_gateway(gc, gcd->gateway);
+
+ ofono_gprs_context_set_ipv4_dns_servers(gc, dns);
+ }
+
+ if (gcd->proto == OFONO_GPRS_PROTO_IPV6) {
+ if (!laddrnetmask ||
+ at_util_get_ipv6_address_and_netmask(laddrnetmask,
+ gcd->address, gcd->netmask) < 0) {
+ failed_setup(gc, NULL, TRUE);
+ return;
+ }
+
+ ofono_gprs_context_set_ipv6_address(gc, gcd->address);
+
+ if (gcd->gateway[0])
+ ofono_gprs_context_set_ipv6_gateway(gc, gcd->gateway);
+
+ ofono_gprs_context_set_ipv6_dns_servers(gc, dns);
+ ofono_gprs_context_set_ipv6_prefix_length(gc,
+ IPV6_DEFAULT_PREFIX_LEN);
}
if (gw)
@@ -327,20 +401,21 @@
DBG("DNS2: %s\n", gcd->dns2);
DBG("Gateway: %s\n", gcd->gateway);
- interface = ofono_modem_get_string(modem, "NetworkInterface");
+ ctrlpath = ofono_modem_get_string(modem, "CtrlPath");
+ interface = ofono_gprs_context_get_interface(gc);
+ datapath = get_datapath(modem, interface);
- ofono_gprs_context_set_interface(gc, interface);
- ofono_gprs_context_set_ipv4_address(gc, gcd->address, TRUE);
+ snprintf(buf, sizeof(buf), "AT+XDATACHANNEL=1,1,\"%s\",\"%s\",0,%u",
+ ctrlpath, datapath, gcd->active_context);
+ g_at_chat_send(gcd->chat, buf, none_prefix, NULL, NULL, NULL);
+ snprintf(buf, sizeof(buf), "AT+CGDATA=\"M-RAW_IP\",%u",
+ gcd->active_context);
- if (gcd->netmask[0])
- ofono_gprs_context_set_ipv4_netmask(gc, gcd->netmask);
-
- if (gcd->gateway[0])
- ofono_gprs_context_set_ipv4_gateway(gc, gcd->gateway);
-
- ofono_gprs_context_set_ipv4_dns_servers(gc, dns);
+ if (g_at_chat_send(gcd->chat, buf, none_prefix, cgdata_cb,
+ gc, NULL) > 0)
+ return;
- CALLBACK_WITH_SUCCESS(gcd->cb, gcd->cb_data);
+ CALLBACK_WITH_FAILURE(gcd->cb, gcd->cb_data);
}
static void ifx_read_settings(struct ofono_gprs_context *gc)
@@ -486,9 +561,7 @@
break;
}
- if (ctx->apn)
- snprintf(buf + len, sizeof(buf) - len - 3,
- ",\"%s\"", ctx->apn);
+ snprintf(buf + len, sizeof(buf) - len - 3, ",\"%s\"", ctx->apn);
if (g_at_chat_send(gcd->chat, buf, none_prefix,
setup_cb, gc, NULL) > 0)
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/ofono/drivers/isimodem/gprs-context.c
^
|
@@ -537,11 +537,15 @@
strncpy(cd->apn, ctx->apn, GPDS_MAX_APN_STRING_LENGTH);
cd->apn[GPDS_MAX_APN_STRING_LENGTH] = '\0';
- strncpy(cd->username, ctx->username, GPDS_MAX_USERNAME_LENGTH);
- cd->username[GPDS_MAX_USERNAME_LENGTH] = '\0';
-
- strncpy(cd->password, ctx->password, GPDS_MAX_PASSWORD_LENGTH);
- cd->username[GPDS_MAX_PASSWORD_LENGTH] = '\0';
+ if (ctx->auth_method == OFONO_GPRS_AUTH_METHOD_NONE) {
+ memset(cd->username, 0, sizeof(cd->username));
+ memset(cd->password, 0, sizeof(cd->password));
+ } else {
+ strncpy(cd->username, ctx->username, GPDS_MAX_USERNAME_LENGTH);
+ cd->username[GPDS_MAX_USERNAME_LENGTH] = '\0';
+ strncpy(cd->password, ctx->password, GPDS_MAX_PASSWORD_LENGTH);
+ cd->password[GPDS_MAX_PASSWORD_LENGTH] = '\0';
+ }
cd->pep = g_isi_pep_create(cd->idx, NULL, NULL);
if (cd->pep == NULL)
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/ofono/drivers/isimodem/voicecall.c
^
|
@@ -227,7 +227,7 @@
call->addr_type = type | 0x80;
call->presentation = pres;
- strncpy(call->address, addr, sizeof(call->address));
+ strncpy(call->address, addr, sizeof(call->address) - 1);
g_free(addr);
}
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/ofono/drivers/mbimmodem/mbim-message.c
^
|
@@ -152,8 +152,8 @@
uint32_t offset, uint32_t len,
char **out)
{
- uint8_t buf[len];
- uint8_t *dest = buf;
+ uint16_t buf[len / 2 + 1];
+ uint8_t *dest = (uint8_t *) buf;
uint32_t remaining = len;
uint32_t iov_start = 0;
uint32_t i = 0;
@@ -195,7 +195,7 @@
/* Strings are in UTF16-LE, so convert to UTF16-CPU first if needed */
if (L_CPU_TO_LE16(0x8000) != 0x8000) {
- uint16_t *le = (uint16_t *) buf;
+ uint16_t *le = buf;
for (i = 0; i < len / 2; i++)
le[i] = __builtin_bswap16(le[i]);
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/ofono/drivers/mbmmodem/gprs-context.c
^
|
@@ -367,7 +367,6 @@
struct gprs_context_data *gcd = ofono_gprs_context_get_data(gc);
struct cb_data *cbd = cb_data_new(cb, data);
char buf[AUTH_BUF_LENGTH];
- int len;
/* IPv6 support not implemented */
if (ctx->proto != OFONO_GPRS_PROTO_IP)
@@ -376,14 +375,10 @@
DBG("cid %u", ctx->cid);
gcd->active_context = ctx->cid;
-
cbd->user = gc;
- len = snprintf(buf, sizeof(buf), "AT+CGDCONT=%u,\"IP\"", ctx->cid);
-
- if (ctx->apn)
- snprintf(buf + len, sizeof(buf) - len - 3, ",\"%s\"",
- ctx->apn);
+ snprintf(buf, sizeof(buf), "AT+CGDCONT=%u,\"IP\",\"%s\"",
+ ctx->cid, ctx->apn);
if (g_at_chat_send(gcd->chat, buf, none_prefix,
mbm_cgdcont_cb, cbd, g_free) == 0)
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/ofono/drivers/stemodem/caif_rtnl.c
^
|
@@ -85,7 +85,7 @@
if (attr->rta_type == IFLA_IFNAME &&
ifname != NULL) {
- strncpy(ifname, RTA_DATA(attr), IF_NAMESIZE);
+ strncpy(ifname, RTA_DATA(attr), IF_NAMESIZE - 1);
ifname[IF_NAMESIZE-1] = '\0';
break;
}
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/ofono/drivers/stemodem/gprs-context.c
^
|
@@ -277,7 +277,6 @@
struct gprs_context_data *gcd = ofono_gprs_context_get_data(gc);
struct cb_data *cbd = cb_data_new(cb, data);
char buf[AUTH_BUF_LENGTH];
- int len;
/* IPv6 support not implemented */
if (ctx->proto != OFONO_GPRS_PROTO_IP)
@@ -291,11 +290,8 @@
goto error;
}
- len = snprintf(buf, sizeof(buf), "AT+CGDCONT=%u,\"IP\"", ctx->cid);
-
- if (ctx->apn)
- snprintf(buf + len, sizeof(buf) - len, ",\"%s\"",
- ctx->apn);
+ snprintf(buf, sizeof(buf), "AT+CGDCONT=%u,\"IP\",\"%s\"",
+ ctx->cid, ctx->apn);
if (g_at_chat_send(gcd->chat, buf, none_prefix,
ste_cgdcont_cb, cbd, g_free) == 0)
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/ofono/drivers/swmodem/gprs-context.c
^
|
@@ -177,9 +177,7 @@
break;
}
- if (ctx->apn)
- snprintf(buf + len, sizeof(buf) - len - 3,
- ",\"%s\"", ctx->apn);
+ snprintf(buf + len, sizeof(buf) - len - 3, ",\"%s\"", ctx->apn);
if (g_at_chat_send(gcd->chat, buf, none_prefix,
at_cgdcont_cb, cbd, g_free) > 0)
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/ofono/drivers/telitmodem/gprs-context-ncm.c
^
|
@@ -346,9 +346,7 @@
break;
}
- if (ctx->apn)
- snprintf(buf + len, sizeof(buf) - len - 3,
- ",\"%s\"", ctx->apn);
+ snprintf(buf + len, sizeof(buf) - len - 3, ",\"%s\"", ctx->apn);
if (g_at_chat_send(gcd->chat, buf, none_prefix,
setup_cb, gc, NULL) > 0)
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/ofono/drivers/ubloxmodem/gprs-context.c
^
|
@@ -43,12 +43,20 @@
static const char *none_prefix[] = { NULL };
static const char *cgcontrdp_prefix[] = { "+CGCONTRDP:", NULL };
static const char *uipaddr_prefix[] = { "+UIPADDR:", NULL };
+static const char *ubmconf_prefix[] = { "+UBMCONF:", NULL };
+
+enum netmode {
+ NETWORKING_MODE_ROUTER,
+ NETWORKING_MODE_BRIDGE,
+};
struct gprs_context_data {
+ const struct ublox_model *model;
GAtChat *chat;
unsigned int active_context;
ofono_gprs_context_cb_t cb;
void *cb_data;
+ enum netmode networking_mode;
};
static void uipaddr_cb(gboolean ok, GAtResult *result, gpointer user_data)
@@ -227,6 +235,14 @@
{
struct gprs_context_data *gcd = ofono_gprs_context_get_data(gc);
+ if (gcd->networking_mode == NETWORKING_MODE_ROUTER) {
+ /* Use DHCP */
+ set_gprs_context_interface(gc);
+ ofono_gprs_context_set_ipv4_address(gc, NULL, 0);
+ CALLBACK_WITH_SUCCESS(gcd->cb, gcd->cb_data);
+ return;
+ }
+
if (ublox_send_cgcontrdp(gc) < 0)
CALLBACK_WITH_FAILURE(gcd->cb, gcd->cb_data);
}
@@ -305,7 +321,7 @@
{
struct gprs_context_data *gcd = ofono_gprs_context_get_data(gc);
char buf[UBLOX_MAX_USER_LEN + UBLOX_MAX_PASS_LEN + 32];
- unsigned auth;
+ unsigned auth = 0;
switch (auth_method) {
case OFONO_GPRS_AUTH_METHOD_PAP:
@@ -372,6 +388,14 @@
{
struct gprs_context_data *gcd = ofono_gprs_context_get_data(gc);
+ if (ublox_is_toby_l4(gcd->model)) {
+ /* TOBY L4 does not support IPv6 */
+ if (ctx->proto != OFONO_GPRS_PROTO_IP) {
+ CALLBACK_WITH_FAILURE(cb, data);
+ return;
+ }
+ }
+
/* IPv6 support not implemented */
if (ctx->proto != OFONO_GPRS_PROTO_IP) {
CALLBACK_WITH_FAILURE(cb, data);
@@ -461,8 +485,44 @@
gcd->active_context = 0;
}
+static void at_ubmconf_read_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);
+ GAtResultIter iter;
+ int mode;
+
+ if (!ok)
+ goto error;
+
+ g_at_result_iter_init(&iter, result);
+ if (!g_at_result_iter_next(&iter, "+UBMCONF:"))
+ goto error;
+
+ if (!g_at_result_iter_next_number(&iter, &mode))
+ goto error;
+
+ switch (mode) {
+ case 1:
+ gcd->networking_mode = NETWORKING_MODE_ROUTER;
+ break;
+ case 2:
+ gcd->networking_mode = NETWORKING_MODE_BRIDGE;
+ break;
+ default:
+ goto error;
+ }
+
+ return;
+
+error:
+ ofono_error("AT+UBMCONF? failed; assuming router mode");
+ gcd->networking_mode = NETWORKING_MODE_ROUTER;
+}
+
static int ublox_gprs_context_probe(struct ofono_gprs_context *gc,
- unsigned int vendor, void *data)
+ unsigned int model_id, void *data)
{
GAtChat *chat = data;
struct gprs_context_data *gcd;
@@ -473,10 +533,23 @@
if (gcd == NULL)
return -ENOMEM;
+ gcd->model = ublox_model_from_id(model_id);
+ if (!gcd->model)
+ return -EINVAL;
+
gcd->chat = g_at_chat_clone(chat);
ofono_gprs_context_set_data(gc, gcd);
+ if (ublox_is_toby_l2(gcd->model)) {
+ g_at_chat_send(chat, "AT+UBMCONF?", ubmconf_prefix,
+ at_ubmconf_read_cb, gc, NULL);
+ } else if (ublox_is_toby_l4(gcd->model)) {
+ gcd->networking_mode = NETWORKING_MODE_ROUTER;
+ } else {
+ gcd->networking_mode = NETWORKING_MODE_ROUTER;
+ }
+
g_at_chat_register(chat, "+CGEV:", cgev_notify, FALSE, gc, NULL);
return 0;
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/ofono/drivers/ubloxmodem/lte.c
^
|
@@ -39,24 +39,85 @@
#include "ubloxmodem.h"
-static const char *ucgdflt_prefix[] = { "+UCGDFLT:", NULL };
+static const char *none_prefix[] = { NULL };
struct lte_driver_data {
GAtChat *chat;
+ const struct ublox_model *model;
+ struct ofono_lte_default_attach_info pending_info;
};
-static void ucgdflt_cb(gboolean ok, GAtResult *result, gpointer user_data)
+static void at_lte_set_auth_cb(gboolean ok, GAtResult *result,
+ gpointer user_data)
{
struct cb_data *cbd = user_data;
ofono_lte_cb_t cb = cbd->cb;
struct ofono_error error;
- DBG("ok %d", ok);
-
decode_at_error(&error, g_at_result_final_response(result));
cb(&error, cbd->data);
}
+static void at_lte_set_default_attach_info_cb(gboolean ok, GAtResult *result,
+ gpointer user_data)
+{
+ struct cb_data *cbd = user_data;
+ ofono_lte_cb_t cb = cbd->cb;
+ void *data = cbd->data;
+ struct lte_driver_data *ldd = cbd->user;
+ struct ofono_error error;
+ char buf[32 + OFONO_GPRS_MAX_USERNAME_LENGTH +
+ OFONO_GPRS_MAX_PASSWORD_LENGTH + 1];
+ enum ofono_gprs_auth_method auth_method;
+ int cid;
+
+ if (!ok) {
+ decode_at_error(&error, g_at_result_final_response(result));
+ cb(&error, data);
+ return;
+ }
+
+ if (ublox_is_toby_l2(ldd->model)) {
+ /* If CGDCONT has already been used to set up cid 4 then
+ * the EPS default bearer will be configured from another
+ * cid (see documentation for how this is selected). Avoid
+ * doing so as this assumes as much...
+ */
+ cid = 4;
+ } else if (ublox_is_toby_l4(ldd->model)) {
+ cid = 1;
+ } else {
+ ofono_error("Unknown model; "
+ "unable to determine EPS default bearer CID");
+ goto out;
+ }
+
+ auth_method = ldd->pending_info.auth_method;
+
+ /* change the authentication method if the parameters are invalid */
+ if (!*ldd->pending_info.username || !*ldd->pending_info.password)
+ auth_method = OFONO_GPRS_AUTH_METHOD_NONE;
+
+ /* In contrast to CGAUTH, all four parameters are _required_ here;
+ * if auth type is NONE then username and password must be set to
+ * empty strings.
+ */
+ sprintf(buf, "AT+UAUTHREQ=%d,%d,\"%s\",\"%s\"",
+ cid,
+ at_util_gprs_auth_method_to_auth_prot(auth_method),
+ ldd->pending_info.username,
+ ldd->pending_info.password);
+
+ cbd = cb_data_ref(cbd);
+ if (g_at_chat_send(ldd->chat, buf, none_prefix,
+ at_lte_set_auth_cb, cbd, cb_data_unref) > 0)
+ return;
+
+out:
+ cb_data_unref(cbd);
+ CALLBACK_WITH_FAILURE(cb, data);
+}
+
static void ublox_lte_set_default_attach_info(const struct ofono_lte *lte,
const struct ofono_lte_default_attach_info *info,
ofono_lte_cb_t cb, void *data)
@@ -67,17 +128,32 @@
DBG("LTE config with APN: %s", info->apn);
- if (strlen(info->apn) > 0)
- snprintf(buf, sizeof(buf), "AT+UCGDFLT=0,\"IP\",\"%s\"",
+ cbd->user = ldd;
+ memcpy(&ldd->pending_info, info, sizeof(ldd->pending_info));
+
+ if (ublox_is_toby_l2(ldd->model)) {
+ if (strlen(info->apn) > 0)
+ snprintf(buf, sizeof(buf), "AT+UCGDFLT=0,%s,\"%s\"",
+ at_util_gprs_proto_to_pdp_type(info->proto),
info->apn);
- else
- snprintf(buf, sizeof(buf), "AT+UCGDFLT=0");
+ else
+ snprintf(buf, sizeof(buf), "AT+UCGDFLT=0");
- /* We can't do much in case of failure so don't check response. */
- if (g_at_chat_send(ldd->chat, buf, ucgdflt_prefix,
- ucgdflt_cb, cbd, g_free) > 0)
+ } else if (ublox_is_toby_l4(ldd->model)) {
+ if (strlen(info->apn) > 0)
+ snprintf(buf, sizeof(buf), "AT+CGDCONT=1,%s,\"%s\"",
+ at_util_gprs_proto_to_pdp_type(info->proto),
+ info->apn);
+ else
+ snprintf(buf, sizeof(buf), "AT+CGDCONT=1");
+ }
+
+ if (g_at_chat_send(ldd->chat, buf, none_prefix,
+ at_lte_set_default_attach_info_cb,
+ cbd, cb_data_unref) > 0)
return;
+ cb_data_unref(cbd);
CALLBACK_WITH_FAILURE(cb, data);
}
@@ -91,7 +167,7 @@
}
static int ublox_lte_probe(struct ofono_lte *lte,
- unsigned int vendor, void *data)
+ unsigned int model_id, void *data)
{
GAtChat *chat = data;
struct lte_driver_data *ldd;
@@ -103,6 +179,7 @@
return -ENOMEM;
ldd->chat = g_at_chat_clone(chat);
+ ldd->model = ublox_model_from_id(model_id);
ofono_lte_set_data(lte, ldd);
|
[-]
[+]
|
Added |
_service:tar_git:ofono-1.30+pp1.tar.bz2/ofono/drivers/ubloxmodem/network-registration.c
^
|
@@ -0,0 +1,427 @@
+/*
+ *
+ * oFono - Open Source Telephony
+ *
+ * Copyright (C) 2008-2011 Intel Corporation. All rights reserved.
+ * Copyright (C) 2010 ST-Ericsson AB.
+ * Copyright (C) 2019 Norrbonn AB
+ *
+ * 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
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <string.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+#include <glib.h>
+
+#include <ofono/log.h>
+#include <ofono/modem.h>
+#include <ofono/netreg.h>
+
+#include "gatchat.h"
+#include "gatresult.h"
+
+#include "common.h"
+#include "ubloxmodem.h"
+#include "drivers/atmodem/vendor.h"
+
+#include "drivers/atmodem/network-registration.h"
+
+static const char *none_prefix[] = { NULL };
+static const char *cmer_prefix[] = { "+CMER:", NULL };
+static const char *ureg_prefix[] = { "+UREG:", NULL };
+
+struct netreg_data {
+ struct at_netreg_data at_data;
+
+ const struct ublox_model *model;
+};
+
+struct tech_query {
+ int status;
+ int lac;
+ int ci;
+ struct ofono_netreg *netreg;
+};
+
+static void ciev_notify(GAtResult *result, gpointer user_data)
+{
+ struct ofono_netreg *netreg = user_data;
+ struct at_netreg_data *nd = ofono_netreg_get_data(netreg);
+ int strength, ind;
+ GAtResultIter iter;
+
+ g_at_result_iter_init(&iter, result);
+
+ if (!g_at_result_iter_next(&iter, "+CIEV:"))
+ return;
+
+ if (!g_at_result_iter_next_number(&iter, &ind))
+ return;
+
+ if (ind != nd->signal_index)
+ return;
+
+ if (!g_at_result_iter_next_number(&iter, &strength))
+ return;
+
+ if (strength == nd->signal_invalid)
+ strength = -1;
+ else
+ strength = (strength * 100) / (nd->signal_max - nd->signal_min);
+
+ ofono_netreg_strength_notify(netreg, strength);
+}
+
+static gboolean notify_time(gpointer user_data)
+{
+ struct ofono_netreg *netreg = user_data;
+ struct at_netreg_data *nd = ofono_netreg_get_data(netreg);
+
+ nd->nitz_timeout = 0;
+
+ ofono_netreg_time_notify(netreg, &nd->time);
+
+ return FALSE;
+}
+
+static void ctzdst_notify(GAtResult *result, gpointer user_data)
+{
+ struct ofono_netreg *netreg = user_data;
+ struct at_netreg_data *nd = ofono_netreg_get_data(netreg);
+ int dst;
+ GAtResultIter iter;
+
+ g_at_result_iter_init(&iter, result);
+
+ if (!g_at_result_iter_next(&iter, "+CTZDST:"))
+ return;
+
+ if (!g_at_result_iter_next_number(&iter, &dst))
+ return;
+
+ DBG("dst %d", dst);
+
+ nd->time.dst = dst;
+
+ if (nd->nitz_timeout > 0) {
+ g_source_remove(nd->nitz_timeout);
+ nd->nitz_timeout = 0;
+ }
+
+ ofono_netreg_time_notify(netreg, &nd->time);
+}
+
+static void ctzv_notify(GAtResult *result, gpointer user_data)
+{
+ struct ofono_netreg *netreg = user_data;
+ struct at_netreg_data *nd = ofono_netreg_get_data(netreg);
+ int year, mon, mday, hour, min, sec;
+ const char *tz, *time;
+ GAtResultIter iter;
+
+ g_at_result_iter_init(&iter, result);
+
+ if (!g_at_result_iter_next(&iter, "+CTZV:"))
+ return;
+
+ if (!g_at_result_iter_next_unquoted_string(&iter, &tz))
+ return;
+
+ if (!g_at_result_iter_next_string(&iter, &time))
+ return;
+
+ DBG("tz %s time %s", tz, time);
+
+ if (sscanf(time, "%u/%u/%u,%u:%u:%u", &year, &mon, &mday,
+ &hour, &min, &sec) != 6)
+ return;
+
+ nd->time.sec = sec;
+ nd->time.min = min;
+ nd->time.hour = hour;
+ nd->time.mday = mday;
+ nd->time.mon = mon;
+ nd->time.year = 2000 + year;
+
+ nd->time.utcoff = atoi(tz) * 15 * 60;
+
+ /* Delay notification in case there's a DST update coming */
+ if (nd->nitz_timeout > 0)
+ g_source_remove(nd->nitz_timeout);
+
+ nd->nitz_timeout = g_timeout_add_seconds(1, notify_time, user_data);
+}
+
+static void ctze_notify(GAtResult *result, gpointer user_data)
+{
+ struct ofono_netreg *netreg = user_data;
+ struct at_netreg_data *nd = ofono_netreg_get_data(netreg);
+ int year, mon, mday, hour, min, sec;
+ int dst;
+ const char *tz, *time;
+ GAtResultIter iter;
+
+ g_at_result_iter_init(&iter, result);
+
+ if (!g_at_result_iter_next(&iter, "+CTZE:"))
+ return;
+
+ if (!g_at_result_iter_next_unquoted_string(&iter, &tz))
+ return;
+
+ if (!g_at_result_iter_next_number(&iter, &dst))
+ return;
+
+ if (!g_at_result_iter_next_string(&iter, &time))
+ return;
+
+ DBG("tz %s dst %d time %s", tz, dst, time);
+
+ if (sscanf(time, "%u/%u/%u,%u:%u:%u", &year, &mon, &mday,
+ &hour, &min, &sec) != 6)
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/ofono/drivers/ubloxmodem/ubloxmodem.c
^
|
@@ -23,6 +23,8 @@
#include <config.h>
#endif
+#include <string.h>
+
#include <glib.h>
#include <gatchat.h>
@@ -33,9 +35,96 @@
#include "ubloxmodem.h"
+const struct ublox_model ublox_models[] = {
+ {
+ .name = "SARA-G270",
+ },
+ /* TOBY L2 series */
+ {
+ .name = "TOBY-L200",
+ .flags = UBLOX_F_TOBY_L2|UBLOX_F_HAVE_USBCONF,
+ },
+ {
+ .name = "TOBY-L201",
+ .flags = UBLOX_F_TOBY_L2|UBLOX_F_HAVE_USBCONF,
+ },
+ {
+ .name = "TOBY-L210",
+ .flags = UBLOX_F_TOBY_L2|UBLOX_F_HAVE_USBCONF,
+ },
+ {
+ .name = "TOBY-L220",
+ .flags = UBLOX_F_TOBY_L2|UBLOX_F_HAVE_USBCONF,
+ },
+ {
+ .name = "TOBY-L280",
+ .flags = UBLOX_F_TOBY_L2|UBLOX_F_HAVE_USBCONF,
+ },
+ /* TOBY L4 series */
+ {
+ .name = "TOBY-L4006",
+ .flags = UBLOX_F_TOBY_L4,
+ },
+ {
+ .name = "TOBY-L4106",
+ .flags = UBLOX_F_TOBY_L4,
+ },
+ {
+ .name = "TOBY-L4206",
+ .flags = UBLOX_F_TOBY_L4,
+ },
+ {
+ .name = "TOBY-L4906",
+ .flags = UBLOX_F_TOBY_L4,
+ },
+ /* LARA L2 series */
+ {
+ .name = "LARA-R202",
+ .flags = UBLOX_F_LARA_R2,
+ },
+ {
+ .name = "LARA-R211",
+ .flags = UBLOX_F_LARA_R2,
+ },
+ { /* sentinel */ },
+};
+
+const struct ublox_model *ublox_model_from_name(const char *name)
+{
+ const struct ublox_model *m;
+
+ for (m = ublox_models; m->name; m++) {
+ if (!strcmp(name, m->name))
+ return m;
+ }
+
+ return NULL;
+}
+
+const struct ublox_model *ublox_model_from_id(int id)
+{
+ return ublox_models + id;
+}
+
+int ublox_model_to_id(const struct ublox_model *model)
+{
+ return model - ublox_models;
+}
+
+int ublox_is_toby_l2(const struct ublox_model *model)
+{
+ return model->flags & UBLOX_F_TOBY_L2;
+}
+
+int ublox_is_toby_l4(const struct ublox_model *model)
+{
+ return model->flags & UBLOX_F_TOBY_L4;
+}
+
static int ubloxmodem_init(void)
{
ublox_gprs_context_init();
+ ublox_netreg_init();
ublox_netmon_init();
ublox_lte_init();
@@ -45,6 +134,7 @@
static void ubloxmodem_exit(void)
{
ublox_gprs_context_exit();
+ ublox_netreg_exit();
ublox_netmon_exit();
ublox_lte_exit();
}
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/ofono/drivers/ubloxmodem/ubloxmodem.h
^
|
@@ -23,9 +23,30 @@
#define UBLOXMODEM "ubloxmodem"
+enum ublox_flags {
+ UBLOX_F_TOBY_L2 = (1 << 0),
+ UBLOX_F_TOBY_L4 = (1 << 1),
+ UBLOX_F_LARA_R2 = (1 << 2),
+ UBLOX_F_HAVE_USBCONF = (1 << 3),
+};
+
+struct ublox_model {
+ char *name;
+ int flags;
+};
+
+const struct ublox_model *ublox_model_from_name(const char *name);
+const struct ublox_model *ublox_model_from_id(int id);
+int ublox_model_to_id(const struct ublox_model *model);
+int ublox_is_toby_l2(const struct ublox_model *model);
+int ublox_is_toby_l4(const struct ublox_model *model);
+
extern void ublox_gprs_context_init(void);
extern void ublox_gprs_context_exit(void);
+void ublox_netreg_init(void);
+void ublox_netreg_exit(void);
+
extern void ublox_netmon_init(void);
extern void ublox_netmon_exit(void);
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/ofono/drivers/xmm7modem/netmon.c
^
|
@@ -47,6 +47,7 @@
struct netmon_driver_data {
GAtChat *chat;
+ int xmci_mode;
};
enum xmci_ofono_type_info {
@@ -85,6 +86,7 @@
{
struct cb_data *cbd = user_data;
struct ofono_netmon *netmon = cbd->data;
+ struct netmon_driver_data *nmd = ofono_netmon_get_data(netmon);
ofono_netmon_cb_t cb = cbd->cb;
struct ofono_error error;
GAtResultIter iter;
@@ -96,6 +98,11 @@
int ecn0 = -1;
int rsrq = -1;
int tech = -1;
+ int type = -1;
+ int ci = -1;
+ const char *cell_id;
+ char mcc[3];
+ char mnc[3];
DBG("ok %d", ok);
@@ -109,18 +116,23 @@
g_at_result_iter_init(&iter, result);
while (g_at_result_iter_next(&iter, "+XMCI:")) {
- if (!g_at_result_iter_next_number(&iter, &number))
+ if (!g_at_result_iter_next_number(&iter, &type))
break;
- tech = xmm7modem_map_radio_access_technology(number);
+ tech = xmm7modem_map_radio_access_technology(type);
- switch (number) {
+ switch (type) {
+ case XMCI_GSM_NEIGH_CELL:
case XMCI_GSM_SERV_CELL:
- /* skip <MCC>,<MNC>,<LAC>,<CI>,<BSIC> */
- g_at_result_iter_skip_next(&iter);
- g_at_result_iter_skip_next(&iter);
- g_at_result_iter_skip_next(&iter);
+ /* <MCC>,<MNC>,<LAC>,<CI>,<BSIC> */
+ g_at_result_iter_next_number(&iter, &number);
+ snprintf(mcc, 3, "%d", number);
+ g_at_result_iter_next_number(&iter, &number);
+ snprintf(mnc, 3, "%d", number);
g_at_result_iter_skip_next(&iter);
+ g_at_result_iter_next_string(&iter, &cell_id);
+ sscanf(&cell_id[2], "%x", &number);
+ ci = number != -1 ? number : 0;
g_at_result_iter_skip_next(&iter);
g_at_result_iter_next_number(&iter, &number);
@@ -129,15 +141,20 @@
g_at_result_iter_next_number(&iter, &number);
ber = number != 99 ? number : ber;
break;
+ case XMCI_UMTS_NEIGH_CELL:
case XMCI_UMTS_SERV_CELL:
/*
- * skip <MCC>,<MNC>,<LAC>,<CI><PSC>,<DLUARFNC>,
+ * <MCC>,<MNC>,<LAC>,<CI><PSC>,<DLUARFNC>,
* <ULUARFCN>,<PATHLOSS>,<RSSI>
*/
+ g_at_result_iter_next_number(&iter, &number);
+ snprintf(mcc, 3, "%d", number);
+ g_at_result_iter_next_number(&iter, &number);
+ snprintf(mnc, 3, "%d", number);
g_at_result_iter_skip_next(&iter);
- g_at_result_iter_skip_next(&iter);
- g_at_result_iter_skip_next(&iter);
- g_at_result_iter_skip_next(&iter);
+ g_at_result_iter_next_string(&iter, &cell_id);
+ sscanf(&cell_id[2], "%x", &number);
+ ci = number != -1 ? number : 0;
g_at_result_iter_skip_next(&iter);
g_at_result_iter_skip_next(&iter);
g_at_result_iter_skip_next(&iter);
@@ -150,15 +167,20 @@
g_at_result_iter_next_number(&iter, &number);
ecn0 = number != 255 ? number : ecn0;
break;
+ case XMCI_LTE_NEIGH_CELL:
case XMCI_LTE_SERV_CELL:
/*
- * skip <MCC>,<MNC>,<TAC>,<CI>,<PCI>,<DLUARFNC>,
+ * <MCC>,<MNC>,<TAC>,<CI>,<PCI>,<DLUARFNC>,
* <ULUARFCN>,<PATHLOSS_LTE>
*/
+ g_at_result_iter_next_number(&iter, &number);
+ snprintf(mcc, 3, "%d", number);
+ g_at_result_iter_next_number(&iter, &number);
+ snprintf(mnc, 3, "%d", number);
g_at_result_iter_skip_next(&iter);
- g_at_result_iter_skip_next(&iter);
- g_at_result_iter_skip_next(&iter);
- g_at_result_iter_skip_next(&iter);
+ g_at_result_iter_next_string(&iter, &cell_id);
+ sscanf(&cell_id[2], "%x", &number);
+ ci = number != -1 ? number : 0;
g_at_result_iter_skip_next(&iter);
g_at_result_iter_skip_next(&iter);
g_at_result_iter_skip_next(&iter);
@@ -174,8 +196,15 @@
break;
}
- ofono_netmon_serving_cell_notify(netmon,
+ if ((nmd->xmci_mode == 0) &&
+ (type == XMCI_GSM_NEIGH_CELL ||
+ type == XMCI_UMTS_NEIGH_CELL ||
+ type == XMCI_LTE_NEIGH_CELL)) {
+ ofono_netmon_neighbouring_cell_notify(netmon,
tech,
+ OFONO_NETMON_INFO_MCC, mcc,
+ OFONO_NETMON_INFO_MNC, mnc,
+ OFONO_NETMON_INFO_CI, ci,
OFONO_NETMON_INFO_RXLEV, rxlev,
OFONO_NETMON_INFO_BER, ber,
OFONO_NETMON_INFO_RSCP, rscp,
@@ -183,10 +212,25 @@
OFONO_NETMON_INFO_RSRQ, rsrq,
OFONO_NETMON_INFO_RSRP, rsrp,
OFONO_NETMON_INFO_INVALID);
-
- CALLBACK_WITH_SUCCESS(cb, cbd->data);
- break;
+ } else if ((nmd->xmci_mode == 1) &&
+ (type == XMCI_GSM_SERV_CELL ||
+ type == XMCI_UMTS_SERV_CELL ||
+ type == XMCI_LTE_SERV_CELL)) {
+ ofono_netmon_serving_cell_notify(netmon,
+ tech,
+ OFONO_NETMON_INFO_RXLEV, rxlev,
+ OFONO_NETMON_INFO_BER, ber,
+ OFONO_NETMON_INFO_RSCP, rscp,
+ OFONO_NETMON_INFO_ECN0, ecn0,
+ OFONO_NETMON_INFO_RSRQ, rsrq,
+ OFONO_NETMON_INFO_RSRP, rsrp,
+ OFONO_NETMON_INFO_INVALID);
+ break;
+ }
}
+
+ CALLBACK_WITH_SUCCESS(cb, cbd->data);
+ nmd->xmci_mode = -1;
}
static void xmm7modem_netmon_request_update(struct ofono_netmon *netmon,
@@ -194,6 +238,7 @@
{
struct netmon_driver_data *nmd = ofono_netmon_get_data(netmon);
struct cb_data *cbd = cb_data_new(cb, data);
+ nmd->xmci_mode = 1;
DBG("xmm7modem netmon request update");
@@ -205,6 +250,23 @@
CALLBACK_WITH_FAILURE(cb, data);
}
+static void xmm7modem_neighbouring_cell_update(struct ofono_netmon *netmon,
+ ofono_netmon_cb_t cb, void *data)
+{
+ struct netmon_driver_data *nmd = ofono_netmon_get_data(netmon);
+ struct cb_data *cbd = cb_data_new(cb, data);
+ nmd->xmci_mode = 0;
+
+ DBG("xmm7modem netmon request neighbouring cell update");
+
+ if (g_at_chat_send(nmd->chat, "AT+XMCI=0", xmci_prefix,
+ xmci_cb, cbd, g_free) > 0)
+ return;
+
+ g_free(cbd);
+ CALLBACK_WITH_FAILURE(cb, data);
+}
+
static gboolean ril_delayed_register(gpointer user_data)
{
struct ofono_netmon *netmon = user_data;
@@ -224,6 +286,7 @@
nmd = g_new0(struct netmon_driver_data, 1);
nmd->chat = g_at_chat_clone(chat);
+ nmd->xmci_mode = -1;
ofono_netmon_set_data(netmon, nmd);
@@ -250,6 +313,7 @@
.probe = xmm7modem_netmon_probe,
.remove = xmm7modem_netmon_remove,
.request_update = xmm7modem_netmon_request_update,
+ .neighbouring_cell_update = xmm7modem_neighbouring_cell_update,
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/ofono/drivers/xmm7modem/radio-settings.c
^
|
@@ -84,10 +84,10 @@
mode = OFONO_RADIO_ACCESS_MODE_LTE;
break;
case 3:
- mode = OFONO_RADIO_ACCESS_MODE_UMTS;
+ mode = OFONO_RADIO_ACCESS_MODE_UMTS|OFONO_RADIO_ACCESS_MODE_GSM;
break;
case 4:
- mode = OFONO_RADIO_ACCESS_MODE_LTE;
+ mode = OFONO_RADIO_ACCESS_MODE_LTE|OFONO_RADIO_ACCESS_MODE_UMTS;
break;
case 5:
mode = OFONO_RADIO_ACCESS_MODE_LTE;
@@ -157,7 +157,16 @@
break;
}
- if (value == 6)
+ if (mode ==
+ (OFONO_RADIO_ACCESS_MODE_UMTS|OFONO_RADIO_ACCESS_MODE_GSM)) {
+ value = 3;
+ preferred = 1;
+ }
+
+ if (mode == (OFONO_RADIO_ACCESS_MODE_LTE|OFONO_RADIO_ACCESS_MODE_UMTS))
+ value = 4;
+
+ if (value == 6 || value == 3 || value == 4)
snprintf(buf, sizeof(buf), "AT+XACT=%u,%u", value, preferred);
else
snprintf(buf, sizeof(buf), "AT+XACT=%u", value);
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/ofono/gatchat/gatmux.c
^
|
@@ -952,8 +952,7 @@
mux_query_cb, msd, msd_free) > 0)
return TRUE;
- if (msd)
- msd_free(msd);
+ msd_free(msd);
return FALSE;
}
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/ofono/gatchat/gatresult.c
^
|
@@ -111,6 +111,7 @@
unsigned int pos;
unsigned int end;
unsigned int len;
+ unsigned int stripped;
char *line;
if (iter == NULL)
@@ -139,7 +140,12 @@
while (end < len && line[end] != ',' && line[end] != ')')
end += 1;
- iter->buf[end] = '\0';
+ stripped = end;
+
+ while (line[stripped - 1] == ' ')
+ stripped -= 1;
+
+ iter->buf[stripped] = '\0';
out:
iter->line_pos = skip_to_next_field(line, end, len);
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/ofono/gatchat/gatresult.h
^
|
@@ -22,6 +22,8 @@
#ifndef __GATCHAT_RESULT_H
#define __GATCHAT_RESULT_H
+#include <glib.h>
+
#ifdef __cplusplus
extern "C" {
#endif
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/ofono/gatchat/gatutil.c
^
|
@@ -67,8 +67,7 @@
escaped_str[0] = type;
escaped_str[1] = ' ';
- escaped_str[2] = '\0';
- escaped_str[escaped] = '\0';
+ memset(escaped_str + 2, '\0', escaped - 1);
for (escaped = 2, i = 0; i < len; i++) {
unsigned char c = str[i];
@@ -87,11 +86,11 @@
escaped_str[escaped++] = 'n';
break;
case 26:
- strncpy(&escaped_str[escaped], ctrlz, ctrlz_size);
+ memcpy(escaped_str + escaped, ctrlz, ctrlz_size);
escaped += ctrlz_size;
break;
case 25:
- strncpy(&escaped_str[escaped], esc, esc_size);
+ memcpy(escaped_str + escaped, esc, esc_size);
escaped += esc_size;
break;
default:
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/ofono/gisi/modem.c
^
|
@@ -33,6 +33,8 @@
#include <errno.h>
#include <glib.h>
+#pragma GCC diagnostic ignored "-Waddress-of-packed-member"
+
#include "message.h"
#include "common.h"
#include "modem.h"
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/ofono/gisi/socket.c
^
|
@@ -32,6 +32,8 @@
#include <fcntl.h>
#include <glib.h>
+#pragma GCC diagnostic ignored "-Waddress-of-packed-member"
+
#include "phonet.h"
#include "socket.h"
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/ofono/include/gprs-context.h
^
|
@@ -93,6 +93,8 @@
enum ofono_gprs_context_type ofono_gprs_context_get_type(
struct ofono_gprs_context *gc);
+const char *ofono_gprs_context_get_interface(struct ofono_gprs_context *gc);
+
void ofono_gprs_context_set_interface(struct ofono_gprs_context *gc,
const char *interface);
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/ofono/include/netmon.h
^
|
@@ -43,6 +43,8 @@
unsigned int enable,
unsigned int period,
ofono_netmon_cb_t cb, void *data);
+ void (*neighbouring_cell_update)(struct ofono_netmon *netmon,
+ ofono_netmon_cb_t cb, void *data);
};
enum ofono_netmon_cell_type {
@@ -104,6 +106,10 @@
void *ofono_netmon_get_data(struct ofono_netmon *netmon);
+void ofono_netmon_neighbouring_cell_notify(struct ofono_netmon *netmon,
+ enum ofono_netmon_cell_type type,
+ int info_type, ...);
+
#ifdef __cplusplus
}
#endif
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/ofono/include/sim.h
^
|
@@ -138,6 +138,10 @@
typedef void (*ofono_sim_logical_access_cb_t)(const struct ofono_error *error,
const unsigned char *resp, unsigned int len, void *data);
+typedef void (*ofono_sim_set_active_card_slot_cb_t)(
+ const struct ofono_error *error,
+ void *data);
+
struct ofono_sim_driver {
const char *name;
int (*probe)(struct ofono_sim *sim, unsigned int vendor, void *data);
@@ -211,7 +215,9 @@
void (*logical_access)(struct ofono_sim *sim, int session_id,
const unsigned char *pdu, unsigned int len,
ofono_sim_logical_access_cb_t cb, void *data);
- /* Since mer/1.23+git28 */
+ void (*set_active_card_slot)(struct ofono_sim *sim, unsigned int index,
+ ofono_sim_set_active_card_slot_cb_t cb, void *data);
+ /* Since mer/1.23+git28 */
void (*open_channel2)(struct ofono_sim *sim, const unsigned char *aid,
unsigned int len, ofono_sim_open_channel_cb_t cb,
void *data);
@@ -229,6 +235,9 @@
void ofono_sim_set_data(struct ofono_sim *sim, void *data);
void *ofono_sim_get_data(struct ofono_sim *sim);
+void ofono_sim_set_card_slot_count(struct ofono_sim *sim, unsigned int val);
+void ofono_sim_set_active_card_slot(struct ofono_sim *sim,
+ unsigned int val);
const char *ofono_sim_get_imsi(struct ofono_sim *sim);
const char *ofono_sim_get_mcc(struct ofono_sim *sim);
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/ofono/include/types.h
^
|
@@ -55,7 +55,9 @@
OFONO_ACCESS_TECHNOLOGY_UTRAN_HSDPA = 4,
OFONO_ACCESS_TECHNOLOGY_UTRAN_HSUPA = 5,
OFONO_ACCESS_TECHNOLOGY_UTRAN_HSDPA_HSUPA = 6,
- OFONO_ACCESS_TECHNOLOGY_EUTRAN = 7
+ OFONO_ACCESS_TECHNOLOGY_EUTRAN = 7,
+ OFONO_ACCESS_TECHNOLOGY_NB_IOT_M1 = 8,
+ OFONO_ACCESS_TECHNOLOGY_NB_IOT_NB1 = 9
};
/* 27.007 Section 6.2 */
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/ofono/include/ussd.h
^
|
@@ -3,6 +3,7 @@
* oFono - Open Source Telephony
*
* Copyright (C) 2008-2011 Intel Corporation. All rights reserved.
+ * Copyright (C) 2021-2022 Jolla Ltd.
*
* 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
@@ -69,6 +70,10 @@
void ofono_ussd_set_data(struct ofono_ussd *ussd, void *data);
void *ofono_ussd_get_data(struct ofono_ussd *ussd);
+/* Since mer/1.28+git2 */
+char *ofono_ussd_decode(int dcs, const void *pdu, int len);
+void ofono_ussd_decode_free(char *ussd);
+
#ifdef __cplusplus
}
#endif
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/ofono/include/voicecall.h
^
|
@@ -190,6 +190,10 @@
void ofono_voicecall_ringback_tone_notify(struct ofono_voicecall *vc,
const ofono_bool_t playTone);
+/* Since mer/1.27+git3 */
+ofono_bool_t ofono_voicecall_is_emergency_number(struct ofono_voicecall *vc,
+ const char *number);
+
#ifdef __cplusplus
}
#endif
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/ofono/plugins/alcatel.c
^
|
@@ -91,34 +91,7 @@
static GAtChat *open_device(struct ofono_modem *modem,
const char *key, char *debug)
{
- const char *device;
- GIOChannel *channel;
- GAtSyntax *syntax;
- GAtChat *chat;
-
- device = ofono_modem_get_string(modem, key);
- if (device == NULL)
- return NULL;
-
- DBG("%s %s", key, device);
-
- channel = g_at_tty_open(device, NULL);
- if (channel == NULL)
- return NULL;
-
- syntax = g_at_syntax_new_gsm_permissive();
- chat = g_at_chat_new(channel, syntax);
- g_at_syntax_unref(syntax);
-
- g_io_channel_unref(channel);
-
- if (chat == NULL)
- return NULL;
-
- if (getenv("OFONO_AT_DEBUG"))
- g_at_chat_set_debug(chat, alcatel_debug, debug);
-
- return chat;
+ return at_util_open_device(modem, key, alcatel_debug, debug, NULL);
}
static void sim_state_cb(gboolean present, gpointer user_data)
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/ofono/plugins/hfp_ag_bluez5.c
^
|
@@ -38,9 +38,6 @@
#include <ofono/modem.h>
#include <ofono/handsfree-audio.h>
-typedef struct GAtChat GAtChat;
-typedef struct GAtResult GAtResult;
-
#include "drivers/atmodem/atutil.h"
#include "hfp.h"
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/ofono/plugins/hso.c
^
|
@@ -301,34 +301,7 @@
static GAtChat *open_device(struct ofono_modem *modem,
const char *key, char *debug)
{
- const char *device;
- GIOChannel *channel;
- GAtSyntax *syntax;
- GAtChat *chat;
-
- device = ofono_modem_get_string(modem, key);
- if (device == NULL)
- return NULL;
-
- DBG("%s %s", key, device);
-
- channel = g_at_tty_open(device, NULL);
- if (channel == NULL)
- return NULL;
-
- syntax = g_at_syntax_new_gsm_permissive();
- chat = g_at_chat_new(channel, syntax);
- g_at_syntax_unref(syntax);
-
- g_io_channel_unref(channel);
-
- if (chat == NULL)
- return NULL;
-
- if (getenv("OFONO_AT_DEBUG"))
- g_at_chat_set_debug(chat, hso_debug, debug);
-
- return chat;
+ return at_util_open_device(modem, key, hso_debug, debug, NULL);
}
static int hso_enable(struct ofono_modem *modem)
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/ofono/plugins/huawei.c
^
|
@@ -553,36 +553,15 @@
static GAtChat *open_device(struct ofono_modem *modem,
const char *key, char *debug)
{
- const char *device;
- GIOChannel *channel;
- GAtSyntax *syntax;
- GAtChat *chat;
+ GAtChat *chat = at_util_open_device(modem, key, huawei_debug, debug,
+ NULL);
- device = ofono_modem_get_string(modem, key);
- if (device == NULL)
- return NULL;
-
- DBG("%s %s", key, device);
-
- channel = g_at_tty_open(device, NULL);
- if (channel == NULL)
- return NULL;
-
- syntax = g_at_syntax_new_gsm_permissive();
- chat = g_at_chat_new(channel, syntax);
- g_at_syntax_unref(syntax);
-
- g_io_channel_unref(channel);
-
- if (chat == NULL)
+ if (!chat)
return NULL;
g_at_chat_add_terminator(chat, "COMMAND NOT SUPPORT", -1, FALSE);
g_at_chat_add_terminator(chat, "TOO MANY PARAMETERS", -1, FALSE);
- if (getenv("OFONO_AT_DEBUG"))
- g_at_chat_set_debug(chat, huawei_debug, debug);
-
return chat;
}
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/ofono/plugins/icera.c
^
|
@@ -96,42 +96,9 @@
static GAtChat *open_device(struct ofono_modem *modem,
const char *key, char *debug)
{
- GAtChat *chat;
- GAtSyntax *syntax;
- GIOChannel *channel;
- GHashTable *options;
- const char *device;
-
- device = ofono_modem_get_string(modem, key);
- if (device == NULL)
- return NULL;
-
- options = g_hash_table_new(g_str_hash, g_str_equal);
- if (options == NULL)
- return NULL;
-
- g_hash_table_insert(options, "Baud", "115200");
-
- channel = g_at_tty_open(device, options);
-
- g_hash_table_destroy(options);
-
- if (channel == NULL)
- return NULL;
-
- syntax = g_at_syntax_new_gsm_permissive();
- chat = g_at_chat_new(channel, syntax);
- g_at_syntax_unref(syntax);
-
- g_io_channel_unref(channel);
-
- if (chat == NULL)
- return NULL;
-
- if (getenv("OFONO_AT_DEBUG"))
- g_at_chat_set_debug(chat, icera_debug, debug);
-
- return chat;
+ return at_util_open_device(modem, key, icera_debug, debug,
+ "Baud", "115200",
+ NULL);
}
static void ussdmode_query(gboolean ok, GAtResult *result,
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/ofono/plugins/linktop.c
^
|
@@ -91,34 +91,7 @@
static GAtChat *open_device(struct ofono_modem *modem,
const char *key, char *debug)
{
- const char *device;
- GIOChannel *channel;
- GAtSyntax *syntax;
- GAtChat *chat;
-
- device = ofono_modem_get_string(modem, key);
- if (device == NULL)
- return NULL;
-
- DBG("%s %s", key, device);
-
- channel = g_at_tty_open(device, NULL);
- if (channel == NULL)
- return NULL;
-
- syntax = g_at_syntax_new_gsm_permissive();
- chat = g_at_chat_new(channel, syntax);
- g_at_syntax_unref(syntax);
-
- g_io_channel_unref(channel);
-
- if (chat == NULL)
- return NULL;
-
- if (getenv("OFONO_AT_DEBUG"))
- g_at_chat_set_debug(chat, linktop_debug, debug);
-
- return chat;
+ return at_util_open_device(modem, key, linktop_debug, debug, NULL);
}
static void cfun_enable(gboolean ok, GAtResult *result, gpointer user_data)
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/ofono/plugins/mbm.c
^
|
@@ -285,35 +285,12 @@
cfun_query, modem, NULL);
}
-static GAtChat *create_port(const char *device)
+static GAtChat *open_device(struct ofono_modem *modem, const char *key,
+ char *debug)
{
- GAtSyntax *syntax;
- GIOChannel *channel;
- GAtChat *chat;
- GHashTable *options;
-
- options = g_hash_table_new(g_str_hash, g_str_equal);
- if (options == NULL)
- return NULL;
-
- g_hash_table_insert(options, "Baud", "115200");
-
- channel = g_at_tty_open(device, options);
-
- g_hash_table_destroy(options);
-
- if (channel == NULL)
- return NULL;
-
- syntax = g_at_syntax_new_gsm_permissive();
- chat = g_at_chat_new(channel, syntax);
- g_at_syntax_unref(syntax);
- g_io_channel_unref(channel);
-
- if (chat == NULL)
- return NULL;
-
- return chat;
+ return at_util_open_device(modem, key, mbm_debug, debug,
+ "Baud", "115200",
+ NULL);
}
static int mbm_enable(struct ofono_modem *modem)
@@ -332,14 +309,11 @@
if (modem_dev == NULL || data_dev == NULL)
return -EINVAL;
- data->modem_port = create_port(modem_dev);
+ data->modem_port = open_device(modem, "ModemDevice", "Modem: ");
if (data->modem_port == NULL)
return -EIO;
- if (getenv("OFONO_AT_DEBUG"))
- g_at_chat_set_debug(data->modem_port, mbm_debug, "Modem: ");
-
- data->data_port = create_port(data_dev);
+ data->data_port = open_device(modem, "DataDevice", "Data: ");
if (data->data_port == NULL) {
g_at_chat_unref(data->modem_port);
data->modem_port = NULL;
@@ -347,9 +321,6 @@
return -EIO;
}
- if (getenv("OFONO_AT_DEBUG"))
- g_at_chat_set_debug(data->data_port, mbm_debug, "Data: ");
-
g_at_chat_register(data->modem_port, "*EMRDY:", emrdy_notifier,
FALSE, modem, NULL);
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/ofono/plugins/nokia.c
^
|
@@ -43,6 +43,7 @@
#include <ofono/phonebook.h>
#include <ofono/log.h>
+#include <drivers/atmodem/atutil.h>
#include <drivers/atmodem/vendor.h>
static const char *none_prefix[] = { NULL };
@@ -91,34 +92,7 @@
static GAtChat *open_device(struct ofono_modem *modem,
const char *key, char *debug)
{
- const char *device;
- GAtSyntax *syntax;
- GIOChannel *channel;
- GAtChat *chat;
-
- device = ofono_modem_get_string(modem, key);
- if (device == NULL)
- return NULL;
-
- DBG("%s %s", key, device);
-
- channel = g_at_tty_open(device, NULL);
- if (channel == NULL)
- return NULL;
-
- syntax = g_at_syntax_new_gsm_permissive();
- chat = g_at_chat_new(channel, syntax);
- g_at_syntax_unref(syntax);
-
- g_io_channel_unref(channel);
-
- if (chat == NULL)
- return NULL;
-
- if (getenv("OFONO_AT_DEBUG"))
- g_at_chat_set_debug(chat, nokia_debug, debug);
-
- return chat;
+ return at_util_open_device(modem, key, nokia_debug, debug, NULL);
}
static void cfun_enable(gboolean ok, GAtResult *result, gpointer user_data)
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/ofono/plugins/novatel.c
^
|
@@ -96,32 +96,7 @@
static GAtChat *open_device(struct ofono_modem *modem,
const char *key, char *debug)
{
- GAtChat *chat;
- GAtSyntax *syntax;
- GIOChannel *channel;
- const char *device;
-
- device = ofono_modem_get_string(modem, key);
- if (device == NULL)
- return NULL;
-
- channel = g_at_tty_open(device, NULL);
- if (channel == NULL)
- return NULL;
-
- syntax = g_at_syntax_new_gsm_permissive();
- chat = g_at_chat_new(channel, syntax);
- g_at_syntax_unref(syntax);
-
- g_io_channel_unref(channel);
-
- if (chat == NULL)
- return NULL;
-
- if (getenv("OFONO_AT_DEBUG"))
- g_at_chat_set_debug(chat, novatel_debug, debug);
-
- return chat;
+ return at_util_open_device(modem, key, novatel_debug, debug, NULL);
}
static void cfun_enable(gboolean ok, GAtResult *result, gpointer user_data)
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/ofono/plugins/phonesim.c
^
|
@@ -161,9 +161,7 @@
break;
}
- if (ctx->apn)
- snprintf(buf + len, sizeof(buf) - len - 3, ",\"%s\"",
- ctx->apn);
+ snprintf(buf + len, sizeof(buf) - len - 3, ",\"%s\"", ctx->apn);
/* Assume always succeeds */
if (g_at_chat_send(gcd->chat, buf, none_prefix, NULL, NULL, NULL) == 0)
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/ofono/plugins/quectel.c
^
|
@@ -25,35 +25,100 @@
#include <errno.h>
#include <stdlib.h>
+#include <stdbool.h>
+#include <unistd.h>
#include <glib.h>
+#include <sys/stat.h>
+#include <sys/ioctl.h>
+#include <sys/socket.h>
+#include <linux/tty.h>
+#include <linux/gsmmux.h>
#include <gatchat.h>
#include <gattty.h>
#define OFONO_API_SUBJECT_TO_CHANGE
+#include <ofono.h>
#include <ofono/plugin.h>
#include <ofono/modem.h>
#include <ofono/devinfo.h>
#include <ofono/netreg.h>
#include <ofono/sim.h>
+#include <ofono/sms.h>
+#include <ofono/phonebook.h>
+#include <ofono/voicecall.h>
+#include <ofono/call-volume.h>
#include <ofono/gprs.h>
#include <ofono/gprs-context.h>
#include <ofono/log.h>
+#include <ofono/dbus.h>
+
+#include <gdbus/gdbus.h>
#include <drivers/atmodem/atutil.h>
#include <drivers/atmodem/vendor.h>
static const char *cfun_prefix[] = { "+CFUN:", NULL };
static const char *cpin_prefix[] = { "+CPIN:", NULL };
+static const char *cbc_prefix[] = { "+CBC:", NULL };
+static const char *qinistat_prefix[] = { "+QINISTAT:", NULL };
+static const char *cgmm_prefix[] = { "UC15", "Quectel_M95", "Quectel_MC60",
+ NULL };
static const char *none_prefix[] = { NULL };
+static const uint8_t gsm0710_terminate[] = {
+ 0xf9, /* open flag */
+ 0x03, /* channel 0 */
+ 0xef, /* UIH frame */
+ 0x05, /* 2 data bytes */
+ 0xc3, /* terminate 1 */
+ 0x01, /* terminate 2 */
+ 0xf2, /* crc */
+ 0xf9, /* close flag */
+};
+
+enum quectel_model {
+ QUECTEL_UNKNOWN,
+ QUECTEL_UC15,
+ QUECTEL_M95,
+ QUECTEL_MC60,
+};
+
struct quectel_data {
GAtChat *modem;
GAtChat *aux;
guint cpin_ready;
- gboolean have_sim;
+ guint call_ready;
+ bool have_sim;
+ enum ofono_vendor vendor;
+ enum quectel_model model;
+ struct l_timeout *sms_ready_timer;
+
+ /* used by quectel uart driver */
+ GAtChat *uart;
+ int mux_ready_count;
+ int initial_ldisc;
+ struct l_gpio_writer *gpio;
+};
+
+struct dbus_hw {
+ DBusMessage *msg;
+ struct ofono_modem *modem;
+ int32_t charge_status;
+ int32_t charge_level;
+ int32_t voltage;
+};
+
+enum quectel_power_event {
+ LOW_POWER_DOWN = -2,
+ LOW_WARNING = -1,
+ NORMAL_POWER_DOWN = 0,
+ HIGH_WARNING = 1,
+ HIGH_POWER_DOWN = 2,
};
+static const char dbus_hw_interface[] = OFONO_SERVICE ".quectel.Hardware";
+
static void quectel_debug(const char *str, void *user_data)
{
const char *prefix = user_data;
@@ -61,6 +126,43 @@
ofono_info("%s%s", prefix, str);
}
+static int quectel_probe_gpio(struct ofono_modem *modem)
+{
+ struct quectel_data *data = ofono_modem_get_data(modem);
+ struct l_gpio_chip *gpiochip;
+ uint32_t offset;
+ const char *chip_name, *offset_str;
+ uint32_t value = 0;
+
+ DBG("%p", modem);
+
+ chip_name = ofono_modem_get_string(modem, "GpioChip");
+ if (!chip_name)
+ return 0;
+
+ offset_str = ofono_modem_get_string(modem, "GpioOffset");
+ if (!offset_str)
+ return -EINVAL;
+
+ offset = strtoul(offset_str, NULL, 0);
+ if (!offset)
+ return -EINVAL;
+
+ gpiochip = l_gpio_chip_new(chip_name);
+ if (!gpiochip)
+ return -ENODEV;
+
+ data->gpio = l_gpio_writer_new(gpiochip, "ofono", 1, &offset,
+ &value);
+
+ l_gpio_chip_free(gpiochip);
+
+ if (!data->gpio)
+ return -EIO;
+
+ return 0;
+}
+
static int quectel_probe(struct ofono_modem *modem)
{
struct quectel_data *data;
@@ -73,7 +175,7 @@
ofono_modem_set_data(modem, data);
- return 0;
+ return quectel_probe_gpio(modem);
}
static void quectel_remove(struct ofono_modem *modem)
@@ -86,42 +188,341 @@
g_at_chat_unregister(data->aux, data->cpin_ready);
ofono_modem_set_data(modem, NULL);
+ l_gpio_writer_free(data->gpio);
g_at_chat_unref(data->aux);
g_at_chat_unref(data->modem);
+ g_at_chat_unref(data->uart);
g_free(data);
}
-static GAtChat *open_device(struct ofono_modem *modem,
- const char *key, char *debug)
+static void close_mux_cb(struct l_timeout *timeout, void *user_data)
+{
+ struct ofono_modem *modem = user_data;
+ struct quectel_data *data = ofono_modem_get_data(modem);
+ GIOChannel *device;
+ uint32_t gpio_value = 0;
+ ssize_t write_count;
+ int fd;
+
+ DBG("%p", modem);
+
+ device = g_at_chat_get_channel(data->uart);
+ fd = g_io_channel_unix_get_fd(device);
+
+ /* restore initial tty line discipline */
+ if (ioctl(fd, TIOCSETD, &data->initial_ldisc) < 0)
+ ofono_warn("Failed to restore line discipline");
+
+ /* terminate gsm 0710 multiplexing on the modem side */
+ write_count = write(fd, gsm0710_terminate, sizeof(gsm0710_terminate));
+ if (write_count != sizeof(gsm0710_terminate))
+ ofono_warn("Failed to terminate gsm multiplexing");
+
+ g_at_chat_unref(data->uart);
+ data->uart = NULL;
+
+ l_timeout_remove(timeout);
+ l_gpio_writer_set(data->gpio, 1, &gpio_value);
+ ofono_modem_set_powered(modem, FALSE);
+}
+
+static void close_serial(struct ofono_modem *modem)
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/ofono/plugins/samsung.c
^
|
@@ -149,47 +149,21 @@
static int samsung_enable(struct ofono_modem *modem)
{
struct samsung_data *data = ofono_modem_get_data(modem);
- GAtSyntax *syntax;
- GIOChannel *channel;
- GHashTable *options;
- const char *device;
-
- device = ofono_modem_get_string(modem, "ControlPort");
- if (device == NULL)
- return -EINVAL;
-
- options = g_hash_table_new(g_str_hash, g_str_equal);
- if (options == NULL)
- return -ENOMEM;
-
- g_hash_table_insert(options, "Baud", "115200");
- g_hash_table_insert(options, "Parity", "none");
- g_hash_table_insert(options, "StopBits", "1");
- g_hash_table_insert(options, "DataBits", "8");
- g_hash_table_insert(options, "XonXoff", "off");
- g_hash_table_insert(options, "RtsCts", "on");
- g_hash_table_insert(options, "Local", "on");
- g_hash_table_insert(options, "Read", "on");
-
- channel = g_at_tty_open(device, options);
-
- g_hash_table_destroy(options);
-
- if (channel == NULL)
- return -EIO;
-
- syntax = g_at_syntax_new_gsm_permissive();
- data->chat = g_at_chat_new(channel, syntax);
- g_at_syntax_unref(syntax);
-
- g_io_channel_unref(channel);
+ data->chat = at_util_open_device(modem, "ControlPort",
+ samsung_debug, "Device: ",
+ "Baud", "115200",
+ "Parity", "none",
+ "StopBits", "1",
+ "DataBits", "8",
+ "XonXoff", "off",
+ "RtsCts", "on",
+ "Local", "on",
+ "Read", "on",
+ NULL);
if (data->chat == NULL)
return -ENOMEM;
- if (getenv("OFONO_AT_DEBUG"))
- g_at_chat_set_debug(data->chat, samsung_debug, "Device: ");
-
g_at_chat_send(data->chat, "ATE0", NULL, NULL, NULL, NULL);
g_at_chat_send(data->chat, "AT+CMEE=1", NULL, NULL, NULL, NULL);
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/ofono/plugins/sierra.c
^
|
@@ -94,34 +94,7 @@
static GAtChat *open_device(struct ofono_modem *modem,
const char *key, char *debug)
{
- const char *device;
- GAtSyntax *syntax;
- GIOChannel *channel;
- GAtChat *chat;
-
- device = ofono_modem_get_string(modem, key);
- if (device == NULL)
- return NULL;
-
- DBG("%s %s", key, device);
-
- channel = g_at_tty_open(device, NULL);
- if (channel == NULL)
- return NULL;
-
- syntax = g_at_syntax_new_gsm_permissive();
- chat = g_at_chat_new(channel, syntax);
- g_at_syntax_unref(syntax);
-
- g_io_channel_unref(channel);
-
- if (chat == NULL)
- return NULL;
-
- if (getenv("OFONO_AT_DEBUG"))
- g_at_chat_set_debug(chat, sierra_debug, debug);
-
- return chat;
+ return at_util_open_device(modem, key, sierra_debug, debug, NULL);
}
static void sim_state_cb(gboolean present, gpointer user_data)
@@ -149,6 +122,8 @@
if (!ok) {
g_at_chat_unref(data->modem);
data->modem = NULL;
+ ofono_modem_set_powered(modem, FALSE);
+ return;
}
data->sim_state_query = at_util_sim_state_query_new(data->modem,
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/ofono/plugins/sim900.c
^
|
@@ -115,7 +115,7 @@
if (strstr(model, "SIM800"))
data->modem_type = SIM800;
else if (strstr(model, "SIM900"))
- data->modem_type = SIM800;
+ data->modem_type = SIM900;
else
data->modem_type = SIMCOM_UNKNOWN;
}
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/ofono/plugins/speedup.c
^
|
@@ -109,34 +109,7 @@
static GAtChat *open_device(struct ofono_modem *modem,
const char *key, char *debug)
{
- const char *device;
- GIOChannel *channel;
- GAtSyntax *syntax;
- GAtChat *chat;
-
- device = ofono_modem_get_string(modem, key);
- if (device == NULL)
- return NULL;
-
- DBG("%s %s", key, device);
-
- channel = g_at_tty_open(device, NULL);
- if (channel == NULL)
- return NULL;
-
- syntax = g_at_syntax_new_gsm_permissive();
- chat = g_at_chat_new(channel, syntax);
- g_at_syntax_unref(syntax);
-
- g_io_channel_unref(channel);
-
- if (chat == NULL)
- return NULL;
-
- if (getenv("OFONO_AT_DEBUG"))
- g_at_chat_set_debug(chat, speedup_debug, debug);
-
- return chat;
+ return at_util_open_device(modem, key, speedup_debug, debug, NULL);
}
static void sim_state_cb(gboolean present, gpointer user_data)
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/ofono/plugins/speedupcdma.c
^
|
@@ -38,6 +38,7 @@
#include <ofono/cdma-connman.h>
#include <ofono/log.h>
+#include "drivers/atmodem/atutil.h"
#include "drivers/atmodem/vendor.h"
struct speedupcdma_data {
@@ -102,34 +103,7 @@
static GAtChat *open_device(struct ofono_modem *modem,
const char *key, char *debug)
{
- const char *device;
- GIOChannel *channel;
- GAtSyntax *syntax;
- GAtChat *chat;
-
- device = ofono_modem_get_string(modem, key);
- if (device == NULL)
- return NULL;
-
- DBG("%s %s", key, device);
-
- channel = g_at_tty_open(device, NULL);
- if (channel == NULL)
- return NULL;
-
- syntax = g_at_syntax_new_gsm_permissive();
- chat = g_at_chat_new(channel, syntax);
- g_at_syntax_unref(syntax);
-
- g_io_channel_unref(channel);
-
- if (chat == NULL)
- return NULL;
-
- if (getenv("OFONO_AT_DEBUG"))
- g_at_chat_set_debug(chat, speedupcdma_debug, debug);
-
- return chat;
+ return at_util_open_device(modem, key, speedupcdma_debug, debug, NULL);
}
static int speedupcdma_enable(struct ofono_modem *modem)
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/ofono/plugins/telit.c
^
|
@@ -116,41 +116,9 @@
static GAtChat *open_device(struct ofono_modem *modem,
const char *key, char *debug)
{
- const char *device;
- GAtSyntax *syntax;
- GIOChannel *channel;
- GAtChat *chat;
- GHashTable *options;
-
- device = ofono_modem_get_string(modem, key);
- if (device == NULL)
- return NULL;
-
- DBG("%s %s", key, device);
-
- options = g_hash_table_new(g_str_hash, g_str_equal);
- if (options == NULL)
- return NULL;
-
- g_hash_table_insert(options, "Baud", "115200");
- channel = g_at_tty_open(device, options);
- g_hash_table_destroy(options);
-
- if (channel == NULL)
- return NULL;
-
- syntax = g_at_syntax_new_gsm_permissive();
- chat = g_at_chat_new(channel, syntax);
- g_at_syntax_unref(syntax);
- g_io_channel_unref(channel);
-
- if (chat == NULL)
- return NULL;
-
- if (getenv("OFONO_AT_DEBUG"))
- g_at_chat_set_debug(chat, telit_debug, debug);
-
- return chat;
+ return at_util_open_device(modem, key, telit_debug, debug,
+ "Baud", "115200",
+ NULL);
}
static void switch_sim_state_status(struct ofono_modem *modem, int status)
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/ofono/plugins/ublox.c
^
|
@@ -40,25 +40,32 @@
#include <ofono/gprs-context.h>
#include <ofono/netmon.h>
#include <ofono/lte.h>
+#include <ofono/sms.h>
#include <ofono/voicecall.h>
+#include <ofono/call-forwarding.h>
+#include <ofono/call-settings.h>
+#include <ofono/call-meter.h>
+#include <ofono/call-barring.h>
+#include <ofono/message-waiting.h>
+#include <ofono/ussd.h>
-#include <drivers/atmodem/atutil.h>
#include <drivers/atmodem/vendor.h>
+#include <drivers/ubloxmodem/ubloxmodem.h>
+static const char *uusbconf_prefix[] = { "+UUSBCONF:", NULL };
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,
+enum ublox_device_flags {
+ UBLOX_DEVICE_F_HIGH_THROUGHPUT_MODE = (1 << 0),
};
struct ublox_data {
GAtChat *modem;
GAtChat *aux;
- int model_id;
enum ofono_vendor vendor_family;
+
+ const struct ublox_model *model;
+ int flags;
};
static void ublox_debug(const char *str, void *user_data)
@@ -98,34 +105,8 @@
static GAtChat *open_device(struct ofono_modem *modem,
const char *key, char *debug)
{
- const char *device;
- GAtSyntax *syntax;
- GIOChannel *channel;
- GAtChat *chat;
-
- device = ofono_modem_get_string(modem, key);
- if (device == NULL)
- return NULL;
-
- DBG("%s %s", key, device);
-
- channel = g_at_tty_open(device, NULL);
- if (channel == NULL)
- return NULL;
-
- syntax = g_at_syntax_new_gsm_permissive();
- chat = g_at_chat_new(channel, syntax);
- g_at_syntax_unref(syntax);
-
- g_io_channel_unref(channel);
-
- if (chat == NULL)
- return NULL;
-
- if (getenv("OFONO_AT_DEBUG"))
- g_at_chat_set_debug(chat, ublox_debug, debug);
-
- return chat;
+ return at_util_open_device(modem, key, ublox_debug, debug,
+ NULL);
}
static void cfun_enable(gboolean ok, GAtResult *result, gpointer user_data)
@@ -144,77 +125,151 @@
return;
}
- if (data->model_id == TOBYL2_HIGH_THROUGHPUT_MODE)
- /* use bridged mode until routed mode support is added */
- g_at_chat_send(data->aux, "AT+UBMCONF=2", none_prefix,
- NULL, NULL, NULL);
-
ofono_modem_set_powered(modem, TRUE);
}
-static int ublox_enable(struct ofono_modem *modem)
+static void query_usbconf_cb(gboolean ok,
+ GAtResult *result, gpointer user_data)
{
+ struct ofono_modem *modem = user_data;
struct ublox_data *data = ofono_modem_get_data(modem);
- const char *model_str = NULL;
+ GAtResultIter iter;
+ int profile;
- DBG("%p", modem);
+ if (!ok) {
+ ofono_error("Unable to query USB configuration");
+ goto error;
+ }
- model_str = ofono_modem_get_string(modem, "Model");
- if (model_str == NULL)
- return -EINVAL;
+ g_at_result_iter_init(&iter, result);
- /*
- * Toby L2 devices are more complex and special than previously
- * supported U-Blox devices. So they need a vendor of their own.
- */
- data->model_id = atoi(model_str);
+retry:
+ if (!g_at_result_iter_next(&iter, "+UUSBCONF:")) {
+ ofono_error("Unable to query USB configuration");
+ goto error;
+ }
- switch (data->model_id) {
- case SARA_G270:
- data->vendor_family = OFONO_VENDOR_UBLOX;
- break;
- case TOBYL2_COMPATIBLE_MODE:
- case TOBYL2_HIGH_THROUGHPUT_MODE:
- data->vendor_family = OFONO_VENDOR_UBLOX_TOBY_L2;
+ if (!g_at_result_iter_next_number(&iter, &profile))
+ goto retry;
+
+ switch (profile) {
+ case 0: /* Fairly back compatible */
+ case 1: /* Fairly back compatible plus audio */
break;
- case TOBYL2_MEDIUM_THROUGHPUT_MODE:
- DBG("low/medium throughtput profile unsupported");
+ case 2: /* Low/medium throughput */
+ ofono_error("Medium throughput mode not supported");
+ goto error;
+ case 3: /* High throughput mode */
+ data->flags |= UBLOX_DEVICE_F_HIGH_THROUGHPUT_MODE;
break;
default:
- DBG("unknown ublox model id %d", data->model_id);
- return -EINVAL;
+ ofono_error("Unexpected USB profile: %d", profile);
+ goto error;
}
- data->aux = open_device(modem, "Aux", "Aux: ");
- if (data->aux == NULL)
- return -EINVAL;
+ if (g_at_chat_send(data->aux, "AT+CFUN=4", none_prefix,
+ cfun_enable, modem, NULL))
+ return;
+
+error:
+ g_at_chat_unref(data->aux);
+ data->aux = NULL;
+ g_at_chat_unref(data->modem);
+ data->modem = NULL;
+ ofono_modem_set_powered(modem, FALSE);
+}
- if (data->vendor_family == OFONO_VENDOR_UBLOX) {
- data->modem = open_device(modem, "Modem", "Modem: ");
- if (data->modem == NULL) {
- g_at_chat_unref(data->aux);
- data->aux = NULL;
- return -EIO;
- }
+static void query_model_cb(gboolean ok, GAtResult *result, gpointer user_data)
+{
+ struct ofono_modem *modem = user_data;
+ struct ublox_data *data = ofono_modem_get_data(modem);
+ struct ofono_error error;
+ const char *model;
+ const struct ublox_model *m;
- g_at_chat_set_slave(data->modem, data->aux);
+ decode_at_error(&error, g_at_result_final_response(result));
+ if (!ok)
+ goto fail;
+
+ if (at_util_parse_attr(result, "", &model) == FALSE) {
+ ofono_error("Failed to query modem model");
+ goto fail;
+ }
+
+ m = ublox_model_from_name(model);
+ if (!m) {
+ ofono_error("Unrecognized model: %s", model);
+ goto fail;
+ }
+
+ data->model = m;
+
+ DBG("Model: %s", data->model->name);
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/ofono/plugins/udevng.c
^
|
@@ -841,7 +841,7 @@
return TRUE;
}
-static gboolean setup_quectel(struct modem_info *modem)
+static gboolean setup_quectel_usb(struct modem_info *modem)
{
const char *aux = NULL, *mdm = NULL;
GSList *list;
@@ -881,6 +881,37 @@
return TRUE;
}
+static gboolean setup_quectel_serial(struct modem_info *modem)
+{
+ struct serial_device_info *info = modem->serial;
+ const char *value;
+
+ value = udev_device_get_property_value(info->dev,
+ "OFONO_QUECTEL_GPIO_CHIP");
+ if (value)
+ ofono_modem_set_string(modem->modem, "GpioChip", value);
+
+ value = udev_device_get_property_value(info->dev,
+ "OFONO_QUECTEL_GPIO_OFFSET");
+ if (value)
+ ofono_modem_set_string(modem->modem, "GpioOffset", value);
+
+ value = udev_device_get_property_value(info->dev,
+ "OFONO_QUECTEL_RTSCTS");
+ ofono_modem_set_string(modem->modem, "RtsCts", value ? value : "off");
+ ofono_modem_set_string(modem->modem, "Device", info->devnode);
+
+ return TRUE;
+}
+
+static gboolean setup_quectel(struct modem_info *modem)
+{
+ if (modem->serial)
+ return setup_quectel_serial(modem);
+ else
+ return setup_quectel_usb(modem);
+}
+
static gboolean setup_quectelqmi(struct modem_info *modem)
{
const char *qmi = NULL, *net = NULL, *gps = NULL, *aux = NULL;
@@ -1094,11 +1125,17 @@
* - high throughput profile : 224/1/3
*/
} else if (g_strcmp0(info->interface, "2/2/1") == 0) {
- if (g_strcmp0(info->number, "02") == 0)
- aux = info->devnode;
- else if (g_strcmp0(info->number, "00") == 0)
+ if (!g_strcmp0(modem->model, "1010")) {
+ if (g_strcmp0(info->number, "06") == 0)
+ aux = info->devnode;
+ } else {
+ if (g_strcmp0(info->number, "02") == 0)
+ aux = info->devnode;
+ }
+ if (g_strcmp0(info->number, "00") == 0)
mdm = info->devnode;
} else if (g_strcmp0(info->interface, "2/6/0") == 0 ||
+ g_strcmp0(info->interface, "2/13/0") == 0 ||
g_strcmp0(info->interface, "10/0/0") == 0 ||
g_strcmp0(info->interface, "224/1/3") == 0) {
net = info->devnode;
@@ -1115,7 +1152,6 @@
ofono_modem_set_string(modem->modem, "Aux", aux);
ofono_modem_set_string(modem->modem, "Modem", mdm);
- ofono_modem_set_string(modem->modem, "Model", modem->model);
ofono_modem_set_string(modem->modem, "NetworkInterface", net);
return TRUE;
@@ -1183,7 +1219,7 @@
static gboolean setup_xmm7xxx(struct modem_info *modem)
{
- const char *mdm = NULL, *net = NULL;
+ const char *mdm = NULL, *net = NULL, *net2 = NULL, *net3 = NULL;
GSList *list;
DBG("%s %s %s %s %s %s\n", modem->syspath, modem->devname,
@@ -1203,6 +1239,10 @@
} else if (g_strcmp0(info->subsystem, "net") == 0) {
if (g_strcmp0(info->number, "06") == 0)
net = info->devnode;
+ if (g_strcmp0(info->number, "08") == 0)
+ net2 = info->devnode;
+ if (g_strcmp0(info->number, "0a") == 0)
+ net3 = info->devnode;
}
} else {
if (g_strcmp0(info->subsystem, "tty") == 0) {
@@ -1223,12 +1263,23 @@
ofono_modem_set_string(modem->modem, "Modem", mdm);
ofono_modem_set_string(modem->modem, "NetworkInterface", net);
+ if (net2)
+ ofono_modem_set_string(modem->modem, "NetworkInterface2", net2);
+
+ if (net3)
+ ofono_modem_set_string(modem->modem, "NetworkInterface3", net3);
+
+ ofono_modem_set_string(modem->modem, "CtrlPath", "/USBCDC/0");
+ ofono_modem_set_string(modem->modem, "DataPath", "/USBHS/NCM/");
+
return TRUE;
}
-static gboolean setup_sim7100(struct modem_info *modem)
+static gboolean setup_sim7x00(struct modem_info *modem)
{
- const char *at = NULL, *ppp = NULL, *gps = NULL, *diag = NULL, *audio = NULL;
+ const char *audio = NULL, *diag = NULL, *gps = NULL;
+ const char *mdm = NULL, *net = NULL, *ppp = NULL;
+ const char *qmi = NULL;
GSList *list;
DBG("%s", modem->syspath);
@@ -1236,10 +1287,12 @@
for (list = modem->devices; list; list = list->next) {
struct device_info *info = list->data;
- DBG("%s %s", info->devnode, info->number);
+ DBG("%s %s %s %s %s %s", info->devnode, info->interface,
+ info->number, info->label,
+ info->sysattr, info->subsystem);
/*
- * Serial port layout:
+ * SIM7100 serial port layout:
* 0: QCDM/DIAG
* 1: NMEA
* 2: AT
@@ -1248,29 +1301,52 @@
*
* -- https://www.spinics.net/lists/linux-usb/msg135728.html
*/
- if (g_strcmp0(info->number, "00") == 0)
- diag = info->devnode;
- else if (g_strcmp0(info->number, "01") == 0)
- gps = info->devnode;
- else if (g_strcmp0(info->number, "02") == 0)
- at = info->devnode;
- else if (g_strcmp0(info->number, "03") == 0)
- ppp = info->devnode;
- else if (g_strcmp0(info->number, "04") == 0)
- audio = info->devnode;
+ if (g_strcmp0(info->subsystem, "usbmisc") == 0) /* cdc-wdm */
+ qmi = info->devnode; /* SIM7600 */
+ else if (g_strcmp0(info->subsystem, "net") == 0) /* wwan */
+ net = info->devnode; /* SIM7600 */
+ else if (g_strcmp0(info->subsystem, "tty") == 0) {
+ if (g_strcmp0(info->interface, "255/255/255") == 0) {
+ if (g_strcmp0(info->number, "00") == 0)
+ diag = info->devnode; /* SIM7x00 */
+ } else if (g_strcmp0(info->interface, "255/0/0") == 0) {
+ if (g_strcmp0(info->number, "01") == 0)
+ gps = info->devnode; /* SIM7x00 */
+ else if (g_strcmp0(info->number, "02") == 0)
+ mdm = info->devnode; /* SIM7x00 */
+ else if (g_strcmp0(info->number, "03") == 0)
+ ppp = info->devnode; /* SIM7100 */
+ else if (g_strcmp0(info->number, "04") == 0)
+ audio = info->devnode; /* SIM7100 */
+ }
+ }
}
- if (at == NULL)
+ if (mdm == NULL)
return FALSE;
- DBG("at=%s ppp=%s gps=%s diag=%s, audio=%s", at, ppp, gps, diag, audio);
+ if (qmi != NULL && net != NULL) {
+ DBG("qmi=%s net=%s mdm=%s gps=%s diag=%s",
+ qmi, net, mdm, gps, diag);
+
+ ofono_modem_set_driver(modem->modem, "gobi");
+
+ ofono_modem_set_string(modem->modem, "Device", qmi);
+ ofono_modem_set_string(modem->modem, "Modem", mdm);
+ ofono_modem_set_string(modem->modem, "NetworkInterface", net);
+ } else {
+ DBG("at=%s ppp=%s gps=%s diag=%s, audio=%s",
+ mdm, ppp, gps, diag, audio);
+
+ ofono_modem_set_driver(modem->modem, "sim7100");
+
+ ofono_modem_set_string(modem->modem, "AT", mdm);
+ ofono_modem_set_string(modem->modem, "PPP", ppp);
+ ofono_modem_set_string(modem->modem, "Audio", audio);
+ }
- ofono_modem_set_string(modem->modem, "AT", at);
- ofono_modem_set_string(modem->modem, "PPP", ppp);
ofono_modem_set_string(modem->modem, "GPS", gps);
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/ofono/plugins/wavecom.c
^
|
@@ -48,6 +48,7 @@
#include <ofono/ussd.h>
#include <ofono/voicecall.h>
+#include <drivers/atmodem/atutil.h>
#include <drivers/atmodem/vendor.h>
@@ -70,52 +71,19 @@
static int wavecom_enable(struct ofono_modem *modem)
{
GAtChat *chat;
- GIOChannel *channel;
- GAtSyntax *syntax;
- const char *device;
- GHashTable *options;
DBG("%p", modem);
- device = ofono_modem_get_string(modem, "Device");
- if (device == NULL)
+ chat = at_util_open_device(modem, "Device", wavecom_debug, "",
+ "Baud", "115200",
+ "Parity", "none",
+ "StopBits", "1",
+ "DataBits", "8",
+ NULL);
+ if (!chat)
return -EINVAL;
- options = g_hash_table_new(g_str_hash, g_str_equal);
-
- if (options == NULL)
- return -ENOMEM;
-
- g_hash_table_insert(options, "Baud", "115200");
- g_hash_table_insert(options, "Parity", "none");
- g_hash_table_insert(options, "StopBits", "1");
- g_hash_table_insert(options, "DataBits", "8");
-
- channel = g_at_tty_open(device, options);
-
- g_hash_table_destroy(options);
-
- if (channel == NULL)
- return -EIO;
-
- /*
- * Could not figure out whether it is fully compliant or not, use
- * permissive for now
- * */
- syntax = g_at_syntax_new_gsm_permissive();
-
- chat = g_at_chat_new(channel, syntax);
- g_at_syntax_unref(syntax);
- g_io_channel_unref(channel);
-
- if (chat == NULL)
- return -ENOMEM;
-
g_at_chat_add_terminator(chat, "+CPIN:", 6, TRUE);
-
- if (getenv("OFONO_AT_DEBUG"))
- g_at_chat_set_debug(chat, wavecom_debug, "");
-
ofono_modem_set_data(modem, chat);
return 0;
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/ofono/plugins/xmm7xxx.c
^
|
@@ -965,41 +965,9 @@
static GAtChat *open_device(struct ofono_modem *modem,
const char *key, char *debug)
{
- const char *device;
- GAtSyntax *syntax;
- GIOChannel *channel;
- GAtChat *chat;
- GHashTable *options;
-
- device = ofono_modem_get_string(modem, key);
- if (device == NULL)
- return NULL;
-
- DBG("%s %s", key, device);
-
- options = g_hash_table_new(g_str_hash, g_str_equal);
- if (options == NULL)
- return NULL;
-
- g_hash_table_insert(options, "Baud", "115200");
- channel = g_at_tty_open(device, options);
- g_hash_table_destroy(options);
-
- if (channel == NULL)
- return NULL;
-
- syntax = g_at_syntax_new_gsm_permissive();
- chat = g_at_chat_new(channel, syntax);
- g_at_syntax_unref(syntax);
- g_io_channel_unref(channel);
-
- if (chat == NULL)
- return NULL;
-
- if (getenv("OFONO_AT_DEBUG"))
- g_at_chat_set_debug(chat, xmm7xxx_debug, debug);
-
- return chat;
+ return at_util_open_device(modem, key, xmm7xxx_debug, debug,
+ "Baud", "115200",
+ NULL);
}
static void switch_sim_state_status(struct ofono_modem *modem, int status)
@@ -1223,7 +1191,7 @@
DBG("%p", modem);
ofono_devinfo_create(modem, OFONO_VENDOR_IFX, "atmodem", data->chat);
- data->sim = ofono_sim_create(modem, OFONO_VENDOR_IFX, "atmodem",
+ data->sim = ofono_sim_create(modem, OFONO_VENDOR_XMM, "atmodem",
data->chat);
}
@@ -1269,6 +1237,7 @@
struct xmm7xxx_data *data = ofono_modem_get_data(modem);
struct ofono_gprs *gprs;
struct ofono_gprs_context *gc;
+ const char *interface = NULL;
DBG("%p", modem);
@@ -1276,11 +1245,39 @@
gprs = ofono_gprs_create(modem, OFONO_VENDOR_IFX, "atmodem",
data->chat);
+
+ interface = ofono_modem_get_string(modem, "NetworkInterface");
gc = ofono_gprs_context_create(modem, OFONO_VENDOR_XMM, "ifxmodem",
data->chat);
- if (gprs && gc)
+ if (gprs && gc) {
ofono_gprs_add_context(gprs, gc);
+ ofono_gprs_context_set_interface(gc, interface);
+ }
+
+ interface = ofono_modem_get_string(modem, "NetworkInterface2");
+
+ if (interface) {
+ gc = ofono_gprs_context_create(modem, OFONO_VENDOR_XMM,
+ "ifxmodem", data->chat);
+
+ if (gprs && gc) {
+ ofono_gprs_add_context(gprs, gc);
+ ofono_gprs_context_set_interface(gc, interface);
+ }
+ }
+
+ interface = ofono_modem_get_string(modem, "NetworkInterface3");
+
+ if (interface) {
+ gc = ofono_gprs_context_create(modem, OFONO_VENDOR_XMM,
+ "ifxmodem", data->chat);
+
+ if (gprs && gc) {
+ ofono_gprs_add_context(gprs, gc);
+ ofono_gprs_context_set_interface(gc, interface);
+ }
+ }
ofono_ims_create(modem, "xmm7modem", data->chat);
ofono_netmon_create(modem, 0, "xmm7modem", data->chat);
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/ofono/plugins/zte.c
^
|
@@ -99,51 +99,16 @@
static GAtChat *open_device(struct ofono_modem *modem,
const char *key, char *debug)
{
- const char *device;
- GIOChannel *channel;
- GAtSyntax *syntax;
- GAtChat *chat;
- GHashTable *options;
-
- device = ofono_modem_get_string(modem, key);
- if (device == NULL)
- return NULL;
-
- DBG("%s %s", key, device);
-
- options = g_hash_table_new(g_str_hash, g_str_equal);
- if (options == NULL)
- return NULL;
-
- g_hash_table_insert(options, "Baud", "115200");
- g_hash_table_insert(options, "Parity", "none");
- g_hash_table_insert(options, "StopBits", "1");
- g_hash_table_insert(options, "DataBits", "8");
- g_hash_table_insert(options, "XonXoff", "off");
- g_hash_table_insert(options, "RtsCts", "on");
- g_hash_table_insert(options, "Local", "on");
- g_hash_table_insert(options, "Read", "on");
-
- channel = g_at_tty_open(device, options);
-
- g_hash_table_destroy(options);
-
- if (channel == NULL)
- return NULL;
-
- syntax = g_at_syntax_new_gsm_permissive();
- chat = g_at_chat_new(channel, syntax);
- g_at_syntax_unref(syntax);
-
- g_io_channel_unref(channel);
-
- if (chat == NULL)
- return NULL;
-
- if (getenv("OFONO_AT_DEBUG"))
- g_at_chat_set_debug(chat, zte_debug, debug);
-
- return chat;
+ return at_util_open_device(modem, key, zte_debug, debug,
+ "Baud", "115200",
+ "Parity", "none",
+ "StopBits", "1",
+ "DataBits", "8",
+ "XonXoff", "off",
+ "RtsCts", "on",
+ "Local", "on",
+ "Read", "on",
+ NULL);
}
static void zoprt_enable(gboolean ok, GAtResult *result, gpointer user_data)
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/ofono/src/common.c
^
|
@@ -424,7 +424,7 @@
}
const char *ofono_phone_number_to_string(const struct ofono_phone_number *ph,
- char buffer[/* OFONO_MAX_PHONE_NUMBER_BUFFER_SIZE */])
+ char buffer[/* OFONO_PHONE_NUMBER_BUFFER_SIZE */])
{
if (ph->type == 145 && (strlen(ph->number) > 0) &&
ph->number[0] != '+') {
@@ -706,8 +706,14 @@
return "hspa";
case ACCESS_TECHNOLOGY_EUTRAN:
return "lte";
+ case ACCESS_TECHNOLOGY_NB_IOT_M1:
+ return "lte-cat-m1";
+ case ACCESS_TECHNOLOGY_NB_IOT_NB1:
+ return "lte-cat-nb1";
case OFONO_ACCESS_TECHNOLOGY_NONE:
break;
+ default:
+ return "";
}
return "";
}
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/ofono/src/common.h
^
|
@@ -42,6 +42,10 @@
OFONO_ACCESS_TECHNOLOGY_UTRAN_HSDPA_HSUPA /* 6 */
#define ACCESS_TECHNOLOGY_EUTRAN \
OFONO_ACCESS_TECHNOLOGY_EUTRAN /* 7 */
+#define ACCESS_TECHNOLOGY_NB_IOT_M1 \
+ OFONO_ACCESS_TECHNOLOGY_NB_IOT_M1 /* 8 */
+#define ACCESS_TECHNOLOGY_NB_IOT_NB1 \
+ OFONO_ACCESS_TECHNOLOGY_NB_IOT_NB1 /* 9 */
/* 27.007 Section 7.2 <stat> */
#define NETWORK_REGISTRATION_STATUS_NOT_REGISTERED \
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/ofono/src/gprs.c
^
|
@@ -110,7 +110,6 @@
};
struct context_settings {
- char *interface;
struct ipv4_settings *ipv4;
struct ipv6_settings *ipv6;
};
@@ -121,6 +120,7 @@
ofono_bool_t inuse;
const struct ofono_gprs_context_driver *driver;
void *driver_data;
+ char *interface;
struct context_settings *settings;
struct ofono_atom *atom;
};
@@ -306,6 +306,8 @@
return TRUE;
}
+ ctx->context.cid = 0;
+
return FALSE;
}
@@ -362,12 +364,10 @@
g_free(settings->ipv6);
settings->ipv6 = NULL;
}
-
- g_free(settings->interface);
- settings->interface = NULL;
}
static void context_settings_append_ipv4(struct context_settings *settings,
+ const char *interface,
DBusMessageIter *iter)
{
DBusMessageIter variant;
@@ -392,7 +392,7 @@
goto done;
ofono_dbus_dict_append(&array, "Interface",
- DBUS_TYPE_STRING, &settings->interface);
+ DBUS_TYPE_STRING, &interface);
if (settings->ipv4->proxy)
ofono_dbus_dict_append(&array, "Proxy", DBUS_TYPE_STRING,
@@ -434,6 +434,7 @@
}
static void context_settings_append_ipv4_dict(struct context_settings *settings,
+ const char *interface,
DBusMessageIter *dict)
{
DBusMessageIter entry;
@@ -444,12 +445,13 @@
dbus_message_iter_append_basic(&entry, DBUS_TYPE_STRING, &key);
- context_settings_append_ipv4(settings, &entry);
+ context_settings_append_ipv4(settings, interface, &entry);
dbus_message_iter_close_container(dict, &entry);
}
static void context_settings_append_ipv6(struct context_settings *settings,
+ const char *interface,
DBusMessageIter *iter)
{
DBusMessageIter variant;
@@ -473,7 +475,7 @@
goto done;
ofono_dbus_dict_append(&array, "Interface",
- DBUS_TYPE_STRING, &settings->interface);
+ DBUS_TYPE_STRING, &interface);
if (settings->ipv6->ip)
ofono_dbus_dict_append(&array, "Address", DBUS_TYPE_STRING,
@@ -504,6 +506,7 @@
}
static void context_settings_append_ipv6_dict(struct context_settings *settings,
+ const char *interface,
DBusMessageIter *dict)
{
DBusMessageIter entry;
@@ -514,13 +517,14 @@
dbus_message_iter_append_basic(&entry, DBUS_TYPE_STRING, &key);
- context_settings_append_ipv6(settings, &entry);
+ context_settings_append_ipv6(settings, interface, &entry);
dbus_message_iter_close_container(dict, &entry);
}
static void signal_settings(struct pri_context *ctx, const char *prop,
- void (*append)(struct context_settings *, DBusMessageIter *))
+ void (*append)(struct context_settings *,
+ const char *, DBusMessageIter *))
{
DBusConnection *conn = ofono_dbus_get_connection();
@@ -528,6 +532,7 @@
DBusMessage *signal;
DBusMessageIter iter;
struct context_settings *settings;
+ const char *interface;
signal = dbus_message_new_signal(path,
OFONO_CONNECTION_CONTEXT_INTERFACE,
@@ -539,12 +544,15 @@
dbus_message_iter_init_append(signal, &iter);
dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &prop);
- if (ctx->context_driver)
+ if (ctx->context_driver) {
settings = ctx->context_driver->settings;
- else
+ interface = ctx->context_driver->interface;
+ } else {
settings = NULL;
+ interface = NULL;
+ }
- append(settings, &iter);
+ append(settings, interface, &iter);
g_dbus_send_message(conn, signal);
}
@@ -782,18 +790,16 @@
static void pri_reset_context_settings(struct pri_context *ctx)
{
struct context_settings *settings;
- char *interface;
+ const char *interface;
gboolean signal_ipv4;
gboolean signal_ipv6;
if (ctx->context_driver == NULL)
return;
+ interface = ctx->context_driver->interface;
settings = ctx->context_driver->settings;
- interface = settings->interface;
- settings->interface = NULL;
-
signal_ipv4 = settings->ipv4 != NULL;
signal_ipv6 = settings->ipv6 != NULL;
@@ -810,8 +816,6 @@
}
pri_ifupdown(interface, FALSE);
-
- g_free(interface);
}
static void pri_update_mms_context_settings(struct pri_context *ctx)
@@ -819,18 +823,17 @@
struct ofono_gprs_context *gc = ctx->context_driver;
struct context_settings *settings = gc->settings;
- if (ctx->message_proxy)
- settings->ipv4->proxy = g_strdup(ctx->message_proxy);
+ settings->ipv4->proxy = g_strdup(ctx->message_proxy);
if (!pri_parse_proxy(ctx, ctx->message_proxy))
pri_parse_proxy(ctx, ctx->message_center);
DBG("proxy %s port %u", ctx->proxy_host, ctx->proxy_port);
- pri_set_ipv4_addr(settings->interface, settings->ipv4->ip);
+ pri_set_ipv4_addr(gc->interface, settings->ipv4->ip);
if (ctx->proxy_host)
- pri_setproxy(settings->interface, ctx->proxy_host);
+ pri_setproxy(gc->interface, ctx->proxy_host);
}
static gboolean pri_str_changed(const char *val, const char *newval)
@@ -1057,6 +1060,7 @@
dbus_bool_t value, preferred;
const char *strvalue;
struct context_settings *settings;
+ const char *interface;
ofono_dbus_dict_append(dict, "Name", DBUS_TYPE_STRING, &name);
@@ -1096,13 +1100,16 @@
DBUS_TYPE_STRING, &strvalue);
}
- if (ctx->context_driver)
+ if (ctx->context_driver) {
settings = ctx->context_driver->settings;
- else
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/ofono/src/handsfree.c
^
|
@@ -174,7 +174,7 @@
unsigned char level)
{
DBusConnection *conn = ofono_dbus_get_connection();
- const char *path = __ofono_atom_get_path(hf->atom);
+ const char *path;
if (hf == NULL)
return;
@@ -187,6 +187,7 @@
if (__ofono_atom_get_registered(hf->atom) == FALSE)
return;
+ path = __ofono_atom_get_path(hf->atom);
ofono_dbus_signal_property_changed(conn, path,
OFONO_HANDSFREE_INTERFACE,
"BatteryChargeLevel", DBUS_TYPE_BYTE,
@@ -295,7 +296,7 @@
subscriber_number->type = numbers[num].type;
strncpy(subscriber_number->number, numbers[num].number,
- OFONO_MAX_PHONE_NUMBER_LENGTH + 1);
+ OFONO_MAX_PHONE_NUMBER_LENGTH);
hf->subscriber_numbers = g_slist_prepend(hf->subscriber_numbers,
subscriber_number);
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/ofono/src/log.c
^
|
@@ -238,7 +238,7 @@
if (written < 0)
break;
- len = read(infd[0], buf, sizeof(buf));
+ len = read(infd[0], buf, sizeof(buf) - 1);
if (len < 0)
break;
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/ofono/src/main.c
^
|
@@ -249,6 +249,7 @@
#ifdef HAVE_ELL
l_log_set_stderr();
+ l_debug("");
l_debug_enable("*");
l_main_init();
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/ofono/src/message-waiting.c
^
|
@@ -753,8 +753,8 @@
efmwis[0] = mw->messages[0].indication ? 0xa : 0x5;
if (mw->ef_cphs_mwis_length > 1)
- efmwis[1] = mw->messages[1].indication ? 0xa : 0x5 |
- mw->messages[3].indication ? 0xa0 : 0x50;
+ efmwis[1] = (mw->messages[1].indication ? 0xa : 0x5) |
+ (mw->messages[3].indication ? 0xa0 : 0x50);
if (ofono_sim_write(mw->sim_context, SIM_EF_CPHS_MWIS_FILEID,
mw_mwis_write_cb,
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/ofono/src/modem.c
^
|
@@ -1150,6 +1150,9 @@
if (modem->lockdown)
return __ofono_error_access_denied(msg);
+ if (!powered)
+ __ofono_sim_clear_cached_pins(modem->sim);
+
err = set_powered(modem, powered);
if (err < 0) {
if (err != -EINPROGRESS)
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/ofono/src/netmon.c
^
|
@@ -50,6 +50,8 @@
const struct ofono_netmon_driver *driver;
DBusMessage *pending;
DBusMessage *reply;
+ DBusMessageIter iter;
+ DBusMessageIter arr;
void *driver_data;
struct ofono_atom *atom;
struct netmon_agent *agent;
@@ -69,174 +71,145 @@
return NULL;
}
-void ofono_netmon_serving_cell_notify(struct ofono_netmon *netmon,
- enum ofono_netmon_cell_type type,
- int info_type, ...)
+static void netmon_cell_info_dict_append(DBusMessageIter *dict,
+ va_list *arglist, int info_type)
{
- va_list arglist;
- DBusMessage *agent_notify = NULL;
- DBusMessageIter iter;
- DBusMessageIter dict;
- enum ofono_netmon_info next_info_type = info_type;
- const char *technology = cell_type_to_tech_name(type);
char *mcc;
char *mnc;
int intval;
-
- if (netmon->pending != NULL) {
- netmon->reply = dbus_message_new_method_return(netmon->pending);
- dbus_message_iter_init_append(netmon->reply, &iter);
- } else if (netmon->agent != NULL) {
- agent_notify = netmon_agent_new_method_call(netmon->agent,
- "ServingCellInformationChanged");
-
- dbus_message_iter_init_append(agent_notify, &iter);
- } else
- return;
-
- dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY,
- OFONO_PROPERTIES_ARRAY_SIGNATURE,
- &dict);
-
- va_start(arglist, info_type);
-
- if (technology == NULL)
- goto done;
-
- ofono_dbus_dict_append(&dict, "Technology",
- DBUS_TYPE_STRING, &technology);
+ enum ofono_netmon_info next_info_type = info_type;
while (next_info_type != OFONO_NETMON_INFO_INVALID) {
switch (next_info_type) {
case OFONO_NETMON_INFO_MCC:
- mcc = va_arg(arglist, char *);
+ mcc = va_arg(*arglist, char *);
if (mcc && strlen(mcc))
- ofono_dbus_dict_append(&dict,
+ ofono_dbus_dict_append(dict,
"MobileCountryCode",
DBUS_TYPE_STRING, &mcc);
break;
case OFONO_NETMON_INFO_MNC:
- mnc = va_arg(arglist, char *);
+ mnc = va_arg(*arglist, char *);
if (mnc && strlen(mnc))
- ofono_dbus_dict_append(&dict,
+ ofono_dbus_dict_append(dict,
"MobileNetworkCode",
DBUS_TYPE_STRING, &mnc);
break;
case OFONO_NETMON_INFO_LAC:
- intval = va_arg(arglist, int);
+ intval = va_arg(*arglist, int);
- CELL_INFO_DICT_APPEND(&dict, "LocationAreaCode",
+ CELL_INFO_DICT_APPEND(dict, "LocationAreaCode",
intval, uint16_t, DBUS_TYPE_UINT16);
break;
case OFONO_NETMON_INFO_CI:
- intval = va_arg(arglist, int);
+ intval = va_arg(*arglist, int);
- CELL_INFO_DICT_APPEND(&dict, "CellId",
+ CELL_INFO_DICT_APPEND(dict, "CellId",
intval, uint32_t, DBUS_TYPE_UINT32);
break;
case OFONO_NETMON_INFO_ARFCN:
- intval = va_arg(arglist, int);
+ intval = va_arg(*arglist, int);
- CELL_INFO_DICT_APPEND(&dict, "ARFCN",
+ CELL_INFO_DICT_APPEND(dict, "ARFCN",
intval, uint16_t, DBUS_TYPE_UINT16);
break;
case OFONO_NETMON_INFO_BSIC:
- intval = va_arg(arglist, int);
+ intval = va_arg(*arglist, int);
- CELL_INFO_DICT_APPEND(&dict, "BSIC",
+ CELL_INFO_DICT_APPEND(dict, "BSIC",
intval, uint8_t, DBUS_TYPE_BYTE);
break;
case OFONO_NETMON_INFO_RXLEV:
- intval = va_arg(arglist, int);
+ intval = va_arg(*arglist, int);
- CELL_INFO_DICT_APPEND(&dict, "ReceivedSignalStrength",
+ CELL_INFO_DICT_APPEND(dict, "ReceivedSignalStrength",
intval, uint8_t, DBUS_TYPE_BYTE);
break;
case OFONO_NETMON_INFO_TIMING_ADVANCE:
- intval = va_arg(arglist, int);
+ intval = va_arg(*arglist, int);
- CELL_INFO_DICT_APPEND(&dict, "TimingAdvance",
+ CELL_INFO_DICT_APPEND(dict, "TimingAdvance",
intval, uint8_t, DBUS_TYPE_BYTE);
break;
case OFONO_NETMON_INFO_PSC:
- intval = va_arg(arglist, int);
+ intval = va_arg(*arglist, int);
- CELL_INFO_DICT_APPEND(&dict, "PrimaryScramblingCode",
+ CELL_INFO_DICT_APPEND(dict, "PrimaryScramblingCode",
intval, uint16_t, DBUS_TYPE_UINT16);
break;
case OFONO_NETMON_INFO_BER:
- intval = va_arg(arglist, int);
+ intval = va_arg(*arglist, int);
- CELL_INFO_DICT_APPEND(&dict, "BitErrorRate",
+ CELL_INFO_DICT_APPEND(dict, "BitErrorRate",
intval, uint8_t, DBUS_TYPE_BYTE);
break;
case OFONO_NETMON_INFO_RSSI:
- intval = va_arg(arglist, int);
+ intval = va_arg(*arglist, int);
- CELL_INFO_DICT_APPEND(&dict, "Strength",
+ CELL_INFO_DICT_APPEND(dict, "Strength",
intval, uint8_t, DBUS_TYPE_BYTE);
break;
case OFONO_NETMON_INFO_RSCP:
- intval = va_arg(arglist, int);
+ intval = va_arg(*arglist, int);
- CELL_INFO_DICT_APPEND(&dict, "ReceivedSignalCodePower",
+ CELL_INFO_DICT_APPEND(dict, "ReceivedSignalCodePower",
intval, uint8_t, DBUS_TYPE_BYTE);
break;
case OFONO_NETMON_INFO_ECN0:
- intval = va_arg(arglist, int);
+ intval = va_arg(*arglist, int);
- CELL_INFO_DICT_APPEND(&dict, "ReceivedEnergyRatio",
+ CELL_INFO_DICT_APPEND(dict, "ReceivedEnergyRatio",
intval, uint8_t, DBUS_TYPE_BYTE);
break;
case OFONO_NETMON_INFO_RSRQ:
- intval = va_arg(arglist, int);
+ intval = va_arg(*arglist, int);
- CELL_INFO_DICT_APPEND(&dict,
+ CELL_INFO_DICT_APPEND(dict,
"ReferenceSignalReceivedQuality",
intval, uint8_t, DBUS_TYPE_BYTE);
break;
case OFONO_NETMON_INFO_RSRP:
- intval = va_arg(arglist, int);
+ intval = va_arg(*arglist, int);
- CELL_INFO_DICT_APPEND(&dict,
+ CELL_INFO_DICT_APPEND(dict,
"ReferenceSignalReceivedPower",
intval, uint8_t, DBUS_TYPE_BYTE);
break;
case OFONO_NETMON_INFO_EARFCN:
- intval = va_arg(arglist, int);
+ intval = va_arg(*arglist, int);
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/ofono/src/network.c
^
|
@@ -1391,8 +1391,8 @@
if (netreg == NULL)
return;
- DBG("%s status %d tech %d", __ofono_atom_get_path(netreg->atom),
- status, tech);
+ DBG("%s status %d tech %d lac %d ci %d",
+ __ofono_atom_get_path(netreg->atom), status, tech, lac, ci);
if (netreg->status != status) {
struct ofono_modem *modem;
@@ -1447,6 +1447,11 @@
if (info == NULL)
return;
+ DBG("net time %d-%02d-%02d %02d:%02d:%02d utcoff %d dst %d",
+ info->year, info->mon, info->mday,
+ info->hour, info->min, info->sec,
+ info->utcoff, info->dst);
+
__ofono_nettime_info_received(modem, info);
}
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/ofono/src/ofono.h
^
|
@@ -428,6 +428,7 @@
struct ofono_sim_aid_session *session);
const char *__ofono_sim_get_impi(struct ofono_sim *sim);
+void __ofono_sim_clear_cached_pins(struct ofono_sim *sim);
#include <ofono/stk.h>
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/ofono/src/phonebook.c
^
|
@@ -179,7 +179,7 @@
if ((type == TYPE_INTERNATIONAL) && (number[0] != '+'))
intl = "+";
- snprintf(buf, sizeof(buf), "TEL;TYPE=\%s%s:\%s\%s", pref,
+ snprintf(buf, sizeof(buf), "TEL;TYPE=%s%s:%s%s", pref,
category_string, intl, number);
vcard_printf(vcards, buf, number);
}
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/ofono/src/radio-settings.c
^
|
@@ -86,9 +86,15 @@
return "umts";
case OFONO_RADIO_ACCESS_MODE_LTE:
return "lte";
- default:
- return NULL;
}
+
+ if (m == (OFONO_RADIO_ACCESS_MODE_UMTS|OFONO_RADIO_ACCESS_MODE_GSM))
+ return "umts,gsm";
+
+ if (m == (OFONO_RADIO_ACCESS_MODE_LTE|OFONO_RADIO_ACCESS_MODE_UMTS))
+ return "lte,umts";
+
+ return NULL;
}
#define radio_access_mode_from_string ofono_radio_access_mode_from_string
@@ -109,6 +115,12 @@
} else if (g_str_equal(str, "lte")) {
*mode = OFONO_RADIO_ACCESS_MODE_LTE;
return TRUE;
+ } else if (g_str_equal(str, "umts,gsm")) {
+ *mode = OFONO_RADIO_ACCESS_MODE_UMTS|OFONO_RADIO_ACCESS_MODE_GSM;
+ return TRUE;
+ } else if (g_str_equal(str, "lte,umts")) {
+ *mode = OFONO_RADIO_ACCESS_MODE_LTE|OFONO_RADIO_ACCESS_MODE_UMTS;
+ return TRUE;
}
return FALSE;
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/ofono/src/sim-auth.c
^
|
@@ -676,13 +676,13 @@
char mnc[3];
char *nai;
- strncpy(mcc, imsi, 3);
+ memcpy(mcc, imsi, 3);
if (strlen(imsi) == 16) {
- strncpy(mnc, imsi + 3, 3);
+ memcpy(mnc, imsi + 3, 3);
} else {
mnc[0] = '0';
- strncpy(mnc + 1, imsi + 3, 2);
+ memcpy(mnc + 1, imsi + 3, 2);
}
nai = g_strdup_printf("%s@ims.mnc%.3s.mcc%.3s.3gppnetwork.org",
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/ofono/src/sim.c
^
|
@@ -133,6 +133,10 @@
struct ofono_atom *atom;
unsigned int hfp_watch;
+ unsigned int card_slot_count;
+ unsigned int active_card_slot;
+ unsigned int pending_active_card_slot;
+
GSList *aid_sessions;
GSList *aid_list;
char *impi;
@@ -145,6 +149,11 @@
bool wait_initialized : 1;
};
+struct cached_pin {
+ char *id;
+ char *pin;
+};
+
struct msisdn_set_request {
struct ofono_sim *sim;
int pending;
@@ -180,6 +189,8 @@
static GSList *g_drivers = NULL;
+static GSList *cached_pins = NULL;
+
static const char *sim_passwd_name(enum ofono_sim_password_type type)
{
return passwd_name[type];
@@ -559,6 +570,13 @@
get_pin_retries(sim, &pin_retries_dict, &dbus_retries);
ofono_dbus_dict_append_dict(&dict, "Retries", DBUS_TYPE_BYTE,
&pin_retries_dict);
+
+ ofono_dbus_dict_append(&dict, "CardSlotCount", DBUS_TYPE_UINT32,
+ &sim->card_slot_count);
+
+ ofono_dbus_dict_append(&dict, "ActiveCardSlot", DBUS_TYPE_UINT32,
+ &sim->active_card_slot);
+
g_free(pin_retries_dict);
g_free(dbus_retries);
@@ -568,6 +586,72 @@
return reply;
}
+static struct cached_pin *pin_cache_lookup(const char *iccid)
+{
+ struct cached_pin *c;
+ GSList *l;
+
+ if (cached_pins == NULL)
+ return NULL;
+
+ for (l = cached_pins; l; l = l->next) {
+ c = l->data;
+
+ if (g_strcmp0(iccid, c->id) == 0)
+ return c;
+ }
+
+ return NULL;
+}
+
+static void pin_cache_update(const char *iccid, const char *pin)
+{
+ struct cached_pin *pin_cached = pin_cache_lookup(iccid);
+ struct cached_pin *cpins;
+
+ if (pin_cached != NULL) {
+ g_free(pin_cached->pin);
+ pin_cached->pin = g_strdup(pin);
+ return;
+ }
+
+ cpins = g_new0(struct cached_pin, 1);
+
+ cpins->id = g_strdup(iccid);
+ cpins->pin = g_strdup(pin);
+ cached_pins = g_slist_prepend(cached_pins, cpins);
+}
+
+static void pin_cache_remove(const char *iccid)
+{
+ struct cached_pin *pin_cached = pin_cache_lookup(iccid);
+
+ if (pin_cached == NULL)
+ return;
+
+ cached_pins = g_slist_remove(cached_pins, pin_cached);
+
+ g_free(pin_cached->pin);
+ g_free(pin_cached->id);
+ g_free(pin_cached);
+}
+
+static void pin_cache_enter_cb(const struct ofono_error *error, void *data)
+{
+ struct ofono_sim *sim = data;
+
+ if (error->type != OFONO_ERROR_TYPE_NO_ERROR) {
+ pin_cache_remove(sim->iccid);
+
+ __ofono_sim_recheck_pin(sim);
+
+ return;
+ }
+
+ sim->wait_initialized = true;
+ DBG("Waiting for ofono_sim_initialized_notify");
+}
+
static void sim_pin_retries_query_cb(const struct ofono_error *error,
int retries[OFONO_SIM_PASSWORD_INVALID],
void *data)
@@ -684,6 +768,36 @@
OFONO_DBUS_ACCESS_INTF_SIMMGR, method, arg);
}
+static void sim_set_slot_callback(const struct ofono_error *error, void *data)
+{
+ struct ofono_sim *sim = data;
+ DBusConnection *conn = ofono_dbus_get_connection();
+ const char *path = __ofono_atom_get_path(sim->atom);
+ DBusMessage *reply;
+
+ if (error->type != OFONO_ERROR_TYPE_NO_ERROR) {
+ DBG("Error setting radio access mode");
+
+ sim->pending_active_card_slot = sim->active_card_slot;
+
+ reply = __ofono_error_from_error(error, sim->pending);
+ __ofono_dbus_pending_reply(&sim->pending, reply);
+
+ return;
+ }
+
+ sim->active_card_slot = sim->pending_active_card_slot;
+
+ reply = dbus_message_new_method_return(sim->pending);
+ __ofono_dbus_pending_reply(&sim->pending, reply);
+
+ ofono_dbus_signal_property_changed(conn, path,
+ OFONO_SIM_MANAGER_INTERFACE,
+ "ActiveCardSlot",
+ DBUS_TYPE_UINT32,
+ &sim->active_card_slot);
+}
+
static DBusMessage *sim_set_property(DBusConnection *conn, DBusMessage *msg,
void *data)
{
@@ -754,6 +868,37 @@
if (set_ok)
return NULL;
+ } else if (!strcmp(name, "ActiveCardSlot")) {
+ dbus_uint32_t value;
+
+ dbus_message_iter_next(&iter);
+
+ if (sim->driver->set_active_card_slot == NULL)
+ return __ofono_error_not_implemented(msg);
+
+ if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_VARIANT)
+ return __ofono_error_invalid_args(msg);
+
+ dbus_message_iter_recurse(&iter, &var);
+
+ if (dbus_message_iter_get_arg_type(&var) != DBUS_TYPE_UINT32)
+ return __ofono_error_invalid_args(msg);
+
+ dbus_message_iter_get_basic(&var, &value);
+
+ if (value <= 0 || value > sim->card_slot_count)
+ return __ofono_error_invalid_args(msg);
+
+ if (sim->active_card_slot == value)
+ return dbus_message_new_method_return(msg);
+
+ sim->pending = dbus_message_ref(msg);
+ sim->pending_active_card_slot = value;
+
+ sim->driver->set_active_card_slot(sim, value - 1,
+ sim_set_slot_callback,
+ sim);
+ return NULL;
}
return __ofono_error_invalid_args(msg);
@@ -786,6 +931,11 @@
OFONO_SIM_MANAGER_INTERFACE,
"LockedPins", DBUS_TYPE_STRING,
&locked_pins);
+
+ /* Cache pin only for SIM PIN type */
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/ofono/src/siri.c
^
|
@@ -54,7 +54,7 @@
void ofono_siri_set_status(struct ofono_siri *siri, int value)
{
DBusConnection *conn = ofono_dbus_get_connection();
- const char *path = __ofono_atom_get_path(siri->atom);
+ const char *path;
dbus_bool_t siri_status;
if (siri == NULL)
@@ -70,6 +70,7 @@
if (__ofono_atom_get_registered(siri->atom) == FALSE)
return;
+ path = __ofono_atom_get_path(siri->atom);
ofono_dbus_signal_property_changed(conn, path, OFONO_SIRI_INTERFACE,
"Enabled", DBUS_TYPE_BOOLEAN,
&siri_status);
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/ofono/src/slot-manager.c
^
|
@@ -1,7 +1,7 @@
/*
* oFono - Open Source Telephony
*
- * Copyright (C) 2017-2021 Jolla Ltd.
+ * Copyright (C) 2017-2022 Jolla Ltd.
*
* 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
@@ -183,7 +183,8 @@
static void slot_manager_emit_all_queued_signals(OfonoSlotManagerObject *mgr);
static void slot_manager_update_ready(OfonoSlotManagerObject *mgr);
static enum slot_manager_dbus_signal slot_manager_update_modem_paths
- (OfonoSlotManagerObject *mgr) G_GNUC_WARN_UNUSED_RESULT;
+ (OfonoSlotManagerObject *mgr, gboolean imsi_change)
+ G_GNUC_WARN_UNUSED_RESULT;
static inline OfonoSlotBase *slot_base_cast(gpointer p)
{
@@ -375,7 +376,7 @@
(OfonoSlotManagerObject *mgr, enum slot_manager_dbus_signal extra)
{
slot_manager_dbus_signal(mgr->dbus, extra |
- slot_manager_update_modem_paths(mgr));
+ slot_manager_update_modem_paths(mgr, FALSE));
}
static void slot_update_data_role(OfonoSlotObject *slot,
@@ -421,34 +422,9 @@
{
OfonoSlotObject *slot = OFONO_SLOT_OBJECT(data);
OfonoSlotManagerObject *mgr = slot->manager;
- OfonoSlotObject *voice_slot = mgr->voice_slot;
- OfonoSlotObject *data_slot = mgr->data_slot;
- int signal_mask;
-
- /*
- * We want the first slot to be selected by default.
- * However, things may become available in pretty much
- * any order, so reset the slot pointers to NULL and let
- * slot_manager_update_modem_paths() to pick them again.
- */
- mgr->voice_slot = NULL;
- mgr->data_slot = NULL;
- mgr->pub.default_voice_path = NULL;
- mgr->pub.default_data_path = NULL;
- signal_mask = slot_manager_update_modem_paths(mgr);
- if (voice_slot != mgr->voice_slot) {
- if (!mgr->voice_slot) {
- DBG("No default voice SIM");
- }
- signal_mask |= SLOT_MANAGER_DBUS_SIGNAL_VOICE_PATH;
- }
- if (data_slot != mgr->data_slot) {
- if (!mgr->data_slot) {
- DBG("No default data SIM");
- }
- signal_mask |= SLOT_MANAGER_DBUS_SIGNAL_DATA_PATH;
- }
- slot_manager_dbus_signal(mgr->dbus, signal_mask);
+
+ slot_manager_dbus_signal(mgr->dbus,
+ slot_manager_update_modem_paths(mgr, TRUE));
slot_manager_emit_all_queued_signals(mgr);
}
@@ -707,7 +683,7 @@
* queued signals mask but doesn't actually emit any signals.
*/
static enum slot_manager_dbus_signal slot_manager_update_modem_paths
- (OfonoSlotManagerObject *mgr)
+ (OfonoSlotManagerObject *mgr, gboolean imsi_change)
{
enum slot_manager_dbus_signal mask = SLOT_MANAGER_DBUS_SIGNAL_NONE;
OfonoSlotObject *slot = NULL;
@@ -719,7 +695,7 @@
if (mgr->default_voice_imsi) {
slot = slot_manager_find_slot_imsi(mgr,
mgr->default_voice_imsi);
- } else if (mgr->voice_slot) {
+ } else if (mgr->voice_slot && !imsi_change) {
/* Make sure that the slot is enabled and SIM is in */
slot = slot_manager_find_slot_imsi(mgr,
mgr->voice_slot->watch->imsi);
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/ofono/src/stkutil.c
^
|
@@ -5417,8 +5417,10 @@
const void *data = va_arg(args, const void *);
bool cr = (flags & DATAOBJ_FLAG_CR) ? true : false;
- if (!builder_func(tlv, data, cr))
+ if (!builder_func(tlv, data, cr)) {
+ va_end(args);
return false;
+ }
builder_func = va_arg(args, dataobj_writer);
}
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/ofono/src/ussd.c
^
|
@@ -3,6 +3,7 @@
* oFono - Open Source Telephony
*
* Copyright (C) 2008-2011 Intel Corporation. All rights reserved.
+ * Copyright (C) 2021-2022 Jolla Ltd.
*
* 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
@@ -970,3 +971,17 @@
ussd->req->cb = NULL;
}
+
+/* Since mer/1.28+git2 */
+
+char *ofono_ussd_decode(int dcs, const void *pdu, int len)
+{
+ /* Returns NULL-terminated UTF-8 string */
+ return ussd_decode(dcs, len, pdu);
+}
+
+void ofono_ussd_decode_free(char *ussd)
+{
+ /* Deallocates a USSD string returned by ofono_ussd_decode */
+ return g_free(ussd);
+}
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/ofono/src/voicecall.c
^
|
@@ -4032,7 +4032,7 @@
emulator_dial(em, vc, num);
} else {
- strncpy(number, str, len - 1);
+ memcpy(number, str, len - 1);
number[len - 1] = '\0';
emulator_dial(em, vc, number);
@@ -4469,6 +4469,9 @@
if (entry->id == id)
break;
+ if (!entry)
+ return;
+
tone_request_finish(vc, entry, 0, FALSE);
/*
@@ -4663,3 +4666,10 @@
break;
}
}
+
+/* Since mer/1.27+git3 */
+ofono_bool_t ofono_voicecall_is_emergency_number(struct ofono_voicecall *vc,
+ const char *number)
+{
+ return vc && number && is_emergency_number(vc, number);
+}
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/ofono/test/dial-number
^
|
@@ -4,7 +4,8 @@
import dbus
if (len(sys.argv) < 2):
- print("Usage: %s [modem] <number> [hide_callerid]" % (sys.argv[0]))
+ print("Usage: %s [modem] <number> [enabled|disabled|default]" % (sys.argv[0]))
+ print("Last argument enables/disables callerid")
sys.exit(1)
bus = dbus.SystemBus()
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/ofono/test/process-context-settings
^
|
@@ -1,6 +1,7 @@
#!/usr/bin/python3
import os
+import sys
import dbus
bus = dbus.SystemBus()
@@ -23,13 +24,14 @@
if properties["Active"] == dbus.Boolean(0):
continue
- print("Configuring %s" % (path))
+ print("Configuring %s" % (path), file=sys.stderr)
settings = properties["Settings"]
interface = settings["Interface"]
if settings["Method"] == "dhcp":
- print(" Run DHCP on interface %s" % (interface))
+ print(" Run DHCP on interface %s" % (interface),
+ file=sys.stderr)
else:
address = settings["Address"]
try:
@@ -37,18 +39,22 @@
except:
gateway = "0.0.0.0";
- print(" Interface is %s" % (interface))
- print(" IP address is %s" % (address))
- print(" Gateway is %s" % (gateway))
+ print(" Interface is %s" % (interface),
+ file=sys.stderr)
+ print(" IP address is %s" % (address),
+ file=sys.stderr)
+ print(" Gateway is %s" % (gateway),
+ file=sys.stderr)
- cmd = "ifconfig " + interface + " " + address
- cmd += " netmask 255.255.255.255"
+ cmd = "ip address add dev " + interface + " " + address
+ cmd += "/32"
os.system(cmd);
for i in settings["DomainNameServers"]:
- print(" Nameserver is %s" % (i))
+ print(" Nameserver is %s" % (i),
+ file=sys.stderr)
- cmd = "route add -host " + i
+ cmd = "ip route add " + i
cmd +=" dev " + interface
os.system(cmd);
- print('')
+ print('', file=sys.stderr)
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/ofono/unit/test-slot-manager.c
^
|
@@ -1,7 +1,7 @@
/*
* oFono - Open Source Telephony
*
- * Copyright (C) 2017-2021 Jolla Ltd.
+ * Copyright (C) 2017-2022 Jolla Ltd.
* Copyright (C) 2019-2020 Open Mobile Platform LLC.
*
* This program is free software; you can redistribute it and/or modify
@@ -51,6 +51,12 @@
#define TEST_SLOT_ERROR_KEY "SlotError"
#define TEST_CONFIG_DIR_TEMPLATE "test-saifish_manager-config-XXXXXX"
+#define SM_STORE "ril"
+#define SM_STORE_GROUP "Settings"
+#define SM_STORE_ENABLED_SLOTS "EnabledSlots"
+#define SM_STORE_DEFAULT_VOICE_SIM "DefaultVoiceSim"
+#define SM_STORE_DEFAULT_DATA_SIM "DefaultDataSim"
+
static GMainLoop *test_loop = NULL;
static GSList *test_drivers = NULL;
static struct ofono_slot_driver_reg *test_driver_reg = NULL;
@@ -1141,6 +1147,7 @@
/* Set data SIM IMSI */
fake_slot_manager_dbus.cb.set_default_data_imsi(m, TEST_IMSI);
g_assert_cmpstr(m->default_data_imsi, == ,TEST_IMSI);
+ g_assert_cmpint(s->data_role, == ,OFONO_SLOT_DATA_NONE);
g_assert(!m->default_data_path); /* Modem is offline */
/* Data IMSI is signaled, path is not */
g_assert_cmpuint(fake_slot_manager_dbus.signals &
@@ -1157,6 +1164,7 @@
fake_watch_emit_queued_signals(w);
/* Now is should point to our slot */
g_assert_cmpstr(m->default_data_path, == ,TEST_PATH);
+ g_assert_cmpint(s->data_role, == ,OFONO_SLOT_DATA_INTERNET);
/* And D-Bus clients are notified */
g_assert(fake_slot_manager_dbus.signals &
SLOT_MANAGER_DBUS_SIGNAL_DATA_PATH);
@@ -1166,6 +1174,7 @@
fake_slot_manager_dbus.cb.set_default_data_imsi(m, TEST_IMSI_1);
g_assert_cmpstr(m->default_data_imsi, == ,TEST_IMSI_1);
g_assert(!m->default_data_path);
+ g_assert_cmpint(s->data_role, == ,OFONO_SLOT_DATA_NONE);
/* And D-Bus clients are notified again */
g_assert_cmpuint(fake_slot_manager_dbus.signals &
(SLOT_MANAGER_DBUS_SIGNAL_DATA_IMSI |
@@ -1177,8 +1186,10 @@
/* Switch the SIM */
fake_watch_set_ofono_imsi(w, TEST_IMSI_1);
+ fake_watch_set_ofono_iccid(w, TEST_ICCID_1);
fake_watch_emit_queued_signals(w);
g_assert_cmpstr(m->default_data_path, == ,TEST_PATH);
+ g_assert_cmpint(s->data_role, == ,OFONO_SLOT_DATA_INTERNET);
/* And D-Bus clients are notified of data path change */
g_assert_cmpuint(fake_slot_manager_dbus.signals &
(SLOT_MANAGER_DBUS_SIGNAL_DATA_IMSI |
@@ -1193,6 +1204,7 @@
g_assert_cmpint(m->slots[0]->sim_presence, == ,OFONO_SLOT_SIM_ABSENT);
g_assert_cmpstr(m->default_data_imsi, == ,TEST_IMSI_1);
g_assert(!m->default_data_path);
+ g_assert_cmpint(s->data_role, == ,OFONO_SLOT_DATA_NONE);
/* And D-Bus clients are notified of data path change */
g_assert_cmpuint(fake_slot_manager_dbus.signals &
(SLOT_MANAGER_DBUS_SIGNAL_DATA_IMSI |
@@ -1200,6 +1212,20 @@
SLOT_MANAGER_DBUS_SIGNAL_DATA_PATH);
fake_slot_manager_dbus.signals &= ~SLOT_MANAGER_DBUS_SIGNAL_DATA_IMSI;
+ /* Insert the SIM back */
+ fake_watch_set_ofono_sim(w, &sim);
+ ofono_slot_set_sim_presence(s, OFONO_SLOT_SIM_PRESENT);
+ g_assert_cmpint(s->sim_presence, == ,OFONO_SLOT_SIM_PRESENT);
+ fake_watch_set_ofono_iccid(w, TEST_ICCID_1);
+ fake_watch_set_ofono_imsi(w, TEST_IMSI_1);
+ fake_watch_emit_queued_signals(w);
+ g_assert_cmpint(s->data_role, == ,OFONO_SLOT_DATA_INTERNET);
+ g_assert_cmpuint(fake_slot_manager_dbus.signals &
+ (SLOT_MANAGER_DBUS_SIGNAL_DATA_IMSI |
+ SLOT_MANAGER_DBUS_SIGNAL_DATA_PATH), == ,
+ SLOT_MANAGER_DBUS_SIGNAL_DATA_PATH);
+ fake_slot_manager_dbus.signals &= ~SLOT_MANAGER_DBUS_SIGNAL_DATA_IMSI;
+
ofono_watch_unref(w);
g_main_loop_quit(test_loop);
return G_SOURCE_REMOVE;
@@ -1629,6 +1655,102 @@
test_common_deinit();
}
+/* ==== config_storage ==== */
+
+static gboolean test_config_storage_run(gpointer user_data)
+{
+ TestDriverData *dd = user_data;
+ struct ofono_slot_manager *m = fake_slot_manager_dbus.m;
+ struct ofono_slot *s = ofono_slot_add(dd->manager, TEST_PATH,
+ OFONO_RADIO_ACCESS_MODE_GSM, TEST_IMEI, TEST_IMEISV,
+ OFONO_SLOT_SIM_PRESENT, OFONO_SLOT_NO_FLAGS);
+ struct ofono_slot *s2 = ofono_slot_add(dd->manager, TEST_PATH_1,
+ OFONO_RADIO_ACCESS_MODE_GSM, TEST_IMEI_1, TEST_IMEISV,
+ OFONO_SLOT_SIM_PRESENT, OFONO_SLOT_NO_FLAGS);
+ char *storage_file = g_build_filename(STORAGEDIR, SM_STORE, NULL);
+ GKeyFile *storage;
+ char **slots;
+ char* val;
+
+ DBG("");
+
+ /* Unblocking D-Bus clients will exit the loop */
+ fake_slot_manager_dbus.fn_block_changed =
+ test_quit_loop_when_unblocked;
+
+ /* Finish initialization with 2 slots */
+ g_assert(s);
+ g_assert(s2);
+ g_assert(!m->ready);
+ ofono_slot_driver_started(test_driver_reg);
+ ofono_slot_unref(s);
+ ofono_slot_unref(s2);
+ g_assert(m->ready);
+
+ /* No file yet */
+ storage = g_key_file_new();
+ g_assert(!g_key_file_load_from_file(storage, storage_file, 0, NULL));
+
+ /* Enable one slot */
+ slots = gutil_strv_add(NULL, TEST_PATH);
+ fake_slot_manager_dbus.cb.set_enabled_slots(m, slots);
+ g_assert(m->slots[0]->enabled);
+ g_assert(!m->slots[1]->enabled);
+
+ /* Check the config file */
+ g_assert(g_key_file_load_from_file(storage, storage_file, 0, NULL));
+ val = g_key_file_get_string(storage, SM_STORE_GROUP,
+ SM_STORE_ENABLED_SLOTS, NULL);
+ g_assert_cmpstr(val, == ,TEST_PATH);
+ g_free(val);
+ g_key_file_free(storage);
+
+ /* Enable both slots */
+ slots = gutil_strv_add(slots, TEST_PATH_1);
+ fake_slot_manager_dbus.cb.set_enabled_slots(m, slots);
+ g_assert(m->slots[0]->enabled);
+ g_assert(m->slots[1]->enabled);
+ g_strfreev(slots);
+
+ /* There's no [EnabledSlots] there because it's the default config */
+ storage = g_key_file_new();
+ g_assert(g_key_file_load_from_file(storage, storage_file, 0, NULL));
+ g_assert(!g_key_file_get_string(storage, SM_STORE_GROUP,
+ SM_STORE_ENABLED_SLOTS, NULL));
+ g_key_file_free(storage);
+
+ g_free(storage_file);
+ return G_SOURCE_REMOVE;
+}
+
+static guint test_config_storage_start(TestDriverData *dd)
+{
+ return g_idle_add(test_config_storage_run, dd);
+}
+
+static void test_config_storage(void)
+{
+ static const struct ofono_slot_driver test_config_storage_d = {
+ .name = "config_storage",
+ .api_version = OFONO_SLOT_API_VERSION,
+ .init = test_driver_init,
+ .start = test_config_storage_start,
+ .cleanup = test_driver_cleanup
+ };
+
+ test_common_init();
+
+ test_driver_reg = ofono_slot_driver_register(&test_config_storage_d);
+ g_assert(test_driver_reg);
+ g_main_loop_run(test_loop);
+ g_assert(test_timeout_id);
+
+ ofono_slot_driver_unregister(test_driver_reg);
+ test_driver_reg = NULL;
+ test_common_deinit();
+}
+
+
/* ==== storage ==== */
static void test_storage_init()
@@ -1805,6 +1927,7 @@
g_test_add_data_func(TEST_("auto_data_sim_once"), "once",
test_auto_data_sim);
g_test_add_func(TEST_("multisim"), test_multisim);
+ g_test_add_func(TEST_("config_storage"), test_config_storage);
g_test_add_func(TEST_("storage"), test_storage);
return g_test_run();
}
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/upstream/AUTHORS
^
|
@@ -139,3 +139,5 @@
Julien Tournier <tournier.julien@gmail.com>
Nandini Rebello <nandini.rebello@intel.com>
Giacinto Cifelli <gciofono@gmail.com>
+Khaled Romdhani <khaledromdhani216@gmail.com>
+Pavel Machek <pavel@ucw.cz>
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/upstream/ChangeLog
^
|
@@ -1,3 +1,6 @@
+ver 1.28:
+ Fix issue with SIM initialization and Gemalto modems.
+
ver 1.27:
Add support for handling SIMCom based SIM800 modems.
Add support for SIM lock state with xmm7xxx modems.
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/upstream/Makefile.am
^
|
@@ -30,7 +30,9 @@
ell/checksum.h \
ell/random.h \
ell/uuid.h \
- ell/file.h
+ ell/file.h \
+ ell/uintset.h \
+ ell/string.h
ell_sources = ell/private.h \
ell/missing.h \
@@ -48,7 +50,9 @@
ell/checksum.c \
ell/random.c \
ell/uuid.c \
- ell/file.c
+ ell/file.c \
+ ell/uintset.c \
+ ell/string.c
ell_libell_internal_la_SOURCES = $(ell_headers) $(ell_sources)
endif
@@ -699,8 +703,8 @@
src/phonebook.c src/history.c src/message-waiting.c \
src/simutil.h src/simutil.c src/storage.h \
src/storage.c src/cbs.c src/watch.c src/call-volume.c \
- src/gprs.c src/idmap.h src/idmap.c \
- src/radio-settings.c src/stkutil.h src/stkutil.c \
+ src/gprs.c src/radio-settings.c \
+ src/stkutil.h src/stkutil.c \
src/nettime.c src/stkagent.c src/stkagent.h \
src/simfs.c src/simfs.h src/audio-settings.c \
src/smsagent.c src/smsagent.h src/ctm.c \
@@ -892,7 +896,7 @@
unit_objects =
-unit_tests = unit/test-common unit/test-util unit/test-idmap \
+unit_tests = unit/test-common unit/test-util \
unit/test-simutil unit/test-stkutil \
unit/test-sms unit/test-cdmasms \
unit/test-mbim \
@@ -905,40 +909,36 @@
unit/test-sms-root unit/test-mux unit/test-caif
unit_test_common_SOURCES = unit/test-common.c src/common.c src/util.c
-unit_test_common_LDADD = @GLIB_LIBS@
+unit_test_common_LDADD = @GLIB_LIBS@ $(ell_ldadd)
unit_objects += $(unit_test_common_OBJECTS)
unit_test_util_SOURCES = unit/test-util.c src/util.c
-unit_test_util_LDADD = @GLIB_LIBS@
+unit_test_util_LDADD = @GLIB_LIBS@ $(ell_ldadd)
unit_objects += $(unit_test_utils_OBJECTS)
-unit_test_idmap_SOURCES = unit/test-idmap.c src/idmap.c
-unit_test_idmap_LDADD = @GLIB_LIBS@
-unit_objects += $(unit_test_idmap_OBJECTS)
-
unit_test_simutil_SOURCES = unit/test-simutil.c src/util.c \
src/simutil.c src/smsutil.c src/storage.c
-unit_test_simutil_LDADD = @GLIB_LIBS@
+unit_test_simutil_LDADD = @GLIB_LIBS@ $(ell_ldadd)
unit_objects += $(unit_test_simutil_OBJECTS)
unit_test_stkutil_SOURCES = unit/test-stkutil.c unit/stk-test-data.h \
src/util.c \
src/storage.c src/smsutil.c \
src/simutil.c src/stkutil.c
-unit_test_stkutil_LDADD = @GLIB_LIBS@
+unit_test_stkutil_LDADD = @GLIB_LIBS@ $(ell_ldadd)
unit_objects += $(unit_test_stkutil_OBJECTS)
unit_test_sms_SOURCES = unit/test-sms.c src/util.c src/smsutil.c src/storage.c
-unit_test_sms_LDADD = @GLIB_LIBS@
+unit_test_sms_LDADD = @GLIB_LIBS@ $(ell_ldadd)
unit_objects += $(unit_test_sms_OBJECTS)
unit_test_cdmasms_SOURCES = unit/test-cdmasms.c src/cdma-smsutil.c
-unit_test_cdmasms_LDADD = @GLIB_LIBS@
+unit_test_cdmasms_LDADD = @GLIB_LIBS@ $(ell_ldadd)
unit_objects += $(unit_test_cdmasms_OBJECTS)
unit_test_sms_root_SOURCES = unit/test-sms-root.c \
src/util.c src/smsutil.c src/storage.c
-unit_test_sms_root_LDADD = @GLIB_LIBS@
+unit_test_sms_root_LDADD = @GLIB_LIBS@ $(ell_ldadd)
unit_objects += $(unit_test_sms_root_OBJECTS)
unit_test_mux_SOURCES = unit/test-mux.c $(gatchat_sources)
@@ -964,28 +964,32 @@
unit/test-rilmodem-cs.c \
drivers/rilmodem/call-settings.c
unit_test_rilmodem_cs_LDADD = gdbus/libgdbus-internal.la $(builtin_libadd) \
- @GLIB_LIBS@ @DBUS_LIBS@ -ldl
+ @GLIB_LIBS@ @DBUS_LIBS@ \
+ $(ell_ldadd) -ldl
unit_objects += $(unit_test_rilmodem_cs_OBJECTS)
unit_test_rilmodem_sms_SOURCES = $(test_rilmodem_sources) \
unit/test-rilmodem-sms.c \
drivers/rilmodem/sms.c
unit_test_rilmodem_sms_LDADD = gdbus/libgdbus-internal.la $(builtin_libadd) \
- @GLIB_LIBS@ @DBUS_LIBS@ -ldl
+ @GLIB_LIBS@ @DBUS_LIBS@ \
+ $(ell_ldadd) -ldl
unit_objects += $(unit_test_rilmodem_sms_OBJECTS)
unit_test_rilmodem_cb_SOURCES = $(test_rilmodem_sources) \
unit/test-rilmodem-cb.c \
drivers/rilmodem/call-barring.c
unit_test_rilmodem_cb_LDADD = gdbus/libgdbus-internal.la $(builtin_libadd) \
- @GLIB_LIBS@ @DBUS_LIBS@ -ldl
+ @GLIB_LIBS@ @DBUS_LIBS@ \
+ $(ell_ldadd) -ldl
unit_objects += $(unit_test_rilmodem_cb_OBJECTS)
unit_test_rilmodem_gprs_SOURCES = $(test_rilmodem_sources) \
unit/test-rilmodem-gprs.c \
drivers/rilmodem/gprs.c
unit_test_rilmodem_gprs_LDADD = gdbus/libgdbus-internal.la $(builtin_libadd) \
- @GLIB_LIBS@ @DBUS_LIBS@ -ldl
+ @GLIB_LIBS@ @DBUS_LIBS@ \
+ $(ell_ldadd) -ldl
unit_objects += $(unit_test_rilmodem_gprs_OBJECTS)
unit_test_mbim_SOURCES = unit/test-mbim.c \
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/upstream/acinclude.m4
^
|
@@ -12,7 +12,8 @@
AC_DEFUN([COMPILER_FLAGS], [
if (test "${CFLAGS}" = ""); then
- CFLAGS="-Wall -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2"
+ CFLAGS="-Wall -O2 -fsigned-char -fno-exceptions"
+ CFLAGS="$CFLAGS -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2"
fi
if (test "$USE_MAINTAINER_MODE" = "yes"); then
CFLAGS="$CFLAGS -Werror -Wextra"
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/upstream/configure.ac
^
|
@@ -1,5 +1,5 @@
AC_PREREQ(2.60)
-AC_INIT(ofono, 1.27)
+AC_INIT(ofono, 1.28)
AM_INIT_AUTOMAKE([foreign subdir-objects color-tests])
AC_CONFIG_HEADERS(config.h)
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/upstream/drivers/atmodem/phonebook.c
^
|
@@ -29,6 +29,7 @@
#include <errno.h>
#include <glib.h>
+#include <ell/ell.h>
#include <ofono/log.h>
#include <ofono/modem.h>
@@ -86,16 +87,12 @@
if (g_at_result_iter_next_hexstring(iter, &hex, &len) == FALSE)
return FALSE;
- utf8 = g_convert((const gchar*) hex, len,
- "UTF-8//TRANSLIT", "UCS-2BE",
- NULL, NULL, NULL);
-
- if (utf8) {
- *str = utf8;
- return TRUE;
- }
+ utf8 = l_utf8_from_ucs2be(hex, len);
+ if (!utf8)
+ return FALSE;
- return FALSE;
+ *str = utf8;
+ return TRUE;
}
/*
@@ -103,7 +100,7 @@
* characters, same as in UTF8
*/
if (g_at_result_iter_next_string(iter, &string)) {
- *str = g_strdup(string);
+ *str = l_strdup(string);
return TRUE;
}
@@ -187,12 +184,12 @@
adtype, secondtext, email,
sip_uri, tel_uri);
- g_free(text);
- g_free(group);
- g_free(secondtext);
- g_free(email);
- g_free(sip_uri);
- g_free(tel_uri);
+ l_free(text);
+ l_free(group);
+ l_free(secondtext);
+ l_free(email);
+ l_free(sip_uri);
+ l_free(tel_uri);
}
}
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/upstream/drivers/atmodem/sms.c
^
|
@@ -28,6 +28,7 @@
#include <stdio.h>
#include <glib.h>
+#include <ell/ell.h>
#include <ofono/log.h>
#include <ofono/modem.h>
@@ -921,7 +922,7 @@
if (len != tpdu_len)
goto err;
- d->cnma_ack_pdu = encode_hex(pdu, tpdu_len, 0);
+ d->cnma_ack_pdu = l_util_hexstring(pdu, tpdu_len);
if (d->cnma_ack_pdu == NULL)
goto err;
@@ -1318,7 +1319,7 @@
{
struct sms_data *data = ofono_sms_get_data(sms);
- g_free(data->cnma_ack_pdu);
+ l_free(data->cnma_ack_pdu);
if (data->timeout_source > 0)
g_source_remove(data->timeout_source);
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/upstream/drivers/atmodem/ussd.c
^
|
@@ -28,6 +28,7 @@
#include <stdio.h>
#include <glib.h>
+#include <ell/ell.h>
#include <ofono/log.h>
#include <ofono/modem.h>
@@ -87,12 +88,12 @@
return NULL;
if (written > 182) {
- g_free(gsm);
+ l_free(gsm);
return NULL;
}
- packed = pack_7bit_own_buf(gsm, written, 0, TRUE, msg_len, 0, msg);
- g_free(gsm);
+ packed = pack_7bit_own_buf(gsm, written, 0, true, msg_len, 0, msg);
+ l_free(gsm);
return packed;
}
@@ -136,7 +137,7 @@
switch (data->charset) {
case AT_UTIL_CHARSET_GSM:
msg_ptr = pack_7bit_own_buf((const guint8 *) content,
- -1, 0, TRUE, &msg_len,
+ -1, 0, true, &msg_len,
0, msg);
break;
@@ -200,7 +201,7 @@
unsigned char unpacked_buf[182];
long written;
- unpack_7bit_own_buf(pdu, len, 0, TRUE, sizeof(unpacked_buf),
+ unpack_7bit_own_buf(pdu, len, 0, true, sizeof(unpacked_buf),
&written, 0, unpacked_buf);
if (written < 1)
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/upstream/drivers/ifxmodem/gprs-context.c
^
|
@@ -616,9 +616,11 @@
DBG("");
- if (stat(TUN_DEV, &st) < 0) {
- ofono_error("Missing support for TUN/TAP devices");
- return -ENODEV;
+ if (vendor != OFONO_VENDOR_XMM) {
+ if (stat(TUN_DEV, &st) < 0) {
+ ofono_error("Missing support for TUN/TAP devices");
+ return -ENODEV;
+ }
}
if (vendor != OFONO_VENDOR_XMM) {
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/upstream/drivers/rilmodem/call-forwarding.c
^
|
@@ -37,7 +37,9 @@
#include <ofono/call-forwarding.h>
#include "common.h"
+#if __GNUC__ > 7
#pragma GCC diagnostic ignored "-Wrestrict"
+#endif
#include "gril.h"
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/upstream/drivers/rilmodem/network-registration.c
^
|
@@ -36,7 +36,9 @@
#include <ofono/modem.h>
#include <ofono/netreg.h>
+#if __GNUC__ > 7
#pragma GCC diagnostic ignored "-Wrestrict"
+#endif
#include <gril/gril.h>
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/upstream/drivers/rilmodem/phonebook.c
^
|
@@ -34,6 +34,7 @@
#include <stdint.h>
#include <glib.h>
+#include <ell/ell.h>
#include <ofono.h>
#include <ofono/log.h>
@@ -180,29 +181,22 @@
if (number_length != UNUSED && number_length != 0) {
number_length--;
/* '+' + number + terminator */
- number = g_try_malloc0(2 * number_length + 2);
+ number = g_new(char, 2 * number_length + 2);
+ prefix = 0;
- if (number) {
- prefix = 0;
-
- if ((msg[number_start + 1] & TON_MASK)
- == TON_INTERNATIONAL) {
- number[0] = '+';
- prefix = 1;
- }
-
- for (i = 0; i < number_length; i++) {
-
- number[2 * i + prefix] =
- digit_to_utf8[msg[number_start + 2 + i]
- & 0x0f];
- number[2 * i + 1 + prefix] =
- digit_to_utf8[msg[number_start + 2 + i]
- >> 4];
- }
+ if ((msg[number_start + 1] & TON_MASK) == TON_INTERNATIONAL) {
+ number[0] = '+';
+ prefix = 1;
+ }
- extension_record = msg[len - 1];
+ for (i = 0; i < number_length; i++) {
+ number[2 * i + prefix] =
+ digit_to_utf8[msg[number_start + 2 + i] & 0x0f];
+ number[2 * i + 1 + prefix] =
+ digit_to_utf8[msg[number_start + 2 + i] >> 4];
}
+
+ extension_record = msg[len - 1];
}
DBG("ADN name %s, number %s ", name, number);
@@ -212,12 +206,7 @@
if ((name == NULL || *name == '\0') && number == NULL)
goto end;
- new_entry = g_try_malloc0(sizeof(*new_entry));
- if (new_entry == NULL) {
- ofono_error("%s: out of memory", __func__);
- goto end;
- }
-
+ new_entry = l_new(struct phonebook_entry, 1);
new_entry->name = name;
new_entry->number = number;
@@ -246,8 +235,8 @@
return new_entry;
end:
- g_free(name);
- g_free(number);
+ l_free(name);
+ l_free(number);
return NULL;
}
@@ -314,17 +303,17 @@
if (entry) {
/* If one already exists, delete it */
if (entry->sne)
- g_free(entry->sne);
+ l_free(entry->sne);
DBG("Adding SNE %s to %d", sne, rec_data->adn_idx);
DBG("name %s", entry->name);
entry->sne = sne;
} else {
- g_free(sne);
+ l_free(sne);
}
} else {
- g_free(sne);
+ l_free(sne);
}
}
@@ -358,9 +347,7 @@
number_length--;
/* '+' + number + terminator */
- anr = g_try_malloc0(2 * number_length + 2);
- if (anr == NULL)
- return;
+ anr = l_new(char, 2 * number_length + 2);
prefix = 0;
if ((msg[2] & TON_MASK) == TON_INTERNATIONAL) {
@@ -376,13 +363,13 @@
entry = g_tree_lookup(ref->phonebook,
GINT_TO_POINTER(rec_data->adn_idx));
if (entry == NULL) {
- g_free(anr);
+ l_free(anr);
return;
}
/* If one already exists, delete it */
if (entry->anr)
- g_free(entry->anr);
+ l_free(entry->anr);
DBG("Adding ANR %s to %d", anr, rec_data->adn_idx);
DBG("name %s", entry->name);
@@ -427,20 +414,20 @@
email = sim_string_to_utf8(msg, len);
if (email == NULL || *email == '\0') {
- g_free(email);
+ l_free(email);
return;
}
entry = g_tree_lookup(ref->phonebook,
GINT_TO_POINTER(rec_data->adn_idx));
if (entry == NULL) {
- g_free(email);
+ l_free(email);
return;
}
/* if one already exists, delete it */
if (entry->email)
- g_free(entry->email);
+ l_free(entry->email);
DBG("Adding email to entry %d", rec_data->adn_idx);
DBG("name %s", entry->name);
@@ -582,12 +569,12 @@
entry->email,
NULL, NULL);
- g_free(entry->name);
- g_free(entry->number);
- g_free(entry->email);
- g_free(entry->anr);
- g_free(entry->sne);
- g_free(entry);
+ l_free(entry->name);
+ l_free(entry->number);
+ l_free(entry->email);
+ l_free(entry->anr);
+ l_free(entry->sne);
+ l_free(entry);
return FALSE;
}
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/upstream/drivers/rilmodem/sim.c
^
|
@@ -31,6 +31,7 @@
#include <errno.h>
#include <glib.h>
+#include <ell/ell.h>
#include <ofono/log.h>
#include <ofono/modem.h>
@@ -150,7 +151,7 @@
int sw1, sw2;
char *hex_response;
unsigned char *response = NULL;
- long len;
+ size_t len;
gboolean ok = FALSE;
int flen = 0, rlen = 0, str = 0;
guchar access[3] = { 0x00, 0x00, 0x00 };
@@ -173,7 +174,7 @@
goto error;
if (hex_response != NULL) {
- response = decode_hex(hex_response, -1, &len, -1);
+ response = l_util_from_hexstring(hex_response, &len);
g_free(hex_response);
hex_response = NULL;
@@ -217,9 +218,6 @@
return;
}
- if (len < 0)
- goto error;
-
if (response[0] == 0x62) {
ok = sim_parse_3g_get_response(response, len,
&flen, &rlen, &str,
@@ -230,7 +228,7 @@
&flen, &rlen, &str,
access, &file_status);
- g_free(response);
+ l_free(response);
if (!ok)
goto error;
@@ -240,7 +238,7 @@
return;
error:
- g_free(response);
+ l_free(response);
CALLBACK_WITH_FAILURE(cb, -1, -1, -1, NULL,
EF_STATUS_INVALIDATED, cbd->data);
}
@@ -291,7 +289,7 @@
if (len == 0)
return NULL;
- return encode_hex(comm_path, len, 0);
+ return l_util_hexstring(comm_path, len);
}
static void ril_sim_read_info(struct ofono_sim *sim, int fileid,
@@ -346,7 +344,7 @@
"0,0,15,(null),pin2=(null),aid=%s)",
CMD_GET_RESPONSE, fileid, hex_path,
sd->aid_str);
- g_free(hex_path);
+ l_free(hex_path);
if (g_ril_send(sd->ril, RIL_REQUEST_SIM_IO, &rilp,
ril_file_info_cb, cbd, g_free) > 0)
@@ -366,7 +364,7 @@
int sw1, sw2;
char *hex_response;
unsigned char *response = NULL;
- long len;
+ size_t len;
if (message->error != RIL_E_SUCCESS) {
ofono_error("RILD reply failure: %s",
@@ -380,7 +378,7 @@
if (hex_response == NULL)
goto error;
- response = decode_hex(hex_response, -1, &len, -1);
+ response = l_util_from_hexstring(hex_response, &len);
g_free(hex_response);
hex_response = NULL;
@@ -390,11 +388,11 @@
}
CALLBACK_WITH_SUCCESS(cb, response, len, cbd->data);
- g_free(response);
+ l_free(response);
return;
error:
- g_free(response);
+ l_free(response);
CALLBACK_WITH_FAILURE(cb, NULL, 0, cbd->data);
}
@@ -477,7 +475,7 @@
CMD_READ_BINARY, fileid, hex_path,
start >> 8, start & 0xff,
length, sd->aid_str);
- g_free(hex_path);
+ l_free(hex_path);
if (g_ril_send(sd->ril, RIL_REQUEST_SIM_IO, &rilp,
ril_file_io_cb, cbd, g_free) > 0)
@@ -527,7 +525,7 @@
"%d,%d,%d,(null),pin2=(null),aid=%s)",
CMD_READ_RECORD, fileid, hex_path,
record, 4, length, sd->aid_str);
- g_free(hex_path);
+ l_free(hex_path);
if (g_ril_send(sd->ril, RIL_REQUEST_SIM_IO, &rilp,
ril_file_io_cb, cbd, g_free) > 0)
@@ -563,7 +561,7 @@
p1 = start >> 8;
p2 = start & 0xff;
- hex_data = encode_hex(value, length, 0);
+ hex_data = l_util_hexstring(value, length);
parcel_init(&rilp);
parcel_w_int32(&rilp, CMD_UPDATE_BINARY);
@@ -584,8 +582,8 @@
"%d,%d,%d,%s,pin2=(null),aid=%s),",
CMD_UPDATE_BINARY, fileid, hex_path,
p1, p2, length, hex_data, sd->aid_str);
- g_free(hex_path);
- g_free(hex_data);
+ l_free(hex_path);
+ l_free(hex_data);
if (g_ril_send(sd->ril, RIL_REQUEST_SIM_IO, &rilp,
ril_file_write_cb, cbd, g_free) > 0)
@@ -619,7 +617,7 @@
goto error;
}
- hex_data = encode_hex(value, length, 0);
+ hex_data = l_util_hexstring(value, length);
parcel_init(&rilp);
parcel_w_int32(&rilp, CMD_UPDATE_RECORD);
@@ -641,8 +639,8 @@
CMD_UPDATE_RECORD, fileid, hex_path,
record, access_mode, length, hex_data,
sd->aid_str);
- g_free(hex_path);
- g_free(hex_data);
+ l_free(hex_path);
+ l_free(hex_data);
if (g_ril_send(sd->ril, RIL_REQUEST_SIM_IO, &rilp,
ril_file_write_cb, cbd, g_free) > 0)
@@ -951,10 +949,10 @@
goto error;
}
- hex_dump = encode_hex((unsigned char *) data, len, '\0');
+ hex_dump = l_util_hexstring((const unsigned char *) data, len);
g_ril_append_print_buf(sd->ril, "{%d,%s}", len, hex_dump);
g_ril_print_response(sd->ril, message);
- g_free(hex_dump);
+ l_free(hex_dump);
expected = sizeof(int32_t) * 5;
if (len < expected) {
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/upstream/drivers/rilmodem/stk.c
^
|
@@ -27,6 +27,7 @@
#include <stdio.h>
#include <glib.h>
+#include <ell/ell.h>
#include <ofono/log.h>
#include <ofono/modem.h>
@@ -94,20 +95,21 @@
struct stk_data *sd = cbd->user;
struct parcel rilp;
unsigned char *response = NULL;
- long len = 0;
- char *pdu;
g_ril_print_response(sd->ril, message);
if (message->error == RIL_E_SUCCESS) {
+ char *pdu;
+ size_t len;
+
g_ril_init_parcel(message, &rilp);
pdu = parcel_r_string(&rilp);
if (pdu)
- response = decode_hex(pdu, -1, &len, -1);
+ response = l_util_from_hexstring(pdu, &len);
CALLBACK_WITH_SUCCESS(cb, response, len, cbd->data);
- g_free(response);
+ l_free(response);
} else {
ofono_error("%s RILD reply failure: %s",
g_ril_request_id_to_string(sd->ril, message->req),
@@ -145,32 +147,32 @@
{
struct ofono_stk *stk = user_data;
struct parcel rilp;
- long pdulen;
+ size_t pdulen;
unsigned char *pdu;
DBG("");
g_ril_init_parcel(message, &rilp);
- pdu = decode_hex(parcel_r_string(&rilp), -1, &pdulen, -1);
+ pdu = l_util_from_hexstring(parcel_r_string(&rilp), &pdulen);
ofono_stk_proactive_command_notify(stk, pdulen, pdu);
- g_free(pdu);
+ l_free(pdu);
}
static void ril_stk_event_notify(struct ril_msg *message, gpointer user_data)
{
struct ofono_stk *stk = user_data;
struct parcel rilp;
- long pdulen;
+ size_t pdulen;
unsigned char *pdu;
DBG("");
g_ril_init_parcel(message, &rilp);
- pdu = decode_hex(parcel_r_string(&rilp), -1, &pdulen, -1);
+ pdu = l_util_from_hexstring(parcel_r_string(&rilp), &pdulen);
ofono_stk_proactive_command_handled_notify(stk, pdulen, pdu);
- g_free(pdu);
+ l_free(pdu);
}
static void ril_stk_session_end_notify(struct ril_msg *message,
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/upstream/drivers/speedupmodem/ussd.c
^
|
@@ -98,7 +98,7 @@
cbd->user = ussd;
- unpack_7bit_own_buf(pdu, len, 0, TRUE, sizeof(coded_buf),
+ unpack_7bit_own_buf(pdu, len, 0, true, sizeof(coded_buf),
&written, 0, (unsigned char *)coded_buf);
if (written < 1)
goto error;
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/upstream/plugins/gemalto.c
^
|
@@ -573,9 +573,6 @@
ofono_devinfo_create(modem, 0, "atmodem", data->app);
ofono_location_reporting_create(modem, 0, "gemaltomodem", data->app);
- ofono_modem_set_integer(modem, "GemaltoVtsQuotes", 1);
- ofono_voicecall_create(modem, 0, "gemaltomodem", data->app);
-
data->sim = ofono_sim_create(modem, OFONO_VENDOR_GEMALTO, "atmodem",
data->app);
@@ -604,11 +601,6 @@
ofono_ussd_create(modem, 0, "atmodem", data->app);
- ofono_call_forwarding_create(modem, 0, "atmodem", data->app);
- ofono_call_settings_create(modem, 0, "atmodem", data->app);
- ofono_call_meter_create(modem, 0, "atmodem", data->app);
- ofono_call_barring_create(modem, 0, "atmodem", data->app);
-
if (!g_strcmp0(model, GEMALTO_MODEL_ALS3_PLS8x))
ofono_lte_create(modem, OFONO_VENDOR_GEMALTO,
"atmodem", data->app);
@@ -621,6 +613,14 @@
DBG("%p", modem);
ofono_netreg_create(modem, OFONO_VENDOR_GEMALTO, "atmodem", data->app);
+
+ ofono_modem_set_integer(modem, "GemaltoVtsQuotes", 1);
+ ofono_voicecall_create(modem, 0, "gemaltomodem", data->app);
+
+ ofono_call_forwarding_create(modem, 0, "atmodem", data->app);
+ ofono_call_settings_create(modem, 0, "atmodem", data->app);
+ ofono_call_meter_create(modem, 0, "atmodem", data->app);
+ ofono_call_barring_create(modem, 0, "atmodem", data->app);
}
static struct ofono_modem_driver gemalto_driver = {
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/upstream/src/gprs.c
^
|
@@ -36,6 +36,7 @@
#include <arpa/inet.h>
#include <stdbool.h>
+#include <ell/ell.h>
#include <glib.h>
#include <gdbus.h>
@@ -43,7 +44,6 @@
#include "common.h"
#include "storage.h"
-#include "idmap.h"
#include "simutil.h"
#include "util.h"
@@ -70,9 +70,9 @@
int flags;
int bearer;
guint suspend_timeout;
- struct idmap *pid_map;
+ struct l_uintset *used_pids;
unsigned int last_context_id;
- struct idmap *cid_map;
+ struct l_uintset *used_cids;
int netreg_status;
struct ofono_netreg *netreg;
unsigned int netreg_watch;
@@ -223,43 +223,23 @@
return FALSE;
}
-static unsigned int gprs_cid_alloc(struct ofono_gprs *gprs)
+static gboolean assign_context(struct pri_context *ctx, unsigned int use_cid)
{
- return idmap_alloc(gprs->cid_map);
-}
-
-static void gprs_cid_take(struct ofono_gprs *gprs, unsigned int id)
-{
- idmap_take(gprs->cid_map, id);
-}
-
-static void gprs_cid_release(struct ofono_gprs *gprs, unsigned int id)
-{
- idmap_put(gprs->cid_map, id);
-}
-
-static gboolean gprs_cid_taken(struct ofono_gprs *gprs, unsigned int id)
-{
- return idmap_find(gprs->cid_map, id) != 0;
-}
-
-static gboolean assign_context(struct pri_context *ctx, int use_cid)
-{
- struct idmap *cidmap = ctx->gprs->cid_map;
+ struct l_uintset *used_cids = ctx->gprs->used_cids;
GSList *l;
- if (cidmap == NULL)
+ if (used_cids == NULL)
return FALSE;
- if (use_cid > 0) {
- gprs_cid_take(ctx->gprs, use_cid);
- ctx->context.cid = use_cid;
- } else
- ctx->context.cid = gprs_cid_alloc(ctx->gprs);
+ if (!use_cid)
+ use_cid = l_uintset_find_unused_min(used_cids);
- if (ctx->context.cid > idmap_get_max(cidmap))
+ if (use_cid > l_uintset_get_max(used_cids))
return FALSE;
+ l_uintset_put(used_cids, use_cid);
+ ctx->context.cid = use_cid;
+
for (l = ctx->gprs->context_drivers; l; l = l->next) {
struct ofono_gprs_context *gc = l->data;
@@ -299,7 +279,7 @@
if (ctx == NULL || ctx->gprs == NULL || ctx->context_driver == NULL)
return;
- gprs_cid_release(ctx->gprs, ctx->context.cid);
+ l_uintset_take(ctx->gprs->used_cids, ctx->context.cid);
ctx->context.cid = 0;
ctx->context_driver->inuse = FALSE;
ctx->context_driver = NULL;
@@ -1434,7 +1414,7 @@
context_methods, context_signals,
NULL, ctx, pri_context_destroy)) {
ofono_error("Could not register PrimaryContext %s", path);
- idmap_put(ctx->gprs->pid_map, ctx->id);
+ l_uintset_take(ctx->gprs->used_pids, ctx->id);
pri_context_destroy(ctx);
return FALSE;
@@ -1462,7 +1442,7 @@
}
strcpy(path, ctx->path);
- idmap_put(ctx->gprs->pid_map, ctx->id);
+ l_uintset_take(ctx->gprs->used_pids, ctx->id);
return g_dbus_unregister_interface(conn, path,
OFONO_CONNECTION_CONTEXT_INTERFACE);
@@ -1919,20 +1899,21 @@
struct pri_context *context;
if (gprs->last_context_id)
- id = idmap_alloc_next(gprs->pid_map, gprs->last_context_id);
+ id = l_uintset_find_unused(gprs->used_pids,
+ gprs->last_context_id);
else
- id = idmap_alloc(gprs->pid_map);
+ id = l_uintset_find_unused_min(gprs->used_pids);
- if (id > idmap_get_max(gprs->pid_map))
+ if (id > l_uintset_get_max(gprs->used_pids))
return NULL;
context = pri_context_create(gprs, name, type);
if (context == NULL) {
- idmap_put(gprs->pid_map, id);
ofono_error("Unable to allocate context struct");
return NULL;
}
+ l_uintset_put(gprs->used_pids, id);
context->id = id;
DBG("Registering new context");
@@ -1962,7 +1943,7 @@
DBG("");
- if (gprs_cid_taken(gprs, cid)) {
+ if (l_uintset_contains(gprs->used_cids, cid)) {
DBG("cid %u already activated", cid);
return;
}
@@ -2353,20 +2334,15 @@
strlen(ap->message_center) > MAX_MESSAGE_CENTER_LENGTH)
return;
- if (gprs->last_context_id)
- id = idmap_alloc_next(gprs->pid_map, gprs->last_context_id);
- else
- id = idmap_alloc(gprs->pid_map);
-
- if (id > idmap_get_max(gprs->pid_map))
+ id = l_uintset_find_unused(gprs->used_pids, gprs->last_context_id);
+ if (id > l_uintset_get_max(gprs->used_pids))
return;
context = pri_context_create(gprs, ap->name, ap->type);
- if (context == NULL) {
- idmap_put(gprs->pid_map, id);
+ if (context == NULL)
return;
- }
+ l_uintset_put(gprs->used_pids, id);
context->id = id;
if (ap->username != NULL)
@@ -2600,10 +2576,8 @@
if (gprs == NULL)
return;
- if (gprs->cid_map)
- idmap_free(gprs->cid_map);
-
- gprs->cid_map = idmap_new_from_range(min, max);
+ l_uintset_free(gprs->used_cids);
+ gprs->used_cids = l_uintset_new_from_range(min, max);
}
static void gprs_context_unregister(struct ofono_atom *atom)
@@ -3010,10 +2984,8 @@
free_contexts(gprs);
- if (gprs->cid_map) {
- idmap_free(gprs->cid_map);
- gprs->cid_map = NULL;
- }
+ l_uintset_free(gprs->used_cids);
+ gprs->used_cids = NULL;
if (gprs->netreg_watch) {
if (gprs->status_watch) {
@@ -3053,10 +3025,8 @@
if (gprs->suspend_timeout)
g_source_remove(gprs->suspend_timeout);
- if (gprs->pid_map) {
- idmap_free(gprs->pid_map);
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/upstream/src/ofono.h
^
|
@@ -20,6 +20,7 @@
*/
#include <glib.h>
+#include <ell/ell.h>
#define OFONO_API_SUBJECT_TO_CHANGE
@@ -387,9 +388,8 @@
ofono_bool_t __ofono_is_valid_net_pin(const char *pin);
-void __ofono_sim_refresh(struct ofono_sim *sim, GSList *file_list,
- ofono_bool_t full_file_change,
- ofono_bool_t naa_init);
+void __ofono_sim_refresh(struct ofono_sim *sim, struct l_queue *file_list,
+ bool full_file_change, bool naa_init);
void __ofono_sim_recheck_pin(struct ofono_sim *sim);
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/upstream/src/sim.c
^
|
@@ -36,6 +36,8 @@
#include <errno.h>
#include <unistd.h>
+#include <ell/ell.h>
+
#include "ofono.h"
#include "common.h"
@@ -349,8 +351,8 @@
static void service_number_free(gpointer pointer)
{
struct service_number *num = pointer;
- g_free(num->id);
- g_free(num);
+ l_free(num->id);
+ l_free(num);
}
static void call_state_watches(struct ofono_sim *sim)
@@ -927,7 +929,7 @@
if (cache)
sim_fs_cache_image(sim->simfs, (const char *) xpm, id);
- g_free(xpm);
+ l_free(xpm);
}
static void sim_iidf_read_clut_cb(int ok, int length, int record,
@@ -1285,27 +1287,26 @@
if (sim_adn_parse(data, record_length, &ph, &alpha) == FALSE)
goto out;
-
/* Use phone number if Id is unavailable */
if (alpha && alpha[0] == '\0') {
- g_free(alpha);
+ l_free(alpha);
alpha = NULL;
}
if (alpha == NULL)
- alpha = g_strdup(phone_number_to_string(&ph));
+ alpha = l_strdup(phone_number_to_string(&ph));
if (sim->service_numbers &&
g_slist_find_custom(sim->service_numbers,
alpha, service_number_compare)) {
ofono_error("Duplicate EFsdn entries for `%s'",
alpha);
- g_free(alpha);
+ l_free(alpha);
goto out;
}
- sdn = g_new(struct service_number, 1);
+ sdn = l_new(struct service_number, 1);
sdn->id = alpha;
memcpy(&sdn->ph, &ph, sizeof(struct ofono_phone_number));
@@ -2512,10 +2513,10 @@
sim->reading_spn = false;
- g_free(sim->spn);
+ l_free(sim->spn);
sim->spn = NULL;
- g_free(sim->spn_dc);
+ l_free(sim->spn_dc);
sim->spn_dc = NULL;
}
@@ -2829,10 +2830,10 @@
DBusConnection *conn = ofono_dbus_get_connection();
const char *path = __ofono_atom_get_path(sim->atom);
- g_free(sim->spn);
+ l_free(sim->spn);
sim->spn = NULL;
- g_free(sim->spn_dc);
+ l_free(sim->spn_dc);
sim->spn_dc = NULL;
if (data == NULL)
@@ -2861,13 +2862,13 @@
}
if (strlen(sim->spn) == 0) {
- g_free(sim->spn);
+ l_free(sim->spn);
sim->spn = NULL;
goto notify;
}
if (dc)
- sim->spn_dc = g_memdup(dc, 1);
+ sim->spn_dc = l_memdup(dc, 1);
notify:
if (sim->spn)
@@ -3399,17 +3400,17 @@
sim_fs_cache_flush_file(sim->simfs, id);
}
-void __ofono_sim_refresh(struct ofono_sim *sim, GSList *file_list,
- ofono_bool_t full_file_change, ofono_bool_t naa_init)
+void __ofono_sim_refresh(struct ofono_sim *sim, struct l_queue *files,
+ bool full_file_change, bool naa_init)
{
- GSList *l;
- gboolean reinit_naa = naa_init || full_file_change;
+ const struct l_queue_entry *l;
+ bool reinit_naa = naa_init || full_file_change;
/*
* Check if any files used in SIM initialisation procedure
* are affected, except EFiccid, EFpl, EFli.
*/
- for (l = file_list; l; l = l->next) {
+ for (l = l_queue_get_entries(files); l; l = l->next) {
struct stk_file *file = l->data;
uint32_t mf, df, ef;
@@ -3450,7 +3451,7 @@
if (full_file_change)
sim_fs_cache_flush(sim->simfs);
else {
- for (l = file_list; l; l = l->next) {
+ for (l = l_queue_get_entries(files); l; l = l->next) {
struct stk_file *file = l->data;
int id = (file->file[file->len - 2] << 8) |
(file->file[file->len - 1] << 0);
@@ -3475,7 +3476,7 @@
if (full_file_change)
sim_fs_notify_file_watches(sim->simfs, -1);
else {
- for (l = file_list; l; l = l->next) {
+ for (l = l_queue_get_entries(files); l; l = l->next) {
struct stk_file *file = l->data;
int id = (file->file[file->len - 2] << 8) |
(file->file[file->len - 1] << 0);
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/upstream/src/simutil.c
^
|
@@ -27,6 +27,7 @@
#include <stdlib.h>
#include <glib.h>
+#include <ell/ell.h>
#include <ofono/types.h>
#include "simutil.h"
@@ -793,14 +794,14 @@
spare_bits = dcs & 0x07;
num_char = (length * 8 - spare_bits) / 7;
- unpacked_buf = unpack_7bit(buffer, length, 0, FALSE,
+ unpacked_buf = unpack_7bit(buffer, length, 0, false,
num_char, &written, 0);
if (unpacked_buf == NULL)
break;
ret = convert_gsm_to_utf8(unpacked_buf, written, NULL, NULL, 0);
- g_free(unpacked_buf);
+ l_free(unpacked_buf);
break;
case 0x10:
@@ -815,9 +816,7 @@
if (buffer[i] == 0xff && buffer[i + 1] == 0xff)
break;
- ret = g_convert((const char *) buffer, length,
- "UTF-8//TRANSLIT", "UCS-2BE",
- NULL, NULL, NULL);
+ ret = l_utf8_from_ucs2be(buffer, length);
break;
}
@@ -989,9 +988,9 @@
if (oper == NULL)
return;
- g_free(oper->info);
- g_free(oper->shortname);
- g_free(oper->longname);
+ l_free(oper->info);
+ l_free(oper->shortname);
+ l_free(oper->longname);
}
struct sim_eons *sim_eons_new(int pnn_records)
@@ -1551,7 +1550,7 @@
void sim_app_record_free(struct sim_app_record *app)
{
- g_free(app->label);
+ l_free(app->label);
g_free(app);
}
@@ -1606,7 +1605,7 @@
GSList *t = ret;
struct sim_app_record *app = ret->data;
- g_free(app->label);
+ l_free(app->label);
g_free(app);
ret = ret->next;
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/upstream/src/smsutil.c
^
|
@@ -33,6 +33,7 @@
#include <unistd.h>
#include <glib.h>
+#include <ell/ell.h>
#include "util.h"
#include "storage.h"
@@ -556,13 +557,13 @@
return FALSE;
if (written > 11) {
- g_free(gsm);
+ l_free(gsm);
return FALSE;
}
- r = pack_7bit_own_buf(gsm, written, 0, FALSE, &packed, 0, p);
+ r = pack_7bit_own_buf(gsm, written, 0, false, &packed, 0, p);
- g_free(gsm);
+ l_free(gsm);
if (r == NULL)
return FALSE;
@@ -667,7 +668,7 @@
return TRUE;
}
- res = unpack_7bit(pdu + *offset, byte_len, 0, FALSE, chars,
+ res = unpack_7bit(pdu + *offset, byte_len, 0, false, chars,
&written, 0);
*offset = *offset + (addr_len + 1) / 2;
@@ -676,10 +677,9 @@
return FALSE;
utf8 = convert_gsm_to_utf8(res, written, NULL, NULL, 0);
+ l_free(res);
- g_free(res);
-
- if (utf8 == NULL)
+ if (!utf8)
return FALSE;
/*
@@ -687,13 +687,12 @@
* 22 bytes+terminator in UTF-8.
*/
if (strlen(utf8) > 22) {
- g_free(utf8);
+ l_free(utf8);
return FALSE;
}
strcpy(out->address, utf8);
-
- g_free(utf8);
+ l_free(utf8);
}
return TRUE;
@@ -1330,7 +1329,7 @@
if ((len - offset) < out->submit.udl)
return FALSE;
- pack_7bit_own_buf(pdu + offset, out->submit.udl, 0, FALSE,
+ pack_7bit_own_buf(pdu + offset, out->submit.udl, 0, false,
NULL, 0, out->submit.ud);
return TRUE;
@@ -2218,7 +2217,8 @@
const struct sms *sms;
int guess_size = g_slist_length(sms_list);
char *utf8;
- GByteArray *utf16 = 0;
+ void *utf16 = NULL;
+ size_t utf16_size = 0;
if (guess_size == 1)
guess_size = 160;
@@ -2265,7 +2265,7 @@
if (unpack_7bit_own_buf(ud + taken,
udl_in_bytes - taken,
- taken, FALSE, max_chars,
+ taken, false, max_chars,
&written, 0, buf) == NULL)
continue;
@@ -2292,7 +2292,7 @@
single_shift);
if (converted) {
g_string_append(str, converted);
- g_free(converted);
+ l_free(converted);
}
} else {
const guint8 *from = ud + taken;
@@ -2302,7 +2302,7 @@
* Header is odd, the maximum length of the whole TP-UD
* field is 139 octets
*/
- gssize num_ucs2_chars = (udl_in_bytes - taken) >> 1;
+ size_t num_ucs2_chars = (udl_in_bytes - taken) >> 1;
num_ucs2_chars = num_ucs2_chars << 1;
/*
@@ -2313,25 +2313,32 @@
* character in the middle. So accumulate the
* entire message before converting to UTF-8.
*/
- if (!utf16)
- utf16 = g_byte_array_new();
-
- g_byte_array_append(utf16, from, num_ucs2_chars);
+ utf16 = l_realloc(utf16, utf16_size + num_ucs2_chars);
+ memcpy(utf16 + utf16_size, from, num_ucs2_chars);
+ utf16_size += num_ucs2_chars;
}
}
if (utf16) {
- char *converted = g_convert_with_fallback((const gchar *)
- utf16->data, utf16->len,
- "UTF-8//TRANSLIT", "UTF-16BE",
- NULL, NULL, NULL, NULL);
+ char *converted;
+
+ /* Strings are in UTF16-BE, so convert if needed */
+ if (L_CPU_TO_BE16(0x8000) != 0x8000) {
+ size_t i;
+ uint16_t *p = utf16;
+
+ for (i = 0; i < utf16_size / 2; i++)
+ p[i] = __builtin_bswap16(p[i]);
+ }
+
+ converted = l_utf8_from_utf16(utf16, utf16_size);
if (converted) {
g_string_append(str, converted);
- g_free(converted);
+ l_free(converted);
}
- g_byte_array_free(utf16, TRUE);
+ l_free(utf16);
}
utf8 = g_string_free(str, FALSE);
@@ -3561,7 +3568,7 @@
struct sms template;
int offset = 0;
unsigned char *gsm_encoded = NULL;
- char *ucs2_encoded = NULL;
+ void *ucs2_encoded = NULL;
long written;
long left;
guint8 seq;
@@ -3586,16 +3593,15 @@
gsm_encoded = convert_utf8_to_gsm_best_lang(utf8, -1, NULL, &written, 0,
alphabet, &used_locking,
&used_single);
- if (gsm_encoded == NULL) {
- gsize converted;
+ if (!gsm_encoded) {
+ size_t converted;
- ucs2_encoded = g_convert(utf8, -1, "UCS-2BE//TRANSLIT", "UTF-8",
- NULL, &converted, NULL);
- written = converted;
- }
+ ucs2_encoded = l_utf8_to_ucs2be(utf8, &converted);
+ if (!ucs2_encoded)
+ return NULL;
- if (gsm_encoded == NULL && ucs2_encoded == NULL)
- return NULL;
+ written = converted - 2;
+ }
if (gsm_encoded != NULL)
template.submit.dcs = 0x00; /* Class Unspecified, 7 Bit */
@@ -3629,10 +3635,10 @@
if (gsm_encoded && (written <= sms_text_capacity_gsm(160, offset))) {
template.submit.udl = written + (offset * 8 + 6) / 7;
- pack_7bit_own_buf(gsm_encoded, written, offset, FALSE, NULL,
+ pack_7bit_own_buf(gsm_encoded, written, offset, false, NULL,
0, template.submit.ud + offset);
- g_free(gsm_encoded);
+ l_free(gsm_encoded);
return sms_list_append(NULL, &template);
}
@@ -3640,7 +3646,7 @@
template.submit.udl = written + offset;
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/upstream/src/stk.c
^
|
@@ -34,6 +34,8 @@
#include <time.h>
#include <sys/time.h>
+#include <ell/ell.h>
+
#include "ofono.h"
#include "common.h"
@@ -343,15 +345,15 @@
}
static struct stk_menu *stk_menu_create(const char *title,
- const struct stk_text_attribute *title_attr,
- const struct stk_icon_id *icon, GSList *items,
- const struct stk_item_text_attribute_list *item_attrs,
- const struct stk_item_icon_id_list *item_icon_ids,
- int default_id, gboolean soft_key, gboolean has_help)
+ const struct stk_text_attribute *title_attr,
+ const struct stk_icon_id *icon, struct l_queue *items,
+ const struct stk_item_text_attribute_list *item_attrs,
+ const struct stk_item_icon_id_list *item_icon_ids,
+ int default_id, bool soft_key, bool has_help)
{
- unsigned int len = g_slist_length(items);
+ unsigned int len = l_queue_length(items);
struct stk_menu *ret;
- GSList *l;
+ const struct l_queue_entry *entry;
int i;
struct stk_text_attribute attr;
@@ -363,23 +365,22 @@
if (item_icon_ids && item_icon_ids->len && item_icon_ids->len != len)
return NULL;
- ret = g_try_new(struct stk_menu, 1);
- if (ret == NULL)
- return NULL;
+ ret = l_new(struct stk_menu, 1);
ret->title = dbus_apply_text_attributes(title ? title : "",
title_attr);
if (ret->title == NULL)
- ret->title = g_strdup(title ? title : "");
+ ret->title = l_strdup(title ? title : "");
memcpy(&ret->icon, icon, sizeof(ret->icon));
- ret->items = g_new0(struct stk_menu_item, len + 1);
+ ret->items = l_new(struct stk_menu_item, len + 1);
ret->default_item = -1;
ret->soft_key = soft_key;
ret->has_help = has_help;
- for (l = items, i = 0; l; l = l->next, i++) {
- struct stk_item *item = l->data;
+ for (entry = l_queue_get_entries(items), i = 0;
+ entry; entry = entry->next, i++) {
+ struct stk_item *item = entry->data;
char *text;
ret->items[i].item_id = item->id;
@@ -394,7 +395,7 @@
}
if (text == NULL)
- text = strdup(item->text);
+ text = l_strdup(item->text);
ret->items[i].text = text;
@@ -416,8 +417,8 @@
static struct stk_menu *stk_menu_create_from_set_up_menu(
const struct stk_command *cmd)
{
- gboolean soft_key = (cmd->qualifier & (1 << 0)) != 0;
- gboolean has_help = (cmd->qualifier & (1 << 7)) != 0;
+ bool soft_key = (cmd->qualifier & (1 << 0)) != 0;
+ bool has_help = (cmd->qualifier & (1 << 7)) != 0;
return stk_menu_create(cmd->setup_menu.alpha_id,
&cmd->setup_menu.text_attr,
@@ -431,8 +432,8 @@
static struct stk_menu *stk_menu_create_from_select_item(
const struct stk_command *cmd)
{
- gboolean soft_key = (cmd->qualifier & (1 << 2)) != 0;
- gboolean has_help = (cmd->qualifier & (1 << 7)) != 0;
+ bool soft_key = (cmd->qualifier & (1 << 2)) != 0;
+ bool has_help = (cmd->qualifier & (1 << 7)) != 0;
return stk_menu_create(cmd->select_item.alpha_id,
&cmd->select_item.text_attr,
@@ -448,11 +449,11 @@
struct stk_menu_item *i;
for (i = menu->items; i->text; i++)
- g_free(i->text);
+ l_free(i->text);
- g_free(menu->items);
- g_free(menu->title);
- g_free(menu);
+ l_free(menu->items);
+ l_free(menu->title);
+ l_free(menu);
}
static void emit_menu_changed(struct ofono_stk *stk)
@@ -461,7 +462,7 @@
static struct stk_menu no_menu = {
.title = "",
.items = &end_item,
- .has_help = FALSE,
+ .has_help = false,
.default_item = -1,
};
static char *name = "MainMenu";
@@ -561,7 +562,7 @@
else
stk_agent_display_action_info(stk->current_agent, alpha, icon);
- g_free(alpha);
+ l_free(alpha);
return TRUE;
}
@@ -986,7 +987,7 @@
}
if (stk->idle_mode_text)
- g_free(stk->idle_mode_text);
+ l_free(stk->idle_mode_text);
if (sim->icon_id.id != 0 && sim->icon_id.qualifier ==
STK_ICON_QUALIFIER_TYPE_SELF_EXPLANATORY)
@@ -1040,7 +1041,7 @@
static void timer_value_from_seconds(struct stk_timer_value *val, int seconds)
{
- val->has_value = TRUE;
+ val->has_value = true;
val->hour = seconds / 3600;
seconds -= val->hour * 3600;
val->minute = seconds / 60;
@@ -1403,7 +1404,7 @@
err = stk_agent_display_text(stk->current_agent, text, &dt->icon_id,
priority, display_text_cb, stk,
display_text_destroy, timeout);
- g_free(text);
+ l_free(text);
/* We most likely got an out of memory error, tell SIM to retry */
if (err < 0) {
@@ -1454,8 +1455,7 @@
}
static void request_confirmation_cb(enum stk_agent_result result,
- gboolean confirm,
- void *user_data)
+ bool confirm, void *user_data)
{
struct ofono_stk *stk = user_data;
static struct ofono_error error = { .type = OFONO_ERROR_TYPE_FAILURE };
@@ -1468,7 +1468,7 @@
rsp.result.type = STK_RESULT_TYPE_SUCCESS;
rsp.get_inkey.text.text = confirm ? "" : NULL;
- rsp.get_inkey.text.yesno = TRUE;
+ rsp.get_inkey.text.yesno = true;
if (cmd->duration.interval) {
rsp.get_inkey.duration.unit = cmd->duration.unit;
@@ -1610,7 +1610,7 @@
&gi->icon_id, request_key_cb,
stk, NULL, timeout);
- g_free(text);
+ l_free(text);
if (err < 0) {
unsigned char no_cause_result[] = { 0x00 };
@@ -1704,7 +1704,7 @@
request_string_cb,
stk, NULL, timeout);
- g_free(text);
+ l_free(text);
if (err < 0) {
unsigned char no_cause_result[] = { 0x00 };
@@ -1761,7 +1761,7 @@
__ofono_voicecall_dial_cancel(vc);
}
-static void confirm_call_cb(enum stk_agent_result result, gboolean confirm,
+static void confirm_call_cb(enum stk_agent_result result, bool confirm,
void *user_data)
{
struct ofono_stk *stk = user_data;
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/upstream/src/stkagent.c
^
|
@@ -29,6 +29,7 @@
#include <glib.h>
#include <gdbus.h>
+#include <ell/ell.h>
#include "ofono.h"
@@ -51,7 +52,7 @@
char *path; /* Agent Path */
char *bus; /* Agent bus */
guint disconnect_watch; /* DBus disconnect watch */
- ofono_bool_t remove_on_terminate;
+ bool remove_on_terminate;
ofono_destroy_func removed_cb;
void *removed_data;
DBusMessage *msg;
@@ -60,7 +61,7 @@
void *user_data;
int min_length;
int max_length;
- ofono_bool_t hidden_entry;
+ bool hidden_entry;
ofono_destroy_func user_destroy;
const struct stk_menu *request_selection_menu;
@@ -117,7 +118,7 @@
agent->user_cb = NULL;
}
-ofono_bool_t stk_agent_matches(struct stk_agent *agent,
+bool stk_agent_matches(struct stk_agent *agent,
const char *path, const char *sender)
{
return !strcmp(agent->path, path) && !strcmp(agent->bus, sender);
@@ -227,7 +228,7 @@
}
struct stk_agent *stk_agent_new(const char *path, const char *sender,
- ofono_bool_t remove_on_terminate)
+ bool remove_on_terminate)
{
struct stk_agent *agent = g_try_new0(struct stk_agent, 1);
DBusConnection *conn = ofono_dbus_get_connection();
@@ -287,9 +288,9 @@
done: \
if (result == STK_AGENT_RESULT_TERMINATE && \
agent->remove_on_terminate) \
- remove_agent = TRUE; \
+ remove_agent = true; \
else \
- remove_agent = FALSE; \
+ remove_agent = false; \
\
error: \
stk_agent_request_end(agent); \
@@ -306,12 +307,12 @@
DBusMessage *reply = dbus_pending_call_steal_reply(call);
unsigned char selection, i;
enum stk_agent_result result;
- gboolean remove_agent;
+ bool remove_agent;
if (check_error(agent, reply,
ALLOWED_ERROR_GO_BACK | ALLOWED_ERROR_TERMINATE,
&result) == -EINVAL) {
- remove_agent = TRUE;
+ remove_agent = true;
goto error;
}
@@ -324,7 +325,7 @@
DBUS_TYPE_BYTE, &selection,
DBUS_TYPE_INVALID) == FALSE) {
ofono_error("Can't parse the reply to RequestSelection()");
- remove_agent = TRUE;
+ remove_agent = true;
goto error;
}
@@ -332,7 +333,7 @@
if (i != selection) {
ofono_error("Invalid item selected");
- remove_agent = TRUE;
+ remove_agent = true;
goto error;
}
@@ -387,12 +388,12 @@
stk_agent_display_text_cb cb = agent->user_cb;
DBusMessage *reply = dbus_pending_call_steal_reply(call);
enum stk_agent_result result;
- gboolean remove_agent;
+ bool remove_agent;
if (check_error(agent, reply,
ALLOWED_ERROR_GO_BACK | ALLOWED_ERROR_TERMINATE |
ALLOWED_ERROR_BUSY, &result) == -EINVAL) {
- remove_agent = TRUE;
+ remove_agent = true;
goto error;
}
@@ -403,7 +404,7 @@
if (dbus_message_get_args(reply, NULL, DBUS_TYPE_INVALID) == FALSE) {
ofono_error("Can't parse the reply to DisplayText()");
- remove_agent = TRUE;
+ remove_agent = true;
goto error;
}
@@ -414,7 +415,7 @@
int stk_agent_display_text(struct stk_agent *agent, const char *text,
const struct stk_icon_id *icon,
- ofono_bool_t urgent,
+ bool urgent,
stk_agent_display_text_cb cb,
void *user_data, ofono_destroy_func destroy,
int timeout)
@@ -455,18 +456,18 @@
stk_agent_confirmation_cb cb = agent->user_cb;
DBusMessage *reply = dbus_pending_call_steal_reply(call);
enum stk_agent_result result;
- gboolean remove_agent;
+ bool remove_agent;
dbus_bool_t confirm;
if (check_error(agent, reply,
ALLOWED_ERROR_GO_BACK | ALLOWED_ERROR_TERMINATE,
&result) == -EINVAL) {
- remove_agent = TRUE;
+ remove_agent = true;
goto error;
}
if (result != STK_AGENT_RESULT_OK) {
- cb(result, FALSE, agent->user_data);
+ cb(result, false, agent->user_data);
goto done;
}
@@ -474,7 +475,7 @@
DBUS_TYPE_BOOLEAN, &confirm,
DBUS_TYPE_INVALID) == FALSE) {
ofono_error("Can't parse the reply to GetConfirmation()");
- remove_agent = TRUE;
+ remove_agent = true;
goto error;
}
@@ -524,13 +525,13 @@
stk_agent_string_cb cb = agent->user_cb;
DBusMessage *reply = dbus_pending_call_steal_reply(call);
enum stk_agent_result result;
- gboolean remove_agent;
+ bool remove_agent;
char *digit;
if (check_error(agent, reply,
ALLOWED_ERROR_GO_BACK | ALLOWED_ERROR_TERMINATE,
&result) == -EINVAL) {
- remove_agent = TRUE;
+ remove_agent = true;
goto error;
}
@@ -543,19 +544,19 @@
DBUS_TYPE_STRING, &digit,
DBUS_TYPE_INVALID) == FALSE) {
ofono_error("Can't parse the reply to GetDigit()");
- remove_agent = TRUE;
+ remove_agent = true;
goto error;
}
if (strlen(digit) != 1 || !strspn(digit, "0123456789*#+")) {
ofono_error("Invalid character");
- remove_agent = TRUE;
+ remove_agent = true;
goto error;
}
if (agent->hidden_entry && digit[0] == '+') {
ofono_error("The character + is not allowed in this mode");
- remove_agent = TRUE;
+ remove_agent = true;
goto error;
}
@@ -590,7 +591,7 @@
agent->user_cb = cb;
agent->user_data = user_data;
agent->user_destroy = destroy;
- agent->hidden_entry = FALSE;
+ agent->hidden_entry = false;
dbus_pending_call_set_notify(agent->call, get_digit_cb, agent, NULL);
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/upstream/src/stkagent.h
^
|
@@ -40,8 +40,8 @@
struct stk_icon_id icon;
struct stk_menu_item *items;
int default_item;
- gboolean soft_key;
- gboolean has_help;
+ bool soft_key;
+ bool has_help;
};
typedef void (*stk_agent_display_text_cb)(enum stk_agent_result result,
@@ -51,7 +51,7 @@
uint8_t id, void *user_data);
typedef void (*stk_agent_confirmation_cb)(enum stk_agent_result result,
- ofono_bool_t confirm,
+ bool confirm,
void *user_data);
typedef void (*stk_agent_string_cb)(enum stk_agent_result result,
@@ -64,7 +64,7 @@
void *user_data);
struct stk_agent *stk_agent_new(const char *path, const char *sender,
- ofono_bool_t remove_on_terminate);
+ bool remove_on_terminate);
void stk_agent_free(struct stk_agent *agent);
@@ -72,7 +72,7 @@
ofono_destroy_func removed_cb,
void *user_data);
-ofono_bool_t stk_agent_matches(struct stk_agent *agent,
+bool stk_agent_matches(struct stk_agent *agent,
const char *path, const char *sender);
void stk_agent_request_cancel(struct stk_agent *agent);
@@ -85,7 +85,7 @@
int stk_agent_display_text(struct stk_agent *agent, const char *text,
const struct stk_icon_id *icon,
- ofono_bool_t urgent,
+ bool urgent,
stk_agent_display_text_cb cb,
void *user_data, ofono_destroy_func destroy,
int timeout);
@@ -110,22 +110,22 @@
int stk_agent_request_key(struct stk_agent *agent, const char *text,
const struct stk_icon_id *icon,
- ofono_bool_t unicode_charset,
+ bool unicode_charset,
stk_agent_string_cb cb, void *user_data,
ofono_destroy_func destroy, int timeout);
int stk_agent_request_digits(struct stk_agent *agent, const char *text,
const struct stk_icon_id *icon,
const char *default_text, int min, int max,
- ofono_bool_t hidden, stk_agent_string_cb cb,
+ bool hidden, stk_agent_string_cb cb,
void *user_data, ofono_destroy_func destroy,
int timeout);
int stk_agent_request_input(struct stk_agent *agent, const char *text,
const struct stk_icon_id *icon,
const char *default_text,
- ofono_bool_t unicode_charset, int min, int max,
- ofono_bool_t hidden, stk_agent_string_cb cb,
+ bool unicode_charset, int min, int max,
+ bool hidden, stk_agent_string_cb cb,
void *user_data, ofono_destroy_func destroy,
int timeout);
@@ -135,12 +135,12 @@
ofono_destroy_func destroy, int timeout);
int stk_agent_play_tone(struct stk_agent *agent, const char *text,
- const struct stk_icon_id *icon, ofono_bool_t vibrate,
+ const struct stk_icon_id *icon, bool vibrate,
const char *tone, stk_agent_tone_cb cb, void *user_data,
ofono_destroy_func destroy, int timeout);
int stk_agent_loop_tone(struct stk_agent *agent, const char *text,
- const struct stk_icon_id *icon, ofono_bool_t vibrate,
+ const struct stk_icon_id *icon, bool vibrate,
const char *tone, stk_agent_tone_cb cb, void *user_data,
ofono_destroy_func destroy, int timeout);
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/upstream/src/stkutil.c
^
|
@@ -28,6 +28,7 @@
#include <stdint.h>
#include <glib.h>
+#include <ell/ell.h>
#include <ofono/types.h>
#include "smsutil.h"
@@ -43,23 +44,22 @@
};
struct stk_file_iter {
- const unsigned char *start;
+ const uint8_t *start;
unsigned int pos;
unsigned int max;
- unsigned char len;
- const unsigned char *file;
+ uint8_t len;
+ const uint8_t *file;
};
struct stk_tlv_builder {
struct comprehension_tlv_builder ctlv;
- unsigned char *value;
+ uint8_t *value;
unsigned int len;
unsigned int max_len;
};
-typedef gboolean (*dataobj_handler)(struct comprehension_tlv_iter *, void *);
-typedef gboolean (*dataobj_writer)(struct stk_tlv_builder *,
- const void *, gboolean);
+typedef bool (*dataobj_handler)(struct comprehension_tlv_iter *, void *);
+typedef bool (*dataobj_writer)(struct stk_tlv_builder *, const void *, bool);
/*
* Defined in TS 102.223 Section 8.13
@@ -71,7 +71,7 @@
*/
struct gsm_sms_tpdu {
unsigned int len;
- unsigned char tpdu[184];
+ uint8_t tpdu[184];
};
#define CHECK_TEXT_AND_ICON(text, icon_id) \
@@ -81,7 +81,7 @@
if ((text == NULL || text[0] == '\0') && icon_id != 0) \
status = STK_PARSE_RESULT_DATA_NOT_UNDERSTOOD; \
-static char *decode_text(unsigned char dcs, int len, const unsigned char *data)
+static char *decode_text(uint8_t dcs, int len, const unsigned char *data)
{
char *utf8;
enum sms_charset charset;
@@ -94,7 +94,7 @@
{
long written;
unsigned long max_to_unpack = len * 8 / 7;
- unsigned char *unpacked = unpack_7bit(data, len, 0, FALSE,
+ uint8_t *unpacked = unpack_7bit(data, len, 0, false,
max_to_unpack,
&written, 0);
if (unpacked == NULL)
@@ -102,16 +102,14 @@
utf8 = convert_gsm_to_utf8(unpacked, written,
NULL, NULL, 0);
- g_free(unpacked);
+ l_free(unpacked);
break;
}
case SMS_CHARSET_8BIT:
utf8 = convert_gsm_to_utf8(data, len, NULL, NULL, 0);
break;
case SMS_CHARSET_UCS2:
- utf8 = g_convert((const gchar *) data, len,
- "UTF-8//TRANSLIT", "UCS-2BE",
- NULL, NULL, NULL);
+ utf8 = l_utf8_from_ucs2be(data, len);
break;
default:
utf8 = NULL;
@@ -121,99 +119,92 @@
}
/* For data object only to indicate its existence */
-static gboolean parse_dataobj_common_bool(struct comprehension_tlv_iter *iter,
- gboolean *out)
+static bool parse_dataobj_common_bool(struct comprehension_tlv_iter *iter,
+ bool *out)
{
if (comprehension_tlv_iter_get_length(iter) != 0)
- return FALSE;
+ return false;
- *out = TRUE;
+ *out = true;
- return TRUE;
+ return true;
}
/* For data object that only has one byte */
-static gboolean parse_dataobj_common_byte(struct comprehension_tlv_iter *iter,
- unsigned char *out)
+static bool parse_dataobj_common_byte(struct comprehension_tlv_iter *iter,
+ uint8_t *out)
{
- const unsigned char *data;
+ const uint8_t *data;
if (comprehension_tlv_iter_get_length(iter) != 1)
- return FALSE;
+ return false;
data = comprehension_tlv_iter_get_data(iter);
*out = data[0];
- return TRUE;
+ return true;
}
/* For data object that only has text terminated by '\0' */
-static gboolean parse_dataobj_common_text(struct comprehension_tlv_iter *iter,
+static bool parse_dataobj_common_text(struct comprehension_tlv_iter *iter,
char **text)
{
- const unsigned char *data;
+ const uint8_t *data;
unsigned int len = comprehension_tlv_iter_get_length(iter);
if (len < 1)
- return FALSE;
+ return false;
data = comprehension_tlv_iter_get_data(iter);
- *text = g_try_malloc(len + 1);
- if (*text == NULL)
- return FALSE;
-
+ *text = l_malloc(len + 1);
memcpy(*text, data, len);
(*text)[len] = '\0';
- return TRUE;
+ return true;
}
/* For data object that only has a byte array with undetermined length */
-static gboolean parse_dataobj_common_byte_array(
- struct comprehension_tlv_iter *iter,
- struct stk_common_byte_array *array)
+static bool parse_dataobj_common_byte_array(struct comprehension_tlv_iter *iter,
+ struct stk_common_byte_array *array)
{
- const unsigned char *data;
+ const uint8_t *data;
unsigned int len = comprehension_tlv_iter_get_length(iter);
if (len < 1)
- return FALSE;
+ return false;
data = comprehension_tlv_iter_get_data(iter);
array->len = len;
- array->array = g_try_malloc(len);
- if (array->array == NULL)
- return FALSE;
-
+ array->array = l_malloc(len);
memcpy(array->array, data, len);
- return TRUE;
+ return true;
}
static void stk_file_iter_init(struct stk_file_iter *iter,
- const unsigned char *start, unsigned int len)
+ const uint8_t *start, unsigned int len)
{
iter->start = start;
iter->max = len;
iter->pos = 0;
}
-static gboolean stk_file_iter_next(struct stk_file_iter *iter)
+static bool stk_file_iter_next(struct stk_file_iter *iter)
{
unsigned int pos = iter->pos;
const unsigned int max = iter->max;
- const unsigned char *start = iter->start;
+ const uint8_t *start = iter->start;
unsigned int i;
- unsigned char last_type;
+ uint8_t last_type;
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/upstream/src/stkutil.h
^
|
@@ -19,6 +19,8 @@
*
*/
+struct l_queue;
+
/*
* TS 101.220, Section 7.2, Card Application Toolkit assigned templates,
* These are the same as 3GPP 11.14 Sections 13.1 and 13.2
@@ -644,13 +646,13 @@
/* For data object that only has a byte array with undetermined length */
struct stk_common_byte_array {
- unsigned char *array;
+ uint8_t *array;
unsigned int len;
};
/* Defined in TS 102.223 Section 8.1 */
struct stk_address {
- unsigned char ton_npi;
+ uint8_t ton_npi;
char *number;
};
@@ -669,9 +671,9 @@
* bytes."
*/
struct stk_subaddress {
- ofono_bool_t has_subaddr;
- unsigned char len;
- unsigned char subaddr[23];
+ bool has_subaddr;
+ uint8_t len;
+ uint8_t subaddr[23];
};
/*
@@ -686,14 +688,14 @@
* The CCP structure is not decoded, but stored as is from the CTLV
*/
struct stk_ccp {
- unsigned char len;
- unsigned char ccp[16];
+ uint8_t len;
+ uint8_t ccp[16];
};
/* Defined in TS 31.111 Section 8.5 */
struct stk_cbs_page {
- unsigned char len;
- unsigned char page[88];
+ uint8_t len;
+ uint8_t page[88];
};
/*
@@ -702,12 +704,12 @@
*/
struct stk_duration {
enum stk_duration_type unit;
- unsigned char interval;
+ uint8_t interval;
};
/* Defined in TS 102.223 Section 8.9 */
struct stk_item {
- unsigned char id;
+ uint8_t id;
char *text;
};
@@ -716,27 +718,27 @@
* to 0.
*/
struct stk_response_length {
- unsigned char min;
- unsigned char max;
+ uint8_t min;
+ uint8_t max;
};
/* Defined in TS 102.223 Section 8.12 */
struct stk_result {
enum stk_result_type type;
unsigned int additional_len;
- unsigned char *additional;
+ uint8_t *additional;
};
/* Defined in TS 102.223 Section 8.14 */
struct stk_ss {
- unsigned char ton_npi;
+ uint8_t ton_npi;
char *ss;
};
/* Defined in TS 131.111 Section 8.17. Length limit of 160 chars in 23.028 */
struct stk_ussd_string {
- unsigned char dcs;
- unsigned char string[160];
+ uint8_t dcs;
+ uint8_t string[160];
int len;
};
@@ -748,7 +750,7 @@
* 2 bytes of 2nd level Dedicated File and 2 bytes of Elementary File.
*/
struct stk_file {
- unsigned char file[8];
+ uint8_t file[8];
unsigned int len;
};
@@ -756,13 +758,13 @@
struct stk_location_info {
char mnc[OFONO_MAX_MNC_LENGTH + 1];
char mcc[OFONO_MAX_MCC_LENGTH + 1];
- unsigned short lac_tac;
- ofono_bool_t has_ci;
- unsigned short ci;
- ofono_bool_t has_ext_ci;
- unsigned short ext_ci;
- ofono_bool_t has_eutran_ci;
- guint32 eutran_ci;
+ uint16_t lac_tac;
+ bool has_ci;
+ uint16_t ci;
+ bool has_ext_ci;
+ uint16_t ext_ci;
+ bool has_eutran_ci;
+ uint32_t eutran_ci;
};
/*
@@ -770,7 +772,7 @@
* that the maximum size is 127 according to the rules of CTLVs.
*/
struct stk_items_next_action_indicator {
- unsigned char list[127];
+ uint8_t list[127];
unsigned int len;
};
@@ -779,7 +781,7 @@
* one should appear more than once.
*/
struct stk_event_list {
- unsigned char list[21];
+ uint8_t list[21];
unsigned int len;
};
@@ -787,9 +789,9 @@
* According to 102.223 Section 8.26, the maximum length of cause is 30.
*/
struct stk_cause {
- unsigned char cause[30];
+ uint8_t cause[30];
unsigned int len;
- ofono_bool_t has_cause;
+ bool has_cause;
};
/*
@@ -797,7 +799,7 @@
* that the maximum size is 127 according to the rules of CTLVs.
*/
struct stk_transaction_id {
- unsigned char list[127];
+ uint8_t list[127];
unsigned int len;
};
@@ -807,9 +809,9 @@
* is represented as 10 bits, so the maximum number of channel is 127*8/10=101.
*/
struct stk_bcch_channel_list {
- unsigned short channels[101];
+ uint16_t channels[101];
unsigned int num;
- ofono_bool_t has_list;
+ bool has_list;
};
/*
@@ -818,8 +820,8 @@
* ids of 0, we use icon_id with 0 to denote empty icon_identifier objects
*/
struct stk_icon_id {
- unsigned char qualifier;
- unsigned char id;
+ uint8_t qualifier;
+ uint8_t id;
};
/*
@@ -829,19 +831,19 @@
* identifier list is 126.
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/upstream/src/ussd.c
^
|
@@ -34,7 +34,6 @@
#include "common.h"
#include "smsutil.h"
-#include "util.h"
#define MAX_USSD_LENGTH 160
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/upstream/src/util.c
^
|
@@ -29,7 +29,7 @@
#include <ctype.h>
#include <stdlib.h>
-#include <glib.h>
+#include <ell/ell.h>
#include "util.h"
@@ -65,9 +65,6 @@
#define UTF8_LENGTH(c) \
((c) < 0x80 ? 1 : ((c) < 0x800 ? 2 : 3))
-#define TABLE_SIZE(t) \
- (sizeof((t)) / sizeof(struct codepoint))
-
struct codepoint {
unsigned short from;
unsigned short to;
@@ -2690,7 +2687,7 @@
return codepoint_lookup(&key, t->single_u, t->single_len_u);
}
-static gboolean populate_locking_shift(struct conversion_table *t,
+static bool populate_locking_shift(struct conversion_table *t,
enum gsm_dialect lang)
{
switch (lang) {
@@ -2698,192 +2695,192 @@
case GSM_DIALECT_SPANISH:
t->locking_g = def_gsm;
t->locking_u = def_unicode;
- t->locking_len_u = TABLE_SIZE(def_unicode);
- return TRUE;
+ t->locking_len_u = L_ARRAY_SIZE(def_unicode);
+ return true;
case GSM_DIALECT_TURKISH:
t->locking_g = tur_gsm;
t->locking_u = tur_unicode;
- t->locking_len_u = TABLE_SIZE(tur_unicode);
- return TRUE;
+ t->locking_len_u = L_ARRAY_SIZE(tur_unicode);
+ return true;
case GSM_DIALECT_PORTUGUESE:
t->locking_g = por_gsm;
t->locking_u = por_unicode;
- t->locking_len_u = TABLE_SIZE(por_unicode);
- return TRUE;
+ t->locking_len_u = L_ARRAY_SIZE(por_unicode);
+ return true;
case GSM_DIALECT_BENGALI:
t->locking_g = ben_gsm;
t->locking_u = ben_unicode;
- t->locking_len_u = TABLE_SIZE(ben_unicode);
- return TRUE;
+ t->locking_len_u = L_ARRAY_SIZE(ben_unicode);
+ return true;
case GSM_DIALECT_GUJARATI:
t->locking_g = guj_gsm;
t->locking_u = guj_unicode;
- t->locking_len_u = TABLE_SIZE(guj_unicode);
- return TRUE;
+ t->locking_len_u = L_ARRAY_SIZE(guj_unicode);
+ return true;
case GSM_DIALECT_HINDI:
t->locking_g = hin_gsm;
t->locking_u = hin_unicode;
- t->locking_len_u = TABLE_SIZE(hin_unicode);
- return TRUE;
+ t->locking_len_u = L_ARRAY_SIZE(hin_unicode);
+ return true;
case GSM_DIALECT_KANNADA:
t->locking_g = kan_gsm;
t->locking_u = kan_unicode;
- t->locking_len_u = TABLE_SIZE(kan_unicode);
- return TRUE;
+ t->locking_len_u = L_ARRAY_SIZE(kan_unicode);
+ return true;
case GSM_DIALECT_MALAYALAM:
t->locking_g = mal_gsm;
t->locking_u = mal_unicode;
- t->locking_len_u = TABLE_SIZE(mal_unicode);
- return TRUE;
+ t->locking_len_u = L_ARRAY_SIZE(mal_unicode);
+ return true;
case GSM_DIALECT_ORIYA:
t->locking_g = ori_gsm;
t->locking_u = ori_unicode;
- t->locking_len_u = TABLE_SIZE(ori_unicode);
- return TRUE;
+ t->locking_len_u = L_ARRAY_SIZE(ori_unicode);
+ return true;
case GSM_DIALECT_PUNJABI:
t->locking_g = pun_gsm;
t->locking_u = pun_unicode;
- t->locking_len_u = TABLE_SIZE(pun_unicode);
- return TRUE;
+ t->locking_len_u = L_ARRAY_SIZE(pun_unicode);
+ return true;
case GSM_DIALECT_TAMIL:
t->locking_g = tam_gsm;
t->locking_u = tam_unicode;
- t->locking_len_u = TABLE_SIZE(tam_unicode);
- return TRUE;
+ t->locking_len_u = L_ARRAY_SIZE(tam_unicode);
+ return true;
case GSM_DIALECT_TELUGU:
t->locking_g = tel_gsm;
t->locking_u = tel_unicode;
- t->locking_len_u = TABLE_SIZE(tel_unicode);
- return TRUE;
+ t->locking_len_u = L_ARRAY_SIZE(tel_unicode);
+ return true;
case GSM_DIALECT_URDU:
t->locking_g = urd_gsm;
t->locking_u = urd_unicode;
- t->locking_len_u = TABLE_SIZE(urd_unicode);
- return TRUE;
+ t->locking_len_u = L_ARRAY_SIZE(urd_unicode);
+ return true;
}
- return FALSE;
+ return false;
}
-static gboolean populate_single_shift(struct conversion_table *t,
+static bool populate_single_shift(struct conversion_table *t,
enum gsm_dialect lang)
{
switch (lang) {
case GSM_DIALECT_DEFAULT:
t->single_g = def_ext_gsm;
- t->single_len_g = TABLE_SIZE(def_ext_gsm);
+ t->single_len_g = L_ARRAY_SIZE(def_ext_gsm);
t->single_u = def_ext_unicode;
- t->single_len_u = TABLE_SIZE(def_ext_unicode);
- return TRUE;
+ t->single_len_u = L_ARRAY_SIZE(def_ext_unicode);
+ return true;
case GSM_DIALECT_TURKISH:
t->single_g = tur_ext_gsm;
- t->single_len_g = TABLE_SIZE(tur_ext_gsm);
+ t->single_len_g = L_ARRAY_SIZE(tur_ext_gsm);
t->single_u = tur_ext_unicode;
- t->single_len_u = TABLE_SIZE(tur_ext_unicode);
- return TRUE;
+ t->single_len_u = L_ARRAY_SIZE(tur_ext_unicode);
+ return true;
case GSM_DIALECT_SPANISH:
t->single_g = spa_ext_gsm;
- t->single_len_g = TABLE_SIZE(spa_ext_gsm);
+ t->single_len_g = L_ARRAY_SIZE(spa_ext_gsm);
t->single_u = spa_ext_unicode;
- t->single_len_u = TABLE_SIZE(spa_ext_unicode);
- return TRUE;
+ t->single_len_u = L_ARRAY_SIZE(spa_ext_unicode);
+ return true;
case GSM_DIALECT_PORTUGUESE:
t->single_g = por_ext_gsm;
- t->single_len_g = TABLE_SIZE(por_ext_gsm);
+ t->single_len_g = L_ARRAY_SIZE(por_ext_gsm);
t->single_u = por_ext_unicode;
- t->single_len_u = TABLE_SIZE(por_ext_unicode);
- return TRUE;
+ t->single_len_u = L_ARRAY_SIZE(por_ext_unicode);
+ return true;
case GSM_DIALECT_BENGALI:
t->single_g = ben_ext_gsm;
- t->single_len_g = TABLE_SIZE(ben_ext_gsm);
+ t->single_len_g = L_ARRAY_SIZE(ben_ext_gsm);
t->single_u = ben_ext_unicode;
- t->single_len_u = TABLE_SIZE(ben_ext_unicode);
- return TRUE;
+ t->single_len_u = L_ARRAY_SIZE(ben_ext_unicode);
+ return true;
case GSM_DIALECT_GUJARATI:
t->single_g = guj_ext_gsm;
- t->single_len_g = TABLE_SIZE(guj_ext_gsm);
+ t->single_len_g = L_ARRAY_SIZE(guj_ext_gsm);
t->single_u = guj_ext_unicode;
- t->single_len_u = TABLE_SIZE(guj_ext_unicode);
- return TRUE;
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/upstream/src/util.h
^
|
@@ -19,6 +19,8 @@
*
*/
+#include <stdbool.h>
+
enum gsm_dialect {
GSM_DIALECT_DEFAULT = 0,
GSM_DIALECT_TURKISH,
@@ -65,33 +67,27 @@
unsigned char terminator,
unsigned char *buf);
-unsigned char *decode_hex(const char *in, long len, long *items_written,
- unsigned char terminator);
-
char *encode_hex_own_buf(const unsigned char *in, long len,
unsigned char terminator, char *buf);
-char *encode_hex(const unsigned char *in, long len,
- unsigned char terminator);
-
unsigned char *unpack_7bit_own_buf(const unsigned char *in, long len,
- int byte_offset, gboolean ussd,
+ int byte_offset, bool ussd,
long max_to_unpack, long *items_written,
unsigned char terminator,
unsigned char *buf);
unsigned char *unpack_7bit(const unsigned char *in, long len, int byte_offset,
- gboolean ussd, long max_to_unpack,
+ bool ussd, long max_to_unpack,
long *items_written, unsigned char terminator);
unsigned char *pack_7bit_own_buf(const unsigned char *in, long len,
- int byte_offset, gboolean ussd,
+ int byte_offset, bool ussd,
long *items_written,
unsigned char terminator,
unsigned char *buf);
unsigned char *pack_7bit(const unsigned char *in, long len, int byte_offset,
- gboolean ussd,
+ bool ussd,
long *items_written, unsigned char terminator);
char *sim_string_to_utf8(const unsigned char *buffer, int length);
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/upstream/tools/stktest.c
^
|
@@ -1189,30 +1189,6 @@
g_idle_add(end_session_and_not_canceled_after_3, NULL);
}
-static gboolean poweroff_and_canceled_after_21(gpointer user_data)
-{
- __stktest_test_finish(pending == NULL);
- return FALSE;
-}
-
-static gboolean end_session_and_canceled_after_21(gpointer user_data)
-{
- g_at_server_send_unsolicited(emulator, "+CUSATEND");
- g_timeout_add_seconds(21, poweroff_and_canceled_after_21, NULL);
-
- return FALSE;
-}
-
-static void expect_response_and_canceled_after_21(const unsigned char *pdu,
- unsigned int len)
-{
- struct test *test = cur_test->data;
-
- STKTEST_RESPONSE_ASSERT(test->rsp_pdu, test->rsp_len, pdu, len);
-
- g_idle_add(end_session_and_canceled_after_21, NULL);
-}
-
static DBusMessage *test_display_text_11(DBusMessage *msg,
const char *text,
unsigned char icon_id,
@@ -1405,7 +1381,7 @@
unsigned char icon_id,
gboolean urgent)
{
- STKTEST_AGENT_ASSERT(g_str_equal(text, "Basic Icon"));
+ STKTEST_AGENT_ASSERT(g_str_equal(text, ""));
STKTEST_AGENT_ASSERT(icon_id == 1);
STKTEST_AGENT_ASSERT(urgent == FALSE);
@@ -1417,7 +1393,7 @@
unsigned char icon_id,
gboolean urgent)
{
- STKTEST_AGENT_ASSERT(g_str_equal(text, "Colour Icon"));
+ STKTEST_AGENT_ASSERT(g_str_equal(text, ""));
STKTEST_AGENT_ASSERT(icon_id == 2);
STKTEST_AGENT_ASSERT(urgent == FALSE);
@@ -1854,7 +1830,7 @@
DBusMessage *reply;
const char *ret = "+";
- STKTEST_AGENT_ASSERT(g_str_equal(alpha, "<NO-ICON>"));
+ STKTEST_AGENT_ASSERT(g_str_equal(alpha, ""));
STKTEST_AGENT_ASSERT(icon_id == 1);
reply = dbus_message_new_method_return(msg);
@@ -1888,7 +1864,7 @@
DBusMessage *reply;
const char *ret = "+";
- STKTEST_AGENT_ASSERT(g_str_equal(alpha, "<NO-ICON>"));
+ STKTEST_AGENT_ASSERT(g_str_equal(alpha, ""));
STKTEST_AGENT_ASSERT(icon_id == 2);
reply = dbus_message_new_method_return(msg);
@@ -2662,7 +2638,7 @@
DBusMessage *reply;
const char *ret = "+";
- STKTEST_AGENT_ASSERT(g_str_equal(alpha, "<NO-ICON>"));
+ STKTEST_AGENT_ASSERT(g_str_equal(alpha, ""));
STKTEST_AGENT_ASSERT(icon_id == 1);
STKTEST_AGENT_ASSERT(g_str_equal(def_input, ""));
STKTEST_AGENT_ASSERT(min == 0);
@@ -2710,7 +2686,7 @@
DBusMessage *reply;
const char *ret = "+";
- STKTEST_AGENT_ASSERT(g_str_equal(alpha, "<NO-ICON>"));
+ STKTEST_AGENT_ASSERT(g_str_equal(alpha, ""));
STKTEST_AGENT_ASSERT(icon_id == 2);
STKTEST_AGENT_ASSERT(g_str_equal(def_input, ""));
STKTEST_AGENT_ASSERT(min == 0);
@@ -3168,7 +3144,7 @@
unsigned char icon_id)
{
STKTEST_AGENT_ASSERT(g_str_equal(tone, "positive-acknowledgement"));
- STKTEST_AGENT_ASSERT(g_str_equal(text, "<BASIC-ICON>"));
+ STKTEST_AGENT_ASSERT(g_str_equal(text, ""));
STKTEST_AGENT_ASSERT(icon_id == 1);
return dbus_message_new_method_return(msg);
@@ -3192,7 +3168,7 @@
unsigned char icon_id)
{
STKTEST_AGENT_ASSERT(g_str_equal(tone, "positive-acknowledgement"));
- STKTEST_AGENT_ASSERT(g_str_equal(text, "<COLOUR-ICON>"));
+ STKTEST_AGENT_ASSERT(g_str_equal(text, ""));
STKTEST_AGENT_ASSERT(icon_id == 2);
return dbus_message_new_method_return(msg);
@@ -3510,7 +3486,7 @@
display_text_response_421,
sizeof(display_text_response_421),
test_display_text_42,
- expect_response_and_canceled_after_21);
+ expect_response_and_not_canceled_after_3);
stktest_add_test("Display Text 4.3", "DisplayText",
display_text_431, sizeof(display_text_431),
display_text_response_431,
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/upstream/unit/test-common.c
^
|
@@ -29,10 +29,14 @@
#include <assert.h>
#include <glib.h>
+#include <ell/ell.h>
+
#include <ofono/types.h>
#include "common.h"
+static const bool VERBOSE = false;
+
static const char *invalid_strings[] = {
"33",
"*",
@@ -71,8 +75,8 @@
gboolean ret;
for (i = 0; invalid_strings[i]; i++) {
- if (g_test_verbose())
- g_print("%s...\n", invalid_strings[i]);
+ if (VERBOSE)
+ printf("%s...\n", invalid_strings[i]);
str = strdup(invalid_strings[i]);
@@ -122,8 +126,8 @@
int i;
for (i = 0; valid_strings[i]; i++) {
- if (g_test_verbose())
- g_print("%s...", valid_strings[i]);
+ if (VERBOSE)
+ printf("%s...", valid_strings[i]);
str = strdup(valid_strings[i]);
@@ -134,8 +138,8 @@
g_assert(ret == TRUE);
- if (g_test_verbose())
- g_print("parsed as: %d, %s, %s, %s, %s, %s\n",
+ if (VERBOSE)
+ printf("parsed as: %d, %s, %s, %s, %s, %s\n",
type, sc, sia, sib, sic, dn);
free(str);
@@ -164,8 +168,8 @@
gboolean res;
for (i = 0; valid_apns[i]; i++) {
- if (g_test_verbose())
- g_print("Test Valid:%s\n", valid_apns[i]);
+ if (VERBOSE)
+ printf("Test Valid:%s\n", valid_apns[i]);
res = is_valid_apn(valid_apns[i]);
@@ -173,8 +177,8 @@
}
for (i = 0; invalid_apns[i]; i++) {
- if (g_test_verbose())
- g_print("Test Invalid:%s\n", invalid_apns[i]);
+ if (VERBOSE)
+ printf("Test Invalid:%s\n", invalid_apns[i]);
res = is_valid_apn(invalid_apns[i]);
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/upstream/unit/test-simutil.c
^
|
@@ -27,6 +27,7 @@
#include <stdio.h>
#include <assert.h>
#include <glib.h>
+#include <ell/ell.h>
#include <ofono/types.h>
@@ -407,12 +408,12 @@
static void test_3g_status_data(void)
{
unsigned char *response;
- long len;
+ size_t len;
int flen, rlen, str;
unsigned char access[3];
unsigned short efid;
- response = decode_hex(binary_ef, -1, &len, 0);
+ response = l_util_from_hexstring(binary_ef, &len);
sim_parse_3g_get_response(response, len, &flen, &rlen, &str,
access, &efid);
@@ -427,7 +428,7 @@
g_free(response);
- response = decode_hex(record_ef, -1, &len, 0);
+ response = l_util_from_hexstring(record_ef, &len);
sim_parse_3g_get_response(response, len, &flen, &rlen, &str,
access, &efid);
@@ -450,11 +451,11 @@
static void test_application_entry_decode(void)
{
unsigned char *ef_dir;
- long len;
+ size_t len;
GSList *entries;
struct sim_app_record *app[2];
- ef_dir = decode_hex(at_cuad_response, -1, &len, 0);
+ ef_dir = l_util_from_hexstring(at_cuad_response, &len);
entries = sim_parse_app_template_entries(ef_dir, len);
g_assert(g_slist_length(entries) == 2);
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/upstream/unit/test-sms-root.c
^
|
@@ -29,11 +29,12 @@
#include <string.h>
#include <glib.h>
-#include <glib/gprintf.h>
#include "util.h"
#include "smsutil.h"
+static const bool VERBOSE = false;
+
static const char *assembly_pdu1 = "038121F340048155550119906041001222048C0500"
"031E0301041804420430043A002C002004100"
"43B0435043A04410430043D04340440002000"
@@ -81,10 +82,10 @@
l = sms_assembly_add_fragment(assembly, &sms, time(NULL),
&sms.deliver.oaddr, ref, max, seq);
- if (g_test_verbose()) {
- g_print("Ref: %u\n", ref);
- g_print("Max: %u\n", max);
- g_print("From: %s\n",
+ if (VERBOSE) {
+ printf("Ref: %u\n", ref);
+ printf("Max: %u\n", max);
+ printf("From: %s\n",
sms_address_to_string(&sms.deliver.oaddr));
}
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/upstream/unit/test-sms.c
^
|
@@ -27,13 +27,16 @@
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
+#include <strings.h>
+#include <ell/ell.h>
#include <glib.h>
-#include <glib/gprintf.h>
#include "util.h"
#include "smsutil.h"
+static const bool VERBOSE = false;
+
static const char *simple_deliver = "07911326040000F0"
"040B911346610089F60000208062917314480CC8F71D14969741F977FD07";
static const char *alnum_sender = "0791447758100650"
@@ -56,13 +59,13 @@
struct tm remote;
char buf[128];
- g_print("%s: (YY-MM-DD) %02d-%02d-%02d\n", prefix,
+ printf("%s: (YY-MM-DD) %02d-%02d-%02d\n", prefix,
(int)scts->year, (int)scts->month, (int)scts->day);
- g_print("%s: (HH-MM-SS) %02d:%02d:%02d\n", prefix,
+ printf("%s: (HH-MM-SS) %02d:%02d:%02d\n", prefix,
(int)scts->hour, (int)scts->minute, (int)scts->second);
- g_print("%s: Timezone %d hours %d minutes\n", prefix,
+ printf("%s: Timezone %d hours %d minutes\n", prefix,
(int)scts->timezone / 4,
(int)((abs(scts->timezone) % 4) * 15));
@@ -71,32 +74,32 @@
strftime(buf, 127, "%Y-%m-%dT%H:%M:%S%z", localtime(&ts));
buf[127] = '\0';
- g_print("local time: %s\n", buf);
+ printf("local time: %s\n", buf);
strftime(buf, 127, "%Y-%m-%dT%H:%M:%S%z", &remote);
buf[127] = '\0';
- g_print("remote time: %s\n", buf);
+ printf("remote time: %s\n", buf);
}
static void print_vpf(enum sms_validity_period_format vpf,
struct sms_validity_period *vp)
{
- g_print("Validity Period Format: %d\n", (int)vpf);
+ printf("Validity Period Format: %d\n", (int)vpf);
switch (vpf) {
case SMS_VALIDITY_PERIOD_FORMAT_ABSENT:
- g_print("Validity-Period: Absent\n");
+ printf("Validity-Period: Absent\n");
break;
case SMS_VALIDITY_PERIOD_FORMAT_RELATIVE:
- g_print("Validity-Period: %d\n",
+ printf("Validity-Period: %d\n",
(int)vp->relative);
break;
case SMS_VALIDITY_PERIOD_FORMAT_ABSOLUTE:
print_scts(&vp->absolute, "Validity-Period:");
break;
case SMS_VALIDITY_PERIOD_FORMAT_ENHANCED:
- g_print("Validity-Period: Enhanced");
+ printf("Validity-Period: Enhanced");
break;
}
}
@@ -104,39 +107,39 @@
static void dump_details(struct sms *sms)
{
if (sms->sc_addr.address[0] == '\0')
- g_print("SMSC Address absent, default will be used\n");
+ printf("SMSC Address absent, default will be used\n");
else
- g_print("SMSC Address number_type: %d, number_plan: %d, %s\n",
+ printf("SMSC Address number_type: %d, number_plan: %d, %s\n",
(int)sms->sc_addr.number_type,
(int)sms->sc_addr.numbering_plan, sms->sc_addr.address);
switch (sms->type) {
case SMS_TYPE_DELIVER:
- g_print("Type: Deliver\n");
+ printf("Type: Deliver\n");
- g_print("Originator-Address: %d, %d, %s\n",
+ printf("Originator-Address: %d, %d, %s\n",
(int)sms->deliver.oaddr.number_type,
(int)sms->deliver.oaddr.numbering_plan,
sms->deliver.oaddr.address);
- g_print("PID: %d\n", (int)sms->deliver.pid);
- g_print("DCS: %d\n", (int)sms->deliver.dcs);
+ printf("PID: %d\n", (int)sms->deliver.pid);
+ printf("DCS: %d\n", (int)sms->deliver.dcs);
print_scts(&sms->deliver.scts, "Timestamp");
break;
case SMS_TYPE_SUBMIT:
- g_print("Type: Submit\n");
+ printf("Type: Submit\n");
- g_print("Message Reference: %u\n", (int)sms->submit.mr);
+ printf("Message Reference: %u\n", (int)sms->submit.mr);
- g_print("Destination-Address: %d, %d, %s\n",
+ printf("Destination-Address: %d, %d, %s\n",
(int)sms->submit.daddr.number_type,
(int)sms->submit.daddr.numbering_plan,
sms->submit.daddr.address);
- g_print("PID: %d\n", (int)sms->submit.pid);
- g_print("DCS: %d\n", (int)sms->submit.dcs);
+ printf("PID: %d\n", (int)sms->submit.pid);
+ printf("DCS: %d\n", (int)sms->submit.dcs);
print_vpf(sms->submit.vpf, &sms->submit.vp);
@@ -156,25 +159,22 @@
{
struct sms sms;
unsigned char *decoded_pdu;
- long pdu_len;
+ size_t pdu_len;
gboolean ret;
int data_len;
unsigned char *unpacked;
char *utf8;
- decoded_pdu = decode_hex(simple_deliver, -1, &pdu_len, 0);
-
+ decoded_pdu = l_util_from_hexstring(simple_deliver, &pdu_len);
g_assert(decoded_pdu);
- g_assert(pdu_len == (long)strlen(simple_deliver) / 2);
+ g_assert(pdu_len == strlen(simple_deliver) / 2);
ret = sms_decode(decoded_pdu, pdu_len, FALSE, 30, &sms);
-
- g_free(decoded_pdu);
-
+ l_free(decoded_pdu);
g_assert(ret);
g_assert(sms.type == SMS_TYPE_DELIVER);
- if (g_test_verbose())
+ if (VERBOSE)
dump_details(&sms);
g_assert(sms.sc_addr.number_type == SMS_NUMBER_TYPE_INTERNATIONAL);
@@ -204,48 +204,43 @@
g_assert(data_len == 11);
- unpacked = unpack_7bit(sms.deliver.ud, data_len, 0, FALSE,
+ unpacked = unpack_7bit(sms.deliver.ud, data_len, 0, false,
sms.deliver.udl, NULL, 0xff);
g_assert(unpacked);
utf8 = convert_gsm_to_utf8(unpacked, -1, NULL, NULL, 0xff);
-
- g_free(unpacked);
+ l_free(unpacked);
g_assert(utf8);
- if (g_test_verbose())
- g_print("Decoded user data is: %s\n", utf8);
+ if (VERBOSE)
+ printf("Decoded user data is: %s\n", utf8);
g_assert(strcmp(utf8, "How are you?") == 0);
-
- g_free(utf8);
+ l_free(utf8);
}
static void test_alnum_sender(void)
{
struct sms sms;
unsigned char *decoded_pdu;
- long pdu_len;
+ size_t pdu_len;
gboolean ret;
int data_len;
unsigned char *unpacked;
char *utf8;
- decoded_pdu = decode_hex(alnum_sender, -1, &pdu_len, 0);
-
+ decoded_pdu = l_util_from_hexstring(alnum_sender, &pdu_len);
g_assert(decoded_pdu);
- g_assert(pdu_len == (long)strlen(alnum_sender) / 2);
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/upstream/unit/test-stkutil.c
^
|
@@ -30,7 +30,7 @@
#include <stdint.h>
#include <glib.h>
-#include <glib/gprintf.h>
+#include <ell/ell.h>
#include <ofono/types.h>
#include "smsutil.h"
@@ -186,14 +186,14 @@
check_common_byte(command, test);
}
-static void check_items(GSList *command, const struct stk_item *test)
+static void check_items(struct l_queue *command, const struct stk_item *test)
{
struct stk_item *si;
- GSList *l;
+ const struct l_queue_entry *entry;
unsigned int i = 0;
- for (l = command; l; l = l->next) {
- si = l->data;
+ for (entry = l_queue_get_entries(command); entry; entry = entry->next) {
+ si = entry->data;
check_item(si, &test[i++]);
}
@@ -278,6 +278,7 @@
message = sms_decode_text(sms_list);
g_assert(g_str_equal(message, ts->ud));
g_free(message);
+ g_slist_free(sms_list);
}
break;
@@ -318,16 +319,17 @@
}
/* Defined in TS 102.223 Section 8.18 */
-static void check_file_list(GSList *command, const struct stk_file *test)
+static void check_file_list(struct l_queue *command,
+ const struct stk_file *test)
{
struct stk_file *sf;
- GSList *l;
+ const struct l_queue_entry *entry = l_queue_get_entries(command);
unsigned int i = 0;
- for (l = command; l; l = l->next) {
- sf = l->data;
+ for (; entry; entry = entry->next) {
+ sf = entry->data;
g_assert(sf->len == test[i].len);
- g_assert(g_mem_equal(sf->file, test[i++].file, sf->len));
+ g_assert(!memcmp(sf->file, test[i++].file, sf->len));
}
g_assert(test[i].len == 0);
@@ -457,14 +459,14 @@
g_assert(g_mem_equal(command->file, test->file, test->len));
}
-static void check_provisioning_file_references(GSList *command,
+static void check_provisioning_file_references(struct l_queue *command,
const struct stk_file *test)
{
struct stk_file *sf;
- GSList *l;
+ const struct l_queue_entry *l;
unsigned int i = 0;
- for (l = command; l; l = l->next) {
+ for (l = l_queue_get_entries(command); l; l = l->next) {
sf = l->data;
check_provisioning_file_reference(sf, &test[i++]);
}
|
[-]
[+]
|
Changed |
_service:tar_git:ofono-1.30+pp1.tar.bz2/upstream/unit/test-util.c
^
|
@@ -24,12 +24,16 @@
#endif
#include <string.h>
+#include <strings.h>
#include <stdio.h>
#include <assert.h>
#include <glib.h>
+#include <ell/ell.h>
#include "util.h"
+static const bool VERBOSE = false;
+
const unsigned char invalid_gsm_extended[] = {
0x1b, 0x15
};
@@ -356,7 +360,7 @@
g_assert(nread == 0);
g_assert(nwritten == 0);
g_assert(res[0] == '\0');
- g_free(res);
+ l_free(res);
/*
* In case of invalid GSM extended code, we should display
@@ -369,13 +373,13 @@
exp_code = gsm_to_unicode_map[invalid_gsm_extended[1]*2 + 1];
exp_res_length = UTF8_LENGTH(exp_code);
- exp_res = g_new0(char, exp_res_length + 1);
- g_unichar_to_utf8(exp_code, exp_res);
+ exp_res = l_new(char, exp_res_length + 1);
+ l_utf8_from_wchar(exp_code, exp_res);
- g_assert(g_strcmp0(res, exp_res) == 0);
+ g_assert(!strcmp(res, exp_res));
g_assert(nread == exp_res_length);
- g_free(exp_res);
- g_free(res);
+ l_free(exp_res);
+ l_free(res);
res = convert_gsm_to_utf8(invalid_gsm_extended_len,
sizeof(invalid_gsm_extended_len),
@@ -404,7 +408,7 @@
char *res;
int i;
long size;
- gunichar *verify;
+ wchar_t verify;
unsigned char *back;
unsigned char buf[2];
@@ -427,23 +431,18 @@
res = convert_gsm_to_utf8(buf, size, &nread, &nwritten, 0);
g_assert(res);
- if (g_test_verbose())
- g_print("size: %ld, nread:%ld, nwritten:%ld, %s\n",
+ if (VERBOSE)
+ printf("size: %ld, nread:%ld, nwritten:%ld, %s\n",
size, nread, nwritten, res);
g_assert(nread == size);
- verify = g_utf8_to_ucs4(res, -1, NULL, NULL, NULL);
-
- g_assert(verify[0] == gsm_to_unicode_map[i*2+1]);
- g_assert(verify[1] == 0);
-
- g_assert(nwritten == UTF8_LENGTH(verify[0]));
+ g_assert(l_utf8_get_codepoint(res, nwritten, &verify) > 0);
+ g_assert(verify == gsm_to_unicode_map[i*2+1]);
+ g_assert(nwritten == UTF8_LENGTH(verify));
back = convert_utf8_to_gsm(res, -1, &nread, &nwritten, 0);
-
g_assert(back);
-
g_assert(nwritten == size);
if (c & 0x1b00) {
@@ -453,9 +452,8 @@
g_assert(back[0] == (c & 0x7f));
}
- g_free(back);
- g_free(verify);
- g_free(res);
+ l_free(back);
+ l_free(res);
}
}
@@ -466,7 +464,7 @@
char *res;
int i;
long size;
- gunichar *verify;
+ wchar_t verify;
unsigned char *back;
unsigned char buf[2];
@@ -490,24 +488,19 @@
&nwritten, 0, 1, 1);
g_assert(res);
- if (g_test_verbose())
- g_print("size: %ld, nread:%ld, nwritten:%ld, %s\n",
+ if (VERBOSE)
+ printf("size: %ld, nread:%ld, nwritten:%ld, %s\n",
size, nread, nwritten, res);
g_assert(nread == size);
- verify = g_utf8_to_ucs4(res, -1, NULL, NULL, NULL);
-
- g_assert(verify[0] == gsm_turkish_to_unicode_map[i*2+1]);
- g_assert(verify[1] == 0);
-
- g_assert(nwritten == UTF8_LENGTH(verify[0]));
+ g_assert(l_utf8_get_codepoint(res, nwritten, &verify) > 0);
+ g_assert(verify == gsm_turkish_to_unicode_map[i*2+1]);
+ g_assert(nwritten == UTF8_LENGTH(verify));
back = convert_utf8_to_gsm_with_lang(res, -1, &nread,
&nwritten, 0, 1, 1);
-
g_assert(back);
-
g_assert(nwritten == size);
if (c & 0x1b00) {
@@ -517,9 +510,8 @@
g_assert(back[0] == (c & 0x7f));
}
- g_free(back);
- g_free(verify);
- g_free(res);
+ l_free(back);
+ l_free(res);
}
}
@@ -536,44 +528,43 @@
unsigned char *decoded, *packed;
char *utf8, *hex_packed;
unsigned char *gsm, *gsm_encoded;
- long hex_decoded_size;
+ size_t hex_decoded_size;
long unpacked_size, packed_size;
long gsm_encoded_size;
- long i;
- if (g_test_verbose())
- g_print("Size of the orig string: %u\n",
+ if (VERBOSE)
+ printf("Size of the orig string: %u\n",
(unsigned int)strlen(sms));
- decoded = decode_hex(sms, -1, &hex_decoded_size, 0);
-
+ decoded = l_util_from_hexstring(sms, &hex_decoded_size);
g_assert(decoded != NULL);
- if (g_test_verbose())
- g_print("Decode to %ld bytes\n", hex_decoded_size);
+ if (VERBOSE)
+ printf("Decode to %zu bytes\n", hex_decoded_size);
+
+ if (VERBOSE) {
+ size_t i;
- if (g_test_verbose()) {
- g_print("%s\n", sms);
+ printf("%s\n", sms);
for (i = 0; i < hex_decoded_size; i++)
- g_print("%02X", decoded[i]);
- g_print("\n");
+ printf("%02X", decoded[i]);
+ printf("\n");
}
- gsm = unpack_7bit(decoded, hex_decoded_size, 0, FALSE,
+ gsm = unpack_7bit(decoded, hex_decoded_size, 0, false,
reported_text_size, &unpacked_size, 0xff);
g_assert(gsm != NULL);
- if (g_test_verbose())
- g_print("String unpacked to %ld bytes\n", unpacked_size);
+ if (VERBOSE)
+ printf("String unpacked to %ld bytes\n", unpacked_size);
utf8 = convert_gsm_to_utf8(gsm, -1, NULL, NULL, 0xff);
+ g_assert(utf8);
|