Aleksander Morgado <[email protected]> writes:

> On Tue, Jul 4, 2017 at 9:39 PM, Tore Anderson <[email protected]> wrote:
>> The ModemManager sources contain a tool called "ipv6pref"[3] which I
>> believe to be my last resort. I haven't been able to make it work,
>> though, so I'm turning to this list for some pointers. My (initial)
>> questions are the following:
>>
>> * It is supposed to be used with a "DM port". Is that a /dev/ttyUSB* or
>> /dev/cdc-wdm0 or something else?
>>
>> * Does the tool require the modem to be in a particular configuration?
>> It has three different configurations; 1 is a vendor specific interface
>> class where I think is meant to be used as a serial modem with PPP (MM
>> recognises it in this mode), 2 is ECM mode and also the default (MM does
>> not recognise it in this mode), 3 is MBIM mode in which MM also
>> recognises it.
>
> The "DM" port is a QCDM capable ttyUSBX. If you want to know which one
> it is, run under ModemManager, and check which of the ports is flagged
> as "qcdm" in the list of ports shown in "mmcli -m 0" output; then stop
> ModemManager and you can run that tool on the tty directly (Dan should
> have more details about what the tool does, I really never played with
> it).


The write strategy of this tool does not work with newer modems for some
reason. I don't know if this is depending on firmware (probably) or
hardware. But I guess it doesn't matter much, as they are tightly tied
together.  This is most likely implemented by the Qualcomm part of the
firmware.

In any case, with the current implemetation I get these results, where
ttyUSB5 is a Huawei E392 and ttyUSB0 is a Sierra Wireless EM7455:


bjorn@miraculix:/usr/local/src/git/modemmanager/libqcdm$ tests/ipv6pref  
/dev/ttyUSB5  --debug
DM:ENC>>> (136)  26 68 07 00 00 00 00 00 00 00 00 00 00 00 00 00 
                 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
                 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
                 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
                 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
                 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
                 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
                 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
                 00 00 00 00 00 60 1c 7e 
QCDM:DEC<< (133)  26 68 07 01 00 00 00 00 00 00 00 00 00 00 00 00 
                  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
                  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
                  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
                  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
                  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
                  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
                  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
                  00 00 00 00 00 
IPv6: enabled
bjorn@miraculix:/usr/local/src/git/modemmanager/libqcdm$ tests/ipv6pref  
/dev/ttyUSB0  --debug
DM:ENC>>> (136)  26 68 07 00 00 00 00 00 00 00 00 00 00 00 00 00 
                 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
                 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
                 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
                 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
                 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
                 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
                 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
                 00 00 00 00 00 60 1c 7e 
E: failed to receive QCDM IPv6 pref command reply
E: failed to get IPv6 state



With the attached patch it works for both these modems.  Note that the
EM7455 doesn't use this NV item setting at all (or has an inverted
default - I don't know), so the item is read as DIAG_NV_STATUS_INACTIVE
(5).  We interpret this as 'disabled' which isn't entirely correct.  The
correct would probably be 'default', where the real value of depends on
hardware/firmware versions...


Anyway, the point is that the patch allows me to read this NV item from
the EM7455 too:


bjorn@miraculix:/usr/local/src/git/modemmanager/libqcdm$ tests/ipv6pref  
/dev/ttyUSB5  --debug
DM:ENC>>> (136)  26 68 07 00 00 00 00 00 00 00 00 00 00 00 00 00 
                 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
                 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
                 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
                 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
                 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
                 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
                 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
                 00 00 00 00 00 60 1c 7e 
QCDM:DEC<< (133)  26 68 07 01 00 00 00 00 00 00 00 00 00 00 00 00 
                  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
                  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
                  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
                  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
                  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
                  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
                  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
                  00 00 00 00 00 
IPv6: enabled
bjorn@miraculix:/usr/local/src/git/modemmanager/libqcdm$ tests/ipv6pref  
/dev/ttyUSB0  --debug
DM:ENC>>> (136)  26 68 07 00 00 00 00 00 00 00 00 00 00 00 00 00 
                 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
                 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
                 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
                 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
                 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
                 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
                 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
                 00 00 00 00 00 60 1c 7e 
QCDM:DEC<< (133)  26 68 07 00 00 00 00 00 00 00 00 00 00 00 00 00 
                  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
                  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
                  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
                  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
                  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
                  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
                  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
                  00 00 00 05 00 
<info> [commands.c:278] check_nv_cmd(): The NV operation failed (status 0x5).
IPv6: disabled



I don't know if this will help Tore much anyway.  I did some testing
with the E392 to confirm that I remembered correctly: This modem does
*not* change the output of any command when IPv6 is disabled.  The only
visible difference is that IPv6 connections fail.  You can still
configure them.


In the current state, with IPv6 enabled, everything works on the E392:

root@miraculix:/tmp# qmicli -d /dev/cdc-wdm1  
--wds-start-network=apn=telenor.smart,ip-type=6  --wds-follow-network
[/dev/cdc-wdm1] Network started
        Packet data handle: '34967784'

Ctrl+C will stop the network
^Ccancelling the operation...
Network cancelled... releasing resources
Network cancelled... releasing resources
error: operation failed: Cannot store transaction: Request is already cancelled
root@miraculix:/tmp# qmicli -d /dev/cdc-wdm1  
--wds-start-network=apn=telenor.smart,ip-type=6   --client-no-release-cid  
[/dev/cdc-wdm1] Network started
        Packet data handle: '34967784'
