OpenWrt package and udev rules

Bjørn Mork bjorn at mork.no
Thu Nov 14 09:40:16 UTC 2019


Aleksander Morgado <aleksander at aleksander.es> writes:

> Hey!
>
>> I noticed that the package comes with the udev rules.  Why is that?  The
>> are explicitly installed by the makefile install rule:
>>
>> define Package/modemmanager/install
>>         $(INSTALL_DIR) $(1)/lib/udev/rules.d
>>         $(INSTALL_DATA) $(PKG_INSTALL_DIR)/lib/udev/rules.d/*.rules $(1)/lib/udev/rules.d
>>
>>
>> are these used anywhere?  If not, then I suggest dropping them.  This
>> will never be a small package, obviously. But I still believe the
>> OpwnWrt way-of-things is to strip away anything not absolutely required.
>>
>
> Oh, all those rules are used even in OpenWRT, if they are not being
> applied correctly, then it's a bug. See this simple parser
> implementation for the rules that is the one being run when not using
> udev:
> https://gitlab.freedesktop.org/mobile-broadband/ModemManager/blob/master/src/kerneldevice/mm-kernel-device-generic-rules.c

Ah, thanks.  That's great!

> That said, this is not the first time I've thought of just getting rid
> of all udev rules and switch to other means of achieving the same
> thing. The not-so-recent changes reporting "bind" events broke our
> rules and I'm not sure there is much benefit (if any at all) relying
> on udev rules for things like blacklists or port type hints. A set of
> "quirk/config files" as done in e.g. fwupd could be a better option
> IMO. If we did that, we could use the same logic to apply the rules
> both when using udev and when using ReportKernelEvent().
>
>> It would be nice if this functionality actually was there, though..  I
>> am having some problems when booting my combined console server and
>> modem manager OpenWrt box.  ModemManager probes ttyUSB[0-3], which are
>> supposed to be used by conserver:
>>
>> ModemManager: hotplug: error: modem not detected at sysfs path
>> [2289]: <info>  Modem: state changed (unknown -> disabled)
>> [2289]: <warn>  (ttyUSB3): serial port closing_wait was reset!
>> [2289]: <warn>  (ttyUSB3): couldn't set serial port closing_wait to none: Not a tty
>> [2289]: <warn>  (ttyUSB1): serial port closing_wait was reset!
>> [2289]: <warn>  (ttyUSB1): couldn't set serial port closing_wait to none: Not a tty
>> [2289]: <warn>  (ttyUSB0): serial port closing_wait was reset!
>> [2289]: <warn>  (ttyUSB0): couldn't set serial port closing_wait to none: Not a tty
>> [2289]: <info>  [device /sys/devices/platform/soc/soc:internal-regs/f1050000.usb/usb1/1-1] creating modem with plugin 'Generic' and '4' ports
>> [2289]: <warn>  Could not grab port (tty/ttyUSB3): 'Cannot add port 'tty/ttyUSB3', unhandled serial type'
>> [2289]: <warn>  Could not grab port (tty/ttyUSB2): 'Cannot add port 'tty/ttyUSB2', unhandled serial type'
>> [2289]: <warn>  Could not grab port (tty/ttyUSB1): 'Cannot add port 'tty/ttyUSB1', unhandled serial type'
>> [2289]: <warn>  Could not grab port (tty/ttyUSB0): 'Cannot add port 'tty/ttyUSB0', unhandled serial type'
>> [2289]: <warn>  Couldn't create modem for device '/sys/devices/platform/soc/soc:internal-regs/f1050000.usb/usb1/1-1': Failed to find primary AT port
>> ModemManager: hotplug: modem exported successfully at /sys/devices/platform/soc/soc:pcie at 82000000/pci0000:00/0000:00:01.0/0000:01:00.0/usb3/3-2
>>
>>
>> It would be nice to avoid this by blacklisting this device, like I would
>> have done on a system with udev.  Is there any way to make the OpenWrt
>> hotplug scripts avoid a specific USB device?
>>
>
> Just add a ID_MM_DEVICE_IGNORE rule as you would have done with udev,
> and restart the daemon.

I should obviously have tried that first.  Worked perfectly.  After a
reboot though. I believe the caching made it a noop on restart?

For the record:  The serial device is not in the default
blacklist. Probabaly because it's not very common.  The ID is 1608:0001

But since this is a device with 4 RS232 ports, you should not consider
it "a modem" ever.  You could connect a modem to one or more of the
ports, but the 4 ports will never belong to "one" modem.

> Also, could you please retry running ModemManager with
> "--filter-policy=STRICT" (e.g. just edit the /etc/init.d/modemmanager
> file to add that)? I would suggest we switch to that filter policy for
> the defaults everywhere, including openwrt. When using that filter
> policy, a USB device that only exposes ttyUSB ports would not be
> probed automatically.


Will do that later.  Don't have time for more testing right now.



Bjørn


More information about the ModemManager-devel mailing list