What is the function of modprobe in this code?
In trying to diagnose a slow/weak wifi connection in my fresh install of ubuntu 18.04 on a Lenovo Yoga C930, I discovered the below answer
The solution seems simple and it's related to a solution I employed in a similar issue in question
I found that restarting my system got my wireless connection working faster, and like the OP in the first referenced question, I have no issue with the signal strength on my dual booted Windows 10 platform. I would like to employ this solution to my machine, but I don't know if it is applicable to the different hardware or how to adapt it. Hence I am asking a clarifying question:
modprobe do in the code
sudo modprobe -v rtl8723be ant_sel=2
and how can I adapt it to suit my system and my issue?
As per request, results of
lspci -nnk | grep 0280 -A3:
6b:00.0 Network controller : Intel Corporation Wireless-AC 9260 [8086:2526] (rev 29)
Subsystem: Intel Corporation Device [8086:0014]
Kernel driver in use: iwlwifi
Kernel modules: iwlwifi
The command was undoubtably preceeded by:
sudo modprobe -r rtl8723be
That has the effect of removing (-r) the module which was presumably loaded with its default parameters.
Many drivers, and, in particular, wireless drivers, have parameters that may be manipulated at the time the driver is loaded; that is, modprobed. You can review the available parameters with the command:
We see the following parameters:
parm: swenc:Set to 1 for software crypto (default 0) (bool) parm: ips:Set to 0 to not use link power save (default 1) (bool) parm: swlps:Set to 1 to use SW control power save (default 0)( bool) parm: fwlps:Set to 1 to use FW control power save (default 1)( bool) parm: msi:Set to 1 to use MSI interrupts mode (default 0) (bool) parm: aspm:Set to 1 to enable ASPM (default 1) (int) parm: debug_level:Set debug level (0-5) (default 0) (int) parm: debug_mask:Set debug mask (default 0) (ullong) parm: disable_watchdog:Set to 1 to disable the watchdog (default 0) (bool) parm: ant_sel:Set to 1 or 2 to force antenna number (default 0) (int)
Of particular interest here is ant_sel; that is, the ability to select antenna 1 or antenna 2 in preference to antenna 0, which, I believe, means to auto select the correct antenna. However, the rtl8723be driver and hardware combination are not yet currently capable of auto selection. It is usually necessary to test and so determine the antenna that gives the strongest connection.
If you wish to make the parameter permanent, create a file that tells the system to always use the selected parameter whenever the module loads. From the terminal:
sudo -i echo "options rtl8723be ant_sel=2" > /etc/modprobe.d/rtl8723be.conf exit
EDIT: As we see from your lspci, your wireless driver is iwlwifi. You have an Intel wireless device, not a Realtek. Any driver parameter you set for rtl8723be will be ineffective as there is no Realtek device on your system to load the driver and apply the parameter.
Creation of the rtl8723be.conf file does no harm; however, it also does nothing helpful. If you want to remove the needless file, then open a terminal and do:
sudo rm /etc/modprobe.d/rtl8723be.conf
It is fairly common for new users of Ubuntu to read a forum post about solving a wireless issue and then blindly apply it to their system. They are usually disappointed when there is no improvement. While it is not dangerous to apply a .conf file to your system for a wireless driver that your system doesn't even use, it is futile if you don't know what driver you have. I urge all Ubuntu users to determine what wireless driver they have before applying any fixes to the system. You can do so with the terminal command:
lspci -nnk | grep 0280 -A3
After determining, for example, that you are using the driver iwlwifi, if you are having difficulties, search only for answers applicable to iwlwifi, such as "slow wireless" iwlwifi or "connection drops" iwlwifi.
Then I ran modinfo again, but the line for ant_sel doesn't appear to have changed;
It will never change. It reports what is available. What will change is
/sys/module/rtl8723be/parameters/ant_sel. It reports what has actually been applied.
If you are having trouble with your wireless, I suggest that you ask a new question and tell us what issue you are facing with your Intel 9260 wireless.
FOCUS ON FINDING GREAT DEVELOPER CONTENT (Collection and Share based on the CC Protocol.)