Hi Gabriel,

  { >>>       struct gemalto_data *data = ofono_modem_get_data(modem);
      const char *app, *mdm;
  -    DBG("%p", modem);
+    /* Close devices */
+    g_at_chat_unref(data->mdm);
+    g_at_chat_unref(data->app);
+

Why would you close both devices?  It is unnecessary, especially in the case that the modem is already up and responding to commands.
Because it seems that opening the device while it is not ready leads the driver to a weird state. When the modem becomes ready, I am not able to send any AT command to the APP device.
Here is the output:

ofonod[12826]: src/modem.c:get_modem_property() modem 0x72b750 property Application ofonod[12826]: src/modem.c:get_modem_property() modem 0x72b750 property Modem
ofonod[12826]: plugins/gemalto.c:open_device() Opening device /dev/ttyACM1
ofonod[12826]: plugins/gemalto.c:open_device() Opening device /dev/ttyACM0
ofonod[12826]: plugins/gemalto.c:gemalto_modem_ready()
ofonod[12826]: plugins/gemalto.c:gemalto_initialize()
ofonod[12826]: src/modem.c:get_modem_property() modem 0x72b750 property Application ofonod[12826]: src/modem.c:get_modem_property() modem 0x72b750 property Modem
ofonod[12826]: plugins/gemalto.c:gemalto_hardware_monitor_enable()
ofonod[12826]: Mdm> ATE0\r
ofonod[12826]: Mdm< ATE0\r\r\nOK\r\n
ofonod[12826]: Mdm> AT&C0\r
ofonod[12826]: Mdm< \r\n+CME ERROR: operation not supported\r\n
ofonod[12826]: src/modem.c:set_powered_timeout() modem: 0x72b750

When it is re-opened, it works fine.

So my question was two fold:

1. Why would you open both devices? Wouldn't opening just one to figure out whether the modem is 'ready' or not be enough? 2. If the modem is ready, why would you close the opened device? That just seems to be a waste of time.

If the device isn't ready then I could see how re-opening the port might be required.

+
+    if(!strncmp(model, GEMALTO_MODEL_ALS3, 4)) {
+        ofono_lte_create(modem, "atmodem", data->app);
+    }

Why strncmp?  No need for {} and there should be a space between if and '('
Because strncmp is more secured than strcmp. But if you prefer strcmp or anything else, I'll change it.

In this case they're the same and its not like you have user input to worry about here...

Regards,
-Denis
_______________________________________________
ofono mailing list
ofono@ofono.org
https://lists.ofono.org/mailman/listinfo/ofono

Reply via email to