Many ublox modems can sit on either the USB bus or talk directly to a
UART. The udev plugin mostly takes care of figuring out what ports to
talk to and the protocol is common for all devices after that.
This patch simplifies the setup a bit:
i) There must always be an aux channel for communication with the modem
ii) The aux channel may be found behind the string Aux for USB modems
or Device for serial modems
iii) If the Modem string is set, use it; if not set, assume it's not
available.
---
plugins/ublox.c | 21 ++++++++++-----------
1 file changed, 10 insertions(+), 11 deletions(-)
diff --git a/plugins/ublox.c b/plugins/ublox.c
index 4b9d0410..32cf1e61 100644
--- a/plugins/ublox.c
+++ b/plugins/ublox.c
@@ -185,19 +185,18 @@ static int ublox_enable(struct ofono_modem *modem)
}
data->aux = open_device(modem, "Aux", "Aux: ");
- if (data->aux == NULL)
- return -EINVAL;
-
- if (data->model_id == SARA_G270) {
- data->modem = open_device(modem, "Modem", "Modem: ");
- if (data->modem == NULL) {
- g_at_chat_unref(data->aux);
- data->aux = NULL;
- return -EIO;
- }
+ /* If this is a serial modem then the device may be behind
+ * the 'Device' attribute instead...
+ */
+ if (data->aux == NULL) {
+ data->aux = open_device(modem, "Device", "Aux: ");
+ if (data->aux == NULL)
+ return -EINVAL;
+ }
+ data->modem = open_device(modem, "Modem", "Modem: ");
+ if (data->modem) {
g_at_chat_set_slave(data->modem, data->aux);
-
g_at_chat_send(data->modem, "ATE0 +CMEE=1", none_prefix,
NULL, NULL, NULL);
--
2.19.1
_______________________________________________
ofono mailing list
[email protected]
https://lists.ofono.org/mailman/listinfo/ofono