ublox: make device selection more flexible

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.
This commit is contained in:
Jonas Bonn 2019-03-12 12:09:57 +01:00 committed by Denis Kenzior
parent e70789534e
commit 55bec598b6
1 changed files with 10 additions and 11 deletions

View File

@ -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);