Giter VIP home page Giter VIP logo

arch-linux-ath-user-regd's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

arch-linux-ath-user-regd's Issues

ath10k can be patched, NO NEED to compile the entire kernel

I have found a site [1] which contains instructions on how to patch ath10k to ignore regulatory domain in EEPROM. Since I have a Qualcomm Atheros card which is affected by the problem, I tried the solution and it worked.

For me, I do the following steps in /tmp/ because it is faster, especially when extracting the kernel source code:
Step 1. Get the kernel source code, e.g. https://www.kernel.org/pub/linux/kernel/v4.x/linux-4.14.14.tar.xz (Download the appropriate version according to the result of uname -r).
Step 2. Extract it, e.g. tar -xvJf linux-4.14.14.tar.xz
Step 3. Edit drivers/net/wireless/ath/regd.c in the extracted directory:
There are four parts to be patched in the aforementioned file:
Part 1:

static void  
ath_reg_apply_beaconing_flags(struct wiphy *wiphy,  
                              struct ath_regulatory *reg,
                              enum nl80211_reg_initiator initiator)
{

        enum nl80211_band band;
        struct ieee80211_supported_band *sband;
        struct ieee80211_channel *ch;
        unsigned int i;

       +#ifdef CONFIG_ATH_USER_REGD
       +    return;
       +#endif

        for (band = 0; band < NUM_NL80211_BANDS; band++) {
                if (!wiphy->bands[band])
                        continue;
                sband = wiphy->bands[band];
                for (i = 0; i < sband->n_channels; i++) {
                        ch = &sband->channels[i];
                        __ath_reg_apply_beaconing_flags(wiphy, reg,
                                                        initiator, ch);
                }
        }
}

Part 2:

static void  
ath_reg_apply_ir_flags(struct wiphy *wiphy,  
                       struct ath_regulatory *reg,
                       enum nl80211_reg_initiator initiator)
{
        struct ieee80211_supported_band *sband;

        +#ifdef CONFIG_ATH_USER_REGD
        +    return;
        +#endif

        sband = wiphy->bands[NL80211_BAND_2GHZ];
        if (!sband)
                return;

Part 3:

static void ath_reg_apply_radar_flags(struct wiphy *wiphy)  
{
        struct ieee80211_supported_band *sband;
        struct ieee80211_channel *ch;
        unsigned int i;

        +#ifdef CONFIG_ATH_USER_REGD
        +    return;
        +#endif

        if (!wiphy->bands[NL80211_BAND_5GHZ])
                return;

        sband = wiphy->bands[NL80211_BAND_5GHZ];

Part 4:

static int  
ath_regd_init_wiphy(struct ath_regulatory *reg,  
                    struct wiphy *wiphy,
                    void (*reg_notifier)(struct wiphy *wiphy,
                                         struct regulatory_request *request))
{
        const struct ieee80211_regdomain *regd;

        wiphy->reg_notifier = reg_notifier;

        +#ifdef CONFIG_ATH_USER_REGD
        +    return 0;
        +#endif

        wiphy->regulatory_flags |= REGULATORY_STRICT_REG |
                                   REGULATORY_CUSTOM_REG;

        if (ath_is_world_regd(reg)) {

Step 4. Edit drivers/net/wireless/ath/Kconfig in the extracted directory:

if WLAN_VENDOR_ATH

+config ATH_USER_REGD
+    bool "Do not enforce EEPROM regulatory restrictions"
+       default n

config ATH_DEBUG  
        bool "Atheros wireless debugging"
        ---help---
          Say Y, if you want to debug atheros wireless drivers.
          Right now only ath9k makes use of this.

Step 5. Run the following commands:

make clean && make mrproper  
cp /usr/lib/modules/$(uname -r)/build/Module.symvers ./  
# Copy current existing kernel configuration
zcat /proc/config.gz > .config  
make oldconfig && make prepare  

If the following appears:

Wireless LAN (WLAN) [Y/n/?] y  
  ADMtek devices (WLAN_VENDOR_ADMTEK) [Y/n/?] y
    ADMtek ADM8211 support (ADM8211) [M/n/?] m
  Atheros/Qualcomm devices (WLAN_VENDOR_ATH) [Y/n/?] y
    Do not enforce EEPROM regulatory restrictions (ATH_USER_REGD) [N/y]

Enter y.
Then, start the compilation:

make scripts  
make M=drivers/net/wireless/ath

Step 6. Replace the kernel module by entering the following commands:

# Use xz. Although the website says to use gzip, which will not work. From the file list on https://www.archlinux.org/packages/core/x86_64/linux/ , one can see that xz is used.
xz drivers/net/wireless/ath/ath.ko 
sudo cp -f drivers/net/wireless/ath/ath.ko.xz /lib/modules/$(uname -r)/kernel/drivers/net/wireless/ath/ath.ko.xz
sudo depmod -a  

Step 7. Reboot.

The above method does not require the compilation of the entire kernel, which takes many hours.

[1] https://www.kdaye.com/ap-5ghz-ath10k/

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.