diff options
-rw-r--r-- | docs/reference/api/ModemManager-overview.xml | 23 | ||||
-rw-r--r-- | docs/reference/api/ModemManager-sections.txt | 3 | ||||
-rw-r--r-- | include/ModemManager-tags.h | 20 | ||||
-rw-r--r-- | src/77-mm-pcmcia-device-blacklist.rules | 2 | ||||
-rw-r--r-- | src/77-mm-usb-device-blacklist.rules | 162 | ||||
-rw-r--r-- | src/mm-filter.c | 12 | ||||
-rw-r--r-- | src/mm-filter.h | 29 |
7 files changed, 150 insertions, 101 deletions
diff --git a/docs/reference/api/ModemManager-overview.xml b/docs/reference/api/ModemManager-overview.xml index 963c0df2..f9d8dc22 100644 --- a/docs/reference/api/ModemManager-overview.xml +++ b/docs/reference/api/ModemManager-overview.xml @@ -125,6 +125,24 @@ $ 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 + </programlisting> + </listitem> + <listitem> <para><emphasis>MM_FILTER_RULE_VIRTUAL</emphasis></para> <para> This filter will automatically flag as forbidden all ports exposed by virtual @@ -167,7 +185,7 @@ $ sudo udevadm trigger <para><emphasis>MM_FILTER_RULE_TTY_BLACKLIST</emphasis></para> <para> 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. </para> </listitem> @@ -239,6 +257,7 @@ $ sudo udevadm trigger This is a policy where the following rules are enabled: <itemizedlist> <listitem>MM_FILTER_RULE_EXPLICIT_WHITELIST</listitem> + <listitem>MM_FILTER_RULE_EXPLICIT_BLACKLIST</listitem> <listitem>MM_FILTER_RULE_VIRTUAL</listitem> <listitem>MM_FILTER_RULE_NET</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: <itemizedlist> <listitem>MM_FILTER_RULE_EXPLICIT_WHITELIST</listitem> + <listitem>MM_FILTER_RULE_EXPLICIT_BLACKLIST</listitem> <listitem>MM_FILTER_RULE_VIRTUAL</listitem> <listitem>MM_FILTER_RULE_NET</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: <itemizedlist> <listitem>MM_FILTER_RULE_EXPLICIT_WHITELIST</listitem> + <listitem>MM_FILTER_RULE_EXPLICIT_BLACKLIST</listitem> <listitem>MM_FILTER_RULE_VIRTUAL</listitem> <listitem>MM_FILTER_RULE_NET</listitem> <listitem>MM_FILTER_RULE_CDC_WDM</listitem> diff --git a/docs/reference/api/ModemManager-sections.txt b/docs/reference/api/ModemManager-sections.txt index 577da27e..cdefe11d 100644 --- a/docs/reference/api/ModemManager-sections.txt +++ b/docs/reference/api/ModemManager-sections.txt @@ -151,9 +151,10 @@ MM_DEPRECATED <TITLE>Common udev tags</TITLE> ID_MM_CANDIDATE ID_MM_PHYSDEV_UID -ID_MM_PORT_IGNORE ID_MM_DEVICE_PROCESS ID_MM_DEVICE_IGNORE +ID_MM_PORT_IGNORE +ID_MM_TTY_BLACKLIST ID_MM_DEVICE_MANUAL_SCAN_ONLY ID_MM_PLATFORM_DRIVER_PROBE ID_MM_PORT_TYPE_AT_PPP diff --git a/include/ModemManager-tags.h b/include/ModemManager-tags.h index 4be1e791..f7e939a7 100644 --- a/include/ModemManager-tags.h +++ b/include/ModemManager-tags.h @@ -73,6 +73,20 @@ #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: * * This is a port-specific tag that allows explicitly ignoring a given port @@ -82,8 +96,8 @@ */ #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 * 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. */ -#define ID_MM_DEVICE_IGNORE "ID_MM_DEVICE_IGNORE" +#define ID_MM_TTY_BLACKLIST "ID_MM_TTY_BLACKLIST" /** * ID_MM_DEVICE_MANUAL_SCAN_ONLY: diff --git a/src/77-mm-pcmcia-device-blacklist.rules b/src/77-mm-pcmcia-device-blacklist.rules index b496a8e5..7c82fa94 100644 --- a/src/77-mm-pcmcia-device-blacklist.rules +++ b/src/77-mm-pcmcia-device-blacklist.rules @@ -4,6 +4,6 @@ ACTION!="add|change|move|bind", GOTO="mm_pcmcia_device_blacklist_end" SUBSYSTEM!="pcmcia", GOTO="mm_pcmcia_device_blacklist_end" # 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" diff --git a/src/77-mm-usb-device-blacklist.rules b/src/77-mm-usb-device-blacklist.rules index e8d7a4cf..983fe434 100644 --- a/src/77-mm-usb-device-blacklist.rules +++ b/src/77-mm-usb-device-blacklist.rules @@ -4,208 +4,208 @@ ACTION!="add|change|move|bind", GOTO="mm_usb_device_blacklist_end" SUBSYSTEM!="usb", GOTO="mm_usb_device_blacklist_end" # APC UPS devices -ATTRS{idVendor}=="051d", ENV{ID_MM_DEVICE_IGNORE}="1" +ATTRS{idVendor}=="051d", ENV{ID_MM_TTY_BLACKLIST}="1" # 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 -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 -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 -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 -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 -ATTRS{idVendor}=="06da", ENV{ID_MM_DEVICE_IGNORE}="1" +ATTRS{idVendor}=="06da", ENV{ID_MM_TTY_BLACKLIST}="1" # 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 -ATTRS{idVendor}=="09ae", ENV{ID_MM_DEVICE_IGNORE}="1" +ATTRS{idVendor}=="09ae", ENV{ID_MM_TTY_BLACKLIST}="1" # Various MGE Office Protection Systems devices -ATTRS{idVendor}=="0463", ATTRS{idProduct}=="0001", ENV{ID_MM_DEVICE_IGNORE}="1" -ATTRS{idVendor}=="0463", ATTRS{idProduct}=="ffff", 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_TTY_BLACKLIST}="1" # 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 -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 -ATTRS{idVendor}=="050d", ATTRS{idProduct}=="0980", ENV{ID_MM_DEVICE_IGNORE}="1" -ATTRS{idVendor}=="050d", ATTRS{idProduct}=="0900", ENV{ID_MM_DEVICE_IGNORE}="1" -ATTRS{idVendor}=="050d", ATTRS{idProduct}=="0910", ENV{ID_MM_DEVICE_IGNORE}="1" -ATTRS{idVendor}=="050d", ATTRS{idProduct}=="0912", ENV{ID_MM_DEVICE_IGNORE}="1" -ATTRS{idVendor}=="050d", ATTRS{idProduct}=="0551", ENV{ID_MM_DEVICE_IGNORE}="1" -ATTRS{idVendor}=="050d", ATTRS{idProduct}=="0751", ENV{ID_MM_DEVICE_IGNORE}="1" -ATTRS{idVendor}=="050d", ATTRS{idProduct}=="0375", ENV{ID_MM_DEVICE_IGNORE}="1" -ATTRS{idVendor}=="050d", ATTRS{idProduct}=="1100", 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_TTY_BLACKLIST}="1" +ATTRS{idVendor}=="050d", ATTRS{idProduct}=="0910", ENV{ID_MM_TTY_BLACKLIST}="1" +ATTRS{idVendor}=="050d", ATTRS{idProduct}=="0912", ENV{ID_MM_TTY_BLACKLIST}="1" +ATTRS{idVendor}=="050d", ATTRS{idProduct}=="0551", ENV{ID_MM_TTY_BLACKLIST}="1" +ATTRS{idVendor}=="050d", ATTRS{idProduct}=="0751", ENV{ID_MM_TTY_BLACKLIST}="1" +ATTRS{idVendor}=="050d", ATTRS{idProduct}=="0375", ENV{ID_MM_TTY_BLACKLIST}="1" +ATTRS{idVendor}=="050d", ATTRS{idProduct}=="1100", ENV{ID_MM_TTY_BLACKLIST}="1" # 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 -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 # Shouldn't be probed themselves, but you can install programs like # "MobileStream USB Modem" which changes the USB PID of the device to something # 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 -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 -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 -ATTRS{idVendor}=="0617", ENV{ID_MM_DEVICE_IGNORE}="1" +ATTRS{idVendor}=="0617", ENV{ID_MM_TTY_BLACKLIST}="1" # West Mountain Radio devices -ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="814a", ENV{ID_MM_DEVICE_IGNORE}="1" -ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="814b", ENV{ID_MM_DEVICE_IGNORE}="1" -ATTRS{idVendor}=="2405", ATTRS{idProduct}=="0003", 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_TTY_BLACKLIST}="1" +ATTRS{idVendor}=="2405", ATTRS{idProduct}=="0003", ENV{ID_MM_TTY_BLACKLIST}="1" # Arduinos -ATTRS{idVendor}=="2341", ENV{ID_MM_DEVICE_IGNORE}="1" -ATTRS{idVendor}=="2a03", ENV{ID_MM_DEVICE_IGNORE}="1" -ATTRS{idVendor}=="1b4f", ATTRS{idProduct}=="9207", ENV{ID_MM_DEVICE_IGNORE}="1" -ATTRS{idVendor}=="1b4f", ATTRS{idProduct}=="9208", ENV{ID_MM_DEVICE_IGNORE}="1" +ATTRS{idVendor}=="2341", ENV{ID_MM_TTY_BLACKLIST}="1" +ATTRS{idVendor}=="2a03", ENV{ID_MM_TTY_BLACKLIST}="1" +ATTRS{idVendor}=="1b4f", ATTRS{idProduct}=="9207", ENV{ID_MM_TTY_BLACKLIST}="1" +ATTRS{idVendor}=="1b4f", ATTRS{idProduct}=="9208", ENV{ID_MM_TTY_BLACKLIST}="1" # Adafruit Flora -ATTRS{idVendor}=="239a", ATTRS{idProduct}=="0004", ENV{ID_MM_DEVICE_IGNORE}="1" -ATTRS{idVendor}=="239a", ATTRS{idProduct}=="8004", 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_TTY_BLACKLIST}="1" # All devices from Pololu Corporation # except some possible future products. -ATTRS{idVendor}=="1ffb", ENV{ID_MM_DEVICE_IGNORE}="1" -ATTRS{idVendor}=="1ffb", ATTRS{idProduct}=="00ad", ENV{ID_MM_DEVICE_IGNORE}="0" -ATTRS{idVendor}=="1ffb", ATTRS{idProduct}=="00ae", ENV{ID_MM_DEVICE_IGNORE}="0" +ATTRS{idVendor}=="1ffb", ENV{ID_MM_TTY_BLACKLIST}="1" +ATTRS{idVendor}=="1ffb", ATTRS{idProduct}=="00ad", ENV{ID_MM_TTY_BLACKLIST}="0" +ATTRS{idVendor}=="1ffb", ATTRS{idProduct}=="00ae", ENV{ID_MM_TTY_BLACKLIST}="0" # 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 -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) -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 -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) -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 -ATTRS{idVendor}=="1546", ATTRS{idProduct}=="01a5", ENV{ID_MM_DEVICE_IGNORE}="1" -ATTRS{idVendor}=="1546", ATTRS{idProduct}=="01a6", ENV{ID_MM_DEVICE_IGNORE}="1" -ATTRS{idVendor}=="1546", ATTRS{idProduct}=="01a7", 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_TTY_BLACKLIST}="1" +ATTRS{idVendor}=="1546", ATTRS{idProduct}=="01a7", ENV{ID_MM_TTY_BLACKLIST}="1" # Garmin GPS devices -DRIVERS=="garmin_gps", ENV{ID_MM_DEVICE_IGNORE}="1" +DRIVERS=="garmin_gps", ENV{ID_MM_TTY_BLACKLIST}="1" # 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 -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 -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 -ATTRS{idVendor}=="26ac", ENV{ID_MM_DEVICE_IGNORE}="1" +ATTRS{idVendor}=="26ac", ENV{ID_MM_TTY_BLACKLIST}="1" # 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 -ATTRS{idVendor}=="8087", ATTRS{idProduct}=="0716", ENV{ID_MM_DEVICE_IGNORE}="1" -ATTRS{idVendor}=="8087", ATTRS{idProduct}=="0801", 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_TTY_BLACKLIST}="1" # 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 -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 # likely are not being used anymore -DRIVERS=="visor", ENV{ID_MM_DEVICE_IGNORE}="1" +DRIVERS=="visor", ENV{ID_MM_TTY_BLACKLIST}="1" # 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 -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) # 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 -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 -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 -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. # 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 -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 -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 -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 -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) -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 -ATTRS{idVendor}=="045B", ATTRS{idProduct}=="0212", ENV{ID_MM_DEVICE_IGNORE}="1" -ATTRS{idVendor}=="0409", ATTRS{idProduct}=="0063", 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_TTY_BLACKLIST}="1" # 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 -ATTRS{idVendor}=="1209", ATTRS{idProduct}=="2300", ENV{ID_MM_DEVICE_IGNORE}="1" -ATTRS{idVendor}=="1209", ATTRS{idProduct}=="2301", 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_TTY_BLACKLIST}="1" # 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 -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 # 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 -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 -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 -ATTRS{idVendor}=="2c99", ENV{ID_MM_DEVICE_IGNORE}="1" +ATTRS{idVendor}=="2c99", ENV{ID_MM_TTY_BLACKLIST}="1" LABEL="mm_usb_device_blacklist_end" diff --git a/src/mm-filter.c b/src/mm-filter.c index e65a628c..2a087af9 100644 --- a/src/mm-filter.c +++ b/src/mm-filter.c @@ -60,6 +60,13 @@ mm_filter_port (MMFilter *self, 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 ((self->priv->enabled_rules & MM_FILTER_RULE_VIRTUAL) && (!mm_kernel_device_get_physdev_sysfs_path (port))) { @@ -92,8 +99,8 @@ mm_filter_port (MMFilter *self, /* Ignore blacklisted tty devices. */ if ((self->priv->enabled_rules & MM_FILTER_RULE_TTY_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); + (mm_kernel_device_get_global_property_as_boolean (port, ID_MM_TTY_BLACKLIST))) { + mm_dbg ("[filter] (%s/%s): port filtered: tty is blacklisted", subsystem, name); return FALSE; } @@ -285,6 +292,7 @@ mm_filter_new (MMFilterRule enabled_rules, mm_dbg ("[filter] created"); 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] 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)); diff --git a/src/mm-filter.h b/src/mm-filter.h index 486d65bf..098a06f3 100644 --- a/src/mm-filter.h +++ b/src/mm-filter.h @@ -47,22 +47,24 @@ GType mm_filter_get_type (void); typedef enum { /*< underscore_name=mm_filter_rule >*/ MM_FILTER_RULE_NONE = 0, MM_FILTER_RULE_EXPLICIT_WHITELIST = 1 << 0, - MM_FILTER_RULE_VIRTUAL = 1 << 1, - MM_FILTER_RULE_NET = 1 << 2, - MM_FILTER_RULE_CDC_WDM = 1 << 3, - MM_FILTER_RULE_TTY = 1 << 4, - MM_FILTER_RULE_TTY_BLACKLIST = 1 << 5, - MM_FILTER_RULE_TTY_MANUAL_SCAN_ONLY = 1 << 6, - MM_FILTER_RULE_TTY_PLATFORM_DRIVER = 1 << 7, - MM_FILTER_RULE_TTY_DEFAULT_ALLOWED = 1 << 8, - MM_FILTER_RULE_TTY_DRIVER = 1 << 9, - MM_FILTER_RULE_TTY_ACM_INTERFACE = 1 << 10, - MM_FILTER_RULE_TTY_WITH_NET = 1 << 11, - MM_FILTER_RULE_TTY_DEFAULT_FORBIDDEN = 1 << 12, + MM_FILTER_RULE_EXPLICIT_BLACKLIST = 1 << 1, + MM_FILTER_RULE_VIRTUAL = 1 << 2, + MM_FILTER_RULE_NET = 1 << 3, + MM_FILTER_RULE_CDC_WDM = 1 << 4, + MM_FILTER_RULE_TTY = 1 << 5, + MM_FILTER_RULE_TTY_BLACKLIST = 1 << 6, + MM_FILTER_RULE_TTY_MANUAL_SCAN_ONLY = 1 << 7, + MM_FILTER_RULE_TTY_PLATFORM_DRIVER = 1 << 8, + MM_FILTER_RULE_TTY_DEFAULT_ALLOWED = 1 << 9, + MM_FILTER_RULE_TTY_DRIVER = 1 << 10, + MM_FILTER_RULE_TTY_ACM_INTERFACE = 1 << 11, + MM_FILTER_RULE_TTY_WITH_NET = 1 << 12, + MM_FILTER_RULE_TTY_DEFAULT_FORBIDDEN = 1 << 13, } MMFilterRule; #define MM_FILTER_RULE_ALL \ (MM_FILTER_RULE_EXPLICIT_WHITELIST | \ + MM_FILTER_RULE_EXPLICIT_BLACKLIST | \ MM_FILTER_RULE_VIRTUAL | \ MM_FILTER_RULE_NET | \ 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. */ #define MM_FILTER_POLICY_DEFAULT \ (MM_FILTER_RULE_EXPLICIT_WHITELIST | \ + MM_FILTER_RULE_EXPLICIT_BLACKLIST | \ MM_FILTER_RULE_VIRTUAL | \ MM_FILTER_RULE_NET | \ 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. */ #define MM_FILTER_POLICY_STRICT \ (MM_FILTER_RULE_EXPLICIT_WHITELIST | \ + MM_FILTER_RULE_EXPLICIT_BLACKLIST | \ MM_FILTER_RULE_VIRTUAL | \ MM_FILTER_RULE_NET | \ MM_FILTER_RULE_CDC_WDM | \ @@ -107,6 +111,7 @@ typedef enum { /*< underscore_name=mm_filter_rule >*/ * blacklists explicitly */ #define MM_FILTER_POLICY_PARANOID \ (MM_FILTER_RULE_EXPLICIT_WHITELIST | \ + MM_FILTER_RULE_EXPLICIT_BLACKLIST | \ MM_FILTER_RULE_VIRTUAL | \ MM_FILTER_RULE_NET | \ MM_FILTER_RULE_CDC_WDM | \ |