xmm7360 / xmm7360-pci

PCI driver for Fibocom L850-GL modem based on Intel XMM7360 modem
427 stars 82 forks source link

Works now. Solution to "Insert a sim card to use this modem" when using xmm7360 together with ModemManager #204

Open yummy527 opened 1 year ago

yummy527 commented 1 year ago

Hi,guys.

I find this working method somewhat occasionally. The "giving up" error #192 stops me for more than half a year (cry...). In these several days, I just wonder whether the LTE or 4G could work or not on my Linux laptop. After all, the Linux kernel has been updated.

Finally, it works after struggling. Here I just give some steps to reproduce how to make it work using xmm7360 together with ModemManager.

Possible solution to some issues

Machine and OS

machine: Lenovo X1 carbon gen8 OS: archlinux with kernel 6.2.9 Python: 3.10(I am not sure whether it maters or not.)

Steps to reproduce successful work

step 1: After a fresh reboot, just "remove" or blacklist the iosm drive with command:

sudo rmmod iosm

This step is important! If iosm is not removed, it will block the xmm7360-pci drive and you will see the warning like "insert a sim card to use this modem".

This command above will not delete iosm from your disk. Every time you boot your machine, the iosm will be there because it is in the kernel. You can check it with command lspci -k and if you carefully check the output, you will find iosm there.

step 2: Install ModemManager (ignore this step if it has been installed already.)

If you are using ArchLinux as me,

sudo pacman -S modemmanager

If you are using Ubuntu,

sudo apt-get update
sudo apt-get -y install modemmanager

If other OS, just find the right way to install ModemManager.

After installing, you could turn off your WIFI.

step 3: edit xmm7360.ini (ignore this step if it has been edited already.)

Open the file xmm7360.ini, and make sure to

Here is mine:

# driver config
apn="ctnet"

#ip-fetch-timeout=1
#nodefaultroute=True
#metric=1000

# uncomment to not add DNS values to /etc/resolv.conf
#noresolv=True

# used to activate NetworkManager integration
dbus=True

# Setup script config
BIN_DIR=/usr/local/bin

step 4: execute the script lte.sh

cd ~/Downloads/xmm7360-pci # cd to where your downloaded folder `xmm7360-pci` is.
sudo ./scripts/lte.sh setup

After running this command, you can check whether the used driver now with command lspci -k. You will find something like below in the long output. Attention here, Kernel driver in use: xmm7360, NOT iosm.

02:00.0 Wireless controller [0d40]: Intel Corporation XMM7360 LTE Advanced Modem (rev 01)
    Subsystem: Device 1cf8:8505
    Kernel driver in use: xmm7360
    Kernel modules: iosm

Then run command with xmm7360-pci as your working folder:

sudo lte up

There will be some very long output. My case is the "giving up" error mentioned in #192. Do not worry about this error.

Attention : this sudo lte up should not be ignored here. I guess that some codes in the up section of the file lte.sh just function to activate the sim card or expose the sim card to ModemManager we installed or Mobile Network in the system setting panel. If this command is skipped, you will only see "insert a sim card to use this modem" in Mobile Network. image

After the long output, run:

sudo lte down

And again, run:

sudo ./scripts/lte.sh setup

The output A should contain:

sudo /sbin/rmmod xmm7360
sudo /sbin/insmod xmm7360.ko

If the output B contains:

sudo /sbin/rmmod xmm7360
rmmod: ERROR: Module xmm7360 is in use
make: [Makefile:18: load] Error 1 (ignored)
sudo /sbin/insmod xmm7360.ko
insmod: ERROR: could not insert module xmm7360.ko: File exists
make: *** [Makefile:19: load] Error 1

you need to run the command for the third time:

sudo ./scripts/lte.sh setup

until you see output A.

If it goes well, in the setting panel, you will see Mobile Network listing there after less than one minute.

step 5: select APN in the Mobile Network panel

Yes. You can select APN in the panel. No input is needed, just click the one you want. APN, username and password are all inlcuded automatically. image

APN, username and password can also be input manually now, just as issue #203 wants. image

Attention

