udev: repurpose ID_MM_DEVICE_IGNORE and new MM_FILTER_RULE_EXPLICIT_BLACKLIST

Until now the ID_MM_DEVICE_IGNORE udev tag was being used in the
internal blacklist of devices shipped by ModemManager when running in
either DEFAULT or PARANOID filter modes. The name of the tag is
extremely misleading because it doesn't really make the full device be
ignored, the tag only applied to TTY ports.

This commit repurposes the tag so that it applies to ANY kind of
port (e.g. TTY, NET, cdc-wdm...) and also to any kind of filter type
(i.e. also applicable in STRICT mode).

The internal blacklist shipped by ModemManager, which should NOT be
used in STRICT mode, uses a new tag name, ID_MM_TTY_BLACKLIST.

The new ID_MM_DEVICE_IGNORE tag is therefore much more usable and its
name is really meaningful. If there are users or third-party projects
adding their own udev rules with the ID_MM_DEVICE_IGNORE tag name,
they should have no problem as the new rule is more restrictive than
the old one.
This commit is contained in:
Aleksander Morgado
2019-08-07 14:35:31 +02:00
committed by Aleksander Morgado
parent 07c8a2b4f6
commit 250639e3da
7 changed files with 150 additions and 101 deletions

View File

@@ -121,6 +121,24 @@ $ sudo vim /lib/udev/rules.d/78-mm-whitelist-internal-modem.rules
LABEL="mm_whitelist_internal_modem_end" LABEL="mm_whitelist_internal_modem_end"
// Apply new rules without reboot // Apply new rules without reboot
$ sudo udevadm control --reload $ sudo udevadm control --reload
$ sudo udevadm trigger
</programlisting>
</listitem>
<listitem>
<para><emphasis>MM_FILTER_RULE_EXPLICIT_BLACKLIST</emphasis></para>
<para>
This filter allows users to manually tag devices and/or device ports with the
<emphasis>ID_MM_DEVICE_IGNORE</emphasis> 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.
</para>
<programlisting>
$ 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 $ sudo udevadm trigger
</programlisting> </programlisting>
</listitem> </listitem>
@@ -167,7 +185,7 @@ $ sudo udevadm trigger
<para><emphasis>MM_FILTER_RULE_TTY_BLACKLIST</emphasis></para> <para><emphasis>MM_FILTER_RULE_TTY_BLACKLIST</emphasis></para>
<para> <para>
This filter will not allow probing any of the devices flagged as This filter will not allow probing any of the devices flagged as
<emphasis>ID_MM_DEVICE_IGNORE</emphasis>, like the ones in the default blacklist <emphasis>ID_MM_TTY_BLACKLIST</emphasis>, like the ones in the default blacklist
shipped by ModemManager. shipped by ModemManager.
</para> </para>
</listitem> </listitem>
@@ -239,6 +257,7 @@ $ sudo udevadm trigger
This is a policy where the following rules are enabled: This is a policy where the following rules are enabled:
<itemizedlist> <itemizedlist>
<listitem>MM_FILTER_RULE_EXPLICIT_WHITELIST</listitem> <listitem>MM_FILTER_RULE_EXPLICIT_WHITELIST</listitem>
<listitem>MM_FILTER_RULE_EXPLICIT_BLACKLIST</listitem>
<listitem>MM_FILTER_RULE_VIRTUAL</listitem> <listitem>MM_FILTER_RULE_VIRTUAL</listitem>
<listitem>MM_FILTER_RULE_NET</listitem> <listitem>MM_FILTER_RULE_NET</listitem>
<listitem>MM_FILTER_RULE_CDC_WDM</listitem> <listitem>MM_FILTER_RULE_CDC_WDM</listitem>
@@ -264,6 +283,7 @@ $ sudo udevadm trigger
This is a policy where the following rules are enabled: This is a policy where the following rules are enabled:
<itemizedlist> <itemizedlist>
<listitem>MM_FILTER_RULE_EXPLICIT_WHITELIST</listitem> <listitem>MM_FILTER_RULE_EXPLICIT_WHITELIST</listitem>
<listitem>MM_FILTER_RULE_EXPLICIT_BLACKLIST</listitem>
<listitem>MM_FILTER_RULE_VIRTUAL</listitem> <listitem>MM_FILTER_RULE_VIRTUAL</listitem>
<listitem>MM_FILTER_RULE_NET</listitem> <listitem>MM_FILTER_RULE_NET</listitem>
<listitem>MM_FILTER_RULE_CDC_WDM</listitem> <listitem>MM_FILTER_RULE_CDC_WDM</listitem>
@@ -290,6 +310,7 @@ $ sudo udevadm trigger
This policy is a mix of the Default and Strict ones: This policy is a mix of the Default and Strict ones:
<itemizedlist> <itemizedlist>
<listitem>MM_FILTER_RULE_EXPLICIT_WHITELIST</listitem> <listitem>MM_FILTER_RULE_EXPLICIT_WHITELIST</listitem>
<listitem>MM_FILTER_RULE_EXPLICIT_BLACKLIST</listitem>
<listitem>MM_FILTER_RULE_VIRTUAL</listitem> <listitem>MM_FILTER_RULE_VIRTUAL</listitem>
<listitem>MM_FILTER_RULE_NET</listitem> <listitem>MM_FILTER_RULE_NET</listitem>
<listitem>MM_FILTER_RULE_CDC_WDM</listitem> <listitem>MM_FILTER_RULE_CDC_WDM</listitem>

View File

