联想推出的 P16 gen 2 笔记本电脑(经 Ubuntu Linux 认证)配备以下 wwan 卡:Intel MBIM [8086:7560]。调制解调器管理器可以看到 wwan 调制解调器,但无法启用它(错误消息:**(modem-manager-gui:9178):警告**:10:33:30.084:调制解调器管理器 >= 0.7.0:GDBus.Error:org.freedesktop.ModemManager1.Error.Core.Retry:无效转换
根据联想的说明(ThinkPad P16 Gen 2 Linux 用户指南:应该“转到https://support.lenovo.com并选择适合您计算机的条目。从产品支持页面下载 wwan-linux-fcc-unlock 包。请务必检查 README 以确认是否适用您所在地区的任何限制,并获取有关如何安装该应用程序的说明。)
但遗憾的是,联想网站上没有提供这样的文件。联想也没有对未能提供 fcc 解锁文件一事发表评论。
此链接也似乎为空:https://www.lenovo.com/linux/wwan-enablement-on-Linux.pdf
除非有人知道上述 wwan 卡的 fcc ulock 文件在哪里可以找到,否则 P16 系列中的 wwan 调制解调器在 ubuntu 或 linux 中无法使用。有没有关于这方面的信息?
提前致谢
答案1
对于 8086:7560 解锁,我已成功使用位于此处的脚本在 ThinkPad X1 Yoga Gen 7 上解锁:https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/751。
您可以将脚本存储为/etc/ModemManager/fcc-unlock.d/8086:7560
并确保它是可执行的(chmod +x
)。您还需要将标头的 shebang 从 更改python
为python3
。
需要采取一些解决方法,特别是当您使用挂起/休眠模式时,因为调制解调器本身相当挑剔。
一个主要问题是一旦 PCI 总线上的调制解调器断电,它将无法再次通电,需要再次打开。这会影响调制解调器本身及其所连接的总线。
您将需要以下 udev 规则:
/etc/udev/rules.d/99-modem-suspend.rules
# The modem fails to wake up ever again after suspend
SUBSYSTEM=="pci", ATTR{vendor}=="0x1cf8", ATTR{device}=="0x8653", ATTR{power/control}="on", GOTO="pci_pm_end"
SUBSYSTEM=="pci", ATTR{vendor}=="0x8086", ATTR{device}=="0x7560", ATTR{power/control}="on", GOTO="pci_pm_end"
SUBSYSTEM=="pci", ATTR{vendor}=="0x8086", ATTR{device}=="0x51b8", ATTR{power/control}="on", GOTO="pci_pm_end"
# Use normal sleeping otherwise
SUBSYSTEM=="pci", ATTR{power/control}="auto"
LABEL="pci_pm_end"
然后,您将需要一个在启动时运行的脚本来设置设备省电的一些初始属性,以便调制解调器或 Linux 不会暂停设备,而是始终保持其通电。
/opt/keep-modem-awake.sh
#!/bin/sh
# Enable wakeups
## Bus the modem is on
if grep 'pci:0000:00:1c.0' < /proc/acpi/wakeup | grep disabled
then
echo "Enabling wakeup for bus owning Modem..." > /dev/kmsg
echo RP01 > /proc/acpi/wakeup
fi
## Modem
if grep 'pci:0000:08:00.0' < /proc/acpi/wakeup | grep disabled
then
echo "Enabling wakeup for modem..." > /dev/kmsg
echo PXSX > /proc/acpi/wakeup
fi
# Disable d3cold for the modem
# It is behind the bridge: 00:1c.0 PCI bridge: Intel Corporation Device 51b8 (rev 01)
# https://patchwork.kernel.org/project/linux-pci/patch/[email protected]/
echo "Disabling modem d3cold..." > /dev/kmsg
## The actual modem
echo 0 > /sys/bus/pci/devices/0000:08:00.0/d3cold_allowed
## The owning buses
echo 0 > /sys/devices/pci0000:00/0000:00:1c.0/d3cold_allowed
echo 0 > /sys/bus/acpi/devices/PNP0A08:00/device:4f/physical_node/d3cold_allowed
echo 0 > /sys/bus/acpi/devices/PNP0A08:00/device:4f/device:50/physical_node/d3cold_allowed
# Use ACPI to reset the PCI and not just power off and power on the device
echo "Setting modem reset method to ACPI..." > /dev/kmsg
echo acpi > /sys/bus/pci/devices/0000:08:00.0/reset_method
注意:您的系统可能有不同的设备路径。例如,在 Lenovo ThinkPad Z16 Gen 1 上,调制解调器为0000:05:00.0
,所属总线为0000:00:01.3
,ACPI 设备为PNP0A08:00/device:07/device:08
。要正确识别要使用的 ID,您可以执行以下操作:
- 使用命令识别您的调制解调器
lspci
。例如:
❯ lspci | grep Modem
05:00.0 Wireless controller [0d40]: Intel Corporation XMM7560 LTE Advanced Pro Modem (rev 01)
这给了我们一个设备路径/sys/bus/pci/devices/0000:05:00.0
- 识别所属总线:
❯ ls -l /sys/bus/pci/devices/0000:05:00.0
lrwxrwxrwx. 1 root root 0 Apr 14 10:24 /sys/bus/pci/devices/0000:05:00.0 -> ../../../devices/pci0000:00/0000:00:01.3/0000:05:00.0
给我们自己的公交路线/sys/bus/pci/devices/0000:00:01.3
- 识别 ACPI 所属总线:
❯ find /sys/bus/acpi/devices/PNP0A08:00/ -type l -exec ls -l {} + | grep '05:00.0'
lrwxrwxrwx. 1 root root 0 Apr 14 14:25 /sys/bus/acpi/devices/PNP0A08:00/device:07/device:08/physical_node -> ../../../../../pci0000:00/0000:00:01.3/0000:05:00.0
为我们提供路径/sys/bus/acpi/devices/PNP0A08:00/device:07
和/sys/bus/acpi/devices/PNP0A08:00/device:07/device:08
然后在启动时运行脚本:
/etc/systemd/system/keep-modem-awake.service
[Unit]
Description="Keep modem awake for suspend."
After=ModemManager.service NetworkManager.service
Wants=ModemManager.service NetworkManager.service
[Service]
ExecStart=/opt/keep-modem-awake.sh
[Install]
WantedBy=multi-user.target
对于后面的脚本,您将需要一个可以找到调制解调器的脚本,因为当系统暂停和恢复时,调制解调器 ID 每次都会改变。
/opt/find-modem.sh
#!/bin/sh
# Make sure path is set
export PATH="$PATH:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
for __i in $(seq 1 10)
do
__modem="$(/opt/find-modem-sub.sh | head -n 1)"
if [ -z "$__modem" ]
then
sleep 0.5
else
break
fi
done
if [ -z "$__modem" ]
then
exit 1
fi
echo "$__modem"
exit 0
/opt/find-modem-sub.sh
#!/bin/sh
# Make sure path is set
export PATH="$PATH:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
# Read in commands
mmcli -L | grep '\/Modem\/' | while read __line
do
echo "$__line" | sed 's/^.*\/Modem\/\([0-9]\{1,\}\).*$/\1/'
exit 0
done
exit 1
然后,如果您计划使用挂起和休眠,则必须相应地设置脚本,以便它们在发生之前和之后运行:
/opt/suspend-modem.sh
#!/bin/sh
# Make sure path is correct
export PATH="$PATH:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
# Get modem ID
__modem="$(/opt/find-modem.sh)"
if [ "$1" = "0" ]
then
echo "Telling NM to not use the modem..." > /dev/kmsg
nmcli c down NetworkName
# Make sure the connection is deactivated
echo "Waiting for NM to show disconnected..." > /dev/kmsg
while nmcli con show --active | grep NetworkName
do
sleep 0.5
done
# Deactivate the modem before suspend as the connection freezes and never comes back
echo "Disabling modem..." > /dev/kmsg
mmcli -m "$__modem" --disable
elif [ "$1" = "1" ]
then
echo "Disabling modem after resume..." > /dev/kmsg
mmcli -m "$__modem" --disable
echo "Entering low power mode after disable..." > /dev/kmsg
mmcli -m "$__modem" --set-power-state-low
echo "Performing enabling loops..." > /dev/kmsg
for __i in $(seq 1 5)
do
echo "Loop $__i..." > /dev/kmsg
echo "Turning on modem and enabling..." 1>&2
mmcli -m "$__modem" --set-power-state-on
if mmcli -m "$__modem" --enable
then
echo "Modem was enabled..." > /dev/kmsg
break
else
echo "Did not enable modem..." > /dev/kmsg
sleep 0.5
fi
done
echo "Telling NM to use the modem now..." > /dev/kmsg
nmcli c up NetworkName
fi
然后相应地执行以下 systemd,这个用于恢复:
rfkill-modem-resume.service
[Unit]
Description=Enable modem after wake-up
After=suspend.target hibernate.target hybrid-sleep.target suspend-then-hibernate.target
[Service]
Type=simple
ExecStart=/opt/suspend-modem.sh 1
[Install]
WantedBy=suspend.target hibernate.target hybrid-sleep.target suspend-then-hibernate.target
这个用于暂停:
rfkill-modem-suspend.service
[Unit]
Description=rfkill modem before sleep
Before=suspend.target hibernate.target hybrid-sleep.target suspend-then-hibernate.target
[Service]
Type=simple
ExecStart=/opt/suspend-modem.sh 0
[Install]
WantedBy=suspend.target hibernate.target hybrid-sleep.target suspend-then-hibernate.target
通过这些脚本和其他方法,我成功地在多次挂起和休眠后保持调制解调器处于活动状态。
另外,您可能还需要调整 NetworkManager 连接,以便 DNS 和路由优先级低于(更高的值)您的主连接,以便将其用作后备。