Hi!
>>>>> Is this actually an AT command modem or one of
those modems where AT
>>>>> commands were only bolted on for carrier certification? Does it
support QMI
>>>>> or something maybe?
>>>> Ok, so ... this is complex. And maybe this is one of "those"
modems.
>>>> There's USB with AT commands, USB with QMI protocol, then serial
with
>>>> mux and U1234AT+XYZ commands.
>>>> It seems Android uses serial, but that is being worked on, so I'm
>>>> using AT commands for now.
>>>
>>> Wow, okay. You might want to try using the qmi driver family instead.
>>
>> I would switch to QMI since then you can also ignore this weird multiplexer.
>
> More explanation needed it seems:
>
> I can already do USB with AT commands, no multiplexer needed. We'd
> actually prefer to go over serial (with multiplexer), because USB
> needs to be powered down in idle, and you still need communication
> ovre serial to know that wakeup of USB is needed.
>
> Yes, it is complex :-(.
I missed the part that the weird serial multiplexer is wired independently. Then do
everything via that serial multiplexer and never look back. However if that is as broken,
then you will be really out of luck. Making this work reliable will be really hard.
While we have seen QMI protocol issues as well, but they have been less bad than the
bolted on AT commands. Manufactures always get AT commands wrong since they let humans
test it and not a real telephony stack like oFono.
Ok, so it was a bit of a fight, and result is _not_ ready for
mergning, and probably not even ready for review.
But it works.. for me.
Trick is to use
AT+CSMS=0
AT+CNMI=1,2,2,1,0
combination and sabotage AT+CNMA commands. That way, ofono uses
PDU mode without acknowledgments, but we get working messages.
Best regards,
Pavel
diff --git a/doc/location-reporting-api.txt b/doc/location-reporting-api.txt
index 21e346d4..ff0a35dc 100644
--- a/doc/location-reporting-api.txt
+++ b/doc/location-reporting-api.txt
@@ -13,7 +13,7 @@ Methods dict GetProperties()
filedescriptor Request()
Asks to turn ON the NMEA stream and supplies the
- gps device file descriptor. The external cliend should
+ gps device file descriptor. The external client should
use the file descriptor to receive the NMEA data.
Possible Errors: [service].Error.InProgress
diff --git a/drivers/atmodem/atutil.c b/drivers/atmodem/atutil.c
index 6f4e8a20..b63d5b33 100644
--- a/drivers/atmodem/atutil.c
+++ b/drivers/atmodem/atutil.c
@@ -381,9 +381,16 @@ gboolean at_util_parse_sms_index_delivery(GAtResult *result, const
char *prefix,
st = AT_UTIL_SMS_STORE_BM;
else
return FALSE;
-
- if (!g_at_result_iter_next_number(&iter, &index))
- return FALSE;
+#if 0
+ if (g_at_result_iter_next(&iter, "-")) {
+ printf("Unexpected - arrived, ignoring\n");
+ }
+#endif
+ if (!g_at_result_iter_next_number(&iter, &index)) {
+ printf("iter next number parse failed, faking\n");
+ index = 1;
+ //return FALSE;
+ }
if (out_index)
*out_index = index;
diff --git a/drivers/atmodem/call-meter.c b/drivers/atmodem/call-meter.c
index 430d5461..3de3f59e 100644
--- a/drivers/atmodem/call-meter.c
+++ b/drivers/atmodem/call-meter.c
@@ -255,7 +255,7 @@ static void at_cpuc_query(struct ofono_call_meter *cm,
struct cb_data *cbd = cb_data_new(cb, data);
cbd->user = "+CPUC:";
- if (g_at_chat_send(chat, "AT+CPUC?", cpuc_prefix,
+ if (g_at_chat_send(chat, "AT+CPnottodayUC?", cpuc_prefix,
cpuc_query_cb, cbd, g_free) > 0)
return;
diff --git a/drivers/atmodem/sms.c b/drivers/atmodem/sms.c
index 68b89862..75dc6c6b 100644
--- a/drivers/atmodem/sms.c
+++ b/drivers/atmodem/sms.c
@@ -328,11 +328,13 @@ static inline void at_ack_delivery(struct ofono_sms *sms)
/* We must acknowledge the PDU using CNMA */
if (data->cnma_ack_pdu) {
- switch (data->vendor) {
+ switch (0) {
case OFONO_VENDOR_CINTERION:
snprintf(buf, sizeof(buf), "AT+CNMA=1");
break;
default:
+ printf("PDU Len %d, strlen %d\n", data->cnma_ack_pdu_len,
strlen(data->cnma_ack_pdu));
+ printf("PDU last char %d\n",
data->cnma_ack_pdu[strlen(data->cnma_ack_pdu)-1]);
snprintf(buf, sizeof(buf), "AT+CNMA=1,%d\r%s",
data->cnma_ack_pdu_len,
data->cnma_ack_pdu);
@@ -340,7 +342,7 @@ static inline void at_ack_delivery(struct ofono_sms *sms)
}
} else {
/* Should be a safe fallback */
- snprintf(buf, sizeof(buf), "AT+CNMA=0");
+ snprintf(buf, sizeof(buf), "AT");
}
g_at_chat_send(data->chat, buf, none_prefix, at_cnma_cb, NULL, NULL);
@@ -440,6 +442,8 @@ static void at_cmt_notify(GAtResult *result, gpointer user_data)
if (data->vendor != OFONO_VENDOR_SIMCOM)
at_ack_delivery(sms);
+ return;
+
err:
ofono_error("Unable to parse CMT notification");
}
@@ -832,9 +836,9 @@ static gboolean build_cnmi_string(char *buf, int *cnmi_opts,
/* Prefer to deliver SMS via +CMT if CNMA is supported */
if (!append_cnmi_element(buf, &len, cnmi_opts[1],
- data->cnma_enabled ? "21" : "1", FALSE))
+ data->cnma_enabled ? "21" : "21", FALSE))
return FALSE;
-
+
/* Always deliver CB via +CBM, otherwise don't deliver at all */
if (!append_cnmi_element(buf, &len, cnmi_opts[2], "20", FALSE))
return FALSE;
@@ -1204,8 +1208,8 @@ static void at_csms_status_cb(gboolean ok, GAtResult *result,
if (!g_at_result_iter_next_number(&iter, &mo))
goto out;
- if (service == 1)
- data->cnma_enabled = TRUE;
+ //if (service == 1)
+ // data->cnma_enabled = TRUE;
if (mt == 1 && mo == 1)
supported = TRUE;
@@ -1255,6 +1259,9 @@ static void at_csms_query_cb(gboolean ok, GAtResult *result,
if (status_min <= 1 && 1 <= status_max)
cnma_supported = TRUE;
+ printf("Forcing cnma to false\n");
+ cnma_supported = FALSE;
+
DBG("CSMS query parsed successfully");
out:
diff --git a/drivers/atmodem/voicecall.c b/drivers/atmodem/voicecall.c
index e4c59c26..df2975bb 100644
--- a/drivers/atmodem/voicecall.c
+++ b/drivers/atmodem/voicecall.c
@@ -161,6 +161,7 @@ static void clcc_poll_cb(gboolean ok, GAtResult *result, gpointer
user_data)
poll_again = TRUE;
goto poll_again;
}
+ goto poll_again;
ofono_error("We are polling CLCC and received an error");
ofono_error("All bets are off for call management");
@@ -420,6 +421,7 @@ static void at_dial(struct ofono_voicecall *vc,
strcat(buf, ";");
+ /* Need to make it non-blocking or something? */
if (g_at_chat_send(vd->chat, buf, atd_prefix,
atd_cb, cbd, g_free) > 0)
return;
diff --git a/gatchat/gatchat.c b/gatchat/gatchat.c
index 3f290ac2..86ed1352 100644
--- a/gatchat/gatchat.c
+++ b/gatchat/gatchat.c
@@ -579,6 +579,8 @@ static void have_line(struct at_chat *p, char *str)
if (str == NULL)
return;
+ printf("< %s\n", str);
+
/* Check for echo, this should not happen, but lets be paranoid */
if (!strncmp(str, "AT", 2))
goto done;
@@ -650,6 +652,9 @@ static void have_pdu(struct at_chat *p, char *pdu)
if (pdu == NULL)
goto error;
+ printf("<PDU %s\n", pdu);
+
+
result.lines = g_slist_prepend(NULL, p->pdu_notify);
result.final_or_pdu = pdu;
@@ -764,11 +769,13 @@ static void new_bytes(struct ring_buffer *rbuf, gpointer user_data)
break;
case G_AT_SYNTAX_RESULT_PROMPT:
+ printf("<PR\n");
chat_wakeup_writer(p);
ring_buffer_drain(rbuf, p->read_so_far);
break;
default:
+ printf("<D\n");
ring_buffer_drain(rbuf, p->read_so_far);
break;
}
@@ -845,6 +852,7 @@ static gboolean can_write_data(gpointer data)
if (cmd == NULL)
return FALSE;
+ printf("> %s\n", cmd->cmd);
len = strlen(cmd->cmd);
/* For some reason write watcher fired, but we've already
@@ -1018,6 +1026,7 @@ static gboolean at_chat_set_wakeup_command(struct at_chat *chat,
return TRUE;
}
+/* HERE ? */
static guint at_chat_send_common(struct at_chat *chat, guint gid,
const char *cmd,
const char **prefix_list,
diff --git a/plugins/udevng.c b/plugins/udevng.c
index ff5d41af..a4b18488 100644
--- a/plugins/udevng.c
+++ b/plugins/udevng.c
@@ -233,10 +233,11 @@ static gboolean setup_gobi(struct modem_info *modem)
}
}
+ DBG("qmi=%s net=%s mdm=%s gps=%s diag=%s", qmi, net, mdm, gps, diag);
+
if (qmi == NULL || mdm == NULL || net == NULL)
return FALSE;
- DBG("qmi=%s net=%s mdm=%s gps=%s diag=%s", qmi, net, mdm, gps, diag);
ofono_modem_set_string(modem->modem, "Device", qmi);
ofono_modem_set_string(modem->modem, "Modem", mdm);
@@ -1250,6 +1251,7 @@ static struct {
{ "cinterion", setup_serial_modem },
{ "nokiacdma", setup_serial_modem },
{ "sim900", setup_serial_modem },
+ { "g1", setup_serial_modem },
{ "wavecom", setup_wavecom },
{ "tc65", setup_tc65 },
{ "ehs6", setup_ehs6 },
@@ -1578,8 +1580,6 @@ static struct {
{ "mbm", "cdc_ether", "0930" },
{ "mbm", "cdc_ncm", "0930" },
{ "hso", "hso" },
- { "gobi", "qmi_wwan" },
- { "gobi", "qcserial" },
{ "sierra", "qmi_wwan", "1199" },
{ "sierra", "qcserial", "1199" },
{ "sierra", "sierra" },
@@ -1602,6 +1602,8 @@ static struct {
{ "telit", "cdc_acm", "1bc7", "0021" },
{ "telitqmi", "qmi_wwan", "1bc7", "1201" },
{ "telitqmi", "option", "1bc7", "1201" },
+ { "telitqmi", "qmi_wwan", "22b8", "2a70" },
+ { "telitqmi", "option", "22b8", "2a70" },
{ "nokia", "option", "0421", "060e" },
{ "nokia", "option", "0421", "0623" },
{ "samsung", "option", "04e8", "6889" },
@@ -1717,10 +1719,12 @@ static void check_device(struct udev_device *device)
return;
}
+#if 0
if ((g_str_equal(bus, "usb") == TRUE) ||
(g_str_equal(bus, "usbmisc") == TRUE))
check_usb_device(device);
else
+#endif
add_serial_device(device);
}
@@ -1749,14 +1753,17 @@ static gboolean create_modem(gpointer key, gpointer value,
gpointer user_data)
if (g_str_equal(driver_list[i].name, modem->driver) == FALSE)
continue;
+ DBG("Attempting modem setup, driver %s", modem->driver);
if (driver_list[i].setup(modem) == TRUE) {
ofono_modem_set_string(modem->modem, "SystemPath",
syspath);
ofono_modem_register(modem->modem);
return FALSE;
}
+ DBG("Modem setup failed, driver %s", modem->driver);
}
+ DBG("Modem setup failed or not in driver_list?");
return TRUE;
}
diff --git a/test/send-sms b/test/send-sms
index 98808aaf..cabe0652 100755
--- a/test/send-sms
+++ b/test/send-sms
@@ -6,6 +6,7 @@ import dbus
if len(sys.argv) < 4:
print("Usage: %s [modem] <to> <message> <delivery report>"
%\
(sys.argv[0]))
+ print(" where delivery report is 0|1")
sys.exit(1)
bus = dbus.SystemBus()
diff --git a/test/test-location b/test/test-location
new file mode 100755
index 00000000..850e472b
--- /dev/null
+++ b/test/test-location
@@ -0,0 +1,20 @@
+import dbus
+import sys
+import glib
+
+bus = dbus.SystemBus()
+
+if len(sys.argv) == 2:
+ path = sys.argv[1]
+else:
+ manager = dbus.Interface(bus.get_object('org.ofono', '/'),
+ 'org.ofono.Manager')
+ modems = manager.GetModems()
+ path = modems[0][0]
+
+print("Connecting modem %s..." % path)
+modem = dbus.Interface(bus.get_object('org.ofono', path),
+ 'org.ofono.LocationReporting')
+
+fd = modem.Request()
+
--
(english)
http://www.livejournal.com/~pavelmachek
(cesky, pictures)
http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html