Age | Commit message (Collapse) | Author |
|
Add subsystem vendor ID support, that can be used in pci devices
instead of vendor ID customization.
|
|
Newly refactored string manipulation function is leaking memory as per
our tests. This submission fixes that memory leak.
|
|
Use autoptr to avoid the embedded goto.
|
|
The input pattern given to the string_match() method is not a regex
pattern and we cannot use it as that, because all the special
characters (e.g. '.') would not be treated correctly.
Also, the prefix matching with the wildcard at the end of the string
needs to be converted to a proper regex wildcard, i.e. '.*'.
This logic also adds support for suffix matching, with a wildcard at
the beginning of the string, e.g. as the ones used for the wwan kernel
device name matching rules (i.e. '*MBIM').
Unit tests are added to cover all cases, most of these tests were
failing without the fixes implemented here.
|
|
So that we can propertly unit-test it.
|
|
Since the 'wwan' subsystem addition to the qcom-soc plugin, the rules
to say a modem is handled by this plugin are too broad, and the plugin
attempts to support any kind of device exposed by the WWAN subsystem,
not just those from Qualcomm SoCs.
Update the plugin to require a new ID_MM_QCOM_SOC udev tag that is set
in the plugin udev rules, given that these rules already check for the
expected SoC drivers (bam-dmux, ipa, qcom-q6v5-mss).
|
|
A pointer can not be used anymore after its ownership has been transfered
using the g_steal_pointer function (pointer is nullified).
In this function, g_steal_pointer() is used when inserting 'value' inside
the array but can also be subsequently used when dumping 'value' to
'out_value' via g_strdup().
Fix that with simple reordering.
Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
|
|
Only the plural ATTRS form was checked but we also need to support
the single ATTR for matching device's attribute only.
Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
|
|
The wwan subsystem is a new bus agnostic framework exposing wwan
device and its components (ports, netdev...). It can be useful to
get the wwan device a device belongs to
Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
|
|
Add a common physdev UID to all ports in the Qualcomm SoC, so that they
are all bound together to the same modem object.
This change assumes that no external plugged device ever exports a
QRTR node in the QRTR bus (e.g. that no PCI or USB device would ever
do that). This assumption is likely wrong, but given that we're
currently limiting the QRTR support to the Qualcomm SoC plugin, the
assumption is valid for us for now.
|
|
Add the skeleton of MMKernelDeviceQrtr and allow building it by the
introduction of with-qrtr.
|
|
ModemManager[6954]: <warn> [1618260091.319919] [br0] invalid sysfs path read for net/br0
**
ERROR:kerneldevice/mm-kernel-device-generic.c:235:ptr_array_add_sysfs_attribute_link_basename: assertion failed: (array && sysfs_path && attribute)
Bail out! ERROR:kerneldevice/mm-kernel-device-generic.c:235:ptr_array_add_sysfs_attribute_link_basename: assertion failed: (array && sysfs_path && attribute)
Thread 1 "ModemManager" received signal SIGABRT, Aborted.
(gdb) bt
#0 0x00007ffff7438ef5 in raise () at /usr/lib/libc.so.6
#1 0x00007ffff7422862 in abort () at /usr/lib/libc.so.6
#2 0x00007ffff76c2084 in () at /usr/lib/libglib-2.0.so.0
#3 0x00007ffff771d85d in g_assertion_message_expr () at /usr/lib/libglib-2.0.so.0
#4 0x00005555556a5337 in ptr_array_add_sysfs_attribute_link_basename (array=0x5555557de520, sysfs_path=0x0, attribute=0x555555703bd8 "driver", out_value=0x0)
at kerneldevice/mm-kernel-device-generic.c:235
#5 0x00005555556a542b in preload_contents_other (self=0x5555557a6c60) at kerneldevice/mm-kernel-device-generic.c:255
#6 0x00005555556a6485 in preload_contents (self=0x5555557a6c60) at kerneldevice/mm-kernel-device-generic.c:517
#7 0x00005555556a7fb6 in check_preload (self=0x5555557a6c60) at kerneldevice/mm-kernel-device-generic.c:980
#8 0x00005555556a855f in initable_init (initable=0x5555557a6c60, cancellable=0x0, error=0x7fffffffe5c8) at kerneldevice/mm-kernel-device-generic.c:1127
#9 0x00007ffff78a2f41 in g_initable_new_valist () at /usr/lib/libgio-2.0.so.0
#10 0x00007ffff78a2ffa in g_initable_new () at /usr/lib/libgio-2.0.so.0
#11 0x00005555556a8205 in mm_kernel_device_generic_new_with_rules (props=0x5555557a5fa0, rules=0x7fffec001e30, error=0x7fffffffe5c8) at kerneldevice/mm-kernel-device-generic.c:1042
#12 0x00005555556a827d in mm_kernel_device_generic_new (props=0x5555557a5fa0, error=0x7fffffffe5c8) at kerneldevice/mm-kernel-device-generic.c:1063
#13 0x00005555555aba9c in handle_kernel_event (self=0x555555793220, properties=0x5555557a5fa0, error=0x7fffffffe5c8) at mm-base-manager.c:414
|
|
|
|
|
|
|
|
Based exclusively on sysfs for now. We could do this via netlink if
needed as well.
|
|
We can now setup a 'lower device' object that will be the one
providing all physdev info. This is useful when using virtual ports
that refer to a 'lower' real physical device, in order to bind
together all those ports on the same modem object.
|
|
This fixes the build when using GLib < 2.54.
|
|
Instead of creating new clients internally whenever we need them, just
make sure each MMKernelDeviceUdev object keeps a full reference to the
GUdevClient that generated all GUdevDevices.
|
|
We already have methods to query for interface specific attributes
like class/subclass/protocol, so add a new one for the interface
number, and make sure we use ATTRS{bInterfaceNumber} to load it
always, instead of assuming the ID_USB_INTERFACE_NUM property is set.
|
|
In addition to loading port and device properties, we now also allow
loading sysfs properties that are assumed to be static (i.e. their
values won't change since loaded the first time).
|
|
Instead of the custom simple implementation which only supported the
'*' modifier in the pattern. This allows us to support e.g. attribute
value matches like e.g. 'DATA[0-9]*_CNTL'.
|
|
Until now we did not support ATTRS{} matches against attributes we
don't support in the core codebase. Implement now a simple lookup
mechanism which traverses the tree of sysfs path from the port sysfs
path to the physical device sysfs path, looking up the attribute
requested.
This is not completely equivalent to what udev does, because the udev
rules matching ATTRS would usually also include an additional previous
matching e.g. SUBSYSTEMS and such, so that the ATTRS is looked up
exactly in the device that also matches the additional previous
rules. In our case, we just simplify the logic and return the first
one found.
|
|
We were applying the DRIVERS check looking only at the single port
driver. Instead, we now lookup and cache all drivers found in the
device tree, and apply the loose DRIVERS check properly looking at all
of them.
We were applying the SUBSYSTEMS and SUBSYSTEM check looking at the
sysfs path and just hoping the subsystem we're looking for is included
in the path itself. Instead, we now lookup and cache all susystems
found in the device tree, and apply the loose SUBSYSTEMS check
properly looking at all of them.
E.g. we can now match SUBSYSTEMS="mhi_q" in the following device tree,
without needing it to be found in the sysfs path:
looking at device '/devices/pci0000:00/0000:00:1b.0/0000:01:00.0/1001_00.01.00_MBIM/mhi_uci_q/mhi_MBIM':
SUBSYSTEM=="mhi_uci_q"
looking at parent device '/devices/pci0000:00/0000:00:1b.0/0000:01:00.0/1001_00.01.00_MBIM':
SUBSYSTEMS=="mhi_q"
looking at parent device '/devices/pci0000:00/0000:00:1b.0/0000:01:00.0':
SUBSYSTEMS=="pci"
|
|
The vendor and product IDs stored for the MMKernelDevice object in the
PCI subsystem are mapped to the "vendor" and "device" attributes.
|
|
The generic backend implementation was really based on detecting USB
devices, not so much devices in other subsystems. This patch puts the
generic backend at the same level as the udev backend to support
non-USB modems.
|
|
USB, PCI, PCMCIA... all these different system buses expose modems in
different ways. Instead of having single methods to attempt to load
different things for all these device types, detect first which is the
system bus in use, and then perform a bus-specific operation to
preload the different things.
|
|
We can just subclass the methods to check whether a given property
exists and to get it as a string, and then implement in the generic
class the actual boolean/int/hex type getters common for all.
|
|
These kind of checks are only useful on public APIs really, there
should be no need to have them in internal code.
|
|
Both 'physdev_subsystem' and 'interface_description' were leaking.
|
|
If multiple kernel device types inherit from MMKernerDevice, and those
are compared against each other, the current logic returns TRUE if the
G_OBJECT_TYPE of one of them is smaller than the other. This function is
checking for equality, so returning FALSE is enough.
|
|
|
|
This allows MMKernelDevice::cmp to compare two kernel devices
with different object types, which means that subclasses can
continue to only handle comparisons with their own type. The
order may not be stable across builds.
|
|
|
|
|
|
E.g. it may be one more layer up:
looking at device '/devices/pci0000:00/0000:00:14.0/usb1/1-8/1-8.4/1-8.4:1.1/ttyUSB1/tty/ttyUSB1':
KERNEL=="ttyUSB1"
SUBSYSTEM=="tty"
DRIVER==""
looking at parent device '/devices/pci0000:00/0000:00:14.0/usb1/1-8/1-8.4/1-8.4:1.1/ttyUSB1':
KERNELS=="ttyUSB1"
SUBSYSTEMS=="usb-serial"
DRIVERS=="option1"
ATTRS{port_number}=="0"
looking at parent device '/devices/pci0000:00/0000:00:14.0/usb1/1-8/1-8.4/1-8.4:1.1':
KERNELS=="1-8.4:1.1"
SUBSYSTEMS=="usb"
DRIVERS=="option"
ATTRS{bNumEndpoints}=="02"
ATTRS{supports_autosuspend}=="1"
ATTRS{bInterfaceNumber}=="01"
ATTRS{bAlternateSetting}==" 0"
ATTRS{bInterfaceSubClass}=="06"
ATTRS{bInterfaceProtocol}=="13"
ATTRS{interface}=="Huawei Mobile Connect - Application"
ATTRS{bInterfaceClass}=="ff"
ATTRS{authorized}=="1"
|
|
|
|
kerneldevice/mm-kernel-device-udev.c: In function ‘mm_kernel_device_udev_new_from_properties’:
kerneldevice/mm-kernel-device-udev.c:770:70: error: declaration of ‘properties’ shadows a global declaration [-Werror=shadow]
770 | mm_kernel_device_udev_new_from_properties (MMKernelEventProperties *properties,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
kerneldevice/mm-kernel-device-udev.c:38:20: note: shadowed declaration is here
38 | static GParamSpec *properties[PROP_LAST];
| ^~~~~~~~~~
|
|
kerneldevice/mm-kernel-device-generic-rules.c: In function ‘udev_rule_clear’:
kerneldevice/mm-kernel-device-generic-rules.c:40:5: error: switch missing default case [-Werror=switch-default]
40 | switch (rule->result.type) {
| ^~~~~~
|
|
kerneldevice/mm-kernel-device-generic.c: In function ‘mm_kernel_device_generic_new_with_rules’:
kerneldevice/mm-kernel-device-generic.c:954:68: error: declaration of ‘properties’ shadows a global declaration [-Werror=shadow]
954 | mm_kernel_device_generic_new_with_rules (MMKernelEventProperties *properties,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
kerneldevice/mm-kernel-device-generic.c:46:20: note: shadowed declaration is here
46 | static GParamSpec *properties[PROP_LAST];
| ^~~~~~~~~~
kerneldevice/mm-kernel-device-generic.c: In function ‘mm_kernel_device_generic_new’:
kerneldevice/mm-kernel-device-generic.c:971:57: error: declaration of ‘properties’ shadows a global declaration [-Werror=shadow]
971 | mm_kernel_device_generic_new (MMKernelEventProperties *properties,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
kerneldevice/mm-kernel-device-generic.c:46:20: note: shadowed declaration is here
46 | static GParamSpec *properties[PROP_LAST];
| ^~~~~~~~~~
|
|
kerneldevice/mm-kernel-device-generic.c: In function ‘check_rule’:
kerneldevice/mm-kernel-device-generic.c:802:9: error: switch missing default case [-Werror=switch-default]
802 | switch (rule->result.type) {
| ^~~~~~
|
|
|
|
This prevents errors due to nasty typos in the strings.
We define all symbols in a single header file that is NOT considered
part of the API, as there is no need for MM clients to know about
these tags code-wise. These tags are only meaningful when associated
to devices in udev.
Information of each tag is included in the general API documentation.
https://gitlab.freedesktop.org/mobile-broadband/ModemManager/issues/88
|
|
|
|
musl libc does not implement the canonicalize_file_name() GNU extension.
Use the POSIX standard realpath() instead.
|
|
|
|
This new object allows configuring the filter rules applied to the
device ports. By default, for now, it implements the same rules as the
MMKernelDevice is_candidate() method, which is obsoleted.
|
|
This patch implicitly enables in the generic device backend the
manual-only greylist (ID_MM_DEVICE_MANUAL_SCAN_ONLY tag) and the
platform TTY whitelist (ID_MM_PLATFORM_DRIVER_PROBE), which were not
being applied.
|
|
|
|
Used to filter out TTYs when not explicitly whitelisted.
|