If the Mobile Network in the system setting panel just tells you "insert a sim card to use this modem" even if you have already insert your sim card. Repeat step 4.

If the Mobile Network in the system setting panel disappears(yes it may disappear when you running the lte.sh), Repeat step 4.

cd ~/Downloads/xmm7360-pci # cd to where your downloaded folder `xmm7360-pci` is.
sudo ./scripts/lte.sh setup
sudo lte up
sudo lte down
sudo ./scripts/lte.sh setup

It is a little strange that the signal shows very weak, 0%. But downloading and uploading works.

That's all my finding. Hope it works for you. image

Thanks

Thanks to the authors and contributors of xmm7360-pci and ModemManager and other packages. Your work is very great. @abrasive @enzingerm

dieselburner commented 1 year ago

The trick is to repeat step 2 and step 4. That is to reinstall ModemManager and run lte.sh script again.

No. That's not how open source supposed to work.

yummy527 commented 1 year ago

The trick is to repeat step 2 and step 4. That is to reinstall ModemManager and run lte.sh script again.

No. That's not how open source supposed to work.

Apologize. Reinstalling ModemManager is not needed at all.

rafaelrsanches commented 1 year ago

My output of lspci -k on Fedora looks like this:

05:00.0 Wireless controller [0d40]: Intel Corporation XMM7360 LTE Advanced Modem (rev 01)
    Subsystem: Intel Corporation Device 0020
    Kernel modules: iosm, xmm7360
yummy527 commented 1 year ago

My output of lspci -k on Fedora looks like this:


05:00.0 Wireless controller [0d40]: Intel Corporation XMM7360 LTE Advanced Modem (rev 01)

  Subsystem: Intel Corporation Device 0020

  Kernel modules: iosm, xmm7360

In your case, it seems that iosm is "removed" and xmm7360 is installed but not used.

cd to the downloaded xmm7360 folder, and try step 4. That is my suggestion.

rafaelrsanches commented 1 year ago

In your case, it seems that iosm is "removed" and xmm7360 is installed but not used.

cd to the downloaded xmm7360 folder, and try step 4. That is my suggestion.

I'm able to do step 4, but the Kernel module doesn't go to "Kernel driver in use:". And if I run sudo lte up I got the following error:

lte.sh: manage xmm7360-pci
APN: myapn.com
Script: /home/user/xmm7360-pci/scripts/lte.sh; Link: /usr/local/bin

bringing wwan0 up!
Traceback (most recent call last):
  File "/home/user/xmm7360-pci/scripts/../rpc/open_xdatachannel.py", line 42, in <module>
    r = rpc.XMMRPC()
        ^^^^^^^^^^^^
  File "/home/user/xmm7360-pci/rpc/rpc.py", line 19, in __init__
    self.fp = os.open(path, os.O_RDWR | os.O_SYNC)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '/dev/xmm0/rpc'
Cannot find device "wwan0"
rafaelrsanches commented 1 year ago

I was able to get it working on Fedora 38 (with Secure Boot disabled), but I have 2 questions.

  1. Do you need to do this steps every time you reboot?
  2. Is it possible to do this with Secure Boot enabled?
poshul commented 1 year ago
  1. Yes, at least part of it. You can blacklist iosm, so the module doesn't get loaded (add blacklist iosm to /etc/modprobe.d/blacklist.conf and then run sudo update-initramfs -u) but at least for me you still need to unload and reload the xmm7360 module after boot.
  2. Yes, https://github.com/xmm7360/xmm7360-pci/issues/133 has a script that allows you to sign the kernel module. See https://docs.fedoraproject.org/en-US/fedora/rawhide/system-administrators-guide/kernel-module-driver-configuration/Working_with_Kernel_Modules/#sect-signing-kernel-modules-for-secure-boot for details on how to make and enroll machine owner keys.
tgxn commented 1 year ago

I merged the rmmod iosm thing today, I think that should fix this?

KataFF commented 1 year ago

