Fibocom L850-GL hangs upon connect.

2018-08-07 Thread Daniel Wood
I have been given a Fibocom L850-GL that seems to be stuck in NCM mode.
As I have not had any luck changing the mode back to MBIM:
ModemManager[25270]:  [1533696762.104669] (ttyACM0): -->
'AT+GTUSBMODE?'
ModemManager[25270]:  [1533696762.121517] (ttyACM0): <--
'+CME ERROR: 4'
ModemManager[25270]:  [1533696831.512880] (ttyACM0): -->
'AT+GTUSBMODE=2'
ModemManager[25270]:  [1533696831.530829] (ttyACM0): <--
'+CME ERROR: 4'

I figured I would try to see how it works under the latest version of
ModemManager, but as soon as you try to actually connect to the internet,
the serial port locks up. Now, given the state of this modem, it may have
nothing to do with ModemManager. Since it may possibly or this may assist
in adding support for these Intel XMM based chipsets, I have collected all
the information I could think of to make it available to you guys,
including debug logs and bus trees.

[85855.509892] usb 2-1.5: New USB device found, idVendor=8087,
idProduct=07f5
[85855.509896] usb 2-1.5: New USB device strings: Mfr=0, Product=0,
SerialNumber=0
[85856.714197] usb 2-1.5: USB disconnect, device number 43
[85861.288570] usb 2-1.5: new high-speed USB device number 44 using ehci-pci
[85861.405658] usb 2-1.5: New USB device found, idVendor=8087,
idProduct=095a
[85861.405662] usb 2-1.5: New USB device strings: Mfr=1, Product=2,
SerialNumber=3
[85861.405665] usb 2-1.5: Product: MODEM + 2 CDC-ACM + 3 CDC-NCM + SS
[85861.405667] usb 2-1.5: Manufacturer: Intel Corp.
[85861.405669] usb 2-1.5: SerialNumber: 00499901064


It is 3000+ lines of info, so I created a Gist:
https://gist.github.com/danielewood/1022919b7547c50fb514a652aa3ec1f3

Let me know if there is any other information that is needed and I'll pull
it. Also, I can create a temporary linux install on a junk USB drive and
provide you with remote ssh access to the machine if someone wants to have
full access and do whatever they want. The broadband plan is unlimited, so
I'm not at all worried bandwidth use.

I also decided to compile ModemManager from the git master branch, those
results are at the end of the page.

Thanks,
-Dan
___
ModemManager-devel mailing list
ModemManager-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/modemmanager-devel


[PATCH 1/2] broadband-modem-mbim: check if modem implements MBIM_CID_PCO

2018-08-07 Thread Ben Chan
Being a part of a series that adds PCO support for MBIM modems that
implement the MBIM_CID_PCO extension, this patch issues a
MBIM_CID_DEVICE_SERVICES query during the modem initialization to check
if a modem implements MBIM_CID_PCO. If the modem does, ModemManager will
subscribe to MBIM_CID_PCO notifications to get PCO updates.
---
 src/mm-broadband-modem-mbim.c | 83 ++-
 1 file changed, 81 insertions(+), 2 deletions(-)

diff --git a/src/mm-broadband-modem-mbim.c b/src/mm-broadband-modem-mbim.c
index 7a62fa46..eab833f6 100644
--- a/src/mm-broadband-modem-mbim.c
+++ b/src/mm-broadband-modem-mbim.c
@@ -81,6 +81,7 @@ struct _MMBroadbandModemMbimPrivate {
 guint notification_id;
 ProcessNotificationFlag setup_flags;
 ProcessNotificationFlag enable_flags;
+gboolean is_pco_supported;
 
 /* 3GPP registration helpers */
 gchar *current_operator_id;
@@ -1737,6 +1738,84 @@ parent_initialization_started (GTask *task)
 task);
 }
 
