2 Replies Latest reply on Feb 4, 2015 9:58 AM by mhahn

    how to use crda on Edison to set country?

    mhahn

      Re: Edison AP mode in 5GHz describes how to customize a kernel for a certain country setting CONFIG_CFG80211_INTERNAL_REGDB. The alternative is to use crda from https://wireless.wiki.kernel.org/en/developers/Regulatory/CRDA which should allow to either set the COUNTRY environment variable and run manually crda or to trigger the same by calling

      iw reg set <country code>

       

      However,

      • the crda bitbake recipe I found on openembedded doesn't seem to work
      • I built crda on the target and installed it - still no success

       

      # COUNTRY="US" crda

      Failed to set regulatory domain: -7

       

      • looking into strace it appears the file "fips_enabled" isn't found - not sure whether this is an issue
      • according to errno.h the error code is: #define E2BIG 7 /* Argument list too long */ - don't quite understand

       

      on the other hand trying

      iw reg set US

      I don't get an error but also nothing is changed: "iw reg get" always lists country 00. With strace iw reg set <country>  I can see "/sys/class/ieee80211/reg/index" missing although CONFIG_CFG8021 is set as schown in the config excerpt below:

      CONFIG_CFG80211=y

      CONFIG_CFG80211_DEVELOPER_WARNINGS=y

      # CONFIG_CFG80211_REG_DEBUG is not set

      # CONFIG_CFG80211_CERTIFICATION_ONUS is not set

      CONFIG_CFG80211_DEFAULT_PS=y

      # CONFIG_CFG80211_DEBUGFS is not set

      # CONFIG_CFG80211_INTERNAL_REGDB is not set

      CONFIG_CFG80211_WEXT=y

       

       

      has someone managed to get crda running fine on Edison?

        • 1. Re: how to use crda on Edison to set country?
          David_J_Hunt

          mhahn,

              I think the kernel is OK as it is, because I'm able to set the country fine with that kernel under ubilinux (Debian), which is (for the most part) the same kernel as Yocto.

           

          I did

          apt-get install iw

          which got me these three packages - crda iw wireless-regdb

          I then added a new regulatory.rules file in /etc/udev//rules.d containing

          # Example file, should be put in /etc/udev/rules.d/regulatory.rules

          KERNEL=="regulatory*", ACTION=="change", SUBSYSTEM=="platform", RUN+="/sbin/crda"

           

          as described in your kernel.org link above. Then I restarted the networking with "/etc/init.d/networking restart"

           

          I then ran the udevadm in monitor mode in the background

          udevadm monitor --environment kernel &

          to keep an eye on the dev requests going to the kernel, and then set the reg domain (using IE for Ireland, of course, where I'm located)

          root@ubilinux:/etc/wpa_supplicant# iw reg get

          country 00:

                  (2402 - 2472 @ 40), (N/A, 20)

                  (2457 - 2482 @ 40), (N/A, 20), PASSIVE-SCAN, NO-IBSS

                  (2474 - 2494 @ 20), (N/A, 20), NO-OFDM, PASSIVE-SCAN, NO-IBSS

                  (5170 - 5250 @ 160), (N/A, 20), PASSIVE-SCAN, NO-IBSS

                  (5250 - 5330 @ 160), (N/A, 20), DFS, PASSIVE-SCAN, NO-IBSS

                  (5490 - 5730 @ 160), (N/A, 20), DFS, PASSIVE-SCAN, NO-IBSS

                  (5735 - 5835 @ 80), (N/A, 20), PASSIVE-SCAN, NO-IBSS

                  (57240 - 63720 @ 2160), (N/A, 0)

          root@ubilinux:/etc/wpa_supplicant# iw reg set IE

          KERNEL[75881.370262] change   /devices/platform/regulatory.0 (platform)

          ACTION=change

          COUNTRY=IE

          DEVPATH=/devices/platform/regulatory.0

          MODALIAS=platform:regulatory

          SEQNUM=1258

          SUBSYSTEM=platform

          UDEV_LOG=3

           

          UDEV  [75881.410430] change   /devices/platform/regulatory.0 (platform)

          ACTION=change

          COUNTRY=IE

          DEVPATH=/devices/platform/regulatory.0

          MODALIAS=platform:regulatory

          SEQNUM=1258

          SUBSYSTEM=platform

          UDEV_LOG=3

          USEC_INITIALIZED=75881362279

           

           

          root@ubilinux:/etc/wpa_supplicant# iw reg get

          country IE:

                  (2402 - 2482 @ 40), (N/A, 20)

                  (5170 - 5250 @ 80), (N/A, 20)

                  (5250 - 5330 @ 80), (N/A, 20), DFS

                  (5490 - 5710 @ 80), (N/A, 27), DFS

                  (57240 - 65880 @ 2160), (N/A, 40), NO-OUTDOOR

          root@ubilinux:/etc/wpa_supplicant#

           

          Rgds,

          Dave

          1 of 1 people found this helpful
          • 2. Re: how to use crda on Edison to set country?
            mhahn

            Thanks, Dave!

            good hint to have a look at udevadm. My settings look pretty identical - also the udev rule:

             

            # cat /lib/udev/rules.d/85-regulatory.rules

            KERNEL=="regulatory*", ACTION=="change", SUBSYSTEM=="platform", RUN+="/sbin/crda"

             

            But in fact crda doesn't trigger anything. 'COUNTRY="US" crda'  simply doesn't work :-(

             

            Meanwhile I rebuilt the kernel with CONFIG_CFG80211_INTERNAL_REGDB to have a solution for now. Hence I now can set the country reg via iw. Still would like to understand why crda doesn't work on my side and maybe find a success story with BKM for the Edison Yocto image