[/dev/cdc-wdm1] Client ID not released:
        Service: 'wds'
            CID: '2'
root@miraculix:/tmp# 
root@miraculix:/tmp# 
root@miraculix:/tmp#  --wds-get-current-settings qmicli -d /dev/cdc-wdm1  -^C
root@miraculix:/tmp# qmicli -d /dev/cdc-wdm1  --wds-get-current-settings  
--client-cid=2 --client-no-release-cid
[/dev/cdc-wdm1] Current settings retrieved:
           IP Family: IPv6
        IPv6 address: 2a02:2121:2c9:eac3:902f:2476:b07a:8be7/64
IPv6 gateway address: 2a02:2121:2c9:eac3:80ff:7398:20bd:d5f8/64
    IPv6 primary DNS: 2001:4600:4:fff::52
  IPv6 secondary DNS: 2001:4600:4:1fff::52
                 MTU: 1500
             Domains: none
[/dev/cdc-wdm1] Client ID not released:
        Service: 'wds'
            CID: '2'




Disabling IPv6 on the E392:


bjorn@miraculix:/usr/local/src/git/modemmanager/libqcdm$ tests/ipv6pref  
/dev/ttyUSB5 --disable
IPv6: enabled
IPv6 successfully disabled. Replug your device.
bjorn@miraculix:/usr/local/src/git/modemmanager/libqcdm$ tests/ipv6pref  
/dev/ttyUSB5  --debug 
DM:ENC>>> (136)  26 68 07 00 00 00 00 00 00 00 00 00 00 00 00 00 
                 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
                 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
                 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
                 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
                 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
                 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
                 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
                 00 00 00 00 00 60 1c 7e 
QCDM:DEC<< (133)  26 68 07 00 00 00 00 00 00 00 00 00 00 00 00 00 
                  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
                  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
                  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
                  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
                  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
                  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
                  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
                  00 00 00 00 00 
IPv6: disabled



After replugging the E392, we still see the IPV6 and IPV4V6 context types:


ati                                                                             
                                                    
Manufacturer: Huawei Technologies Co., Ltd.                                     
                                                    
Model: E392                                                                     
                                                    
Revision: 11.335.13.00.000
IMEI: 860999000023707
+GCAP: +CGSM

OK
at+cgdcont=?
+CGDCONT: (1-16),"IP",,,(0-2),(0-4)
+CGDCONT: (1-16),"PPP",,,(0-2),(0-4)
+CGDCONT: (1-16),"IPV6",,,(0-2),(0-4)
+CGDCONT: (1-16),"IPV4V6",,,(0-2),(0-4)

OK
at+cgdcont?
+CGDCONT: 1,"IPV4V6","telenor.smart","0.0.0.0",0,0

OK



But now IPv6 connections do not work anymore:

root@miraculix:/tmp# qmicli -d /dev/cdc-wdm1  
--wds-start-network=apn=telenor.smart,ip-type=6  --client-no-release-cid
error: couldn't start network: QMI protocol error (14): 'CallFailed'
call end reason (1): generic-unspecified
verbose call end reason (2,204): [internal] unknown-cause
[/dev/cdc-wdm1] Client ID not released:
        Service: 'wds'
            CID: '1'


IPv4 connections do of course still work:

root@miraculix:/tmp# qmicli -d /dev/cdc-wdm1  
--wds-start-network=apn=telenor.smart,ip-type=4  --client-no-release-cid
[/dev/cdc-wdm1] Network started
        Packet data handle: '34969280'
[/dev/cdc-wdm1] Client ID not released:
        Service: 'wds'
            CID: '2'




This behaviour is so different from the symptoms Tore see, that I doubt
there is any relation.  Still, it can't harm to test if the attached
patch allows writing anything that NV item...  Or it can harm - I never
give out gurantees when it comes to arbitrary NVRAM writes ;-)



Bjørn

>From 1d11e070be2f9b57496a67820501d7c91c39b99f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B8rn=20Mork?= <[email protected]>
Date: Wed, 5 Jul 2017 11:56:47 +0200
Subject: [PATCH] qcdm: replace single byte write in ipv6pref
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Single byte writes fails with some firmware versions.  Writing
complete records appear to work better.

Signed-off-by: Bjørn Mork <[email protected]>
---
 libqcdm/tests/ipv6pref.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libqcdm/tests/ipv6pref.c b/libqcdm/tests/ipv6pref.c
index ffb7a7e9bc45..f1fdce96a7dc 100644
--- a/libqcdm/tests/ipv6pref.c
+++ b/libqcdm/tests/ipv6pref.c
@@ -95,7 +95,7 @@ qcdm_send (int fd, char *buf, size_t len)
 
 	while (i < len) {
 		errno = 0;
-		status = write (fd, &buf[i], 1);
+		status = write (fd, &buf[i], len);
 		if (status < 0) {
 			if (errno == EAGAIN) {
 				eagain_count--;
@@ -104,7 +104,7 @@ qcdm_send (int fd, char *buf, size_t len)
 			} else
 				assert (errno == 0);
 		} else
-			i++;
+			i += status;
 
 		usleep (1000);
 	}
-- 
2.11.0

_______________________________________________
ModemManager-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/modemmanager-devel

Reply via email to