当手机连接到 USB 时,如何防止通知和图标弹出?

Léo*_* 준영 12 nautilus usb phone power-management 16.04

条件:手机连接到 USB 时出现无关的通知和弹出窗口。
差分条件:USB 电源管理失败,网卡管理失败。
支持:通知、弹出窗口和 dmesg 警告主要发生在电源状态达到最大值时,但在电源状态百分比保持不变时变得相当稳定。

当我通过 USB 将手机连接到笔记本电脑时,文件管理器会一直打开(图 1 和图 2)。左侧栏中也有弹出图标(图 3)。网络共享时还会频繁打开/关闭互联网连接通知(图 4 和 5)。劣质电缆会增加这些烦恼的频率。所有类型的通知每分钟可以发送多次。当电池达到高功率状态时,它们的速率会增加,但在电池充满电时保持稳定。

  • 我做了 wjandrea解决问题的建议 ,它的状态在这里gsettings set org.gnome.desktop.media-handling automount-open falseautomount-opendmesg | tail

仅将设备连接到笔记本电脑时,您会看到大约 10-30 个错误窗口(图 1 和 2)和手机的右侧图标来回弹出(图 3)

在此处输入图片说明

在此处输入图片说明

在此处输入图片说明

  • 我做 wjandrea 的第二个建议gsettings set org.gnome.desktop.media-handling automount false。然而,三星手机的图标开始一次又一次地在左侧栏中弹出。它主要发生在我的笔记本电脑充满电时,因此它可能是电源管理中的问题。它的dmesg | tail状态在这里(也参见图 3),这是第一次发生,主要是当我的笔记本电脑达到最大电池状态时。

此处是第二个 dmesg 的子集

