[PATCH] allow device specification to be a symlink

Dan Williams dcbw at redhat.com
Wed Mar 6 14:16:38 UTC 2019


On Tue, 2019-03-05 at 22:48 -0500, Nick Black wrote:
> I posted this to
> https://gitlab.freedesktop.org/mobile-broadband/libqmi/issues/10,
> but am unsure as to whether that's monitored.
> 
> When a valid symlink to a device node exists, qmicli still fails
> to determine the driver and wwan interface corresponding to the
> dereferenced symlink. This is due to using the -d argument's
> basename as an index into sysfs.
> 
> uptowngirl $ ls -l /dev/cdc-huawei
>  lrwxrwxrwx 1 root root 8 Mar  4 02:02 /dev/cdc-huawei -> cdc-wdm0
> uptowngirl $ sudo qmicli -d /dev/cdc-huawei -w
>  [04 Mar 2019, 02:16:05] -Warning ** [/dev/cdc-huawei] couldn't load
> driver of cdc-wdm port
>  error: couldn't open the QmiDevice: Cannot automatically select
> QMI/MBIM mode: driver unknown
> uptowngirl $
> 
> I've added code to check for a symlink, and dereference it if
> so. Please request changes or merge. Thanks!

Can you abstract the link checking into a separate function, since it's
used in two places? No problem to allocate a new string in both cases
(symlink and not) and return it to the caller.

Dan



More information about the libqmi-devel mailing list