udevng: Record devnode even for non-USB devices
PATCH 1/5 udevng: Record devnode even for non-USB devices
This is useful for WWAN AT/MBIM/QCDM ports that are being created by PCI based devices.
--- plugins/udevng.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
plugins/udevng.c +2 -2
@@ -1972,8 +1972,9 @@ static void add_device(const char *modem_syspath, const char *modem_devname,g_hash_table_replace (modem_list, modem->syspath, modem); } + devnode =udev_device_get_devnode (device); +if (modem->type ==MODEM_TYPE_USB ) { - devnode =udev_device_get_devnode (device); usb_interface =udev_device_get_parent_with_subsystem_devtype ( device,"usb" ,"usb_interface" );
@@ -1990,7 +1991,6 @@ static void add_device(const char *modem_syspath, const char *modem_devname, label =udev_device_get_property_value (usb_interface,"OFONO_LABEL" ); }else { - devnode =NULL ; interface =udev_device_get_property_value (device,"INTERFACE" ); number =NULL ;
Signature · 1 line
2.48.1
PATCH 2/5 udevng: mhi: Collect WWAN net devices as well
net devices that are part of the WWAN subsystem should be categorized as part of the MHI device as well. This is relevant for MHI devices that operate in MBIM mode. For such devices, the netdev has an intermediate parent (the wwan device) instead of being parented directly to the MHI subsystem device.
│ │ │ │ └─mhi0 │ │ │ │ ┆ P: /devices/pci0000:00/... │ │ │ │ ┆ M: mhi0 │ │ │ │ ┆ R: 0 │ │ │ │ ┆ J: +mhi:mhi0 │ │ │ │ ┆ U: mhi │ │ │ │ ┆ E: DEVPATH=/devices/pci0000:00/... │ │ │ │ ┆ E: SUBSYSTEM=mhi │ │ │ │ ┆ E: MODALIAS=mhi:mhi0 ... │ │ │ │ └─wwan/wwan0 │ │ │ │ ┆ P: /devices/pci0000:00/... │ │ │ │ ┆ M: wwan0 │ │ │ │ ┆ R: 0 │ │ │ │ ┆ J: +wwan:wwan0 │ │ │ │ ┆ U: wwan │ │ │ │ ┆ T: wwan_dev │ │ │ │ ┆ E: DEVPATH=/devices/pci0000:00/... │ │ │ │ ┆ E: SUBSYSTEM=wwan │ │ │ │ ┆ E: DEVTYPE=wwan_dev │ │ │ │ ├─net/wwan0 │ │ │ │ │ ┆ P: /devices/pci0000:00/... │ │ │ │ │ ┆ M: wwan0 │ │ │ │ │ ┆ R: 0 │ │ │ │ │ ┆ J: n3 │ │ │ │ │ ┆ U: net │ │ │ │ │ ┆ T: wwan │ │ │ │ │ ┆ I: 3 │ │ │ │ │ ┆ E: DEVPATH=/devices/pci0000:00/... │ │ │ │ │ ┆ E: SUBSYSTEM=net │ │ │ │ │ ┆ E: DEVTYPE=wwan │ │ │ │ │ ┆ E: INTERFACE=wwan0 │ │ │ │ │ ┆ E: IFINDEX=3 --- plugins/udevng.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
plugins/udevng.c +3 -2
@@ -2397,8 +2397,9 @@ static void check_net_device(struct udev_device *device)const char *iflink;struct udev_device *parent; - parent =udev_device_get_parent (device); -if (parent &&l_streq0 (udev_device_get_subsystem (parent),"mhi" )) { + parent =udev_device_get_parent_with_subsystem_devtype (device, +"mhi" ,NULL ); +if (parent) { parent =udev_device_get_parent_with_subsystem_devtype (device,"pci" ,NULL );if (parent)
Signature · 1 line
2.48.1
PATCH 3/5 udevng: mhi: Detect MBIM mode devices
In reply to Denis KenziorMHI devices can operate in QRTR or MBIM mode. MBIM mode devices should utilize the 'mbim' driver.
--- plugins/udevng.c | 47 ++++++++++++++++++++++++++++++++++++----------- 1 file changed, 36 insertions(+), 11 deletions(-)
plugins/udevng.c +36 -11
@@ -1653,6 +1653,7 @@ static gboolean setup_mhi(struct modem_info *modem) {const struct device_info *net =NULL ;const struct device_info *qrtr =NULL ; +const struct device_info *mbim =NULL ;GSList *list;int r;
@@ -1660,29 +1661,53 @@ static gboolean setup_mhi(struct modem_info *modem)for (list = modem->devices; list; list = list->next) {const struct device_info *info = list->data; -const char *subsystem = -udev_device_get_subsystem (info->udev_device); +struct udev_device *udev_device = info->udev_device; +const char *subsystem =udev_device_get_subsystem (udev_device); +const char *devtype =udev_device_get_devtype (udev_device); -DBG ("%s" ,udev_device_get_syspath (info->udev_device)); +DBG ("%s %s %s" ,udev_device_get_syspath (udev_device), + subsystem, devtype); -if (l_streq0 (udev_device_get_property_value (info->udev_device, +if (l_streq0 (udev_device_get_property_value (udev_device,"MODALIAS" ),"mhi:IPCR" )) qrtr = info;else if (l_streq0 (subsystem,"net" )) net = info; +else if (l_streq0 (subsystem,"wwan" ) && +l_streq0 (devtype,"wwan_port" )) { +const char *type = +udev_device_get_sysattr_value (udev_device, +"type" ); + +if (l_streq0 (type,"MBIM" )) + mbim = info; + } } -DBG ("net: %p, qrtr: %p" , net, qrtr); - -if (!net || !qrtr) +DBG ("net: %p" , net); +if (!net)return FALSE; - r =setup_qmi_qrtr (modem, net); -if (r <0 ) -return FALSE; +/* Prefer to drive MHI devices in QRTR mode if available */ +if (qrtr) { + r =setup_qmi_qrtr (modem, net); +if (r <0 ) +return FALSE; -return TRUE; +return TRUE; + } + +/* Otherwise, try MBIM mode */ +if (mbim) { +ofono_modem_set_string (modem->modem,"Device" , mbim->devnode); +ofono_modem_set_string (modem->modem, +"NetworkInterface" ,get_ifname (net)); +ofono_modem_set_driver (modem->modem,"mbim" ); +return TRUE; + } + +return FALSE; } static struct {
Signature · 1 line
2.48.1
PATCH 4/5 mbim: Do not require the DescriptorsFile property
In reply to Denis KenziorSome PCIe MBIM devices (for example, based on MHI) do not provide a descriptors file, unlike USB MBIM devices.
--- plugins/mbim.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-)
plugins/mbim.c +7 -10
@@ -80,22 +80,19 @@ static int mbim_probe(struct ofono_modem *modem) {const char *descriptors;struct mbim_data *data; -int err;DBG ("%p" , modem); - descriptors =ofono_modem_get_string (modem,"DescriptorFile" ); - -if (!descriptors) -return -EINVAL ; - data = l_new(struct mbim_data, 1); data->max_outstanding =1 ; + data->max_segment =512 ; + + descriptors =ofono_modem_get_string (modem,"DescriptorFile" ); +if (descriptors) { +int err =mbim_parse_descriptors (data, descriptors); - err =mbim_parse_descriptors (data, descriptors); -if (err <0 ) { -DBG ("Warning, unable to load descriptors, setting defaults" ); - data->max_segment =512 ; +if (err <0 ) +ofono_warn ("Unable to load descriptors" ); } DBG("MaxSegment: %d, MaxOutstanding: %d",
Signature · 1 line
2.48.1
PATCH 5/5 mbim: Print the device as a string
In reply to Denis KenziorInstead of printing 'device' as a pointer, print it as a string:
ofonod[2672]: plugins/mbim.c:mbim_enable() /dev/wwan0mbim0
--- plugins/mbim.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
plugins/mbim.c +1 -1
@@ -269,7 +269,7 @@ static int mbim_enable(struct ofono_modem *modem)if (!device)return -EINVAL ; -DBG ("%p" , device); +DBG ("%s" , device); fd =open (device,O_EXCL |O_NONBLOCK |O_RDWR );if (fd <0 )return -EIO ;
Signature · 1 line
2.48.1
This series was applied to ofono.git (master) by Denis Kenzior <[email protected]>:
Hello:
This series was applied to ofono.git (master)
by Denis Kenzior <[email protected]>:
Quoted 5 lines · On Fri, 9 May 2025 15:01:08 -0500 you wrote:
This is useful for WWAN AT/MBIM/QCDM ports that are being created by PCI based devices.
--- plugins/udevng.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Here is the summary with links:
- [1/5] udevng: Record devnode even for non-USB devices
https://git.kernel.org/pub/scm/network/ofono/ofono.git/?id=0ede8e3300d8 - [2/5] udevng: mhi: Collect WWAN net devices as well https://git.kernel.org/pub/scm/network/ofono/ofono.git/?id=1d1f9cda1b53 - [3/5] udevng: mhi: Detect MBIM mode devices https://git.kernel.org/pub/scm/network/ofono/ofono.git/?id=92f6fe8c1b87 - [4/5] mbim: Do not require the DescriptorsFile property https://git.kernel.org/pub/scm/network/ofono/ofono.git/?id=597bcbcbb9ae - [5/5] mbim: Print the device as a string https://git.kernel.org/pub/scm/network/ofono/ofono.git/?id=3fc849113f3a
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html