[    5.788819] wl: module license 'MIXED/Proprietary' taints kernel.
[    5.788820] Disabling lock debugging due to kernel taint
[    5.789154] input: HDA Intel PCH Headphone as /devices/pci0000:00/0000:00:1b.0/sound/card1/input8
[    5.797453] wl: module verification failed: signature and/or required key missing - tainting kernel
[    5.812002] input: HDA Intel HDMI HDMI/DP,pcm=3 as /devices/pci0000:00/0000:00:03.0/sound/card0/input9
[    5.812092] input: HDA Intel HDMI HDMI/DP,pcm=7 as /devices/pci0000:00/0000:00:03.0/sound/card0/input10
[    5.812165] input: HDA Intel HDMI HDMI/DP,pcm=8 as /devices/pci0000:00/0000:00:03.0/sound/card0/input11
[    5.981764] intel_rapl: Found RAPL domain package
[    5.981769] intel_rapl: Found RAPL domain core
[    5.981771] intel_rapl: Found RAPL domain uncore
[    5.981772] intel_rapl: Found RAPL domain dram
[    6.024117] wlan0: Broadcom BCM43a0 802.11 Hybrid Wireless Controller 6.30.223.248 (r487574)
[    6.030416] applesmc: key=561 fan=1 temp=33 index=33 acc=0 lux=2 kbd=1
[    6.050130] wl 0000:03:00.0 wlp3s0: renamed from wlan0
[    6.242168] Non-volatile memory driver v1.3
[    6.428191] IPv6: ADDRCONF(NETDEV_UP): wlp3s0: link is not ready
[    6.862799] input: bcm5974 as /devices/pci0000:00/0000:00:14.0/usb1/1-5/1-5:1.2/input/input12
[    6.862926] usbcore: registered new interface driver bcm5974
[    7.053663] fuse init (API version 7.24)
[    7.329118] Bluetooth: Core ver 2.21
[    7.329540] NET: Registered protocol family 31
[    7.329543] Bluetooth: HCI device and connection manager initialized
[    7.329548] Bluetooth: HCI socket layer initialized
[    7.329551] Bluetooth: L2CAP socket layer initialized
[    7.329558] Bluetooth: SCO socket layer initialized
[    7.350445] usbcore: registered new interface driver btusb
[    7.355183] Bluetooth: hci0: BCM: chip id 73 build 0932
[    7.356184] Bluetooth: hci0: BCM: product 05ac:828f
[    7.372192] Bluetooth: hci0: BCM20702B0 Generic USB Class 1 @ 20 MHz
[    7.391321] usb 1-3.1: USB disconnect, device number 5
[    7.634631] usb 1-3.2: USB disconnect, device number 6
[    8.363517] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[    8.363521] Bluetooth: BNEP filters: protocol multicast
[    8.363525] Bluetooth: BNEP socket layer initialized
[    8.377953] Bluetooth: RFCOMM TTY layer initialized
[    8.377960] Bluetooth: RFCOMM socket layer initialized
[    8.377965] Bluetooth: RFCOMM ver 1.11
[   78.943062] usb 1-1: USB disconnect, device number 2
[   79.308530] usb 1-1: new high-speed USB device number 8 using xhci_hcd
[   79.437071] usb 1-1: New USB device found, idVendor=04e8, idProduct=6863
[   79.437079] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[   79.437083] usb 1-1: Product: SAMSUNG_Android
[   79.437086] usb 1-1: Manufacturer: SAMSUNG
[   79.437089] usb 1-1: SerialNumber: d068730a
[   79.978452] usbcore: registered new interface driver cdc_ether
[   79.981649] rndis_host 1-1:1.0 usb0: register 'rndis_host' at usb-0000:00:14.0-1, RNDIS device, 02:57:00:57:38:37
[   79.981726] usbcore: registered new interface driver rndis_host
[   79.983854] rndis_host 1-1:1.0 enp0s20u1: renamed from usb0
[   80.011403] IPv6: ADDRCONF(NETDEV_UP): enp0s20u1: link is not ready
[ 1290.235637] usb 1-1: USB disconnect, device number 8
[ 1290.235777] rndis_host 1-1:1.0 enp0s20u1: unregister 'rndis_host' usb-0000:00:14.0-1, RNDIS device
[ 1290.591107] usb 1-1: new high-speed USB device number 9 using xhci_hcd
[ 1290.719964] usb 1-1: New USB device found, idVendor=04e8, idProduct=6863
[ 1290.719973] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 1290.719977] usb 1-1: Product: SAMSUNG_Android
[ 1290.719981] usb 1-1: Manufacturer: SAMSUNG
[ 1290.719984] usb 1-1: SerialNumber: d068730a
[ 1290.722251] rndis_host 1-1:1.0 usb0: register 'rndis_host' at usb-0000:00:14.0-1, RNDIS device, 02:57:00:57:38:37
[ 1291.255806] rndis_host 1-1:1.0 enp0s20u1: renamed from usb0
[ 1291.277892] IPv6: ADDRCONF(NETDEV_UP): enp0s20u1: link is not ready
[ 1870.316573] usb 1-1: USB disconnect, device number 9
[ 1870.316687] rndis_host 1-1:1.0 enp0s20u1: unregister 'rndis_host' usb-0000:00:14.0-1, RNDIS device
[ 1871.735777] usb 1-1: new high-speed USB device number 10 using xhci_hcd
[ 1871.865681] usb 1-1: New USB device found, idVendor=04e8, idProduct=6860
[ 1871.865687] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 1871.865690] usb 1-1: Product: SAMSUNG_Android
[ 1871.865692] usb 1-1: Manufacturer: SAMSUNG
[ 1871.865694] usb 1-1: SerialNumber: d068730a
[ 2265.887618] usb 1-1: USB disconnect, device number 10
[ 2268.395967] usb 1-1: new high-speed USB device number 11 using xhci_hcd
[ 2268.524992] usb 1-1: New USB device found, idVendor=04e8, idProduct=6860
[ 2268.524998] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 2268.525001] usb 1-1: Product: SAMSUNG_Android
[ 2268.525003] usb 1-1: Manufacturer: SAMSUNG
[ 2268.525005] usb 1-1: SerialNumber: d068730a
[ 2389.754208] usb 1-1: USB disconnect, device number 11
[ 2451.283233] usb 1-1: new high-speed USB device number 12 using xhci_hcd
[ 2451.412713] usb 1-1: New USB device found, idVendor=04e8, idProduct=6860
[ 2451.412719] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 2451.412722] usb 1-1: Product: SAMSUNG_Android
[ 2451.412725] usb 1-1: Manufacturer: SAMSUNG
[ 2451.412727] usb 1-1: SerialNumber: d068730a
[ 4253.278282] usb 1-1: USB disconnect, device number 12
[ 4254.096939] usb 1-1: new high-speed USB device number 13 using xhci_hcd
[ 4259.392860] usb 1-1: new high-speed USB device number 14 using xhci_hcd
[ 4259.522162] usb 1-1: New USB device found, idVendor=04e8, idProduct=6860
[ 4259.522167] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 4259.522170] usb 1-1: Product: SAMSUNG_Android
[ 4259.522173] usb 1-1: Manufacturer: SAMSUNG
[ 4259.522175] usb 1-1: SerialNumber: d068730a
[ 4259.731917] usb 1-1: USB disconnect, device number 14
[ 4260.068777] usb 1-1: new high-speed USB device number 15 using xhci_hcd
[ 4260.200384] usb 1-1: New USB device found, idVendor=04e8, idProduct=6860
[ 4260.200389] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 4260.200392] usb 1-1: Product: SAMSUNG_Android
[ 4260.200395] usb 1-1: Manufacturer: SAMSUNG
[ 4260.200397] usb 1-1: SerialNumber: d068730a
[ 4487.825779] usb 1-1: USB disconnect, device number 15
[ 4488.457511] usb 1-1: new high-speed USB device number 16 using xhci_hcd
[ 4488.643676] usb 1-1: New USB device found, idVendor=04e8, idProduct=6860
[ 4488.643682] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 4488.643685] usb 1-1: Product: SAMSUNG_Android
[ 4488.643687] usb 1-1: Manufacturer: SAMSUNG
[ 4488.643689] usb 1-1: SerialNumber: d068730a
[ 4507.592538] usb 1-1: USB disconnect, device number 16
[ 4507.929239] usb 1-1: new high-speed USB device number 17 using xhci_hcd
[ 4508.115547] usb 1-1: New USB device found, idVendor=04e8, idProduct=6860
[ 4508.115553] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 4508.115556] usb 1-1: Product: SAMSUNG_Android
[ 4508.115558] usb 1-1: Manufacturer: SAMSUNG
[ 4508.115560] usb 1-1: SerialNumber: d068730a
Run Code Online (Sandbox Code Playgroud)