I tried the steps described in the OP, but it did not work for me (see #209)

mrchar commented 1 year ago

In your case, it seems that iosm is "removed" and xmm7360 is installed but not used. cd to the downloaded xmm7360 folder, and try step 4. That is my suggestion.

I'm able to do step 4, but the Kernel module doesn't go to "Kernel driver in use:". And if I run sudo lte up I got the following error:

lte.sh: manage xmm7360-pci
APN: myapn.com
Script: /home/user/xmm7360-pci/scripts/lte.sh; Link: /usr/local/bin

bringing wwan0 up!
Traceback (most recent call last):
  File "/home/user/xmm7360-pci/scripts/../rpc/open_xdatachannel.py", line 42, in <module>
    r = rpc.XMMRPC()
        ^^^^^^^^^^^^
  File "/home/user/xmm7360-pci/rpc/rpc.py", line 19, in __init__
    self.fp = os.open(path, os.O_RDWR | os.O_SYNC)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '/dev/xmm0/rpc'
Cannot find device "wwan0"

this suggest means that you are not load xxm7350, you can rerun make && make load to resolve the problem

vebodev commented 11 months ago

yummy527,

I did the same instructions on Archlinux. However I met a different case not mentioned before. image It is not the same UI as yours. I have no idea to find out the same config as yours.

Please advice what should I do. thank you

yummy527 commented 9 months ago

yummy527,

I did the same instructions on Archlinux. However I met a different case not mentioned before. image It is not the same UI as yours. I have no idea to find out the same config as yours.

Please advice what should I do. thank you

As far I could remember, it just worked after second sudo ./scripts/lte.sh setup. I changed nothing related to user name and password in your screenshot, just using the default ones. Be sure to set your APN in xmm7360.ini. Since you are using China Telecom, just apn="ctnet".

Long time no use this xmm7360 tool (WIFI instead). Today I tried to run it, and just found that it didn't work now. In details, I met the compile error, modified some codes as you suggested in issue 215, and run the code following steps in this post. It did not work now. Besides, I tried the iosm way mention in #211 , but also failed the same way as #192.

SimPilotAdamT commented 8 months ago

I seem to have some success... I forked this project and managed to get it compiling after some fiddling, and the module works. My only remaining issue is integration with ModemManager, which seems to fail on my device... I am using a ThinkaPad P52s with lspci output:

03:00.0 Wireless controller [0d40]: Intel Corporation XMM7360 LTE Advanced Modem [8086:7360] (rev 01)
        Subsystem: Intel Corporation XMM7360 LTE Advanced Modem [8086:0020]
        Flags: bus master, fast devsel, latency 0, IRQ 150
        Memory at dd200000 (64-bit, non-prefetchable) [size=4K]
        Memory at dd201000 (64-bit, non-prefetchable) [size=1K]
        Capabilities: [40] Power Management version 3
        Capabilities: [50] MSI: Enable+ Count=1/4 Maskable- 64bit+
        Capabilities: [70] Express Endpoint, MSI 00
        Capabilities: [100] Advanced Error Reporting
        Capabilities: [148] Latency Tolerance Reporting
        Capabilities: [150] L1 PM Substates
        Kernel driver in use: xmm7360
        Kernel modules: iosm

I am using Arch Linux with the latest Arch kernel in the stable repos. Having followed the steps in your original post, ModemManager refuses to pick up my module (I have to use the lte commands instead), spitting these into the journald log:

Feb 22 15:25:26 adam-arch-laptop systemd[1]: Starting Modem Manager...
Feb 22 15:25:26 adam-arch-laptop ModemManager[7776]: <msg> ModemManager (version 1.22.0-1) starting in system bus...
Feb 22 15:25:26 adam-arch-laptop systemd[1]: Started Modem Manager.
Feb 22 15:25:30 adam-arch-laptop ModemManager[7776]: <msg> [base-manager] couldn't check support for device '/sys/devices/pci0000:00/0000:00:1c.6/0000:04:00.0': not supported by any plugin
Feb 22 15:25:30 adam-arch-laptop ModemManager[7776]: <msg> [base-manager] couldn't check support for device '/sys/devices/pci0000:00/0000:00:1f.6': not supported by any plugin