Re: [PATCH v4 1/6] plugins/udevng: Add support for PCIe MBIM modems * Parses through the sysfs tree and detects MBIM control nodes, net and AT nodes

Muhammad <[email protected]> Tue, 6 May 2025 16:12:28 +0500
Newsgroups dev.linux.lists.ofono
Message-ID <[email protected]>
Hello Denis,

Thank you for the reply.

On 5/5/25 20:46, Denis Kenzior wrote:
> Hi Muhammad,
>
> On 5/4/25 2:19 PM, Muhammad Asif wrote:
>
>> diff --git a/plugins/udevng.c b/plugins/udevng.c
>> index b8df66de..09c916db 100644
>> --- a/plugins/udevng.c
>> +++ b/plugins/udevng.c
>> @@ -1176,7 +1176,13 @@ static gboolean setup_mbim(struct modem_info 
>> *modem)
>>   {
>>       const char *ctl = NULL, *net = NULL, *atcmd = NULL;
>>       GSList *list;
>> +    const char *sub_subsystem = NULL, *type = NULL;
>> +    char path[512], wwan_path[1024], sub_path[2048];
>>       char descriptors[PATH_MAX];
>> +    struct udev *new_udev;
>> +    struct udev_device *wwan_device, *sub_device;
>> +    struct dirent *dir = NULL, *subdir = NULL;
>> +    DIR *d = NULL, *sd = NULL;
>>         DBG("%s [%s:%s]", modem->syspath, modem->vendor, modem->model);
>
> I see that you added "mbim" to a list of pci drivers in patch 4. This 
> patch and patch 4 should be combined into a single patch. Can you 
> provide a log from 'ofonod -nd'?  Especially after patch 4, oFono 
> should be detecting all nodes related to this device. Or, hmm...
>
> Perhaps there needs to be some additional logic in check_wwan_device() 
> as well? Right now it only detects MHI devices.
>
I tried this actually, oFono cannot comb through the nodes because the 
subsystem shows up as PCI, not WWAN. So I had to manually parse through 
all of the WWAN nodes.

On 5/5/25 20:46, Denis Kenzior wrote:

>> @@ -1196,6 +1202,56 @@ static gboolean setup_mbim(struct modem_info 
>> *modem)
>>           else if (g_strcmp0(subsystem, "tty") == 0) {
>>               if (g_strcmp0(info->number, "02") == 0)
>>                   atcmd = info->devnode;
>> +        } else if (g_strcmp0(subsystem, "pci") == 0) {
>> +            sprintf(path, "%s/wwan", 
>> udev_device_get_syspath(info->udev_device));
>> +
>> +            d = opendir(path);
>> +            if (!d)
>> +                return FALSE;
>
> Hmm, so you are detecting some node (I assume root) of the device, 
> then open coding custom detection logic based on the wwan subsystem 
> provided sysfs links. What if the WWAN subsystem isn't enabled in the 
> kernel?  Can udevng be made to work without these links?

Without the WWAN subsystem, the kernel does not enumerate the WWAN 
nodes, and also does not include the wwan/ directories in sysfs. oFono 
will handle that and report the modem as unusable.

- Muhammad