[PATCH] sim: fix crash in case of invalid sim password type
by Christophe Ronco
Hi,
I have an old Swedish SIM card here that I tried to put in my MC7304 modem.
My ofono version is 1.20 (with some additional patches).
It sometimes return an invalid SIM password type.
After that, ofono crashes. Here is an extract of debug traces when this happens.
Ofono is just starting, modem was here before ofono starts.
Jun 27 15:28:41 klk-lpbs-0504B4 daemon.debug ofonod[1120]: ../git/drivers/qmimodem/sim.c:qmi_read_attributes() file id 0x6fb7 path len 0
Jun 27 15:28:41 klk-lpbs-0504B4 daemon.debug ofonod[1120]: ../git/drivers/qmimodem/devinfo.c:string_cb()
Jun 27 15:28:41 klk-lpbs-0504B4 daemon.debug ofonod[1120]: ../git/drivers/qmimodem/devinfo.c:qmi_query_serial()
Jun 27 15:28:41 klk-lpbs-0504B4 daemon.debug ofonod[1120]: ../git/drivers/qmimodem/sim.c:get_file_attributes_cb()
Jun 27 15:28:41 klk-lpbs-0504B4 daemon.err ofonod[1120]: Requested file structure differs from SIM: 6fb7
Jun 27 15:28:41 klk-lpbs-0504B4 daemon.debug ofonod[1120]: ../git/src/voicecall.c:ecc_g2_read_cb() 0
Jun 27 15:28:41 klk-lpbs-0504B4 daemon.debug ofonod[1120]: ../git/drivers/qmimodem/sim.c:qmi_read_attributes() file id 0x6fb7 path len 0
Jun 27 15:28:41 klk-lpbs-0504B4 daemon.debug ofonod[1120]: ../git/drivers/qmimodem/devinfo.c:get_ids_cb()
Jun 27 15:28:41 klk-lpbs-0504B4 daemon.debug ofonod[1120]: ../git/drivers/qmimodem/sim.c:get_file_attributes_cb()
Jun 27 15:28:41 klk-lpbs-0504B4 daemon.debug ofonod[1120]: ../git/drivers/qmimodem/sim.c:qmi_read_record() file id 0x6fb7 path len 0
Jun 27 15:28:41 klk-lpbs-0504B4 daemon.debug ofonod[1120]: ../git/drivers/qmimodem/sim.c:read_generic_cb()
Jun 27 15:28:41 klk-lpbs-0504B4 daemon.debug ofonod[1120]: ../git/src/voicecall.c:ecc_g3_read_cb() 1
Jun 27 15:28:41 klk-lpbs-0504B4 daemon.debug ofonod[1120]: ../git/drivers/qmimodem/sim.c:qmi_read_record() file id 0x6fb7 path len 0
Jun 27 15:28:41 klk-lpbs-0504B4 daemon.debug ofonod[1120]: ../git/drivers/qmimodem/sim.c:read_generic_cb()
Jun 27 15:28:41 klk-lpbs-0504B4 daemon.debug ofonod[1120]: ../git/src/voicecall.c:ecc_g3_read_cb() 1
Jun 27 15:28:41 klk-lpbs-0504B4 daemon.debug ofonod[1120]: ../git/drivers/qmimodem/sim.c:qmi_read_record() file id 0x6fb7 path len 0
Jun 27 15:28:41 klk-lpbs-0504B4 daemon.debug ofonod[1120]: ../git/drivers/qmimodem/sim.c:read_generic_cb()
Jun 27 15:28:41 klk-lpbs-0504B4 daemon.debug ofonod[1120]: ../git/src/voicecall.c:ecc_g3_read_cb() 1
Jun 27 15:28:41 klk-lpbs-0504B4 daemon.debug ofonod[1120]: ../git/drivers/qmimodem/sim.c:qmi_read_record() file id 0x6fb7 path len 0
Jun 27 15:28:41 klk-lpbs-0504B4 daemon.debug ofonod[1120]: ../git/drivers/qmimodem/sim.c:read_generic_cb()
Jun 27 15:28:41 klk-lpbs-0504B4 daemon.debug ofonod[1120]: ../git/src/voicecall.c:ecc_g3_read_cb() 1
Jun 27 15:28:41 klk-lpbs-0504B4 daemon.debug ofonod[1120]: ../git/drivers/qmimodem/sim.c:qmi_read_record() file id 0x6fb7 path len 0
Jun 27 15:28:41 klk-lpbs-0504B4 daemon.debug ofonod[1120]: ../git/drivers/qmimodem/sim.c:read_generic_cb()
Jun 27 15:28:41 klk-lpbs-0504B4 daemon.debug ofonod[1120]: ../git/src/voicecall.c:ecc_g3_read_cb() 1
Jun 27 15:28:41 klk-lpbs-0504B4 daemon.debug ofonod[1120]: ../git/drivers/qmimodem/sim.c:qmi_read_attributes() file id 0x2fe2 path len 0
Jun 27 15:28:41 klk-lpbs-0504B4 daemon.debug ofonod[1120]: ../git/drivers/qmimodem/sim.c:get_file_attributes_cb()
Jun 27 15:28:41 klk-lpbs-0504B4 daemon.debug ofonod[1120]: ../git/drivers/qmimodem/sim.c:qmi_read_transparent() file id 0x2fe2 path len 0
Jun 27 15:28:41 klk-lpbs-0504B4 daemon.debug ofonod[1120]: ../git/drivers/qmimodem/sim.c:read_generic_cb()
Jun 27 15:28:41 klk-lpbs-0504B4 daemon.debug ofonod[1120]: ../git/src/simfs.c:sim_fs_op_read_block_cb() bufoff: 0, dataoff: 0, tocopy: 10
Jun 27 15:28:41 klk-lpbs-0504B4 daemon.debug ofonod[1120]: ../git/drivers/qmimodem/sim.c:qmi_read_attributes() file id 0x6f05 path len 0
Jun 27 15:28:41 klk-lpbs-0504B4 daemon.debug ofonod[1120]: ../git/drivers/qmimodem/sim.c:get_file_attributes_cb()
Jun 27 15:28:41 klk-lpbs-0504B4 daemon.debug ofonod[1120]: ../git/drivers/qmimodem/sim.c:qmi_read_transparent() file id 0x6f05 path len 0
Jun 27 15:28:41 klk-lpbs-0504B4 daemon.debug ofonod[1120]: ../git/drivers/qmimodem/sim.c:read_generic_cb()
Jun 27 15:28:41 klk-lpbs-0504B4 daemon.debug ofonod[1120]: ../git/src/simfs.c:sim_fs_op_read_block_cb() bufoff: 0, dataoff: 0, tocopy: 6
Jun 27 15:28:41 klk-lpbs-0504B4 daemon.debug ofonod[1120]: ../git/drivers/qmimodem/sim.c:qmi_read_attributes() file id 0x2f05 path len 0
Jun 27 15:28:41 klk-lpbs-0504B4 daemon.debug ofonod[1120]: ../git/drivers/qmimodem/sim.c:get_file_attributes_cb()
Jun 27 15:28:41 klk-lpbs-0504B4 daemon.debug ofonod[1120]: ../git/drivers/qmimodem/sim.c:qmi_read_transparent() file id 0x2f05 path len 0
Jun 27 15:28:41 klk-lpbs-0504B4 daemon.debug ofonod[1120]: ../git/drivers/qmimodem/sim.c:read_generic_cb()
Jun 27 15:28:41 klk-lpbs-0504B4 daemon.debug ofonod[1120]: ../git/src/simfs.c:sim_fs_op_read_block_cb() bufoff: 0, dataoff: 0, tocopy: 6
Jun 27 15:28:41 klk-lpbs-0504B4 daemon.debug ofonod[1120]: ../git/drivers/qmimodem/sim.c:qmi_query_passwd_state()
Jun 27 15:28:42 klk-lpbs-0504B4 daemon.debug ofonod[1120]: ../git/drivers/qmimodem/sim.c:get_card_status() info1->app_state:0x6: OFONO_SIM_PASSWORD_INVALID
Jun 27 15:28:42 klk-lpbs-0504B4 daemon.debug ofonod[1120]: ../git/drivers/qmimodem/sim.c:query_passwd_state_cb() passwd state 16
Jun 27 15:28:42 klk-lpbs-0504B4 daemon.debug ofonod[1120]: ../git/src/sim.c:sim_pin_query_cb() sim->pin_type: 0, pin_type: 16
Jun 27 15:28:42 klk-lpbs-0504B4 daemon.err ofonod[1120]: Aborting (signal 11) [/usr/sbin/ofonod]
Problem is just that we don't have a string corresponding to this password type.
Christophe Ronco (1):
sim: fix crash in case of invalid sim password type
src/sim.c | 1 +
1 file changed, 1 insertion(+)
--
2.7.4
2 years, 11 months
ofono with sim5320 module
by David Ashley
Hello, I'm at my wits' end trying to get ofono working with the
sim5320 module. I'm using the plugins/sim900.c module as a starting
point. I think the issue has something to do with the difference
between the MUX functionality between the 900 and the 5320. The sim900
supports the elaborate parameters sent on the
AT+CMUX=0,x,x,x,x, etc.
but the SIM5320 only supports
AT+CMUX=0
There's that... but also the way the sim900 plugin creates a
SETUP_DLC, initiates muxing, then deletes the setup DLC and creates 4
new DLC's... it didn't work for the sim5320 until I remapped the DLC's
somewhat like this:
#define NUM_DLC 4
#define VOICE_DLC 2
#define NETREG_DLC 1
//#define SMS_DLC 2
#define GPRS_DLC 3
#define SETUP_DLC 0
static char *dlc_prefixes[NUM_DLC] = {
[VOICE_DLC]="Voice: ",
[NETREG_DLC]="Net: ",
// [SMS_DLC]= "SMS: ",
[GPRS_DLC]= "GPRS: " ,
[SETUP_DLC]= "Setup: ",
};
Note I have to eliminate the SMS_DLC usage later in sim5320_post_sim:
// ofono_sms_create(modem, OFONO_VENDOR_SIMCOM, "atmodem",
// data->dlcs[SMS_DLC]);
OK everything is *ALMOST* working. ofonod interacts fine with
connmand, connmand tells ofonod to activate the sim5320, which
actually establishes a ppp connection and sets up a ppp device:
ppp0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-0
inet addr:30.97.132.47 P-t-P:30.97.132.47 Mask:255.255.255.255
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:2 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:500
RX bytes:0 (0.0 B) TX bytes:124 (124.0 B)
Here's the rub: No matter what I do, I never get any RX packets from
that ppp device, and even when it appears to TX packets (I'm trying to
ping out) the machine on the internet isn't actually receiving them.
I'm running on a beaglebone with a custom board with a sim5320 module on it.
I have no idea what to try... Any advice would be appreciated...
Thanks very much!!!!
-Dave
3 years, 3 months
[PATCH] nokia-gpio: do not create links to gpios in /dev/cmt
by Clayton Craft
The nokia-gpio plugin should not try to create symlinks to relevant gpio
pins under /dev/cmt, since the location it is looking is no longer
correct on newer kernels and it might change again in the future. This
patch removes code from nokia-gpio that tries to create a symlink.
Users will now need to symlink the modem gpios to /dev/cmt themselves.
On the 4.13 kernel, this can be done by, for example, adding a udev rule
to:
# ln -sf /sys/bus/hsi/devices/n900-modem /dev/cmt
---
plugins/nokia-gpio.c | 67 ++++------------------------------------------------
1 file changed, 4 insertions(+), 63 deletions(-)
diff --git a/plugins/nokia-gpio.c b/plugins/nokia-gpio.c
index 7a93106c..1d014337 100644
--- a/plugins/nokia-gpio.c
+++ b/plugins/nokia-gpio.c
@@ -632,74 +632,15 @@ static void phonet_status_cb(GIsiModem *idx, enum GIsiPhonetLinkState state,
static int gpio_probe_links(void)
{
- char const *gpiodir = "/sys/class/gpio";
char const *cmtdir = "/dev/cmt";
- DIR *gpio;
- struct dirent *d;
- if (file_exists(cmtdir)) {
- DBG("Using %s", cmtdir);
- return 0;
- }
-
- DBG("Using %s: trying to make links to %s", gpiodir, cmtdir);
-
- if (!dir_exists(cmtdir)) {
- if (mkdir(cmtdir, 0755) == -1) {
- DBG("%s: %s", cmtdir, strerror(errno));
- return -(errno = ENODEV);
- }
- }
-
- gpio = opendir(gpiodir);
- if (gpio == NULL) {
- DBG("%s: %s", "gpiodir", strerror(errno));
+ if (!file_exists(cmtdir)) {
+ DBG("%s: %s", cmtdir, strerror(errno));
return -(errno = ENODEV);
}
- while ((d = readdir(gpio)) != NULL) {
- char nn[PATH_MAX], name[PATH_MAX], from[PATH_MAX], to[PATH_MAX];
- FILE *nf;
- size_t len;
-
- snprintf(nn, sizeof nn, "%s/%s/name", gpiodir, d->d_name);
-
- nf = fopen(nn, "rb");
- if (nf == NULL) {
- DBG("%s: %s", nn, strerror(errno));
- continue;
- }
-
- len = fread(name, sizeof name, 1, nf);
-
- if (ferror(nf)) {
- DBG("read from %s: %s", nn, strerror(errno));
- fclose(nf);
- continue;
- }
-
- fclose(nf);
-
- if (len < 4)
- continue;
-
- name[--len] = '\0';
-
- if (strncmp(name, "cmt_", 4))
- continue;
-
- snprintf(from, sizeof from, "%s/%s", gpiodir, d->d_name);
- snprintf(to, sizeof to, "%s/%s", cmtdir, name);
-
- if (symlink(from, to) == -1)
- DBG("%s: %s", to, strerror(errno));
- }
-
- DBG("%s: %s", "/sys/class/gpio", strerror(errno));
-
- (void) closedir(gpio);
-
- return -(errno = ENODEV);
+ DBG("Using %s", cmtdir);
+ return 0;
}
--
2.14.1
3 years, 6 months
[PATCH 1/2] include: Add ofono_modem_get_sim
by Slava Monich
---
include/modem.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/include/modem.h b/include/modem.h
index e40b23e..c93b3d2 100644
--- a/include/modem.h
+++ b/include/modem.h
@@ -29,6 +29,7 @@ extern "C" {
#include <ofono/types.h>
struct ofono_modem;
+struct ofono_sim;
enum ofono_modem_type {
OFONO_MODEM_TYPE_HARDWARE = 0,
@@ -80,6 +81,7 @@ void ofono_modem_remove_interface(struct ofono_modem *modem,
const char *interface);
const char *ofono_modem_get_path(struct ofono_modem *modem);
+struct ofono_sim *ofono_modem_get_sim(struct ofono_modem *modem);
void ofono_modem_set_data(struct ofono_modem *modem, void *data);
void *ofono_modem_get_data(struct ofono_modem *modem);
--
1.9.1
3 years, 6 months
[PATCH 1/7] sim-auth: prep simauth/dbus headers
by James Prestwood
Added new dbus interfaces for SimAuth module as well as
function prototype definitions to simauth header
---
include/dbus.h | 2 ++
include/sim-auth.h | 16 +++++++++++++++-
2 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/include/dbus.h b/include/dbus.h
index a6519c7..f0e437c 100644
--- a/include/dbus.h
+++ b/include/dbus.h
@@ -58,6 +58,8 @@ extern "C" {
#define OFONO_LOCATION_REPORTING_INTERFACE OFONO_SERVICE ".LocationReporting"
#define OFONO_GNSS_INTERFACE "org.ofono.AssistedSatelliteNavigation"
#define OFONO_GNSS_POSR_AGENT_INTERFACE "org.ofono.PositioningRequestAgent"
+#define OFONO_USIM_APPLICATION_INTERFACE "org.ofono.USimApplication"
+#define OFONO_ISIM_APPLICATION_INTERFACE "org.ofono.ISimApplication"
#define OFONO_HANDSFREE_INTERFACE OFONO_SERVICE ".Handsfree"
#define OFONO_SIRI_INTERFACE OFONO_SERVICE ".Siri"
#define OFONO_NETMON_INTERFACE OFONO_SERVICE ".NetworkMonitor"
diff --git a/include/sim-auth.h b/include/sim-auth.h
index 0a62adc..b57fe25 100644
--- a/include/sim-auth.h
+++ b/include/sim-auth.h
@@ -26,6 +26,8 @@
extern "C" {
#endif
+#include <stdint.h>
+
#include <ofono/types.h>
struct ofono_sim_auth;
@@ -34,6 +36,11 @@ typedef void (*ofono_sim_list_apps_cb_t)(const struct ofono_error *error,
const unsigned char *dataobj,
int len, void *data);
+typedef void (*ofono_sim_open_channel_cb_t)(int session_id, void *data);
+
+typedef void (*ofono_logical_access_cb_t)(const uint8_t *resp,
+ uint16_t len, void *data);
+
struct ofono_sim_auth_driver {
const char *name;
int (*probe)(struct ofono_sim_auth *sa, unsigned int vendor,
@@ -41,7 +48,14 @@ struct ofono_sim_auth_driver {
void (*remove)(struct ofono_sim_auth *sa);
void (*list_apps)(struct ofono_sim_auth *sa,
- ofono_sim_list_apps_cb_t cb, void *data);
+ ofono_sim_list_apps_cb_t cb, void *data);
+ void (*open_channel)(struct ofono_sim_auth *sa,
+ ofono_sim_open_channel_cb_t cb,
+ const void *channel, void *data);
+ void (*close_channel)(struct ofono_sim_auth *sa, int session_id);
+ void (*logical_access)(struct ofono_sim_auth *sa,
+ ofono_logical_access_cb_t cb, int session_id,
+ const uint8_t *pdu, uint16_t len, void *data);
};
int ofono_sim_auth_driver_register(const struct ofono_sim_auth_driver *d);
--
2.7.4
3 years, 6 months
[PATCH 1/7] sim-auth: prep simauth/dbus headers
by James Prestwood
Added new dbus interfaces for SimAuth module as well as
function prototype definitions to simauth header
---
include/dbus.h | 2 ++
include/sim-auth.h | 20 +++++++++++++++++++-
2 files changed, 21 insertions(+), 1 deletion(-)
diff --git a/include/dbus.h b/include/dbus.h
index a6519c7..f0e437c 100644
--- a/include/dbus.h
+++ b/include/dbus.h
@@ -58,6 +58,8 @@ extern "C" {
#define OFONO_LOCATION_REPORTING_INTERFACE OFONO_SERVICE ".LocationReporting"
#define OFONO_GNSS_INTERFACE "org.ofono.AssistedSatelliteNavigation"
#define OFONO_GNSS_POSR_AGENT_INTERFACE "org.ofono.PositioningRequestAgent"
+#define OFONO_USIM_APPLICATION_INTERFACE "org.ofono.USimApplication"
+#define OFONO_ISIM_APPLICATION_INTERFACE "org.ofono.ISimApplication"
#define OFONO_HANDSFREE_INTERFACE OFONO_SERVICE ".Handsfree"
#define OFONO_SIRI_INTERFACE OFONO_SERVICE ".Siri"
#define OFONO_NETMON_INTERFACE OFONO_SERVICE ".NetworkMonitor"
diff --git a/include/sim-auth.h b/include/sim-auth.h
index 0a62adc..68c8602 100644
--- a/include/sim-auth.h
+++ b/include/sim-auth.h
@@ -34,6 +34,14 @@ typedef void (*ofono_sim_list_apps_cb_t)(const struct ofono_error *error,
const unsigned char *dataobj,
int len, void *data);
+typedef void (*ofono_sim_open_channel_cb_t)(int session_id, void *data);
+
+typedef void (*ofono_gsm_authenticate_cb_t)(void *data, const guint8 *sres,
+ const guint8 *kc);
+
+typedef void (*ofono_umts_authenticate_cb_t)(void *data, const guint8 *res,
+ guint8 res_len, const guint8 *ck, const guint8 *ik);
+
struct ofono_sim_auth_driver {
const char *name;
int (*probe)(struct ofono_sim_auth *sa, unsigned int vendor,
@@ -41,7 +49,17 @@ struct ofono_sim_auth_driver {
void (*remove)(struct ofono_sim_auth *sa);
void (*list_apps)(struct ofono_sim_auth *sa,
- ofono_sim_list_apps_cb_t cb, void *data);
+ ofono_sim_list_apps_cb_t cb, void *data);
+ void (*open_channel)(struct ofono_sim_auth *sa,
+ ofono_sim_open_channel_cb_t cb,
+ const void *channel, void *data);
+ void (*close_channel)(struct ofono_sim_auth *sa, int session_id);
+ void (*gsm_authenticate)(struct ofono_sim_auth *sa,
+ ofono_gsm_authenticate_cb_t cb, int session_id,
+ const void *rand, void *data);
+ void (*umts_authenticate)(struct ofono_sim_auth *sa,
+ ofono_umts_authenticate_cb_t cb, int session_id,
+ const void *rand, const void *autn, void *data);
};
int ofono_sim_auth_driver_register(const struct ofono_sim_auth_driver *d);
--
2.7.4
3 years, 6 months
[PATCH 0/2] huawei E3372: add LTE support
by Christophe Ronco
Hi,
Here is a first version of patches to support LTE with E3372 USB keys.
Huawei has two AT command sets to deal with band and mode (technologies).
Standard AT commands set (AT^SYSCFG, AT^SYSINFO, ^MODE, ...) handle 2G and 3G technologies only.
Extended AT commands set (AT^SYSCFGEX, AT^SYSINFOEX, ^HSCQ, ...) handle 2G, 3G and 4G technologies.
Extended commands are described in this document (downloadable on the web):
HUAWEI ME906s LTE Module AT Command Interface Specification-(V100R001_01, 0English).pdf
Huawei driver in Ofono uses standard AT command set. When it says to use any band in any technology to connect, this disable 4G.
Fix consists in using the other command set to do the same thing when it is supported.
^HCSQ notification is also able to report LTE attachment while ^MODE reports UMTS attachment when modem is attached in 4G.
Tests have been done only with E3372, with 3G and 4G SIM cards. I don't have any 3G only huawei modem.
Technology report in network-registration.c works only because notification come in this order:
1) PCUI: < \r\n^MODE: 5,4\r\n
2) PCUI: < \r\n^HCSQ:"LTE",38,34,101,28\r\n
3) PCUI: < \r\n^SRVST: 2\r\n\r\n+CREG: 1,"C0FA","00107202"\r\n
I have never seen notifications in other order but I don't have a Huawei document saying it won't happen.
I will be happy to have your comments on these patches.
Best Regards,
Christophe Ronco
Christophe Ronco (2):
huawei: add LTE support
atmodem: correctly report lte bearer for huawei modems
drivers/atmodem/gprs.c | 22 ++++
drivers/atmodem/network-registration.c | 25 ++++
drivers/huaweimodem/radio-settings.c | 213 ++++++++++++++++++++++++++++++---
3 files changed, 244 insertions(+), 16 deletions(-)
--
2.7.4
3 years, 6 months
hey! they inspired me sö much
by Francine Parker
Just löök intö that amazing pröducts söme individuals can dö! They inspired me very much! Amazing! This is actually the link http://mageindustries.com/measure.php?UE9vZm9ub0BvZm9uby5vcmc-
Hope this helps, Francine Parker
From: ofono [mailto:ofono@ofono.org]
Sent: Wednesday, September 13, 2017 1:50 PM
To: minjun_li(a)sina.com
Subject: new flair pls
I've done 2,000 miles on my Rival 22 hydraulics through the worst that English winter has to throw, they're pretty good. They squeal now and again, usually while braking at slow speeds after 20 minutes of riding through dirt and mud and not braking at all. During rain they also make that metallic chafing sound, but that isn't really a big deal. I've just replaced the front pads (I used RED pads from superstarcomponents).
I have no experience of Shimano road hydraulics but the XT brakes on my MTB have always been fine.
Sent from Mail for Windows 10
3 years, 7 months
[PATCH 1/4] atutil: Add logic for cgcontrdp to get address and netmask
by Ankit Navik
---
drivers/atmodem/atutil.c | 40 ++++++++++++++++++++++++++++++++++++++++
drivers/atmodem/atutil.h | 3 +++
2 files changed, 43 insertions(+)
diff --git a/drivers/atmodem/atutil.c b/drivers/atmodem/atutil.c
index 1487348..6f4e8a2 100644
--- a/drivers/atmodem/atutil.c
+++ b/drivers/atmodem/atutil.c
@@ -27,6 +27,7 @@
#include <gatchat.h>
#include <string.h>
#include <stdlib.h>
+#include <errno.h>
#define OFONO_API_SUBJECT_TO_CHANGE
#include <ofono/log.h>
@@ -614,3 +615,42 @@ void at_util_sim_state_query_free(struct at_util_sim_state_query *req)
g_free(req);
}
+
+/*
+ * CGCONTRDP returns addr + netmask in the same string in the form
+ * of "a.b.c.d.m.m.m.m" for IPv4.
+ * address/netmask must be able to hold
+ * 255.255.255.255 + null = 16 characters
+ */
+int at_util_get_ipv4_address_and_netmask(const char *addrnetmask,
+ char *address, char *netmask)
+{
+ const char *s = addrnetmask;
+ const char *net = NULL;
+
+ int ret = -EINVAL;
+ int i;
+
+ /* Count 7 dots for ipv4, less or more means error. */
+ for (i = 0; i < 9; i++, s++) {
+ s = strchr(s, '.');
+
+ if (!s)
+ break;
+
+ if (i == 3) {
+ /* set netmask ptr and break the string */
+ net = s + 1;
+ }
+ }
+
+ if (i == 7) {
+ memcpy(address, addrnetmask, net - addrnetmask);
+ address[net - addrnetmask - 1] = '\0';
+ strcpy(netmask, net);
+
+ ret = 0;
+ }
+
+ return ret;
+}
diff --git a/drivers/atmodem/atutil.h b/drivers/atmodem/atutil.h
index 5cb88b7..7113a4c 100644
--- a/drivers/atmodem/atutil.h
+++ b/drivers/atmodem/atutil.h
@@ -83,6 +83,9 @@ struct at_util_sim_state_query *at_util_sim_state_query_new(GAtChat *chat,
GDestroyNotify destroy);
void at_util_sim_state_query_free(struct at_util_sim_state_query *req);
+int at_util_get_ipv4_address_and_netmask(const char *addrnetmask,
+ char *address, char *netmask);
+
struct cb_data {
void *cb;
void *data;
--
1.9.1
3 years, 7 months
Support for samsung-ipc
by Tomáš Šafařík
Hello,
I would like to ask about support for Samsung devices that use IPC like i9100 (galaxys2). I would like to get it work for postmarketOS project - http:/wiki.postmarketos.org/
I found this old post https://lists.ofono.org/pipermail/ofono/2012-September/013766.html that send patchset for support via libsamsung-ipc. But I do not see any samsung driver in current repository.
Does please anyone have any info about this topic ( is it supported, was the patchset included, etc. )?
Thanks,
--
Tomas Safarik
3 years, 7 months