linux-surface
linux-surface copied to clipboard
LTE/4G/mobile support
Has anybody tried the LTE model of the Surface Pro 2017 or the Surface Go LTE ? Is the modem being recognized/working?
If someone with the LTE models can get us some logs and device lists, we can look into this!
Which files / logs do you need? I would really love to get the LTE going.
Thank you!!!
I have a Surface Go LTE and I have installed @jakeday kernel. The LTE is picked up in part (dmesg output) but it is non-functional as far as I can tell:
[ 7.374157] usb 2-3: Disable of device-initiated U1 failed.
[ 7.374902] usb 2-3: Disable of device-initiated U2 failed.
[ 7.398539] cdc_mbim 2-3:1.0: cdc-wdm5: USB WDM device
[ 7.398803] cdc_mbim 2-3:1.0 wwan0: register 'cdc_mbim' at usb-0000:00:14.0-3, CDC MBIM, 52:16:91:aa:f3:e7
[ 7.399893] usb 2-3: Enable of device-initiated U1 failed.
[ 7.403292] usb 2-3: Enable of device-initiated U2 failed.
[ 7.403406] usbcore: registered new interface driver cdc_mbim
and later on:
[ 9.098887] cdc_mbim 2-3:1.0 wwp0s20f0u3: renamed from wwan0
The result shows up as an network interface:
root@az-surface:~# ip a
...
2: wwp0s20f0u3: <BROADCAST,MULTICAST,NOARP> mtu 1500 qdisc noop state DOWN group default qlen 1000
link/ether 5a:0d:68:60:3e:33 brd ff:ff:ff:ff:ff:ff
...
Some info:
root@az-surface:~# lsusb
Bus 002 Device 002: ID 045e:096e Microsoft Corp.
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 005: ID 045e:096f Microsoft Corp.
Bus 001 Device 003: ID 0cf3:e302 Atheros Communications, Inc.
Bus 001 Device 004: ID 04b4:5217 Cypress Semiconductor Corp.
Bus 001 Device 012: ID 0451:8142 Texas Instruments, Inc. TUSB8041 4-Port Hub
Bus 001 Device 013: ID 05ac:0250 Apple, Inc. Aluminium Keyboard (ISO)
Bus 001 Device 011: ID 05ac:1006 Apple, Inc. Hub in Aluminum Keyboard
Bus 001 Device 009: ID 0451:8142 Texas Instruments, Inc. TUSB8041 4-Port Hub
Bus 001 Device 008: ID 046d:c52b Logitech, Inc. Unifying Receiver
Bus 001 Device 007: ID 08bb:2912 Texas Instruments
Bus 001 Device 010: ID 04b4:3610 Cypress Semiconductor Corp.
Bus 001 Device 006: ID 047d:8023 Kensington
Bus 001 Device 002: ID 047d:8021 Kensington
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
and
root@az-surface:~# lspci
00:00.0 Host bridge: Intel Corporation Xeon E3-1200 v6/7th Gen Core Processor Host Bridge/DRAM Registers (rev 02)
00:02.0 VGA compatible controller: Intel Corporation HD Graphics 615 (rev 02)
00:04.0 Signal processing controller: Intel Corporation Xeon E3-1200 v5/E3-1500 v5/6th Gen Core Processor Thermal Subsystem (rev 02)
00:05.0 Multimedia controller: Intel Corporation Xeon E3-1200 v5/E3-1500 v5/6th Gen Core Processor Imaging Unit (rev 01)
00:13.0 Non-VGA unclassified device: Intel Corporation Sunrise Point-LP Integrated Sensor Hub (rev 21)
00:14.0 USB controller: Intel Corporation Sunrise Point-LP USB 3.0 xHCI Controller (rev 21)
00:14.2 Signal processing controller: Intel Corporation Sunrise Point-LP Thermal subsystem (rev 21)
00:14.3 Multimedia controller: Intel Corporation Device 9d32 (rev 01)
00:15.0 Signal processing controller: Intel Corporation Sunrise Point-LP Serial IO I2C Controller #0 (rev 21)
00:15.1 Signal processing controller: Intel Corporation Sunrise Point-LP Serial IO I2C Controller #1 (rev 21)
00:15.2 Signal processing controller: Intel Corporation Sunrise Point-LP Serial IO I2C Controller #2 (rev 21)
00:15.3 Signal processing controller: Intel Corporation Sunrise Point-LP Serial IO I2C Controller #3 (rev 21)
00:16.0 Communication controller: Intel Corporation Sunrise Point-LP CSME HECI #1 (rev 21)
00:19.0 Signal processing controller: Intel Corporation Sunrise Point-LP Serial IO UART Controller #2 (rev 21)
00:19.2 Signal processing controller: Intel Corporation Sunrise Point-LP Serial IO I2C Controller #4 (rev 21)
00:1c.0 PCI bridge: Intel Corporation Sunrise Point-LP PCI Express Root Port #3 (rev f1)
00:1c.3 PCI bridge: Intel Corporation Device 9d13 (rev f1)
00:1c.6 PCI bridge: Intel Corporation Sunrise Point-LP PCI Express Root Port #7 (rev f1)
00:1e.0 Signal processing controller: Intel Corporation Sunrise Point-LP Serial IO UART Controller #0 (rev 21)
00:1f.0 ISA bridge: Intel Corporation Device 9d4b (rev 21)
00:1f.2 Memory controller: Intel Corporation Sunrise Point-LP PMC (rev 21)
00:1f.3 Audio device: Intel Corporation Sunrise Point-LP HD Audio (rev 21)
01:00.0 Network controller: Qualcomm Atheros QCA6174 802.11ac Wireless Network Adapter (rev 32)
02:00.0 Unassigned class [ff00]: Realtek Semiconductor Co., Ltd. RTS522A PCI Express Card Reader (rev 01)
03:00.0 Non-Volatile memory controller: Toshiba America Info Systems Device 0113 (rev 01)
Any help with getting the 4G/LTE modem working would be much appreciated!
@jakeday I have a Surface Pro 5 with LTE and an active AT&T sim card. How can I help you get this working?
I'm working on LTE support now. It should be working in the next release. I'll let you know once it's ready!
Anything further on this? Thank you!
It appears this was included in b7e8acf. @jakeday Can you confirm?
Either way, I'll give it a try this weekend and report back. Thanks!
Only the device ID's were added to the qcserial module. So I'm not shure if this will work with the LTE Modem. Normally it should talk mbim or qmi.
I'd adressed the problem in the ModemManager List without any response.
The qcserial patch didn't work for me: I: If#=0x0 Alt= 0 #EPs= 1 Cls=02(commc) Sub=0e Prot=00 Driver=cdc_mbim I: If#=0x1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim I: If#=0x2 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=ff Driver=qcserial
The probem is that the mbim port does an reset:
Mai 28 17:28:04 ThinClient ModemManager[388]:
Any update on LTE ? is it working ?
+1
Hi there. I've recently bought an Surface Pro 2017 with LTE modem. For a couple of days I've been trying to get the modem working under Linux. Modem is the same as in the Surface Go, but has a different USB ID (045E:094A). Modem exposes 3 devices: MBIM Control (registers as /dev/cdc-wdm1), MBIM Data (registers as a network adapter) and a third device which is a GPS receiver (not a serial port). Firmware for the modem is available in C:\Windows\Firmware\QCOM. It is based on Android.
I couldn't get the modem to work under Linux yet. MBIM device does not respond to the "open" command. Other MBIM commands return a "NotOpened" error. I've made a USBPcap packet dump of the modem on Windows. I've reset the modem's network adapter a few times during the dump (Windows driver sends MBIM "close" and "open" commands when disabling and enabling modem network adapter). I will try to analyze the dump myself, but my experience with raw USB is limited. I've attached the dump to this post if anyone wants to take a look. Use Wireshark to read the dump.
I think I have found the reason why the modem refuses to work. I've checked power statuses of modem's USB devices. Main USB device (045E:094A) reports runtime_status "active", while the MBIM Control and MBIM Data sub-devices report USB runtime_status "suspended". I've analyzed the firmware dump and indeed the firmware has "remote wakeup" enabled. Windows driver uses a SetFeature SUSPEND call to wake up the modem. The problem is that Linux does not offer any options to "wakeup" modem sub-devices, only the main device (trying to wake-up the main device has no effect).
I'm no expert here, but just guessing: so the way to go would be modifying the firmware in a way that the MBIM Control and MBIM Data sub-devices don't go to sleep?
I've managed to get LTE working on my Surface Pro 2017 (I've posted this from Ubuntu using LTE). The problem wasn't remote wakeup at all, it was the cdc_ncm driver. It was not setting the NTB transfer buffer sizes during initialization for some reason, causing the modem's control interface to refuse to respond. To fix the problem, you need to force the cdc_ncm driver to set the buffer sizes. This can be done at boot from /etc/rc.local, no kernel patch is necessary. I've attached my /etc/rc.local file (in a zip archive). Change "wwp0s20f0u2" to your modem's interface name and 2-2 and 2-2:1.0 to your modem's USB device IDs. To get your modem's interface name, use "ip a" command. Look for a device with "wwp" prefix or "wwan0". To get your modem's USB device ID, type "lsusb -t". Look for a device with class "Communications". Device ID format is Bus-Dev and Bus-Dev:1.If, without the leading zeros (in my case it's Bus 02 Dev 2 If 0) Default buffer size for my Pro 2017's modem is 16384. This size should work for the Go as well as it uses the same Qualcomm X16 modem. P.S.: Make sure ModemManager is installed if you want to use the UI to control your LTE connection. rclocal.zip
I can confirm that it works on the Surface Go after setting the buffer sizes like described above.
Interface name and usb device IDs & therefore paths are little different as suggested. I can upload the exact file for the Surface Go if later today
I think it would be wise to fill a bug report on kernel.org. At init cdc_ncm driver assumes the device should already have an initial buffer size set (because the driver does report a default buffer size) and there's no need to set it again, but in case of Microsoft Surface devices, this assumption is wrong. I think this issue is more of a bug in Microsoft's firmware than a bug in the kernel driver, but it would be nice if kernel developers made some kind of workaround for this.
Hi, did you find out anything more about the gps? From what I read it should be part of the X16 modem, but Qualcomm doesn't say anything about it on the product page.
One of the functions of modem's USB composite device is the GPS. It should in theory work with the qcserial driver and present a USB serial port, but this does not happen for me, even after patching the driver to recognize the GPS. Windows uses Qualcomm's QMUX driver to interface with the GPS. I will need to take a closer look at driver's USB traffic, but it's not a priority for me right now.
Thank you for your quick reply!
Tip:...for gps to work you need to change the usb composition setting of the LTE device to 8 i believe. Its probably at 6 or at 9 by default in which gps won't work as a com port under linux or possibly on windows as well. You might need to double check these settings to be sure they are correct as this is for previous qualcomm LTE devices.
@Trinity93 Default composition is listed as 1. I can only see one USB composition listed in modem's USB descriptor. Trying to change modem's USB composition usually results in modem simply disconnecting itself from the system and locking-up. If anyone wants to look for hidden modes, I have a copy of modem's firmware image (it's based on Android NDK).
@ddscentral https://osmocom.org/attachments/3287/swi_usbcomp.pl try running this script to see what comes up. it should tell you if there is any hidden ones ;)
@Trinity93 See output. swi_usbcomp.txt
@Trinity93 See output. swi_usbcomp.txt
was that all it returned? it should have returned something that this at the 0x555b return line
QMI msg '0x555b' returned status = 1 Current USB composition: 8 USB compositions: 0 - HIP DM NMEA AT MDM1 MDM2 MDM3 MS NOT SUPPORTED 1 - HIP DM NMEA AT MDM1 MS NOT SUPPORTED 2 - HIP DM NMEA AT NIC1 MS NOT SUPPORTED 3 - HIP DM NMEA AT MDM1 NIC1 MS NOT SUPPORTED 4 - HIP DM NMEA AT NIC1 NIC2 NIC3 MS NOT SUPPORTED 5 - HIP DM NMEA AT ECM1 MS NOT SUPPORTED 6 - DM NMEA AT QMI SUPPORTED 7 - DM NMEA AT RMNET1 RMNET2 RMNET3 NOT SUPPORTED * 8 - DM NMEA AT MBIM SUPPORTED 9 - MBIM SUPPORTED 10 - NMEA MBIM NOT SUPPORTED 11 - DM MBIM NOT SUPPORTED 12 - DM NMEA MBIM NOT SUPPORTED 13 - Config1: comp6 Config2: comp8 NOT SUPPORTED 14 - Config1: comp6 Config2: comp9 NOT SUPPORTED 15 - Config1: comp6 Config2: comp10 NOT SUPPORTED 16 - Config1: comp6 Config2: comp11 NOT SUPPORTED 17 - Config1: comp6 Config2: comp12 NOT SUPPORTED 18 - Config1: comp7 Config2: comp8 NOT SUPPORTED 19 - Config1: comp7 Config2: comp9 NOT SUPPORTED 20 - Config1: comp7 Config2: comp10 NOT SUPPORTED 21 - Config1: comp7 Config2: comp11 NOT SUPPORTED 22 - Config1: comp7 Config2: comp12 NOT SUPPORTED
@Trinity93 I've piped the output to a text file, so yes, that was all the script returned. And usbcomp option does absolutely nothing, other than just print the same output.
@ddscentral Ok hehe very interesting...
Judging from the script, command 0x555b should return the available USB compositions but in our case it returns nothing at all.
@ddscentral i suspect microsoft is loading custom firmware which probably will require a little custom firmware of our own instead
You can extract the firmware from MSI driver package for the Surface Pro LTE. https://www.microsoft.com/en-us/download/details.aspx?id=56278 The firmware file looks like a standard Android update file, except for the boot.img which lacks initrd.
@ddscentral whats the output of qmicli --dms-swi-get-usb-composition
@Trinity93 See attached file (with --verbose flag). The main response was: error: couldn't get USB composite modes: QMI protocol error (57): 'Wms.InvalidMessageId'
Also, modem is really slow to respond to QMI commands. I needed a few tries to get the attached output.
@zommarin ever figure it out? Feel like I'm in the same boat
@ajbruscino No luck so far, but I have not been trying the latest tips in this thread.
@ajbruscino The modem is working fine after setting the buffer sizes in rc.local. In Ubuntu, the modem should be recognized by the DE as "Mobile Broadband". You may need to install the mbimcli and mbim-network tools first. For DEs lacking modem support, you can always use "mbim-network" tool from terminal. Follow the tutorial here if you need help: https://techship.com/faq/how-to-set-up-a-simple-data-connection-over-the-mbim-interface-using-libmbim-and-driver-cdc-mbim-in-linux/ mbim-set-ip script can be found here: https://github.com/elementzonline/GSMModem/tree/master/SIM7600/mbim-set-ip
@ajbruscino The modem is working fine after setting the buffer sizes in rc.local. In Ubuntu, the modem should be recognized by the DE as "Mobile Broadband". You may need to install the mbimcli and mbim-network tools first. For DEs lacking modem support, you can always use "mbim-network" tool from terminal. Follow the tutorial here if you need help: https://techship.com/faq/how-to-set-up-a-simple-data-connection-over-the-mbim-interface-using-libmbim-and-driver-cdc-mbim-in-linux/ mbim-set-ip script can be found here: https://github.com/elementzonline/GSMModem/tree/master/SIM7600/mbim-set-ip
Hey everyone. I am a noob so my questions may sound a bit damy but still here they are:
- Should I install any firmware for this modem? If "Yes" - where to get this firmware and how (where) to install it?
- Should I install any driver for this modem? If "Yes" - where to get this driver and how (where) to install it?
- Do I need to have libmbim if I use ModemManager? If "Yes": 3.1 Are libmbim and libmbim-glib-dev the same or different things? 3.2. Are mbim and mbim-network the same or different things?
- If answer on question #2 is "No" - why in ModemManager I can't see any device?
- I copied rc.local file provided by ddscentral to /etc with only one change - my modem is wwp0s20f0u3, so what exactly did I wrong?
$ sudo lsusb -t
/: Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/6p, 5000M |__ Port 3: Dev 2, If 0, Class=Communications, Driver=cdc_mbim, 5000M |__ Port 3: Dev 2, If 1, Class=CDC Data, Driver=cdc_mbim, 5000M |__ Port 3: Dev 2, If 2, Class=Vendor Specific Class, Driver=, 5000M /: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/12p, 480M |__ Port 5: Dev 2, If 1, Class=Wireless, Driver=btusb, 12M |__ Port 5: Dev 2, If 0, Class=Wireless, Driver=btusb, 12M |__ Port 7: Dev 3, If 0, Class=Human Interface Device, Driver=usbhid, 12M |__ Port 7: Dev 3, If 1, Class=Human Interface Device, Driver=usbhid, 12M |__ Port 7: Dev 3, If 2, Class=Human Interface Device, Driver=usbhid, 12M |__ Port 7: Dev 3, If 3, Class=Human Interface Device, Driver=usbhid, 12M
$ mbimcli --version
mbimcli 1.14.0 Copyright (2013-2014) Aleksander Morgado License GPLv2+: GNU GPL version 2 or later http://gnu.org/licenses/gpl-2.0.html This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.
$ ip a 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: wwp0s20f0u3: <BROADCAST,MULTICAST,NOARP> mtu 1500 qdisc noop state DOWN group default qlen 1000 link/ether c6:4f:9d:f1:15:ea brd ff:ff:ff:ff:ff:ff 3: wlp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000 link/ether d8:c4:97:ee:7e:fd brd ff:ff:ff:ff:ff:ff inet 192.168.33.10/24 brd 192.168.33.255 scope global dynamic wlp1s0 valid_lft 380sec preferred_lft 380sec inet6 fe80::a15a:d94f:d8a5:7a84/64 scope link tentative dadfailed valid_lft forever preferred_lft forever inet6 fe80::8a1c:1df9:5594:43f1/64 scope link tentative dadfailed valid_lft forever preferred_lft forever inet6 fe80::191b:a299:7d0b:e04b/64 scope link tentative dadfailed valid_lft forever preferred_lft forever
@Mirsonov You don't need any firmware or driver (modem uses cdc_ncm and cdc_mbim, both of which you already have on your system). You do need libmbim and ModemManager installed for NetworkManager to see your modem.
ddscentral, thanks for the answer. I downloaded latest libmbim-1.20.0, extracted it, and ran 3 commands: ./configure make sudo make install
Looks like libmbim-1.20.0 was installed. But Modem Manager still does not see any device.
What I did wrong again? How to see if libmbim-1.20.0 was installed correctly - is there any command to type so it can show the status of libmbim-1.20.0 installation?
Maybe I installed wrong Modem Manager? Is this the one I need: https://linuxonly.ru/?
@Mirsonov What's your distro ? You should normally install packages from your distribution's repository, unless you have a good reason to build from source (eg. repository version is outdated).
Debian Stretch. How can I see if libmbim installed correctly? I installed modem-manager-gui from repository not from this web-site. But in "About" of this Modem Manager there is a link to this we-site, so I was wondering if this exact Modem Manager I need.
So, right now I have installed:
- libmbim-1.20.0;
- modem-manager-gui;
- mbimcli 1.14.0.
But Modem Manager does not see any device - what is wrong?
make sure you have the right lines in /etc/rc.local and that it is running on boot. in ubuntu you might have to start a service to get the script to run
Hi,
great work, thx so far! Thanks to you, I got the 4G-Modem on my SP 2017 LTE finally up and running @ddscentral - or at least, Ubuntu recognizes it finally as a mbim/cdc device and start initializing it. However, neither the ModemManger (CLI and GUI tools, tried both), nor the MBIM tools are able to successfully connect itself to my provider.
System: Ubuntu 18.04, tried both the current 5.3.10-surface and the 4.19.83-surface-lts kernels from https://github.com/qzed/linux-surface
Provider: Telekom Germany APN settings:
APN: internet.telekom
APN auth protocol: PAP
APN user: t-mobile
APN password: tm
mbim-proxy: yes
which should be correct according to the Telekom Support. I also tried several other combinations which could be found on the web...still, nothing seems to be working. And the APN internet.telekom seems to be correct, as the same SIM card is working with a Huawei E3372 LTE/4G dongle.
Using ModemManager it simple states "Connection failed". Not really helpful ;) Using the MBIM tools, following the link @ddscentral provided above, I got the following output:
sudo mbim-network /dev/cdc-wdm1 start
Loading profile at /etc/mbim-network.conf...
APN: internet.telekom
APN auth protocol: PAP
APN user: t-mobile
APN password: tm
mbim-proxy: yes
Loading previous state from /tmp/mbim-network-state-cdc-wdm1...
Previous Transaction ID: 10
error: no actions specified
Clearing state at /tmp/mbim-network-state-cdc-wdm1...
Querying subscriber ready status 'mbimcli -d /dev/cdc-wdm1 --query-subscriber-ready-status --no-close --device-open-proxy'...
[/dev/cdc-wdm1] Subscriber ready status retrieved: Ready state: 'initialized' Subscriber ID: '901370010669147' SIM ICCID: '8988247000106691471' Ready info: 'none' Telephone numbers: (0) 'unknown' [/dev/cdc-wdm1] Session not closed: TRID: '4'
Saving state at /tmp/mbim-network-state-cdc-wdm1... (TRID: 4)
Querying registration state 'mbimcli -d /dev/cdc-wdm1 --query-registration-state --no-open=4 --no-close --device-open-proxy'...
[/dev/cdc-wdm1] Registration status: Network error: 'unknown' Register state: 'roaming' Register mode: 'automatic' Available data classes: 'umts, hsdpa, hsupa' Current cellular class: 'gsm' Provider ID: '26201' Provider name: 'Cellular Data' Roaming text: 'unknown' Registration flags: 'packet-service-automatic-attach' [/dev/cdc-wdm1] Session not closed: TRID: '6'
Saving state at /tmp/mbim-network-state-cdc-wdm1... (TRID: 6)
Attaching to packet service with 'mbimcli -d /dev/cdc-wdm1 --attach-packet-service --no-open=6 --no-close --device-open-proxy'...
Saving state at /tmp/mbim-network-state-cdc-wdm1... (TRID: 8)
Starting network with 'mbimcli -d /dev/cdc-wdm1 --connect=apn='internet.telekom',auth='PAP',username='t-mobile',password='tm' --no-open=8 --no-close --device-open-proxy'...
error: operation failed: Failure
Network start failed
[/dev/cdc-wdm1] Session not closed: TRID: '10'
Saving state at /tmp/mbim-network-state-cdc-wdm1... (TRID: 10)
...which, unfortunately, isn't really helpful, too.
Any help or idea would be great :D Thanks in advance!
Hi!
A follow up to my last post, just in case someone is running into the same problems:
It seems to be necessary to boot into Windows at least for one time and ensure that the correct SIM is selected. It seems, that the eSIM and the physical SIM are getting mixed up sometimes, thus prohibiting the ModemManager (or mbim directly) to configuring, if no eSIM is loaded.
After ensuring Windows had selected the physical SIM as default, the SIM device instantly became available in Linux (I'm currently writing from Ubuntu 18.04 connected via 4G on the Surface), if it was initialized with the fix from @ddscentral
Thanks again!
@ddscentral Ah, were you finally successful in getting the GPS up and running on the Surface 5 LTE? I have the same issues as you described above.
Only strange thing: During my configuration tries to get the 4G working, I managed it somehow to retrieve a valid NMEA string...unfortunately, I hadn't write down every step I did...
@Trinity93 Any idea or further debugging hints...?
I got exactly the same outputs from the swi_usbcomp script and qmicli as the ones from @ddscentral
I recently acquired Surface Go with LTE and installed your kernel @jakeday.
Most things worked as expected, except for LTE, under Ubuntu 18.04 LTS. I changed rc.local as @ddscentral did above, but the modem doesn't get even recognized.
Observations so far:
- Sometimes the modem does get recognized, but mostly it doesn't. (
sudo mmcli -LreturnsNo modems were found) - When the modem is detected, it's gone after waking from suspend.
- Sometimes the name of interface which is supposed to point to the modem changes to
wwan0
Any clue as to how we can get LTE working? Will be happy to run some commands on the machine if necessary.
MBIM modems are best used with mbim-network tool. NetworkManager works with them too with the right plugins installed. Not sure about suspend, but I never had modem disappear completely.
I have sorta given up on getting the gps to work for now. Till we can get the chipset out of the special microsoft supported mode its in, i don't see how this will be possible to fix.
@ddscentral I did fresh install of Ubuntu with linux-surface/linux-surface kernel, and oddly the modem doesn't disappear anymore, at least so far.
However the modem still doesn't work after suspend.
Every time the machine wakes from suspend, the number in sudo mmcli -L increments.
Like /org/freedesktop/ModemManager1/Modem/1 [Surface] Android, /org/freedesktop/ModemManager1/Modem/2 [Surface] Android, and so on.
Restarting ModemManager and NetworkManager after waking from suspend didn't work. Stopping ModemManager before going to suspend didn't work either.
But I guess the issue is kind of irrelevant to this thread anymore.
I can confirm the behavior of @katsuya-horiuchi - after suspend, the modems disappear completely. However, I somehow managed to get everything up and working. After all, we hadn't had much to do to getting it work properly - at least in terms of system configuration ;)
Regarding the modem initialization: @katsuya-horiuchi This behavior is related to systemd and the point its rclocal helper unit will be initialized. It seems to be working most of the time, but sometimes needs to be done manually (or, better, writing your own systemd unit for initialization, which isn't a backwards-backwards-compatibility thing like rclocal).
More information: https://unix.stackexchange.com/a/471871
I think I'll be getting my surface back on Thursday. I'll provide some further information then.
@Trinity93 Ah, as mentioned above - its working in my setup now. The ModemManager is doing some magic in the background. When I'm remembering correctly, we didn't configure much. Basically:
sudo mmcli -m 0 --enable
sudo mmcli -m 0 --location-enable-gps-raw
#sudo mmcli -m 0 --location-enable-gps-nmea
Most importantly - do not enable AGPS!. This silly chip seems to hang itself up when you're trying to use AGPS, seemingly a problem with the MS firmware you mentioned above.
And then...wait. Grab a coffee or something....a cold reset tooks quite a long time. After that, the location service in the ModemManager seems to be working properly, and we'll be able to retrieve the RAW gps information and NMEA data from it, using the ModemManager API or the respective Qt bindings...
- https://www.freedesktop.org/software/ModemManager/api/latest/gdbus-org.freedesktop.ModemManager1.Modem.Location.html
- https://github.com/KDE/modemmanager-qt
Yes, it would probably be best to write our own service instead of relying on rclocal. Modem chip runs it's own Android OS, so no wonder it takes time to reboot itself.
@nightsparc Could you possibly share your configuration? It seems I'm not competent enough to make this work using systemd.
Hi All,
I am also facing problems with the connectivity after the suspension. The modem seems to work (I can send text messages and scan the gsm network under the Modem Manager GUI, but I could not manage so far to get it re-connected.
If I remove the modules by hand and reload them followed by the rc.local sequence (thanks a lot ddscentral for putting it all together) the modem is not even present.
Could you please suggest the right procedure to have re-initiated (or whatever is needed)?
@ddscentral You have done a great job explaining it for debian. Can you translate for arch/manjaro?
Thank you for your time
" I`ve managed to get LTE working on my Surface Pro 2017 (I've posted this from Ubuntu using LTE). The problem wasn't remote wakeup at all, it was the cdc_ncm driver. It was not setting the NTB transfer buffer sizes during initialization for some reason, causing the modem's control interface to refuse to respond. To fix the problem, you need to force the cdc_ncm driver to set the buffer sizes. This can be done at boot from /etc/rc.local, no kernel patch is necessary. I've attached my /etc/rc.local file (in a zip archive). Change "wwp0s20f0u2" to your modem's interface name and 2-2 and 2-2:1.0 to your modem's USB device IDs. To get your modem's interface name, use "ip a" command. Look for a device with "wwp" prefix or "wwan0". To get your modem's USB device ID, type "lsusb -t". Look for a device with class "Communications". Device ID format is Bus-Dev and Bus-Dev:1.If, without the leading zeros (in my case it's Bus 02 Dev 2 If 0) Default buffer size for my Pro 2017's modem is 16384. This size should work for the Go as well as it uses the same Qualcomm X16 modem. P.S.: Make sure ModemManager is installed if you want to use the UI to control your LTE connection. rclocal.zip "
The key is to set the buffer size before using the modem. You don't have to use rc.local, any script that runs at system startup will do. It could, for example, be an oneshot systemd service (a quick Google search shows that's what Arch uses by default). Interface naming scheme will likely be different in your distro, since Ubuntu auto-renames NICs based on their physical location (or MAC). Default interface name of LTE modem should be wwan0
Hi all, I have a SGO2 running ubuntu The modem is working with the mentioned trick by setting buffersize in rc.local. However, the modem had to be used one time in windows until it was visible in linux. I also found out that Modem Manager GUI is not relyably removing all sms from the modem and then no sms can be received or sent anymore until all these sms will be deleted by using mmcli manually. So i started some first sms tools to handle sms communication by an bash-sms-deamon running as local user process: https://github.com/dr-ni/mmsmsd.git I would like to use an email client for sending and receiving of all sms. Receiving could be managed by writing all received messages into an mbox file - but for sending I have no clue how to handle. Any ideas?
Is there any solution available to select SIM instead of eSIM directly in Linux instead of booting into Windows? I don't have dual boot, only Linux is installed. mmcli is reporting state failed because of sim-missing :/
Normal SIM worked fine for me in Linux OOB. But I guess that's because I've previously switched to using the SIM in Windows.
You guys think that running windows on vbox should trigger the device to come on? As another user mentioned, I too don't have a dual boot. I now switched to mint. And the system does recognize everything properly as ddcentral here recommends. (much appreciated by the way)
@romanash666 I managed to get it running directly from Linux. I have to go through my terminal logs to extract steps which helped. No promises but hopefully this weekend or next one.
@kepi any update?
I tried to get fancy with udev rules to properly initialize the modem on boot (echoing the values), but it must have been too early - sys/bus/usb/devices/2-3/2-3:1.0/net/wwp0s20f0u3/cdc_ncm/rx_max didn't exist.
So I used a Systemd timer to run a service 15 seconds after boot that initializes the modem and restarts ModemManager.service. It works great.
The service needs to be disabled, while the timer is enabled.
/etc/systemd/system/surfacego2_modemfix.service:
[Unit]
Description=Properly initialize Qualcomm X16 modem
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/bin/sh /usr/bin/surfacego2-modemfix.sh
ExecStartPost=systemctl restart ModemManager.service
/etc/systemd/system/surfacego2_modemfix.timer:
[Unit]
Description=Start the service to fix the Surface modem with a delay
[Timer]
OnBootSec=15sec
[Install]
WantedBy=timers.target
/usr/bin/surfacego2-modemfix.sh:
#!/usr/bin/bash
echo 16383 | tee /sys/bus/usb/devices/2-3/2-3:1.0/net/wwp0s20f0u3/cdc_ncm/rx_max
echo 16383 | tee /sys/bus/usb/devices/2-3/2-3:1.0/net/wwp0s20f0u3/cdc_ncm/tx_max
echo 16384 | tee /sys/bus/usb/devices/2-3/2-3:1.0/net/wwp0s20f0u3/cdc_ncm/rx_max
echo 16384 | tee /sys/bus/usb/devices/2-3/2-3:1.0/net/wwp0s20f0u3/cdc_ncm/tx_max
@kepi any update?
I'm sorry, it took much longer then anticipated. I had 8 files with logs from my tmux session tabs with thousand of lines. I had to go through them because I wasn't totally sure of correct sequence of steps.
Anyway, if I got it right, it should be really simple. Just switching SIM slot to number 1 with qmicli was everything needed at the end. I tried to document whole process at https://kepi.cz/surface-go-2-lte-modem but it should be enough to just jump to the last section (Recap) and try it.
Let me know if it doesn't work (with logs), I'll help if I can. It is completely possible that I missed something important.
Let me know if it doesn't work (with logs), I'll help if I can. It is completely possible that I missed something important.
I followed your instructions but the attempt to switch sim slots
sudo qmicli -d /dev/cdc-wdm0 --device-open-proxy --device-open-mbim --uim-switch-slot=1
... end up with the following error:
error: couldn't switch slots: QMI protocol error (26): 'NoEffect'
Any ideas? Thank you!
The output of
sudo qmicli -d /dev/cdc-wdm0 --device-open-proxy --device-open-mbim --uim-get-card-status
is
[/dev/cdc-wdm0] Successfully got card status Provisioning applications: Primary GW: session doesn't exist Primary 1X: session doesn't exist Secondary GW: session doesn't exist Secondary 1X: session doesn't exist Slot [1]: Card state: 'present' UPIN state: 'not-initialized' UPIN retries: '0' UPUK retries: '0' Application [1]: Application type: 'usim (2)' Application state: 'detected' Application ID: A0:00:00:00:87:10:02:FF:49:FF:05:89 Personalization state: 'unknown' UPIN replaces PIN1: 'no' PIN1 state: 'not-initialized' PIN1 retries: '0' PUK1 retries: '0' PIN2 state: 'not-initialized' PIN2 retries: '0' PUK2 retries: '0' Application [2]: Application type: 'unknown (0)' Application state: 'detected' Application ID: A0:00:00:00:63:50:4B:43:53:2D:31:35 Personalization state: 'unknown' UPIN replaces PIN1: 'no' PIN1 state: 'not-initialized' PIN1 retries: '0' PUK1 retries: '0' PIN2 state: 'not-initialized' PIN2 retries: '0' PUK2 retries: '0' Slot [2]: Card state: 'present' UPIN state: 'not-initialized' UPIN retries: '0' UPUK retries: '0'
I can confirm that this works with my Surface Go running Ubuntu 20.04.
Thank you very for the detailed instructions for some of us who have never ventured into this territory of getting device ID's and interface names.
My Surface Go with LTE now works and is able to connect to my cellular provider without issues.
I've managed to get LTE working on my Surface Pro 2017 (I've posted this from Ubuntu using LTE). The problem wasn't remote wakeup at all, it was the cdc_ncm driver. It was not setting the NTB transfer buffer sizes during initialization for some reason, causing the modem's control interface to refuse to respond. To fix the problem, you need to force the cdc_ncm driver to set the buffer sizes. This can be done at boot from /etc/rc.local, no kernel patch is necessary. I've attached my /etc/rc.local file (in a zip archive). Change "wwp0s20f0u2" to your modem's interface name and 2-2 and 2-2:1.0 to your modem's USB device IDs. To get your modem's interface name, use "ip a" command. Look for a device with "wwp" prefix or "wwan0". To get your modem's USB device ID, type "lsusb -t". Look for a device with class "Communications". Device ID format is Bus-Dev and Bus-Dev:1.If, without the leading zeros (in my case it's Bus 02 Dev 2 If 0) Default buffer size for my Pro 2017's modem is 16384. This size should work for the Go as well as it uses the same Qualcomm X16 modem. P.S.: Make sure ModemManager is installed if you want to use the UI to control your LTE connection. rclocal.zip
I'm glad that my instructions helped you. 4G on Linux works really well. I actually had to use 4G on Linux for work recently during a power outage, because Windows is way too RAM hungry to handle my VMWare work VMs (which need 6 GB RAM).
It seems there's some progress in getting the camera working on newer kernels, will need to check them out.
It works fine on my Surface Go all until it goes suspended. I understand from the posts above there is still no way to hard reset the modem / wake up all the driver components after resuming?
On my SP5, modem does turn off as well on suspend (making hotspot functionality essentially useless) under Windows but resets after waking up. Most likely there's some kind of special treatment in the Windows driver or modem's Android firmware for suspend. Or maybe USB power management is to blame.
For the said SG it still works under Windows after waking up. Probably unrelated, but what surprises me with this device is how much power it draws when suspended - ca 20% of the battery a day. And this is the same regardless under Linux or Windows. Not sure if this is sort of industrial standard but for example, for Ideapad D330, it's 2-3% only. Not to mention things like Ipad that could go on a single charge for weeks if not used frequently.
Having an issue with a Surface Go 2 getting ModemManager to play nice with the card despite following the information on the wiki. I run(as root, ModemManager set to not start on boot)
# echo 16383 | tee /sys/bus/usb/devices/2-3/2-3:1.0/net/wwp0s20f0u3/cdc_ncm/rx_max
# echo 16383 | tee /sys/bus/usb/devices/2-3/2-3:1.0/net/wwp0s20f0u3/cdc_ncm/tx_max
# echo 16384 | tee /sys/bus/usb/devices/2-3/2-3:1.0/net/wwp0s20f0u3/cdc_ncm/rx_max
# echo 16384 | tee /sys/bus/usb/devices/2-3/2-3:1.0/net/wwp0s20f0u3/cdc_ncm/tx_max
systemctl start ModemManager
but still get the following errors:
Feb 08 19:16:10 surfacego2 ModemManager[2173]: [/dev/cdc-wdm0] Enabling QMI indications via MBIM...
Feb 08 19:16:10 surfacego2 ModemManager[2173]: [/dev/cdc-wdm0] enabled QMI indications via MBIM
Feb 08 19:16:10 surfacego2 ModemManager[2173]: <info> [modem0/cdc-wdm0/mbim] MBIM device is QMI capable
Feb 08 19:16:11 surfacego2 ModemManager[2173]: [/dev/cdc-wdm0] Allocating new client ID...
Feb 08 19:16:11 surfacego2 ModemManager[2173]: [/dev/cdc-wdm0] Registered 'dms' (version 1.0) client with ID '1'
Feb 08 19:16:11 surfacego2 ModemManager[2173]: [/dev/cdc-wdm0] Allocating new client ID...
Feb 08 19:16:11 surfacego2 ModemManager[2173]: [/dev/cdc-wdm0] Registered 'nas' (version 1.25) client with ID '2'
Feb 08 19:16:11 surfacego2 ModemManager[2173]: [/dev/cdc-wdm0] Allocating new client ID...
Feb 08 19:16:11 surfacego2 ModemManager[2173]: [/dev/cdc-wdm0] Registered 'loc' (version 2.0) client with ID '1'
Feb 08 19:16:11 surfacego2 ModemManager[2173]: [/dev/cdc-wdm0] Allocating new client ID...
Feb 08 19:16:11 surfacego2 ModemManager[2173]: [/dev/cdc-wdm0] Registered 'pdc' (version 1.0) client with ID '1'
Feb 08 19:16:11 surfacego2 ModemManager[2173]: <info> [modem0] QMI-based capability and mode switching support enabled
Feb 08 19:16:12 surfacego2 ModemManager[2173]: <warn> [modem0] couldn't query SIM slots: Only one SIM slot is supported
Feb 08 19:16:24 surfacego2 ModemManager[2173]: <info> [modem0] state changed (unknown -> locked)
Feb 08 19:16:24 surfacego2 ModemManager[2173]: <warn> [modem0] modem couldn't be initialized: Couldn't check unlock status: SIM not inserted
Feb 08 19:16:24 surfacego2 ModemManager[2173]: <info> [modem0] state changed (locked -> failed)
Feb 08 19:16:24 surfacego2 ModemManager[2173]: <warn> [modem0] couldn't open ports during Modem SIM hot swap enabling: Couldn't get primary port
Feb 08 19:16:24 surfacego2 ModemManager[2173]: <error> [modem0] SIM is missing and SIM hot swap is configured, but ports are not opened.
Checking with qmcli I get:
# qmicli -d /dev/cdc-wdm0 --device-open-auto --uim-get-slot-status
[/dev/cdc-wdm0] Successfully got slots status
[/dev/cdc-wdm0] 2 physical slots found:
Physical slot 1:
Card status: present
Slot status: active
Logical slot: 1
ICCID: 8901260970177214749
Protocol: uicc
Num apps: 0
Is eUICC: no
Physical slot 2:
Card status: present
Slot status: active
Logical slot: 2
ICCID: unknown
Protocol: uicc
Num apps: 0
Is eUICC: yes
Yet mmcli doesn't see any sim card slots:
# mmcli -m 0
-----------------------------------
General | path: /org/freedesktop/ModemManager1/Modem/0
| device id: c1fb105c5f42aadd556bbffc67e7280c4bc7a025
-----------------------------------
Hardware | manufacturer: Surface
| model: Surface
| firmware revision: 2005-79b1b1-c8-00004.14
| carrier config: ROW_Generic_3GPP
| carrier config revision: 08010810
| h/w revision: 0
| supported: gsm-umts, lte
| current: gsm-umts, lte
| equipment id: ##########################
-----------------------------------
System | device: /sys/devices/pci0000:00/0000:00:14.0/usb2/2-3
| drivers: cdc_mbim
| plugin: generic
| primary port: cdc-wdm0
| ports: cdc-wdm0 (mbim), wwp0s20f0u3 (net)
-----------------------------------
Status | state: failed
| failed reason: sim-missing
| power state: low
| signal quality: 0% (cached)
-----------------------------------
Modes | supported: allowed: 3g; preferred: none
| allowed: 4g; preferred: none
| allowed: 3g, 4g; preferred: 4g
| allowed: 3g, 4g; preferred: 3g
| current: allowed: any; preferred: none
-----------------------------------
Bands | supported: utran-1, utran-6, utran-5, utran-8, utran-2, eutran-1,
| eutran-2, eutran-3, eutran-4, eutran-5, eutran-7, eutran-8,
| eutran-12, eutran-13, eutran-14, eutran-19, eutran-20, eutran-25,
| eutran-26, eutran-28, eutran-29, eutran-30, eutran-38, eutran-39,
| eutran-40, eutran-41, eutran-66
-----------------------------------
IP | supported: ipv4, ipv6, ipv4v6
One year later and meanwhile I ended up with my modem not working again with same output as @gitwah and probably @survient (he didn't attach card-status, but it everything else looks same). Btw I'm not sure when my setup breaks but probably when I switched SIM to different operator.
Anyway I had been playing with it couple times without success. Last week I hit yet another trouble with SGO2 (bug with USB-C monitor charging) and tried to update firmware because there was some hints it might help. After many failures to do it from Linux I tried to create USB flash with Windows to Go. To my surprise, Windows wasn't able to connect with the modem as well... There was /Insert SIM/ and no option to do anything else.
With this yet another failure :) I refused to surrender. With couple more hours and night with qmicli, mbimcli and mmcli it looks like I finally found the missing piece. At least it is working for me.
systemctl stop Modemamanager # to be sure that something is not blocking the device
AID=""; while [ -z "$AID" ]; do AID=$(sudo qmicli -d /dev/cdc-wdm0 --uim-get-card-status | grep -E "([A-Z0-9]{2}:){15}[A-Z0-9]{2}" | xargs); sleep 2; done; echo $AID
Your application id should be printed, something like A0:00:00:00:87:10:02:FF:49:FF:05:89 (which is @gitwah 's app id from his output).
Than try to provision session:
sudo qmicli -d /dev/cdc-wdm0 --uim-change-provisioning-session="slot=1,activate=yes,session-type=primary-gw-provisioning,aid=$AID"
I updated my article with these details and little more info: https://kepi.cz/surface-go-2-lte-modem