+static void
+query_device_services_ready (MbimDevice   *device,
+ GAsyncResult *res,
+ GTask*task)
+{
+MMBroadbandModemMbim *self;
+MbimMessage *response;
+GError *error = NULL;
+MbimDeviceServiceElement **device_services;
+guint32 device_services_count;
+
+self = g_task_get_source_object (task);
+self->priv->is_pco_supported = FALSE;
+
+response = mbim_device_command_finish (device, res, );
+if (response &&
+mbim_message_response_get_result (response, 
MBIM_MESSAGE_TYPE_COMMAND_DONE, ) &&
+mbim_message_device_services_response_parse (
+response,
+_services_count,
+NULL, /* max_dss_sessions */
+_services,
+)) {
+guint32 i;
+
+for (i = 0; i < device_services_count; i++) {
+MbimService service;
+guint32 j;
+
+service = mbim_uuid_to_service 
(_services[i]->device_service_id);
+if (service != MBIM_SERVICE_BASIC_CONNECT_EXTENSIONS)
+continue;
+
+for (j = 0; j < device_services[i]->cids_count; j++) {
+if (device_services[i]->cids[j] == 
MBIM_CID_BASIC_CONNECT_EXTENSIONS_PCO) {
+mm_dbg ("PCO is supported");
+self->priv->is_pco_supported = TRUE;
+break;
+}
+}
+
+break;
+}
+mbim_device_service_element_array_free (device_services);
+} else {
+/* Ignore error */
+mm_warn ("Couldn't query device services: %s", error->message);
+g_error_free (error);
+}
+
+if (response)
+mbim_message_unref (response);
+
+parent_initialization_started (task);
+}
+
+static void
+query_device_services (GTask *task)
+{
+InitializationStartedContext *ctx;
+MbimMessage *message;
+MbimDevice *device;
+
+ctx = g_task_get_task_data (task);
+device = mm_port_mbim_peek_device (ctx->mbim);
+g_assert (device);
+
+mm_dbg ("querying device services...");
+message = mbim_message_device_services_query_new (NULL);
+mbim_device_command (device,
+ message,
+ 10,
+ NULL,
+ (GAsyncReadyCallback)query_device_services_ready,
+ task);
+mbim_message_unref (message);
+}
+
 static void
 mbim_device_removed_cb (MbimDevice *device,
 MMBroadbandModemMbim *self)
@@ -1806,7 +1885,7 @@ mbim_port_open_ready (MMPortMbim *mbim,
  * initialization */
 self = MM_BROADBAND_MODEM_MBIM (g_task_get_source_object (task));
 track_mbim_device_removed (self, mbim);
-parent_initialization_started (task);
+query_device_services (task);
 }
 
 static void
@@ -1837,7 +1916,7 @@ initialization_started (MMBroadbandModem *self,
 /* Nothing to be done, just connect to a signal and launch parent's
  * callback */
 track_mbim_device_removed (MM_BROADBAND_MODEM_MBIM (self), ctx->mbim);
-parent_initialization_started (task);
+query_device_services (task);
 return;
 }
 
-- 
2.18.0.597.ga71716f1ad-goog

___
ModemManager-devel mailing list
ModemManager-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/modemmanager-devel


[PATCH 2/2] broadband-modem-mbim: subscribe to MBIM_CID_PCO notifications

2018-08-07 Thread Ben Chan
This patch changes MMBroadbandModem to subscribe to MBIM_CID_PCO
notifications if the modem supports that.
---
 src/mm-broadband-modem-mbim.c | 76 ---
 1 file changed, 71 insertions(+), 5 deletions(-)

diff --git a/src/mm-broadband-modem-mbim.c b/src/mm-broadband-modem-mbim.c
index eab833f6..79c2726f 100644
--- a/src/mm-broadband-modem-mbim.c
+++ b/src/mm-broadband-modem-mbim.c
@@ -65,6 +65,7 @@ typedef enum {
 PROCESS_NOTIFICATION_FLAG_CONNECT  = 1 << 3,
 PROCESS_NOTIFICATION_FLAG_SUBSCRIBER_INFO  = 1 << 4,
 PROCESS_NOTIFICATION_FLAG_PACKET_SERVICE   = 1 << 5,
+PROCESS_NOTIFICATION_FLAG_PCO  = 1 << 6,
 } ProcessNotificationFlag;
 
 struct _MMBroadbandModemMbimPrivate {
@@ -2484,6 +2485,48 @@ sms_notification (MMBroadbandModemMbim *self,
 }
 }
 
