Age | Commit message (Collapse) | Author |
|
|
|
These modules have 2 different USB layouts:
The default layout with PID 0x9205 (AT+CUSBSELNV=1) exposes 4 TTYs and
an ECM interface:
T: Bus=02 Lev=01 Prnt=01 Port=02 Cnt=01 Dev#= 6 Spd=480 MxCh= 0
D: Ver= 2.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs= 1
P: Vendor=1e0e ProdID=9205 Rev=00.00
S: Manufacturer=SimTech, Incorporated
S: Product=SimTech SIM7080
S: SerialNumber=1234567890ABCDEF
C: #Ifs= 6 Cfg#= 1 Atr=e0 MxPwr=500mA
I: If#=0x0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
I: If#=0x1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
I: If#=0x2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
I: If#=0x3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
I: If#=0x4 Alt= 0 #EPs= 1 Cls=02(commc) Sub=06 Prot=00 Driver=cdc_ether
I: If#=0x5 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver=cdc_ether
The purpose of each TTY is as follows:
* ttyUSB0: DIAG/QCDM port.
* ttyUSB1: GNSS data.
* ttyUSB2: AT-capable port (control).
* ttyUSB3: AT-capable port (data).
In the secondary layout with PID=0x9206 (AT+CUSBSELNV=86) the module
exposes 6 TTY ports:
T: Bus=02 Lev=01 Prnt=01 Port=02 Cnt=01 Dev#= 8 Spd=480 MxCh= 0
D: Ver= 2.00 Cls=02(commc) Sub=00 Prot=00 MxPS=64 #Cfgs= 1
P: Vendor=1e0e ProdID=9206 Rev=00.00
S: Manufacturer=SimTech, Incorporated
S: Product=SimTech SIM7080
S: SerialNumber=1234567890ABCDEF
C: #Ifs= 6 Cfg#= 1 Atr=e0 MxPwr=500mA
I: If#=0x0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
I: If#=0x1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
I: If#=0x2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
I: If#=0x3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
I: If#=0x4 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
I: If#=0x5 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
The purpose of each TTY is as follows:
* ttyUSB0: DIAG/QCDM port.
* ttyUSB1: GNSS data.
* ttyUSB2: AT-capable port (control).
* ttyUSB3: QFLOG interface.
* ttyUSB4: DAM interface.
* ttyUSB5: AT-capable port (data).
|
|
|
|
|
|
|
|
|
|
|
|
So that we can provide the specific object id in every log associated
to a given object.
|
|
|
|
simtech/mm-broadband-modem-simtech.c: In function ‘enable_unsolicited_events_context_step’:
simtech/mm-broadband-modem-simtech.c:442:18: error: this statement may fall through [-Werror=implicit-fallthrough=]
442 | ctx->step++;
| ~~~~~~~~~^~
simtech/mm-broadband-modem-simtech.c:444:5: note: here
444 | case ENABLE_UNSOLICITED_EVENTS_STEP_LAST:
| ^~~~
|
|
simtech/mm-broadband-modem-simtech.c: In function ‘enable_unsolicited_events_context_step’:
simtech/mm-broadband-modem-simtech.c:378:5: error: switch missing default case [-Werror=switch-default]
378 | switch (ctx->step) {
| ^~~~~~
simtech/mm-broadband-modem-simtech.c: In function ‘disable_unsolicited_events_context_step’:
simtech/mm-broadband-modem-simtech.c:563:5: error: switch missing default case [-Werror=switch-default]
563 | switch (ctx->step) {
| ^~~~~~
|
|
simtech/mm-broadband-modem-simtech.c: In function ‘simtech_act_to_mm_act’:
simtech/mm-broadband-modem-simtech.c:89:19: error: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’ [-Werror=sign-compare]
89 | return (nsmod < G_N_ELEMENTS (simtech_act_to_mm_act_map) ? simtech_act_to_mm_act_map[nsmod] : MM_MODEM_ACCESS_TECHNOLOGY_UNKNOWN);
| ^
|
|
Useful when clamping a unsigned integer with low threshold set to 0,
which would give us compiler warnings with -Wtype-limits when using
CLAMP(), e.g.:
via/mm-broadband-modem-via.c: In function ‘handle_evdo_quality_change’:
/usr/include/glib-2.0/glib/gmacros.h:811:63: error: comparison of unsigned expression < 0 is always false [-Werror=type-limits]
811 | #define CLAMP(x, low, high) (((x) > (high)) ? (high) : (((x) < (low)) ? (low) : (x)))
| ^
via/mm-broadband-modem-via.c:284:19: note: in expansion of macro ‘CLAMP’
284 | quality = CLAMP (quality, 0, 100);
| ^~~~~
|
|
simtech/tests/test-modem-helpers-simtech.c: In function ‘test_clcc_urc_single’:
simtech/tests/test-modem-helpers-simtech.c:98:64: error: initialization discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
98 | { 1, MM_CALL_DIRECTION_INCOMING, MM_CALL_STATE_ACTIVE, "123456789" }
| ^~~~~~~~~~~
simtech/tests/test-modem-helpers-simtech.c: In function ‘test_clcc_urc_multiple’:
simtech/tests/test-modem-helpers-simtech.c:113:65: error: initialization discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
113 | { 2, MM_CALL_DIRECTION_INCOMING, MM_CALL_STATE_ACTIVE, "123456789" },
| ^~~~~~~~~~~
simtech/tests/test-modem-helpers-simtech.c:114:65: error: initialization discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
114 | { 3, MM_CALL_DIRECTION_INCOMING, MM_CALL_STATE_ACTIVE, "987654321" },
| ^~~~~~~~~~~
simtech/tests/test-modem-helpers-simtech.c: In function ‘test_clcc_urc_complex’:
simtech/tests/test-modem-helpers-simtech.c:130:65: error: initialization discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
130 | { 1, MM_CALL_DIRECTION_INCOMING, MM_CALL_STATE_ACTIVE, "123456789" },
| ^~~~~~~~~~~
simtech/tests/test-modem-helpers-simtech.c:131:65: error: initialization discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
131 | { 2, MM_CALL_DIRECTION_INCOMING, MM_CALL_STATE_WAITING, "987654321" },
| ^~~~~~~~~~~
|
|
https://source.puri.sm/Librem5/ModemManager/issues/6
|
|
We'll use +CPCMREG=1/0 to start/stop USB audio function, and we will
also report the specific ttyUSB port to be used for audio in the Call
interface.
|
|
|
|
The SIM7600E ends up emitting these URCs with too many <CR>s, and the
generic +CRING handler doesn't catch them, interfering with other
actions, e.g.:
$ sudo mmcli --call 1 --accept
error: couldn't accept the call: 'GDBus.Error:org.freedesktop.ModemManager1.Error.Core.Failed: Couldn't accept the call: Unhandled response '+CRING: VOICE
+CRING: VOICE''
|
|
Just processing and parsing them for now, so that they don't interfere
with other commands:
$ sudo mmcli --call 1 --accept
error: couldn't accept the call: 'GDBus.Error:org.freedesktop.ModemManager1.Error.Core.Failed: Couldn't accept the call: Unhandled response '
VOICE CALL: BEGIN''
|
|
|
|
We don't expect them in the set of values we support, but they may
happen according to the spec.
|
|
|
|
|
|
We will explicitly query for +AUTOCSQ and +CNSMOD support before
trying to enable them.
If +AUTOCSQ is supported and correctly enabled, we'll request signal
quality polling to be disabled.
If +CNSMOD is supported and correctly enabled, we'll request access
technology polling to be disabled.
|
|
The +AUTOCSQ setup enables automatic signal quality reporting via +CSQ
URCs, which unfortunately have the same format as the +CSQ command
responses.
Therefore, we need to subclass load_signal_quality() explicitly in
order to ignore those cases where the response to the +CSQ command is
received empty (already processed as a URC).
|
|
|
|
The logic to setup the generic +CIND indications in the SIM7600E seems
to end up breaking connectivity when in TTY+PPP mode. If we issue the
AT+CMER=3,0,0,1 command, this will end up in the modem not replying a
correct CONNECT response to the ATD command.
Let's disable these +CIND indications completely in the simtech
plugin, as there is even no AT command reference saying those are
supported.
Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/issues/144
|
|
The new logic is available in a new 'MMSharedSimtech' interface which
is implemented both by the generic AT-based MMBroadbandModemSimtech
modem, and by a new QMI-based new MMBroadbandModemQmiSimtech.
Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/issues/112
|
|
E.g. the SIM7600E shows up as:
P: Vendor=1e0e ProdID=9001 Rev=03.18
S: Manufacturer=SimTech, Incorporated
S: Product=SimTech, Incorporated
S: SerialNumber=0123456789ABCDEF
C: #Ifs= 6 Cfg#= 1 Atr=a0 MxPwr=500mA
I: If#=0x0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
I: If#=0x1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
I: If#=0x2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
I: If#=0x3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
I: If#=0x4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
I: If#=0x5 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=qmi_wwan
|
|
The plugin already has a VID filter for 0x1e0e, this tag is useless.
|
|
From 5s to 20s, as it seems it could take much more to complete and
get a response, as seen in the logs below.
<debug> [1568553228.546862] (ttyUSB3): --> 'AT+CNSMOD=1<CR>'
<debug> [1568553233.799470] (ttyUSB3): --> 'AT+AUTOCSQ=1,1<CR>'
<debug> [1568553238.798866] (ttyUSB3) setting up 3GPP unsolicited registration messages handlers
<debug> [1568553238.798932] (ttyUSB2) setting up 3GPP unsolicited registration messages handlers
<debug> [1568553238.798990] (ttyUSB3) device open count is 1 (close)
<warn> [1568553238.799029] (tty/ttyUSB3) at port timed out 2 consecutive times
<debug> [1568553238.799094] (ttyUSB3) device open count is 2 (open)
<debug> [1568553238.799148] (ttyUSB3): --> 'AT+CREG=2<CR>'
<warn> [1568553241.798727] (tty/ttyUSB3) at port timed out 3 consecutive times
<debug> [1568553241.798799] (ttyUSB3): --> 'AT+CREG=1<CR>'
<debug> [1568553244.795389] Enabling unsolicited registration events in primary port failed: 'AT sequence failed'
<debug> [1568553244.795462] (ttyUSB2) device open count is 2 (open)
<debug> [1568553244.795507] (ttyUSB3) device open count is 1 (close)
<warn> [1568553244.795545] (tty/ttyUSB3) at port timed out 4 consecutive times
<debug> [1568553244.795588] (ttyUSB2): --> 'AT+CREG=2<CR>'
<debug> [1568553244.800815] (ttyUSB3): <-- '<CR><LF>OK<CR><LF><CR><LF>OK<CR><LF>'
<debug> [1568553244.801624] (ttyUSB3): <-- '<CR><LF>OK<CR><LF><CR><LF>OK<CR><LF>'
<debug> [1568553244.808710] (ttyUSB2): <-- '<CR><LF>OK<CR><LF>'
|
|
We keep the pflags input in mm_base_modem_grab_port() so that plugins
can use other methods to gather port type hints (e.g. querying with AT
commands as in Huawei/Telit or looking at sysfs properties as in HSO).
For standard udev tag port type hints, it will be the base modem
looking them up.
Note that there is no longer any need to ignore non-flagged ports for
those modems that require primary/secondary flags. They will be
implicitly ignored when mm_base_modem_organize_ports() decides which
ports to use, as the flagged ones are preferred over the non-flagged
ones.
|
|
We define 3 common udev tag ids to be used by all plugins:
* ID_MM_PORT_TYPE_AT_PRIMARY: the primary modem port. It will be used
for AT control and also as PPP if there is no other port flagged
explicitly to do PPP.
* ID_MM_PORT_TYPE_AT_SECONDARY: the secondary modem port. It will be
used when/if the primary port gets connected to do PPP.
* ID_MM_PORT_TYPE_PPP: the port to be used to do PPP only. This tag
makes sense only when the primary port shouldn't be used for PPP,
i.e. when there is a port dedicated to do PPP and one port
dedicated for control.
|
|
When a new USB device is hotplugged, e.g. a USB<->RS232 converter that
exposes a single ttyUSB0, these udev events happen:
add /devices/pci0000:00/0000:00:14.0/usb2/2-1 (usb/usb-device)
add /devices/pci0000:00/0000:00:14.0/usb2/2-1/2-1:1.0 (usb/usb-interface)
add /devices/pci0000:00/0000:00:14.0/usb2/2-1/2-1:1.0/ttyUSB0 (usb-serial)
add /devices/pci0000:00/0000:00:14.0/usb2/2-1/2-1:1.0/ttyUSB0/tty/ttyUSB0 (tty)
bind /devices/pci0000:00/0000:00:14.0/usb2/2-1/2-1:1.0/ttyUSB0 (usb-serial)
bind /devices/pci0000:00/0000:00:14.0/usb2/2-1/2-1:1.0 (usb/usb-interface)
bind /devices/pci0000:00/0000:00:14.0/usb2/2-1 (usb/usb-device)
Our udev rules in MM only added tags in the 'add' events, and it looks
like the only ones 'persistent' after this sequence are those of the
last event happening on the specific path.
This meant that all TTY subsystem rules (e.g. ID_MM_CANDIDATE) would
be stored for later check (e.g. if ModemManager is started after these
rules have been applied), which was ok. "udevadm info -p ..." would
show these tags correctly always.
But this also meant that the 'bind' udev event happening for the USB
device didn't get any of our device-specific tags, and so we would be
missing them (e.g. ID_MM_DEVICE_MANUAL_SCAN_ONLY) if MM is started
after the last event has happened. "udevadm info -p ..." would
not show these tags.
Modify all our rules to also run at the 'bind' events.
See, for context:
https://github.com/systemd/systemd/issues/8221
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
There are 2 main types of udev properties: device-specific and
port-specific.
The port-specific properties are set independently per port (e.g. port
type hints set per interface number for a given vid:pid).
The device-specific properties apply to all ports in the device. Some
of these properties are currently expected in the physical device
(e.g. ID_MM_PLATFORM_DRIVER_PROBE) while some others are expected in
each port (e.g. the plugin udev tag filters).
This patch tries to simplify the logic and just assume that the device
specific tags may be given in either the physical device or the port
device, by providing separate APIs to retrieve port-specific or
device-specific (global) properties. If the same tag is given in both
the device and the port, the one in the device takes preference.
For the generic backend, these new APIs are really useless, as all
device-specific and port-specific properties are always stored in the
port object themselves (there is no 'tree' of devices in the generic
backend, no 'physdev' device).
For the udev backend, though, there really is a difference, as the
tags may be set in port or device.
https://bugs.freedesktop.org/show_bug.cgi?id=100156
|
|
The mm_base_modem_grab_port() now receives a MMKernelDevice directly from the
plugin, which is then stored in the MMPort corresponding to the port.
This means that we have direct access to e.g. all properties set by udev rules
everywhere, and we don't need additional GUdevClient objects (e.g. like the one
used in the Huawei plugin to detect NDISDUP support during runtime).
For virtual ports (e.g. generated during unit tests), we have a new 'generic'
kernel device object which just provides the values from the kernel device
properties given during its creation.
|
|
Instead of relying constantly on GUdevDevice objects reported by GUdev, we now
use a new generic object (MMKernelDevice) for which we provide an initial GUdev
based backend.
|
|
All ports of the same modem reported by the kernel will all be associated with
a common 'uid' (unique id), which uniquely identifies the physical device. This
logic was already in place, what we do now is avoid calling it the 'sysfs
path' of the physical device, because we may not want to use that to identify
a device.
This logic now also enables the possibility of "naming" the modems in a unique
way by setting the "ID_MM_PHYSDEV_UID" property in the "usb_device" that owns
all the ports.
E.g. a custom device has 4 modems in 4 different USB ports. The device path of
each USB device will always be the same, so the naming rules could go like this:
$ vim /usr/lib/udev/rules.d/78-mm-naming.rules
ACTION!="add|change|move", GOTO="mm_naming_rules_end"
DEVPATH=="/devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.5/4-1.5.1", ENV{ID_MM_PHYSDEV_UID}="USB-MODEM-1"
DEVPATH=="/devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.5/4-1.5.2", ENV{ID_MM_PHYSDEV_UID}="USB-MODEM-2"
DEVPATH=="/devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.5/4-1.5.3", ENV{ID_MM_PHYSDEV_UID}="USB-MODEM-3"
DEVPATH=="/devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.5/4-1.5.4", ENV{ID_MM_PHYSDEV_UID}="USB-MODEM-4"
LABEL="mm_naming_rules_end"
Each of the modems found will have a unique UID retrieved from the previous list
of rules. Then, "mmcli" has also been updated to allow using the UID instead of
the modem DBus path or index, e.g.:
$ sudo mmcli -m USB-MODEM-1
/org/freedesktop/ModemManager1/Modem/0 (device id '988d83252c0598f670c2d69d5f41e077204a92fd')
-------------------------
Hardware | manufacturer: 'ZTE CORPORATION'
| model: 'MF637'
| revision: 'BD_W7P673A3F3V1.0.0B04'
| supported: 'gsm-umts'
| current: 'gsm-umts'
| equipment id: '356516027657837'
-------------------------
System | device: 'USB-MODEM-1'
| drivers: 'option'
| plugin: 'ZTE'
| primary port: 'ttyUSB5'
| ports: 'ttyUSB5 (at)'
...
$ sudo mmcli -m USB-MODEM-1 --enable
...
|
|
Commit 7ff57f9808f35d434b638a67b84481271c67c90e introduced a change to try to
use ATTRS{bInterfaceNumber} as a common way to match by interface number, but
this logic is broken because all the rules that we use to match by interface
number (attribute in the interface device) also require matching by idVendor
and idProduct (attributes in the physdev device), and udev rules forbid matches
from more than one parent device at a time.
We could use ATTR{bInterfaceNumber} (instead of ATTRS) to tag the actual USB
interface device, but that would require a change in all the plugins to look for
the tag not in the TTY device, but in its parent.
So, recover the original behavior, where a hidden property is created containing
the first bInterfaceNumber found in the list of parent devices, and then run
the matches against idVendor and idProduct only if the hidden property is found
with the expected value.
|