@@ -151,9 +151,10 @@ MM_DEPRECATED
<TITLE>Common udev tags</TITLE> <TITLE>Common udev tags</TITLE>
ID_MM_CANDIDATE ID_MM_CANDIDATE
ID_MM_PHYSDEV_UID ID_MM_PHYSDEV_UID
ID_MM_PORT_IGNORE
ID_MM_DEVICE_PROCESS ID_MM_DEVICE_PROCESS
ID_MM_DEVICE_IGNORE ID_MM_DEVICE_IGNORE
ID_MM_PORT_IGNORE
ID_MM_TTY_BLACKLIST
ID_MM_DEVICE_MANUAL_SCAN_ONLY ID_MM_DEVICE_MANUAL_SCAN_ONLY
ID_MM_PLATFORM_DRIVER_PROBE ID_MM_PLATFORM_DRIVER_PROBE
ID_MM_PORT_TYPE_AT_PPP ID_MM_PORT_TYPE_AT_PPP

View File

@@ -72,6 +72,20 @@
*/ */
#define ID_MM_DEVICE_PROCESS "ID_MM_DEVICE_PROCESS" #define ID_MM_DEVICE_PROCESS "ID_MM_DEVICE_PROCESS"
/**
* ID_MM_DEVICE_IGNORE:
*
* This is a device-specific tag that allows explicitly requesting to
* ignore all ports exposed by the device.
*
* This tag was originally applicable to TTY ports and only when running
* in DEFAULT or PARANOID filter policy types. Since 1.12, this tag
* applies to all filter types (including STRICT), and to all port types
* (not only TTYs), and is associated to the
* MM_FILTER_RULE_EXPLICIT_BLACKLIST rule.
*/
#define ID_MM_DEVICE_IGNORE "ID_MM_DEVICE_IGNORE"
/** /**
* ID_MM_PORT_IGNORE: * ID_MM_PORT_IGNORE:
* *
@@ -83,7 +97,7 @@
#define ID_MM_PORT_IGNORE "ID_MM_PORT_IGNORE" #define ID_MM_PORT_IGNORE "ID_MM_PORT_IGNORE"
/** /**
* ID_MM_DEVICE_IGNORE: * ID_MM_TTY_BLACKLIST:
* *
* This is a device-specific tag that allows explicitly blacklisting * This is a device-specific tag that allows explicitly blacklisting
* devices that expose TTY devices so that they are never probed. * devices that expose TTY devices so that they are never probed.
@@ -94,7 +108,7 @@
* *
* This tag is ignored when the STRICT filter policy is used. * This tag is ignored when the STRICT filter policy is used.
*/ */
#define ID_MM_DEVICE_IGNORE "ID_MM_DEVICE_IGNORE" #define ID_MM_TTY_BLACKLIST "ID_MM_TTY_BLACKLIST"
/** /**
* ID_MM_DEVICE_MANUAL_SCAN_ONLY: * ID_MM_DEVICE_MANUAL_SCAN_ONLY:

View File

@@ -4,6 +4,6 @@ ACTION!="add|change|move|bind", GOTO="mm_pcmcia_device_blacklist_end"
SUBSYSTEM!="pcmcia", GOTO="mm_pcmcia_device_blacklist_end" SUBSYSTEM!="pcmcia", GOTO="mm_pcmcia_device_blacklist_end"
# Gemplus Serial Port smartcard adapter # Gemplus Serial Port smartcard adapter
ATTRS{prod_id1}=="Gemplus", ATTRS{prod_id2}=="SerialPort", ATTRS{prod_id3}=="GemPC Card", ENV{ID_MM_DEVICE_IGNORE}="1" ATTRS{prod_id1}=="Gemplus", ATTRS{prod_id2}=="SerialPort", ATTRS{prod_id3}=="GemPC Card", ENV{ID_MM_TTY_BLACKLIST}="1"
LABEL="mm_pcmcia_device_blacklist_end" LABEL="mm_pcmcia_device_blacklist_end"

View File

@@ -4,208 +4,208 @@ ACTION!="add|change|move|bind", GOTO="mm_usb_device_blacklist_end"
SUBSYSTEM!="usb", GOTO="mm_usb_device_blacklist_end" SUBSYSTEM!="usb", GOTO="mm_usb_device_blacklist_end"
# APC UPS devices # APC UPS devices
ATTRS{idVendor}=="051d", ENV{ID_MM_DEVICE_IGNORE}="1" ATTRS{idVendor}=="051d", ENV{ID_MM_TTY_BLACKLIST}="1"
# Sweex 1000VA # Sweex 1000VA
ATTRS{idVendor}=="0925", ATTRS{idProduct}=="1234", ENV{ID_MM_DEVICE_IGNORE}="1" ATTRS{idVendor}=="0925", ATTRS{idProduct}=="1234", ENV{ID_MM_TTY_BLACKLIST}="1"
# Agiler UPS # Agiler UPS
ATTRS{idVendor}=="05b8", ATTRS{idProduct}=="0000", ENV{ID_MM_DEVICE_IGNORE}="1" ATTRS{idVendor}=="05b8", ATTRS{idProduct}=="0000", ENV{ID_MM_TTY_BLACKLIST}="1"
# Krauler UP-M500VA # Krauler UP-M500VA
ATTRS{idVendor}=="0001", ATTRS{idProduct}=="0000", ENV{ID_MM_DEVICE_IGNORE}="1" ATTRS{idVendor}=="0001", ATTRS{idProduct}=="0000", ENV{ID_MM_TTY_BLACKLIST}="1"
# Ablerex 625L USB # Ablerex 625L USB
ATTRS{idVendor}=="ffff", ATTRS{idProduct}=="0000", ENV{ID_MM_DEVICE_IGNORE}="1" ATTRS{idVendor}=="ffff", ATTRS{idProduct}=="0000", ENV{ID_MM_TTY_BLACKLIST}="1"
# Belkin F6C1200-UNV # Belkin F6C1200-UNV
ATTRS{idVendor}=="0665", ATTRS{idProduct}=="5161", ENV{ID_MM_DEVICE_IGNORE}="1" ATTRS{idVendor}=="0665", ATTRS{idProduct}=="5161", ENV{ID_MM_TTY_BLACKLIST}="1"
# Various Liebert and Phoenixtec Power devices # Various Liebert and Phoenixtec Power devices
ATTRS{idVendor}=="06da", ENV{ID_MM_DEVICE_IGNORE}="1" ATTRS{idVendor}=="06da", ENV{ID_MM_TTY_BLACKLIST}="1"
# Unitek Alpha 1200Sx # Unitek Alpha 1200Sx
ATTRS{idVendor}=="0f03", ATTRS{idProduct}=="0001", ENV{ID_MM_DEVICE_IGNORE}="1" ATTRS{idVendor}=="0f03", ATTRS{idProduct}=="0001", ENV{ID_MM_TTY_BLACKLIST}="1"
# Various Tripplite devices # Various Tripplite devices
ATTRS{idVendor}=="09ae", ENV{ID_MM_DEVICE_IGNORE}="1" ATTRS{idVendor}=="09ae", ENV{ID_MM_TTY_BLACKLIST}="1"
# Various MGE Office Protection Systems devices # Various MGE Office Protection Systems devices
ATTRS{idVendor}=="0463", ATTRS{idProduct}=="0001", ENV{ID_MM_DEVICE_IGNORE}="1" ATTRS{idVendor}=="0463", ATTRS{idProduct}=="0001", ENV{ID_MM_TTY_BLACKLIST}="1"
ATTRS{idVendor}=="0463", ATTRS{idProduct}=="ffff", ENV{ID_MM_DEVICE_IGNORE}="1" ATTRS{idVendor}=="0463", ATTRS{idProduct}=="ffff", ENV{ID_MM_TTY_BLACKLIST}="1"
# CyberPower 900AVR/BC900D # CyberPower 900AVR/BC900D
ATTRS{idVendor}=="0764", ATTRS{idProduct}=="0005", ENV{ID_MM_DEVICE_IGNORE}="1" ATTRS{idVendor}=="0764", ATTRS{idProduct}=="0005", ENV{ID_MM_TTY_BLACKLIST}="1"
# CyberPower CP1200AVR/BC1200D # CyberPower CP1200AVR/BC1200D
ATTRS{idVendor}=="0764", ATTRS{idProduct}=="0501", ENV{ID_MM_DEVICE_IGNORE}="1" ATTRS{idVendor}=="0764", ATTRS{idProduct}=="0501", ENV{ID_MM_TTY_BLACKLIST}="1"
# Various Belkin devices # Various Belkin devices
ATTRS{idVendor}=="050d", ATTRS{idProduct}=="0980", ENV{ID_MM_DEVICE_IGNORE}="1" ATTRS{idVendor}=="050d", ATTRS{idProduct}=="0980", ENV{ID_MM_TTY_BLACKLIST}="1"
ATTRS{idVendor}=="050d", ATTRS{idProduct}=="0900", ENV{ID_MM_DEVICE_IGNORE}="1" ATTRS{idVendor}=="050d", ATTRS{idProduct}=="0900", ENV{ID_MM_TTY_BLACKLIST}="1"
ATTRS{idVendor}=="050d", ATTRS{idProduct}=="0910", ENV{ID_MM_DEVICE_IGNORE}="1" ATTRS{idVendor}=="050d", ATTRS{idProduct}=="0910", ENV{ID_MM_TTY_BLACKLIST}="1"
ATTRS{idVendor}=="050d", ATTRS{idProduct}=="0912", ENV{ID_MM_DEVICE_IGNORE}="1" ATTRS{idVendor}=="050d", ATTRS{idProduct}=="0912", ENV{ID_MM_TTY_BLACKLIST}="1"
ATTRS{idVendor}=="050d", ATTRS{idProduct}=="0551", ENV{ID_MM_DEVICE_IGNORE}="1" ATTRS{idVendor}=="050d", ATTRS{idProduct}=="0551", ENV{ID_MM_TTY_BLACKLIST}="1"
ATTRS{idVendor}=="050d", ATTRS{idProduct}=="0751", ENV{ID_MM_DEVICE_IGNORE}="1" ATTRS{idVendor}=="050d", ATTRS{idProduct}=="0751", ENV{ID_MM_TTY_BLACKLIST}="1"
ATTRS{idVendor}=="050d", ATTRS{idProduct}=="0375", ENV{ID_MM_DEVICE_IGNORE}="1" ATTRS{idVendor}=="050d", ATTRS{idProduct}=="0375", ENV{ID_MM_TTY_BLACKLIST}="1"
ATTRS{idVendor}=="050d", ATTRS{idProduct}=="1100", ENV{ID_MM_DEVICE_IGNORE}="1" ATTRS{idVendor}=="050d", ATTRS{idProduct}=="1100", ENV{ID_MM_TTY_BLACKLIST}="1"
# HP R/T 2200 INTL (like SMART2200RMXL2U) # HP R/T 2200 INTL (like SMART2200RMXL2U)
ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="1f0a", ENV{ID_MM_DEVICE_IGNORE}="1" ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="1f0a", ENV{ID_MM_TTY_BLACKLIST}="1"
# Powerware devices # Powerware devices
ATTRS{idVendor}=="0592", ATTRS{idProduct}=="0002", ENV{ID_MM_DEVICE_IGNORE}="1" ATTRS{idVendor}=="0592", ATTRS{idProduct}=="0002", ENV{ID_MM_TTY_BLACKLIST}="1"
# Palm Treo 700/900/etc # Palm Treo 700/900/etc
# Shouldn't be probed themselves, but you can install programs like # Shouldn't be probed themselves, but you can install programs like
# "MobileStream USB Modem" which changes the USB PID of the device to something # "MobileStream USB Modem" which changes the USB PID of the device to something
# that isn't blacklisted. # that isn't blacklisted.
ATTRS{idVendor}=="0830", ATTRS{idProduct}=="0061", ENV{ID_MM_DEVICE_IGNORE}="1" ATTRS{idVendor}=="0830", ATTRS{idProduct}=="0061", ENV{ID_MM_TTY_BLACKLIST}="1"
# GlobalScaleTechnologies SheevaPlug # GlobalScaleTechnologies SheevaPlug
ATTRS{idVendor}=="9e88", ATTRS{idProduct}=="9e8f", ENV{ID_MM_DEVICE_IGNORE}="1" ATTRS{idVendor}=="9e88", ATTRS{idProduct}=="9e8f", ENV{ID_MM_TTY_BLACKLIST}="1"
# Atmel Corp at91sam SAMBA bootloader # Atmel Corp at91sam SAMBA bootloader
ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="6124", ENV{ID_MM_DEVICE_IGNORE}="1" ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="6124", ENV{ID_MM_TTY_BLACKLIST}="1"
# All devices from the Swiss Federal Institute of Technology # All devices from the Swiss Federal Institute of Technology
ATTRS{idVendor}=="0617", ENV{ID_MM_DEVICE_IGNORE}="1" ATTRS{idVendor}=="0617", ENV{ID_MM_TTY_BLACKLIST}="1"
# West Mountain Radio devices # West Mountain Radio devices
ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="814a", ENV{ID_MM_DEVICE_IGNORE}="1" ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="814a", ENV{ID_MM_TTY_BLACKLIST}="1"
ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="814b", ENV{ID_MM_DEVICE_IGNORE}="1" ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="814b", ENV{ID_MM_TTY_BLACKLIST}="1"
ATTRS{idVendor}=="2405", ATTRS{idProduct}=="0003", ENV{ID_MM_DEVICE_IGNORE}="1" ATTRS{idVendor}=="2405", ATTRS{idProduct}=="0003", ENV{ID_MM_TTY_BLACKLIST}="1"
# Arduinos # Arduinos
ATTRS{idVendor}=="2341", ENV{ID_MM_DEVICE_IGNORE}="1" ATTRS{idVendor}=="2341", ENV{ID_MM_TTY_BLACKLIST}="1"
ATTRS{idVendor}=="2a03", ENV{ID_MM_DEVICE_IGNORE}="1" ATTRS{idVendor}=="2a03", ENV{ID_MM_TTY_BLACKLIST}="1"
ATTRS{idVendor}=="1b4f", ATTRS{idProduct}=="9207", ENV{ID_MM_DEVICE_IGNORE}="1" ATTRS{idVendor}=="1b4f", ATTRS{idProduct}=="9207", ENV{ID_MM_TTY_BLACKLIST}="1"
ATTRS{idVendor}=="1b4f", ATTRS{idProduct}=="9208", ENV{ID_MM_DEVICE_IGNORE}="1" ATTRS{idVendor}=="1b4f", ATTRS{idProduct}=="9208", ENV{ID_MM_TTY_BLACKLIST}="1"
# Adafruit Flora # Adafruit Flora
ATTRS{idVendor}=="239a", ATTRS{idProduct}=="0004", ENV{ID_MM_DEVICE_IGNORE}="1" ATTRS{idVendor}=="239a", ATTRS{idProduct}=="0004", ENV{ID_MM_TTY_BLACKLIST}="1"
ATTRS{idVendor}=="239a", ATTRS{idProduct}=="8004", ENV{ID_MM_DEVICE_IGNORE}="1" ATTRS{idVendor}=="239a", ATTRS{idProduct}=="8004", ENV{ID_MM_TTY_BLACKLIST}="1"
# All devices from Pololu Corporation # All devices from Pololu Corporation
# except some possible future products. # except some possible future products.
ATTRS{idVendor}=="1ffb", ENV{ID_MM_DEVICE_IGNORE}="1" ATTRS{idVendor}=="1ffb", ENV{ID_MM_TTY_BLACKLIST}="1"
ATTRS{idVendor}=="1ffb", ATTRS{idProduct}=="00ad", ENV{ID_MM_DEVICE_IGNORE}="0" ATTRS{idVendor}=="1ffb", ATTRS{idProduct}=="00ad", ENV{ID_MM_TTY_BLACKLIST}="0"
ATTRS{idVendor}=="1ffb", ATTRS{idProduct}=="00ae", ENV{ID_MM_DEVICE_IGNORE}="0" ATTRS{idVendor}=="1ffb", ATTRS{idProduct}=="00ae", ENV{ID_MM_TTY_BLACKLIST}="0"
# Altair U-Boot device # Altair U-Boot device
ATTRS{idVendor}=="0216", ATTRS{idProduct}=="0051", ENV{ID_MM_DEVICE_IGNORE}="1" ATTRS{idVendor}=="0216", ATTRS{idProduct}=="0051", ENV{ID_MM_TTY_BLACKLIST}="1"
# Bluegiga BLE112B # Bluegiga BLE112B
ATTRS{idVendor}=="2458", ATTRS{idProduct}=="0001", ENV{ID_MM_DEVICE_IGNORE}="1" ATTRS{idVendor}=="2458", ATTRS{idProduct}=="0001", ENV{ID_MM_TTY_BLACKLIST}="1"
# MediaTek GPS chip (HOLUX M-1200E, GlobalTop Gms-d1, etc) # MediaTek GPS chip (HOLUX M-1200E, GlobalTop Gms-d1, etc)
ATTRS{idVendor}=="0e8d", ATTRS{idProduct}=="3329", ENV{ID_MM_DEVICE_IGNORE}="1" ATTRS{idVendor}=="0e8d", ATTRS{idProduct}=="3329", ENV{ID_MM_TTY_BLACKLIST}="1"
# MediaTek MT65xx preloader # MediaTek MT65xx preloader
ATTRS{idVendor}=="0e8d", ATTRS{idProduct}=="2000", ENV{ID_MM_DEVICE_IGNORE}="1" ATTRS{idVendor}=="0e8d", ATTRS{idProduct}=="2000", ENV{ID_MM_TTY_BLACKLIST}="1"
# PS-360 OEM (GPS sold with MS Street and Trips 2005) # PS-360 OEM (GPS sold with MS Street and Trips 2005)
ATTRS{idVendor}=="067b", ATTRS{idProduct}=="aaa0", ENV{ID_MM_DEVICE_IGNORE}="1" ATTRS{idVendor}=="067b", ATTRS{idProduct}=="aaa0", ENV{ID_MM_TTY_BLACKLIST}="1"
# u-blox AG, u-blox 5 GPS chips # u-blox AG, u-blox 5 GPS chips
ATTRS{idVendor}=="1546", ATTRS{idProduct}=="01a5", ENV{ID_MM_DEVICE_IGNORE}="1" ATTRS{idVendor}=="1546", ATTRS{idProduct}=="01a5", ENV{ID_MM_TTY_BLACKLIST}="1"
ATTRS{idVendor}=="1546", ATTRS{idProduct}=="01a6", ENV{ID_MM_DEVICE_IGNORE}="1" ATTRS{idVendor}=="1546", ATTRS{idProduct}=="01a6", ENV{ID_MM_TTY_BLACKLIST}="1"
ATTRS{idVendor}=="1546", ATTRS{idProduct}=="01a7", ENV{ID_MM_DEVICE_IGNORE}="1" ATTRS{idVendor}=="1546", ATTRS{idProduct}=="01a7", ENV{ID_MM_TTY_BLACKLIST}="1"
# Garmin GPS devices # Garmin GPS devices
DRIVERS=="garmin_gps", ENV{ID_MM_DEVICE_IGNORE}="1" DRIVERS=="garmin_gps", ENV{ID_MM_TTY_BLACKLIST}="1"
# Garmin ANT+ stick # Garmin ANT+ stick
ATTRS{idVendor}=="0fcf", ATTRS{idProduct}=="1009", ENV{ID_MM_DEVICE_IGNORE}="1" ATTRS{idVendor}=="0fcf", ATTRS{idProduct}=="1009", ENV{ID_MM_TTY_BLACKLIST}="1"
# Cypress M8-based GPS devices, UPSes, and serial converters # Cypress M8-based GPS devices, UPSes, and serial converters
DRIVERS=="cypress_m8", ENV{ID_MM_DEVICE_IGNORE}="1" DRIVERS=="cypress_m8", ENV{ID_MM_TTY_BLACKLIST}="1"
# All devices in the Openmoko vendor ID, except usb hubs # All devices in the Openmoko vendor ID, except usb hubs
ATTRS{idVendor}=="1d50", ATTRS{bDeviceClass}!="09", ENV{ID_MM_DEVICE_IGNORE}="1" ATTRS{idVendor}=="1d50", ATTRS{bDeviceClass}!="09", ENV{ID_MM_TTY_BLACKLIST}="1"
# All devices from 3D Robotics # All devices from 3D Robotics
ATTRS{idVendor}=="26ac", ENV{ID_MM_DEVICE_IGNORE}="1" ATTRS{idVendor}=="26ac", ENV{ID_MM_TTY_BLACKLIST}="1"
# empiriKit science lab controller device # empiriKit science lab controller device
ATTRS{idVendor}=="0425", ATTRS{idProduct}=="0408", ENV{ID_MM_DEVICE_IGNORE}="1" ATTRS{idVendor}=="0425", ATTRS{idProduct}=="0408", ENV{ID_MM_TTY_BLACKLIST}="1"
# Infineon Flashloader used by Intel XMM modem bootloader # Infineon Flashloader used by Intel XMM modem bootloader
ATTRS{idVendor}=="8087", ATTRS{idProduct}=="0716", ENV{ID_MM_DEVICE_IGNORE}="1" ATTRS{idVendor}=="8087", ATTRS{idProduct}=="0716", ENV{ID_MM_TTY_BLACKLIST}="1"
ATTRS{idVendor}=="8087", ATTRS{idProduct}=="0801", ENV{ID_MM_DEVICE_IGNORE}="1" ATTRS{idVendor}=="8087", ATTRS{idProduct}=="0801", ENV{ID_MM_TTY_BLACKLIST}="1"
# Intel coredump downloader device # Intel coredump downloader device
ATTRS{idVendor}=="1519", ATTRS{idProduct}=="f000", ENV{ID_MM_DEVICE_IGNORE}="1" ATTRS{idVendor}=="1519", ATTRS{idProduct}=="f000", ENV{ID_MM_TTY_BLACKLIST}="1"
# GW Instek AFG-2225 arbitrary function generator # GW Instek AFG-2225 arbitrary function generator
ATTRS{idVendor}=="2184", ATTRS{idProduct}=="001c", ENV{ID_MM_DEVICE_IGNORE}="1" ATTRS{idVendor}=="2184", ATTRS{idProduct}=="001c", ENV{ID_MM_TTY_BLACKLIST}="1"
# PalmOS devices - even though some are phones, they are so old they most # PalmOS devices - even though some are phones, they are so old they most
# likely are not being used anymore # likely are not being used anymore
DRIVERS=="visor", ENV{ID_MM_DEVICE_IGNORE}="1" DRIVERS=="visor", ENV{ID_MM_TTY_BLACKLIST}="1"
# Palmconnect # Palmconnect
ATTRS{idVendor}=="0830", ATTRS{idProduct}=="0080", ENV{ID_MM_DEVICE_IGNORE}="1" ATTRS{idVendor}=="0830", ATTRS{idProduct}=="0080", ENV{ID_MM_TTY_BLACKLIST}="1"
# IMC flashing device # IMC flashing device
ATTRS{idVendor}=="058b", ATTRS{idProduct}=="0041", ENV{ID_MM_DEVICE_IGNORE}="1" ATTRS{idVendor}=="058b", ATTRS{idProduct}=="0041", ENV{ID_MM_TTY_BLACKLIST}="1"
# All devices from the Access Interfacing Solutions (Access Ltd) # All devices from the Access Interfacing Solutions (Access Ltd)
# Access IS do not produce modems and are unlikely to do so in future # Access IS do not produce modems and are unlikely to do so in future
ATTRS{idVendor}=="0db5", ENV{ID_MM_DEVICE_IGNORE}="1" ATTRS{idVendor}=="0db5", ENV{ID_MM_TTY_BLACKLIST}="1"
# Palm M500 # Palm M500
ATTRS{idVendor}=="0830", ATTRS{idProduct}=="0001", ENV{ID_MM_DEVICE_IGNORE}="1" ATTRS{idVendor}=="0830", ATTRS{idProduct}=="0001", ENV{ID_MM_TTY_BLACKLIST}="1"
# Palm M505 # Palm M505
ATTRS{idVendor}=="0830", ATTRS{idProduct}=="0002", ENV{ID_MM_DEVICE_IGNORE}="1" ATTRS{idVendor}=="0830", ATTRS{idProduct}=="0002", ENV{ID_MM_TTY_BLACKLIST}="1"
# Palm M515 # Palm M515
ATTRS{idVendor}=="0830", ATTRS{idProduct}=="0003", ENV{ID_MM_DEVICE_IGNORE}="1" ATTRS{idVendor}=="0830", ATTRS{idProduct}=="0003", ENV{ID_MM_TTY_BLACKLIST}="1"
# All devices from POSNET POLSKA S.A. # All devices from POSNET POLSKA S.A.
# POSNET POLSKA S.A. do not produce modems and are unlikely to do so in future # POSNET POLSKA S.A. do not produce modems and are unlikely to do so in future
ATTRS{idVendor}=="1424", ENV{ID_MM_DEVICE_IGNORE}="1" ATTRS{idVendor}=="1424", ENV{ID_MM_TTY_BLACKLIST}="1"
# proxmark3 # proxmark3
ATTRS{manufacturer}=="proxmark.org", ENV{ID_MM_DEVICE_IGNORE}="1" ATTRS{manufacturer}=="proxmark.org", ENV{ID_MM_TTY_BLACKLIST}="1"
# Sigma Sport Docking Station TOPLINE 2009 # Sigma Sport Docking Station TOPLINE 2009
ATTRS{idVendor}=="1d9d", ATTRS{idProduct}=="1010", ENV{ID_MM_DEVICE_IGNORE}="1" ATTRS{idVendor}=="1d9d", ATTRS{idProduct}=="1010", ENV{ID_MM_TTY_BLACKLIST}="1"
# Sigma Sport Docking Station TOPLINE 2012 # Sigma Sport Docking Station TOPLINE 2012
ATTRS{idVendor}=="1d9d", ATTRS{idProduct}=="1011", ENV{ID_MM_DEVICE_IGNORE}="1" ATTRS{idVendor}=="1d9d", ATTRS{idProduct}=="1011", ENV{ID_MM_TTY_BLACKLIST}="1"
# Telit LE866 flashing device # Telit LE866 flashing device
ATTRS{idVendor}=="216f", ATTRS{idProduct}=="0051", ENV{ID_MM_DEVICE_IGNORE}="1" ATTRS{idVendor}=="216f", ATTRS{idProduct}=="0051", ENV{ID_MM_TTY_BLACKLIST}="1"
# Analog Devices ADALM-PLUTO (PlutoSDR) # Analog Devices ADALM-PLUTO (PlutoSDR)
ATTRS{idVendor}=="0456", ATTRS{idProduct}=="b673", ENV{ID_MM_DEVICE_IGNORE}="1" ATTRS{idVendor}=="0456", ATTRS{idProduct}=="b673", ENV{ID_MM_TTY_BLACKLIST}="1"
# Renesas development and promotion boards # Renesas development and promotion boards
ATTRS{idVendor}=="045B", ATTRS{idProduct}=="0212", ENV{ID_MM_DEVICE_IGNORE}="1" ATTRS{idVendor}=="045B", ATTRS{idProduct}=="0212", ENV{ID_MM_TTY_BLACKLIST}="1"
ATTRS{idVendor}=="0409", ATTRS{idProduct}=="0063", ENV{ID_MM_DEVICE_IGNORE}="1" ATTRS{idVendor}=="0409", ATTRS{idProduct}=="0063", ENV{ID_MM_TTY_BLACKLIST}="1"
# Analog Devices EVAL-ADXL362Z-DB # Analog Devices EVAL-ADXL362Z-DB
ATTRS{idVendor}=="064B", ATTRS{idProduct}=="7825", ENV{ID_MM_DEVICE_IGNORE}="1" ATTRS{idVendor}=="064B", ATTRS{idProduct}=="7825", ENV{ID_MM_TTY_BLACKLIST}="1"
# keyboard.io devices # keyboard.io devices
ATTRS{idVendor}=="1209", ATTRS{idProduct}=="2300", ENV{ID_MM_DEVICE_IGNORE}="1" ATTRS{idVendor}=="1209", ATTRS{idProduct}=="2300", ENV{ID_MM_TTY_BLACKLIST}="1"
ATTRS{idVendor}=="1209", ATTRS{idProduct}=="2301", ENV{ID_MM_DEVICE_IGNORE}="1" ATTRS{idVendor}=="1209", ATTRS{idProduct}=="2301", ENV{ID_MM_TTY_BLACKLIST}="1"
# Netchip Technology, Inc. Linux-USB Serial Gadget (CDC ACM mode) # Netchip Technology, Inc. Linux-USB Serial Gadget (CDC ACM mode)
ATTRS{idVendor}=="0525", ATTRS{idProduct}=="a4a7", ENV{ID_MM_DEVICE_IGNORE}="1" ATTRS{idVendor}=="0525", ATTRS{idProduct}=="a4a7", ENV{ID_MM_TTY_BLACKLIST}="1"
# Silicon Labs Telegesis ETRX USB Zigbee dongle # Silicon Labs Telegesis ETRX USB Zigbee dongle
ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="000f", ENV{ID_MM_DEVICE_IGNORE}="1" ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="000f", ENV{ID_MM_TTY_BLACKLIST}="1"
# Devices using Microchip's VID # Devices using Microchip's VID
# Dangerous Prototypes Bus Pirate v4 # Dangerous Prototypes Bus Pirate v4
ATTRS{idVendor}=="04d8", ATTRS{idProduct}=="fb00", ENV{ID_MM_DEVICE_IGNORE}="1" ATTRS{idVendor}=="04d8", ATTRS{idProduct}=="fb00", ENV{ID_MM_TTY_BLACKLIST}="1"
# Pycom Pysense # Pycom Pysense
ATTRS{idVendor}=="04d8", ATTRS{idProduct}=="f012", ENV{ID_MM_DEVICE_IGNORE}="1" ATTRS{idVendor}=="04d8", ATTRS{idProduct}=="f012", ENV{ID_MM_TTY_BLACKLIST}="1"
# Pycom Pytrack # Pycom Pytrack
ATTRS{idVendor}=="04d8", ATTRS{idProduct}=="f013", ENV{ID_MM_DEVICE_IGNORE}="1" ATTRS{idVendor}=="04d8", ATTRS{idProduct}=="f013", ENV{ID_MM_TTY_BLACKLIST}="1"
# All devices from Prusa Research # All devices from Prusa Research
ATTRS{idVendor}=="2c99", ENV{ID_MM_DEVICE_IGNORE}="1" ATTRS{idVendor}=="2c99", ENV{ID_MM_TTY_BLACKLIST}="1"
LABEL="mm_usb_device_blacklist_end" LABEL="mm_usb_device_blacklist_end"

View File

@@ -60,6 +60,13 @@ mm_filter_port (MMFilter *self,
return TRUE; return TRUE;
} }
/* If the device is explicitly blacklisted, we ignore every port. */
if ((self->priv->enabled_rules & MM_FILTER_RULE_EXPLICIT_BLACKLIST) &&
(mm_kernel_device_get_global_property_as_boolean (port, ID_MM_DEVICE_IGNORE))) {
mm_dbg ("[filter] (%s/%s): port filtered: device is blacklisted", subsystem, name);
return FALSE;
}
/* If this is a virtual device, don't allow it */ /* If this is a virtual device, don't allow it */
if ((self->priv->enabled_rules & MM_FILTER_RULE_VIRTUAL) && if ((self->priv->enabled_rules & MM_FILTER_RULE_VIRTUAL) &&
(!mm_kernel_device_get_physdev_sysfs_path (port))) { (!mm_kernel_device_get_physdev_sysfs_path (port))) {
@@ -92,8 +99,8 @@ mm_filter_port (MMFilter *self,
/* Ignore blacklisted tty devices. */ /* Ignore blacklisted tty devices. */
if ((self->priv->enabled_rules & MM_FILTER_RULE_TTY_BLACKLIST) && if ((self->priv->enabled_rules & MM_FILTER_RULE_TTY_BLACKLIST) &&
(mm_kernel_device_get_global_property_as_boolean (port, ID_MM_DEVICE_IGNORE))) { (mm_kernel_device_get_global_property_as_boolean (port, ID_MM_TTY_BLACKLIST))) {
mm_dbg ("[filter] (%s/%s): port filtered: device is blacklisted", subsystem, name); mm_dbg ("[filter] (%s/%s): port filtered: tty is blacklisted", subsystem, name);
return FALSE; return FALSE;
} }
@@ -285,6 +292,7 @@ mm_filter_new (MMFilterRule enabled_rules,
mm_dbg ("[filter] created"); mm_dbg ("[filter] created");
mm_dbg ("[filter] explicit whitelist: %s", RULE_ENABLED_STR (MM_FILTER_RULE_EXPLICIT_WHITELIST)); mm_dbg ("[filter] explicit whitelist: %s", RULE_ENABLED_STR (MM_FILTER_RULE_EXPLICIT_WHITELIST));
mm_dbg ("[filter] explicit blacklist: %s", RULE_ENABLED_STR (MM_FILTER_RULE_EXPLICIT_BLACKLIST));
mm_dbg ("[filter] virtual devices forbidden: %s", RULE_ENABLED_STR (MM_FILTER_RULE_VIRTUAL)); mm_dbg ("[filter] virtual devices forbidden: %s", RULE_ENABLED_STR (MM_FILTER_RULE_VIRTUAL));
mm_dbg ("[filter] net devices allowed: %s", RULE_ENABLED_STR (MM_FILTER_RULE_NET)); mm_dbg ("[filter] net devices allowed: %s", RULE_ENABLED_STR (MM_FILTER_RULE_NET));
mm_dbg ("[filter] cdc-wdm devices allowed: %s", RULE_ENABLED_STR (MM_FILTER_RULE_CDC_WDM)); mm_dbg ("[filter] cdc-wdm devices allowed: %s", RULE_ENABLED_STR (MM_FILTER_RULE_CDC_WDM));

View File

@@ -47,22 +47,24 @@ GType mm_filter_get_type (void);
typedef enum { /*< underscore_name=mm_filter_rule >*/ typedef enum { /*< underscore_name=mm_filter_rule >*/
MM_FILTER_RULE_NONE = 0, MM_FILTER_RULE_NONE = 0,
MM_FILTER_RULE_EXPLICIT_WHITELIST = 1 << 0, MM_FILTER_RULE_EXPLICIT_WHITELIST = 1 << 0,
MM_FILTER_RULE_VIRTUAL = 1 << 1, MM_FILTER_RULE_EXPLICIT_BLACKLIST = 1 << 1,
MM_FILTER_RULE_NET = 1 << 2, MM_FILTER_RULE_VIRTUAL = 1 << 2,
MM_FILTER_RULE_CDC_WDM = 1 << 3, MM_FILTER_RULE_NET = 1 << 3,
MM_FILTER_RULE_TTY = 1 << 4, MM_FILTER_RULE_CDC_WDM = 1 << 4,
MM_FILTER_RULE_TTY_BLACKLIST = 1 << 5, MM_FILTER_RULE_TTY = 1 << 5,
MM_FILTER_RULE_TTY_MANUAL_SCAN_ONLY = 1 << 6, MM_FILTER_RULE_TTY_BLACKLIST = 1 << 6,
MM_FILTER_RULE_TTY_PLATFORM_DRIVER = 1 << 7, MM_FILTER_RULE_TTY_MANUAL_SCAN_ONLY = 1 << 7,
MM_FILTER_RULE_TTY_DEFAULT_ALLOWED = 1 << 8, MM_FILTER_RULE_TTY_PLATFORM_DRIVER = 1 << 8,
MM_FILTER_RULE_TTY_DRIVER = 1 << 9, MM_FILTER_RULE_TTY_DEFAULT_ALLOWED = 1 << 9,
MM_FILTER_RULE_TTY_ACM_INTERFACE = 1 << 10, MM_FILTER_RULE_TTY_DRIVER = 1 << 10,
MM_FILTER_RULE_TTY_WITH_NET = 1 << 11, MM_FILTER_RULE_TTY_ACM_INTERFACE = 1 << 11,
MM_FILTER_RULE_TTY_DEFAULT_FORBIDDEN = 1 << 12, MM_FILTER_RULE_TTY_WITH_NET = 1 << 12,
MM_FILTER_RULE_TTY_DEFAULT_FORBIDDEN = 1 << 13,
} MMFilterRule; } MMFilterRule;
#define MM_FILTER_RULE_ALL \ #define MM_FILTER_RULE_ALL \
(MM_FILTER_RULE_EXPLICIT_WHITELIST | \ (MM_FILTER_RULE_EXPLICIT_WHITELIST | \
MM_FILTER_RULE_EXPLICIT_BLACKLIST | \
MM_FILTER_RULE_VIRTUAL | \ MM_FILTER_RULE_VIRTUAL | \
MM_FILTER_RULE_NET | \ MM_FILTER_RULE_NET | \
MM_FILTER_RULE_CDC_WDM | \ MM_FILTER_RULE_CDC_WDM | \
@@ -80,6 +82,7 @@ typedef enum { /*< underscore_name=mm_filter_rule >*/
* device ports unless they're blacklisted in some way or another. */ * device ports unless they're blacklisted in some way or another. */
#define MM_FILTER_POLICY_DEFAULT \ #define MM_FILTER_POLICY_DEFAULT \
(MM_FILTER_RULE_EXPLICIT_WHITELIST | \ (MM_FILTER_RULE_EXPLICIT_WHITELIST | \
MM_FILTER_RULE_EXPLICIT_BLACKLIST | \
MM_FILTER_RULE_VIRTUAL | \ MM_FILTER_RULE_VIRTUAL | \
MM_FILTER_RULE_NET | \ MM_FILTER_RULE_NET | \
MM_FILTER_RULE_CDC_WDM | \ MM_FILTER_RULE_CDC_WDM | \
@@ -93,6 +96,7 @@ typedef enum { /*< underscore_name=mm_filter_rule >*/
* if they are allowed by any of the automatic whitelist rules. */ * if they are allowed by any of the automatic whitelist rules. */
#define MM_FILTER_POLICY_STRICT \ #define MM_FILTER_POLICY_STRICT \
(MM_FILTER_RULE_EXPLICIT_WHITELIST | \ (MM_FILTER_RULE_EXPLICIT_WHITELIST | \
MM_FILTER_RULE_EXPLICIT_BLACKLIST | \
MM_FILTER_RULE_VIRTUAL | \ MM_FILTER_RULE_VIRTUAL | \
MM_FILTER_RULE_NET | \ MM_FILTER_RULE_NET | \
MM_FILTER_RULE_CDC_WDM | \ MM_FILTER_RULE_CDC_WDM | \
@@ -107,6 +111,7 @@ typedef enum { /*< underscore_name=mm_filter_rule >*/
* blacklists explicitly */ * blacklists explicitly */
#define MM_FILTER_POLICY_PARANOID \ #define MM_FILTER_POLICY_PARANOID \
(MM_FILTER_RULE_EXPLICIT_WHITELIST | \ (MM_FILTER_RULE_EXPLICIT_WHITELIST | \
MM_FILTER_RULE_EXPLICIT_BLACKLIST | \
MM_FILTER_RULE_VIRTUAL | \ MM_FILTER_RULE_VIRTUAL | \
MM_FILTER_RULE_NET | \ MM_FILTER_RULE_NET | \
MM_FILTER_RULE_CDC_WDM | \ MM_FILTER_RULE_CDC_WDM | \