+static void
+basic_connect_extensions_notification_pco (MMBroadbandModemMbim *self,
+   MbimMessage *notification)
+{
+MbimPcoValue *pco_value;
+GError *error = NULL;
+gchar *pco_data_hex;
+
+if (!mbim_message_basic_connect_extensions_pco_notification_parse (
+notification,
+_value,
+)) {
+mm_warn ("Couldn't parse PCO notification: %s", error->message);
+g_error_free (error);
+return;
+}
+
+pco_data_hex = mm_utils_bin2hexstr (pco_value->pco_data_buffer, 
pco_value->pco_data_size);
+mm_dbg ("Received PCO: session ID=%u type=%s size=%u data=%s",
+ pco_value->session_id,
+ mbim_pco_type_get_string (pco_value->pco_data_type),
+ pco_value->pco_data_size,
+ pco_data_hex);
+g_free (pco_data_hex);
+mbim_pco_value_free (pco_value);
+}
+
+static void
+basic_connect_extensions_notification (MMBroadbandModemMbim *self,
+   MbimMessage *notification)
+{
+switch (mbim_message_indicate_status_get_cid (notification)) {
+case MBIM_CID_BASIC_CONNECT_EXTENSIONS_PCO:
+if (self->priv->setup_flags & PROCESS_NOTIFICATION_FLAG_PCO)
+basic_connect_extensions_notification_pco (self, notification);
+break;
+default:
+/* Ignore */
+break;
+}
+}
+
 static void
 device_notification_cb (MbimDevice *device,
 MbimMessage *notification,
@@ -2501,6 +2544,9 @@ device_notification_cb (MbimDevice *device,
 case MBIM_SERVICE_BASIC_CONNECT:
 basic_connect_notification (self, notification);
 break;
+case MBIM_SERVICE_BASIC_CONNECT_EXTENSIONS:
+basic_connect_extensions_notification (self, notification);
+break;
 case MBIM_SERVICE_SMS:
 sms_notification (self, notification);
 break;
@@ -2518,13 +2564,14 @@ common_setup_cleanup_unsolicited_events_sync 
(MMBroadbandModemMbim *self,
 if (!device)
 return;
 
-mm_dbg ("Supported notifications: signal (%s), registration (%s), sms 
(%s), connect (%s), subscriber (%s), packet (%s)",
+mm_dbg ("Supported notifications: signal (%s), registration (%s), sms 
(%s), connect (%s), subscriber (%s), packet (%s), pco (%s)",
 self->priv->setup_flags & PROCESS_NOTIFICATION_FLAG_SIGNAL_QUALITY 
? "yes" : "no",
 self->priv->setup_flags & 
PROCESS_NOTIFICATION_FLAG_REGISTRATION_UPDATES ? "yes" : "no",
 self->priv->setup_flags & PROCESS_NOTIFICATION_FLAG_SMS_READ ? 
"yes" : "no",
 self->priv->setup_flags & PROCESS_NOTIFICATION_FLAG_CONNECT ? 
"yes" : "no",
 self->priv->setup_flags & 
PROCESS_NOTIFICATION_FLAG_SUBSCRIBER_INFO ? "yes" : "no",
-self->priv->setup_flags & PROCESS_NOTIFICATION_FLAG_PACKET_SERVICE 
? "yes" : "no");
+self->priv->setup_flags & PROCESS_NOTIFICATION_FLAG_PACKET_SERVICE 
? "yes" : "no",
+self->priv->setup_flags & PROCESS_NOTIFICATION_FLAG_PCO ? "yes" : 
"no");
 
 if (setup) {
 /* Don't re-enable it if already there */
@@ -2600,6 +2647,8 @@ cleanup_unsolicited_events_3gpp (MMIfaceModem3gpp *_self,
 if (is_sim_hot_swap_configured)
 self->priv->setup_flags &= ~PROCESS_NOTIFICATION_FLAG_SUBSCRIBER_INFO;
 self->priv->setup_flags &= ~PROCESS_NOTIFICATION_FLAG_PACKET_SERVICE;
+if (self->priv->is_pco_supported)
+self->priv->setup_flags &= ~PROCESS_NOTIFICATION_FLAG_PCO;
 common_setup_cleanup_unsolicited_events (self, FALSE, callback, user_data);
 }
 
@@ -2614,6 +2663,8 @@ setup_unsolicited_events_3gpp (MMIfaceModem3gpp *_self,
 self->priv->setup_flags |= PROCESS_NOTIFICATION_FLAG_CONNECT;
 self->priv->setup_flags |= PROCESS_NOTIFICATION_FLAG_SUBSCRIBER_INFO;
 self->priv->setup_flags |= PROCESS_NOTIFICATION_FLAG_PACKET_SERVICE;
+if (self->priv->is_pco_supported)
+self->priv->setup_flags |= PROCESS_NOTIFICATION_FLAG_PCO;
 common_setup_cleanup_unsolicited_events (self, TRUE, callback, user_data);
 }
 
@@ -2688,15 +2739,16 @@ 

Re: [RFC] Deprecate SubscriptionState?

2018-08-07 Thread Ben Chan
On Tue, Aug 7, 2018 at 7:22 AM Dan Williams  wrote:
>
> On Tue, 2018-08-07 at 01:07 +0200, Aleksander Morgado wrote:
> > Hey,
> >
> > Why raw PCO data in hex string? Why not directly the binary data?
> > e.g.
> > "ay" instead of "s". The signature could be then "a(iay)"
>
> Yeah I'd vote for byte array eg "a(iay)" (eg array of struct of integer
> + byte array).
>

Sounds good. We will need to indicate whether the received PCO is
partial or complete, so I'll go with something like an array of struct
of (uint32 + boolean + byte array),  i.e. a(ubay).

I'm planning to do the following:
1. introduce the new Pco property under Modem3gpp interface
2. set it up for modems supporting MBIM_CID_PCO
3. migrate the altair-lte plugin to use the Pco property
4. migrate Chromium OS to use the Pco property instead of the
SubscriptionState property
5. remove the SubscriptionState property from Modem3gpp -- this is an
MM API break, so a version bump will be needed

Does that sound like a plan?

> Dan
___
ModemManager-devel mailing list
ModemManager-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/modemmanager-devel


Re: [RFC] Deprecate SubscriptionState?

2018-08-07 Thread Dan Williams
On Tue, 2018-08-07 at 01:07 +0200, Aleksander Morgado wrote:
> Hey,
> 
> > > 
> > > At some point we need to handle network-initiated bearers in MM
> > > though.
> > > 
> > 
> > Given that the SessionId reported in a MBIM_CID_PCO notification
> > may
> > not be associated with any CID managed/known to ModemManager, we
> > may
> > simply expose a PCO property under the Modem3gpp interface. The PCO
> > property can be a list of (session_id, raw_pco_data_in_hex_str)
> > pair
> > (i.e.  a(is) or a{is} as the D-Bus type).  Does that make sense?
> 
> Why raw PCO data in hex string? Why not directly the binary data?
> e.g.
> "ay" instead of "s". The signature could be then "a(iay)"

Yeah I'd vote for byte array eg "a(iay)" (eg array of struct of integer
+ byte array).

Dan
___
ModemManager-devel mailing list
ModemManager-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/modemmanager-devel


Re: Adding AT commands to activate call audio over USB endpoint

2018-08-07 Thread Aleksander Morgado
Hey,

> We're using a SIMCom SIM7100 modem which has the ability to exchange
> call audio data over a USB serial endpoint⁰.  To enable this, the modem
> needs an AT command after the call has connected, AT+CPCMREG=1, and a
> command after call has disconnected, AT+CPCMREG=0.
>

Would these commands be needed as soon as a call is started (even if
not established)? or just when established?
Also, how would it work for received calls, at which point should the
command be executed?

> Not knowing the internals of ModemManager too well, I'm wondering if
> anyone could advise on an appropriate way to add these AT commands for
> our particular modem?
>

The way to do this would be to define a new async command in the Voice
interface struct (mm-iface-modem-voice.h) and then in the same voice
interface implementation setup the logic to call that command whenever
needed, but only if it is implemented (e.g. in this case we would have
NULL defaults as others modems don't need this). Once that logic is in
place, we would need a new "simcom" plugin (there is none right now),
which creates a new MMBroadbandModemSimcom that implements the voice
interface and subclasses the specific command.

The asynccommand could just be something like:

gboolean (* setup_audio) (
MMIfaceModemVoice *self,
GAsyncReadyCallback callback,
gpointer user_data);
gboolean (* setup_audio_finish) (
MMIfaceModemVoice *self,
GAsyncResult *res,
GError **error);

It's a bit of work to set it up, but that is how we're able to support
multiple different modems of very different kinds, by providing common
logic (e.g. in the interface implementations) that may be subclassed
differently by the different plugins.

-- 
Aleksander
https://aleksander.es
___
ModemManager-devel mailing list
ModemManager-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/modemmanager-devel


Adding AT commands to activate call audio over USB endpoint

2018-08-07 Thread Bob Ham
Hi there,

We're using a SIMCom SIM7100 modem which has the ability to exchange
call audio data over a USB serial endpoint⁰.  To enable this, the modem
needs an AT command after the call has connected, AT+CPCMREG=1, and a
command after call has disconnected, AT+CPCMREG=0.

Not knowing the internals of ModemManager too well, I'm wondering if
anyone could advise on an appropriate way to add these AT commands for
our particular modem?

Thanks,

Bob


⁰
http://simcomm2m.com/UploadFile/TechnicalFile/SIM7100_SIM7500_SIM7600%20Series_USB%20AUDIO_Application%20Note_V1.03.pdf

-- 
Bob Ham 

for (;;) { ++pancakes; }



signature.asc
Description: OpenPGP digital signature
___
ModemManager-devel mailing list
ModemManager-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/modemmanager-devel