## Modem filter

ModemManager will not probe all TTYs, NET and cdc-wdm ports found in the system, as this may end up interfering e.g. with TTYs that have nothing to do with modem devices.

The daemon comes with several predefined filter policies, each of them composed of one or more filter rules.

## Filter rules

The device filter in ModemManager defines the following independent filter rules. The predefined filter policies are based on one or more of these predefined filter rules.

- MM_FILTER_RULE_EXPLICIT_WHITELIST

  This filter allows users to manually tag devices and/or device ports with the ID_MM_DEVICE_PROCESS udev tag. If the filter finds this tag, the device and/or device ports will be automatically accepted and port probing will be allowed.

      $ sudo vim /lib/udev/rules.d/78-mm-whitelist-internal-modem.rules
          ACTION!="add|change|move", GOTO="mm_whitelist_internal_modem_end"
          ATTRS{idVendor}=="1199", ATTRS{idProduct}=="a001", ENV{ID_MM_DEVICE_PROCESS}="1"
          LABEL="mm_whitelist_internal_modem_end"
      // Apply new rules without reboot
      $ sudo udevadm control --reload
      $ sudo udevadm trigger

- MM_FILTER_RULE_EXPLICIT_BLACKLIST

  This filter allows users to manually tag devices and/or device ports with the ID_MM_DEVICE_IGNORE udev tag. If the filter finds this tag, the device and/or device ports will be automatically ignored and port probing will be never run on them.

      $ sudo vim /lib/udev/rules.d/78-mm-blacklist-internal-modem.rules
          ACTION!="add|change|move", GOTO="mm_blacklist_internal_modem_end"
          ATTRS{idVendor}=="1199", ATTRS{idProduct}=="a001", ENV{ID_MM_DEVICE_IGNORE}="1"
          LABEL="mm_blacklist_internal_modem_end"
      // Apply new rules without reboot
      $ sudo udevadm control --reload
      $ sudo udevadm trigger

- MM_FILTER_RULE_PLUGIN_WHITELIST

  This filter will automatically whitelist devices that are explicitly referenced by plugins, either with plugin-specific whitelist tags, with exact vid:pid matches, or just with vid matches.

- MM_FILTER_RULE_QRTR

  This filter will automatically flag as allowed all QRTR nodes that have been notified as being modem management capable.

  This filter rule is available since 1.18.0.

- MM_FILTER_RULE_VIRTUAL

  This filter will automatically flag as forbidden all ports exposed by virtual devices, like the 'lo' network interface or the tty0, tty1... virtual terminals. There is no reason to disable this filter, except for testing purposes.

- MM_FILTER_RULE_NET

  This filter will automatically flag as allowed all network ports exposed by devices. Unless there is a will to explicitly forbid network ports, this filter should always be enabled.

- MM_FILTER_RULE_USBMISC

  This filter will automatically flag as allowed all cdc-wdm ports exposed in the usbmisc subsystem. Unless there is a will to explicitly forbid the cdc-wdm ports exposed by qmi_wwan, cdc_mbim or huawei-cdc-ncm kernel drivers, this filter should always be enabled.

- MM_FILTER_RULE_RPMSG

  This filter will automatically flag as allowed all rpmsg ports exposed in the rpmsg subsystem. Unless there is a will to explicitly forbid the rpmsg ports, this filter should always be enabled.

  This filter rule is available since 1.16.0.

- MM_FILTER_RULE_WWAN

  This filter will automatically flag as allowed all wwan control ports exposed in the wwan subsystem. Unless there is a will to explicitly forbid the wwan control ports, this filter should always be enabled.

  This filter rule is available since 1.18.0.

- MM_FILTER_RULE_TTY

  If the MM_FILTER_RULE_TTY filter is disabled, no TTY port will be allowed. If this filter is enabled, TTY ports will only be allowed if the TTY-specific filters (defined next) allow it.

- MM_FILTER_RULE_TTY_PLATFORM_DRIVER

  If this filter is enabled, all platform TTY ports will be forbidden automatically.

- MM_FILTER_RULE_TTY_DRIVER

  If this filter is enabled, all TTY ports managed by modem-specific kernel drivers will be allowed automatically.

- FILTER_RULE_TTY_ACM_INTERFACE

  If this filter is enabled, all TTY ports managed by the cdc-acm kernel driver with class=2/subclass=2/protocol=1 (AT command capable ttyACM port) will be allowed automatically.

- MM_FILTER_RULE_TTY_WITH_NET

  If this filter is enabled, all TTY ports for devices that also expose a network interface port will be allowed automatically.

- MM_FILTER_RULE_TTY_DEFAULT_FORBIDDEN

  This rule is the implicit one defining what happens when a TTY port isn't explicitly accepted by any of the TTY-specific filters; i.e. the TTY port will be forbidden.

The following filter rules have been deprecated and are no longer used.

- MM_FILTER_RULE_TTY_BLACKLIST

  Deprecated in 1.18.0.

- MM_FILTER_RULE_TTY_MANUAL_SCAN_ONLY

  Deprecated in 1.18.0.