在此处输入图片说明

在此处输入图片说明

其他提案

  • 斯内瑟。它在第一天起作用。我会在下周告诉你它是如何运作的。

    > sudo -i 
    > sed 's/LABEL="libmtp_usb_rules"/LABEL="libmtp_usb_rules"\n\n#Masi, ignore my phone\nATTR{idVendor}=="04e8", ATTR{idProduct}=="6863", GOTO="libmtp_rules_end"/g' /lib/udev/rules.d/69-libmtp.rules | sudo tee /etc/udev/rules.d/69-libmtp.rules \
    udevadm control --reload-rules
    
    # TODO for long time monitoring
    
    Run Code Online (Sandbox Code Playgroud)

电话:三星 Galaxy S4 gt-i9506 带有淡马锡的CyanogenMod 13非官方ROM,有足够的补丁
Ubuntu 版本:16.04
Linux 内核:4.4 和 4.6
Linux 内核选项:wl
Bash:4.3.42(1)-release (x86_64-pc-linux- gnu)
笔记本电脑:2013 年中 Macbook Air
USB:两个 USB3 端口(最高 5 Gbps)(此处为官方规格)
网卡驱动程序:非免费的Broadcom-sta-dkms(请参阅此处
手机中的 VPN:NordVPN 美国 udp 服务器
VPN在笔记本电脑中,当 wifi 与路由器防火墙连接时:NordVPN EE udp 服务器

  • 支持 1:电源状态的负面变化 (-1%) 与通知相关。
  • 支持 2:不稳定的互联网连接会消耗大量电量 (\Delta P = 1%)。
  • 支持 3:受 VPN 保护的互联网连接显着减少了通知数量。

Dha*_*ria 3

dconf是在这种情况下进行检查的地方。

dconf 是一个低级配置系统和设置管理。其主要目的是在还没有配置存储系统的平台上为 GSettings 和 KSettings 提供后端。这取决于 GLib。它是 GNOME 3 的一部分,是 GConf 的替代品。~维基百科

为此,您需要安装dconf 编辑器,如下所示:

sudo apt-get update
sudo apt-get install dconf-tools
Run Code Online (Sandbox Code Playgroud)

要打开dconf 编辑器

Alt + F2

或者

转到应用程序 > 系统工具 > dconf 编辑器

现在在 dconf 编辑器的侧边栏中

org > gnome > 桌面 > 媒体处理

取消选中自动挂载打开选项。

以下是 16.04 中 dconf-editor 的屏幕截图:

16.04 中的 dconf 编辑器


Ami*_*ias 0

我的一加一也有类似的问题,它的 USB 插座有点不稳定,这使得它每 5 分钟左右就会启动一个 nautilus 窗口。

我发现防止这种情况的最有效方法是通过匹配 USB 供应商和型号 ID,然后将设备设置为未经授权的模式,使 udev 完全忽略它。通过这种方式,您可以专门防止该设备触发任何更上游的事情,例如自动挂载,而不会影响其他任何事情。

如何做udev黑名单 https://projectgus.com/2014/09/blacklisting-a-single-usb-device-from-linux/

三星手机指南 http://blog.vacs.fr/vacs/blogs/post.html?post=2010/12/24/How-to-repair-the-USB-not-Detected-problem-on-Android -三星手机