diff options
-rw-r--r-- | src/77-mm-platform-serial-whitelist.rules | 14 | ||||
-rw-r--r-- | src/Makefile.am | 3 | ||||
-rw-r--r-- | src/mm-manager.c | 18 |
3 files changed, 32 insertions, 3 deletions
diff --git a/src/77-mm-platform-serial-whitelist.rules b/src/77-mm-platform-serial-whitelist.rules new file mode 100644 index 00000000..b62d0a6e --- /dev/null +++ b/src/77-mm-platform-serial-whitelist.rules @@ -0,0 +1,14 @@ +# do not edit this file, it will be overwritten on update + +ACTION!="add|change", GOTO="mm_platform_device_whitelist_end" +SUBSYSTEM!="platform", GOTO="mm_platform_device_whitelist_end" + +# Be careful here since many devices connected to platform drivers on PCs +# are legacy devices that won't like probing. But often on embedded +# systems serial ports are provided by platform devices. + +# Allow atmel_usart +DRIVERS=="atmel_usart", ENV{ID_MM_PLATFORM_DRIVER_PROBE}="1" + +LABEL="mm_platform_device_whitelist_end" + diff --git a/src/Makefile.am b/src/Makefile.am index 13832a17..46046ce5 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -3,7 +3,8 @@ SUBDIRS=. tests udevrulesdir = $(UDEV_BASE_DIR)/rules.d udevrules_DATA = \ 77-mm-usb-device-blacklist.rules \ - 77-mm-pcmcia-device-blacklist.rules + 77-mm-pcmcia-device-blacklist.rules \ + 77-mm-platform-serial-whitelist.rules EXTRA_DIST = \ $(udevrules_DATA) diff --git a/src/mm-manager.c b/src/mm-manager.c index 287c1ab7..fc3a1281 100644 --- a/src/mm-manager.c +++ b/src/mm-manager.c @@ -636,7 +636,7 @@ find_physical_device (GUdevDevice *child) GUdevDevice *physdev = NULL; const char *subsys, *type; guint32 i = 0; - gboolean is_usb = FALSE, is_pci = FALSE, is_pcmcia = FALSE; + gboolean is_usb = FALSE, is_pci = FALSE, is_pcmcia = FALSE, is_platform = FALSE; g_return_val_if_fail (child != NULL, NULL); @@ -671,6 +671,11 @@ find_physical_device (GUdevDevice *child) if (physdev) break; } + } else if (is_platform || !strcmp (subsys, "platform")) { + /* Take the first platform parent as the physical device */ + is_platform = TRUE; + physdev = iter; + break; } else if (is_pci || !strcmp (subsys, "pci")) { is_pci = TRUE; physdev = iter; @@ -690,7 +695,7 @@ static void device_added (MMManager *manager, GUdevDevice *device) { MMManagerPrivate *priv = MM_MANAGER_GET_PRIVATE (manager); - const char *subsys, *name, *physdev_path; + const char *subsys, *name, *physdev_path, *physdev_subsys; SupportsInfo *info; char *key; gboolean found; @@ -743,6 +748,15 @@ device_added (MMManager *manager, GUdevDevice *device) goto out; } + /* If the physdev is a 'platform' device that's not whitelisted, ignore it */ + physdev_subsys = g_udev_device_get_subsystem (physdev); + if ( physdev_subsys + && !strcmp (physdev_subsys, "platform") + && !g_udev_device_get_property_as_boolean (physdev, "ID_MM_PLATFORM_DRIVER_PROBE")) { + g_debug ("(%s/%s): port's parent platform driver is not whitelisted", subsys, name); + goto out; + } + physdev_path = g_udev_device_get_sysfs_path (physdev); if (!physdev_path) { g_debug ("(%s/%s): could not get port's parent device sysfs path", subsys, name); |