8 Replies Latest reply on Dec 15, 2014 3:52 PM by jwestervelt

    Need the magic sauce to keep Edison/ubilinux connected to WiFi

    jwestervelt

      All,

       

      I am primarily a gentoo user, so I'm used to just setting up wpa_supplicant and having it work reliably 100% of the time.  Debian is somewhat new to me, but it appears that the wireless configuration requires a healthy knowledge of the arcane arts.  I set up wpa_supplicant and it never connects on boot up, but it always connects if I issue an `ifup --force wlan0`.   Frustrating.

       

      I installed wicd-curses, and had better luck after removing everything related to wlan0 from /etc/network/interfaces.  Now the Edison connects on boot, albeit after more than a minute, but it sometimes disconnects in the middle of the night and just refuses to reconnect.

       

      This is the output of my /var/log/messages file. 

       

      Dec 15 00:53:42 ubilinux kernel: [16726.427577] dhd_preinit_ioctls wl ampdu_hostreorder failed -23

      Dec 15 00:53:42 ubilinux kernel: [16726.521159] CFG80211-ERROR) wl_update_wiphybands : bw_cap failed, -23

      Dec 15 00:53:44 ubilinux kernel: [16728.876298] CFG80211-ERROR) wl_cfg80211_connect : Connectting withff:ff:ff:ff:ff:ff channel (157) ssid "Aperture Science Laboratori 5GHz�", len (32)

      Dec 15 00:53:44 ubilinux kernel: [16728.876298]

      Dec 15 00:53:44 ubilinux kernel: [16728.900280] CFG80211-ERROR) wl_cfg80211_disconnect : Reason 3

      Dec 15 00:53:45 ubilinux kernel: [16729.497979] CFG80211-ERROR) wl_cfg80211_connect : Connectting with70:73:cb:b5:3f:d0 channel (157) ssid "Aperture Science Laboratori 5GHz�", len (32)

      Dec 15 00:53:45 ubilinux kernel: [16729.497979]

      Dec 15 00:53:45 ubilinux kernel: [16729.513790] CFG80211-ERROR) wl_run_escan :  Escan set error (-16)

      Dec 15 00:53:45 ubilinux kernel: [16729.513826] CFG80211-ERROR) wl_run_escan : error (-16)

      Dec 15 00:53:45 ubilinux kernel: [16729.513848] CFG80211-ERROR) __wl_cfg80211_scan : Scan err = (-16), busy?-16

      Dec 15 00:53:45 ubilinux kernel: [16729.513871] CFG80211-ERROR) wl_cfg80211_scan : scan error (-16)

      Dec 15 00:53:49 ubilinux kernel: [16733.672723] CFG80211-ERROR) wl_is_linkdown : Link down Reason : WLC_E_DEAUTH_IND

      Dec 15 00:53:49 ubilinux kernel: [16733.674400] link down, during connecting

      Dec 15 00:53:49 ubilinux kernel: [16733.675191] CFG80211-ERROR) wl_bss_connect_done : Report connect result - connection failed

      Dec 15 00:53:49 ubilinux kernel: [16733.675227] CFG80211-ERROR) wl_escan_handler : escan is not ready ndev f5d3b800 drv_status 0x0 e_type 69 e_states 4

      Dec 15 00:53:56 ubilinux kernel: [16740.561971] CFG80211-ERROR) wl_cfg80211_connect : Connectting with70:73:cb:b5:3f:d0 channel (157) ssid "Aperture Science Laboratori 5GHz�", len (32)

      Dec 15 00:53:56 ubilinux kernel: [16740.561971]

      Dec 15 00:53:56 ubilinux kernel: [16740.567552] wl_bss_connect_done succeeded with 70:73:cb:b5:3f:d0

      Dec 15 00:53:56 ubilinux kernel: [16740.574384] wl_bss_connect_done succeeded with 70:73:cb:b5:3f:d0

      Dec 15 16:06:21 ubilinux kernel: [71477.428268] CFG80211-ERROR) wl_is_linkdown : Link down Reason : WLC_E_LINK

      Dec 15 16:06:21 ubilinux kernel: [71477.428311] link down if wlan0 may call cfg80211_disconnected. event : 16, reason=1 from 70:73:cb:b5:3f:d0

      Dec 15 16:06:21 ubilinux kernel: [71477.432386] CFG80211-ERROR) wl_is_linkdown : Link down Reason : WLC_E_LINK

      Dec 15 16:06:21 ubilinux kernel: [71477.435837] cfg80211: Calling CRDA to update world regulatory domain

      Dec 15 16:06:25 ubilinux kernel: [71481.487999] wl_android_wifi_off in

      Dec 15 16:06:25 ubilinux kernel: [71481.493403] CFG80211-ERROR) wl_escan_handler : escan is not ready ndev f5d3b800 drv_status 0x0 e_type 69 e_states 4

      Dec 15 16:06:25 ubilinux kernel: [71481.500194] wifi_platform_set_power = 0

      Dec 15 16:06:25 ubilinux kernel: [71481.515189]

      Dec 15 16:06:25 ubilinux kernel: [71481.515189] Dongle Host Driver, version 1.141.59 (r)

      Dec 15 16:06:25 ubilinux kernel: [71481.515189] Compiled in /mnt/hddbuilds/build/dave/edison-src-44/edison-src/broadcom_cws/wlan/driver_bcm43x on Oct 29 2014 at 12:44:49

      Dec 15 16:06:25 ubilinux kernel: [71481.515224] wl_android_wifi_on in

      Dec 15 16:06:25 ubilinux kernel: [71481.515242] wifi_platform_set_power = 1

      Dec 15 16:06:25 ubilinux kernel: [71482.068876] F1 signature OK, socitype:0x1 chip:0xa94c rev:0x2 pkg:0x0

      Dec 15 16:06:25 ubilinux kernel: [71482.070586] DHD: dongle ram size is set to 524288(orig 524288) at 0x0

      Dec 15 16:06:25 ubilinux kernel: [71482.073135] dhdsdio_download_firmware: firmware path=/lib/firmware/fw_bcmdhd.bin, nvram path=/lib/firmware/bcmdhd.cal

      Dec 15 16:06:25 ubilinux kernel: [71482.203002] sdioh_request_buffer: [1] doing memory copy buf=f6f9f000, len=2037

      Dec 15 16:06:25 ubilinux kernel: [71482.207522] dhdsdio_write_vars: Download, Upload and compare of NVRAM succeeded.

      Dec 15 16:06:26 ubilinux kernel: [71482.368738] dhd_bus_init: enable 0x06, ready 0x06 (waited 0us)

      Dec 15 16:06:26 ubilinux kernel: [71482.371909] wifi_platform_get_mac_addr

      Dec 15 16:06:26 ubilinux kernel: [71482.371954] wifi_get_mac_addr_intel: unable to open /config/wifi/mac.txt

      Dec 15 16:06:26 ubilinux kernel: [71482.377649] Firmware up: op_mode=0x0015, MAC=fc:c2:de:2f:9a:8f

      Dec 15 16:06:26 ubilinux kernel: [71482.400541] Firmware version = wl0: Aug 15 2014 15:09:17 version 6.20.190.2 (r497061) FWID 01-bb9bbd07

      Dec 15 16:06:26 ubilinux kernel: [71482.401521] dhd_preinit_ioctls wl ampdu_hostreorder failed -23

      Dec 15 16:06:26 ubilinux kernel: [71482.487730] CFG80211-ERROR) wl_update_wiphybands : bw_cap failed, -23

      Dec 15 16:06:26 ubilinux kernel: [71482.653071] wl_android_wifi_off in

      Dec 15 16:06:26 ubilinux kernel: [71482.658643] CFG80211-ERROR) wl_escan_handler : escan is not ready ndev f5d3b800 drv_status 0x0 e_type 69 e_states 4

      Dec 15 16:06:26 ubilinux kernel: [71482.664889] wifi_platform_set_power = 0

      Dec 15 16:06:36 ubilinux kernel: [71492.544409] CFG80211-ERROR) wl_scan_timeout : timer expired but no scan request

      Dec 15 16:20:31 ubilinux kernel: [72327.555591] pmic_ccsm pmic_ccsm: USB VBUS Removed. Notifying OTG driver

       

      If I issue an `/etc/init.d/wicd restart`  it will reconnect after spitting out messages similar to those listed above for 30-40 seconds.   Do I really need to put a cronjob in to manage wireless on Debian and restart networking once every 2-3 hours???  This really shouldn't be rocket surgery, it's just home WiFi.  I've had easier luck configuring an amateur radio network interface in gentoo, and that even involved bouncing a signal off the moon... Someone enlighten me please. 

       

      root@ubilinux:~# cat /etc/network/interfaces

      # interfaces(5) file used by ifup(8) and ifdown(8)

      auto lo

      iface lo inet loopback

       

      root@ubilinux:~# cat /etc/wicd/wireless-settings.conf

      [70:73:CB:B5:3F:D0]

      afterscript = None

      dhcphostname = ubilinux

      bssid = 70:73:CB:B5:3F:D0

      postdisconnectscript = None

      dns_domain = None

      gateway = None

      use_global_dns = False

      encryption = True

      ip = None

      beforescript = None

      hidden = False

      channel = 157

      mode = Master

      netmask = None

      key = X#X#X#X#X#

      usedhcphostname = 1

      predisconnectscript = None

      enctype = wpa

      dns3 = None

      dns2 = None

      search_domain = None

      use_settings_globally = False

      use_static_dns = False

      encryption_method = WPA2

      essid = Aperture Science Laboratori 5GHz

      automatic = 1

      dns1 = None

        • 1. Re: Need the magic sauce to keep Edison/ubilinux connected to WiFi
          Daniele_Cleri

          By Default the Wireless settings on ubilinux do not enable wlan0 on boot.

           

          The network settings on Debian based distros are at /etc/network/interfaces

           

          Other than reconfigure your SSID and PSK, the only thing that you need to change to get it working on boot is to un-comment the line:

           

          #auto wlan0

           

          Cheers,

          Daniele

          Emutex Team

          • 2. Re: Need the magic sauce to keep Edison/ubilinux connected to WiFi
            jwestervelt

            Daniele,

            I appreciate the input, however I moved to wpa_supplicant because, as I understand it, /etc/network/interfaces only has provisions to connect to a single SSID.  This device will roam, and I need to be able to have it pick up on known SSIDs and connect automatically. 

             

            Thanks,

            Jason

            • 3. Re: Need the magic sauce to keep Edison/ubilinux connected to WiFi
              jwestervelt

              Apparently since wpa_supplicant is so helplessly broken under ubilinux, the solution is to write a script that greps for my desired SSID from `iwlist` output, then update the /etc/network/interfaces file accordingly, and then fire off an `ifconfig --force wlan0`...     and then put that script in a cronjob that runs every minute.

               

              Such a horrible way to manage wireless.  I would have thought that debian would have been somewhat "with the program" by now.

              • 4. Re: Need the magic sauce to keep Edison/ubilinux connected to WiFi
                Daniele_Cleri

                Hi Jwestervelt,

                 

                I am sorry for my misunderstanding but from your first post it wasn't clear that you needed the roaming feature for your WiFi configuration.

                 

                If you want your Edison to connect to known networks automatically when roaming you don't need to install any additional software from the original ubilinux image.

                 

                Please follow my steps below and let me know if you may encounter any issues:

                 

                Edit the main network config file and change the WiFi related settings to:

                 

                $ vi /etc/network/interfaces

                -----------------------------

                # the auto wlan0 below is mandatory

                # change wlan0 inet to manual

                # add wpa-roam line

                # define a number of known network using user defined strings, e.g. mobile, home and also default

                 

                auto wlan0

                iface wlan0 inet manual

                        wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf

                 

                iface mobile inet dhcp

                iface home inet dhcp

                iface default inet dhcp

                 

                -----------------------------

                 

                Then edit the wpa_supplicant.conf file

                 

                $ vi /etc/wpa_supplicant/wpa_supplicant.conf

                -------------------------------------

                ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev

                update_config=1

                 

                network={

                        ssid="YOURMOBILESSID"

                        scan_ssid=1

                        key_mgmt=WPA-PSK

                        psk="YOURMOBILEPASS"

                        id_str="mobile"

                        priority=5

                }

                 

                network={

                        ssid="YOURHOMESSID"

                        scan_ssid=1

                        key_mgmt=WPA-PSK

                        psk="YOURHOMEPASS"

                        id_str="home"

                        priority=5

                }

                 

                ----------------------------

                 

                You can add as many network as you need, the next reboot your system will connect to the first available network listed in your config files.

                Once the network to which your Edison is connected becomes unavailable, it start looking for any other known network in the area, and it connects to it if available.

                • 5. Re: Need the magic sauce to keep Edison/ubilinux connected to WiFi
                  jwestervelt

                  Thanks for the input Daniele.  I had attempted exactly what you had stated, but apparently there was a problem in my wpa_supplicant.conf file.  I went through and redid it from scratch, and it appears to be working.  It appears that one of my network stanzas was incorrect, causing wpa_supplicant to fail to parse the config file.  What boggles me is how a manual ifup --force managed to get it working.

                   

                  Either way, it is all good now as far as I can tell.  I'll know for sure once i've allowed the device to roam to another AP to see if it reconnects automatically.

                  • 6. Re: Need the magic sauce to keep Edison/ubilinux connected to WiFi
                    Daniele_Cleri

                    Hi Jwestervelt,

                     

                    I am glad that it solved your issue.

                     

                    I have actually tested it already with my mobile phone in AP mode and my home WiFi router.

                    When both are active it selects my mobile AP and then, when I disable the tethering, it switches to my home WiFi router in 10/15 secs.

                     

                    If you have a WiFi router and a mobile phone tethering capable you can try to be sure that the roaming feature is working correctly for you too.

                     

                    Cheers,

                    Daniele

                    Emutex Team

                    • 7. Re: Need the magic sauce to keep Edison/ubilinux connected to WiFi
                      jwestervelt

                      Bah... still having some problems.  I get horrible ping times and packet loss after a while, forcing me to bounce the interface.  I ran into this previously and it was one of the reasons why I ditched wpa_supplicant under ubilinux.  Any idea why this would happen?  Simply bouncing the interface via ifdown/ifup resolves the problem temporarily.

                       

                      root@freyja:~# ping -c4 192.168.1.254

                      PING 192.168.1.254 (192.168.1.254) 56(84) bytes of data.

                      64 bytes from 192.168.1.254: icmp_req=1 ttl=255 time=1017 ms

                      64 bytes from 192.168.1.254: icmp_req=2 ttl=255 time=1015 ms

                      64 bytes from 192.168.1.254: icmp_req=3 ttl=255 time=1024 ms

                       

                       

                      --- 192.168.1.254 ping statistics ---

                      4 packets transmitted, 3 received, 25% packet loss, time 3005ms

                      rtt min/avg/max/mdev = 1015.708/1019.187/1024.270/3.674 ms, pipe 2

                      root@freyja:~# ifdown wlan0 && ifup wlan0

                      root@freyja:~# ping -c4 192.168.1.254

                      PING 192.168.1.254 (192.168.1.254) 56(84) bytes of data.

                      64 bytes from 192.168.1.254: icmp_req=1 ttl=255 time=1017 ms

                      64 bytes from 192.168.1.254: icmp_req=2 ttl=255 time=1015 ms

                      64 bytes from 192.168.1.254: icmp_req=3 ttl=255 time=1024 ms

                       

                       

                      --- 192.168.1.254 ping statistics ---

                      4 packets transmitted, 3 received, 25% packet loss, time 3005ms

                      rtt min/avg/max/mdev = 1015.708/1019.187/1024.270/3.674 ms, pipe 2

                      root@freyja:~# ifdown wlan0 && ifup wlan0

                      root@freyja:~# ping -c4 192.168.1.254

                      connect: Network is unreachable

                      root@freyja:~# ping -c4 192.168.1.254

                      PING 192.168.1.254 (192.168.1.254) 56(84) bytes of data.

                      64 bytes from 192.168.1.254: icmp_req=1 ttl=255 time=19.6 ms

                      64 bytes from 192.168.1.254: icmp_req=2 ttl=255 time=20.1 ms

                      64 bytes from 192.168.1.254: icmp_req=3 ttl=255 time=16.3 ms

                      64 bytes from 192.168.1.254: icmp_req=4 ttl=255 time=24.0 ms

                       

                       

                      --- 192.168.1.254 ping statistics ---

                      4 packets transmitted, 4 received, 0% packet loss, time 3005ms

                      rtt min/avg/max/mdev = 16.360/20.073/24.070/2.736 ms

                      • 8. Re: Need the magic sauce to keep Edison/ubilinux connected to WiFi
                        jwestervelt

                        Looks like it is a driver problem.  I'm guessing that this will require waiting until intel puts out a newer kernel.  :/  No idea why this just started happening, but i'm really not up for reinstalling the OS for the 8th time on this thing.  Was working somewhat, did ifdown/ifup to fix the ping issue listed above... then issued a reboot and got a kernel error.  :/

                         

                        [   27.736429] dhd_bus_rxctl: rxcnt_timeout=1, rxlen=0

                        [   27.736453] dhd_check_hang: Event HANG send up due to  re=1 te=0 e=-110 s=2

                        [   27.736522] dhd_check_hang: Event HANG send up due to  re=1 te=0 e=-110 s=2

                        [   27.736573] dhd_prot_ioctl : bus is down. we have nothing to do

                        [   27.736610] dhd_prot_ioctl : bus is down. we have nothing to do

                        [   27.736630] CFG80211-ERROR) wl_set_wpa_version : set wpa_auth failed (-1)

                        [   27.736652] CFG80211-ERROR) wl_cfg80211_connect : Invalid wpa_version

                        [   27.740602] dhd_prot_ioctl : bus is down. we have nothing to do

                        [   27.740629] CFGP2P-ERROR) wl_cfgp2p_bss_isup : 'cfg bss -C 0' failed: -1

                        [   27.740652] CFGP2P-ERROR) wl_cfgp2p_bss_isup : NOTE: this ioctl error is normal when the BSS has not been created yet.

                        [   27.740681] dhd_prot_ioctl : bus is down. we have nothing to do

                        [   27.740743] wl_android_wifi_off in

                        [   27.740762] dhd_prot_ioctl : bus is down. we have nothing to do

                        [   27.741037] wifi_platform_set_power = 0

                        [   27.743031] CFG80211-ERROR) wl_cfg80211_hang : In : chip crash eventing

                        [   27.744312] ------------[ cut here ]------------

                        [   27.744353] WARNING: at /mnt/hddbuilds/build/dave/edison-src-44/edison-src/build/tmp/work/edison-poky-linux/linux-yocto/3.10.17-ww42-r0/linux/net/wireless/sme.c:757 cfg80211_disconnected+0xce/0xe0()

                        [   27.744367] Modules linked in: usb_f_acm u_serial g_multi libcomposite bcm_bt_lpm bcm4334x(O)

                        [   27.744430] CPU: 0 PID: 23 Comm: kworker/0:1 Tainted: G           O 3.10.17-poky-edison-ww42+ #4

                        [   27.744446] Hardware name: Intel Corporation Merrifield/BODEGA BAY, BIOS 466 2014.06.23:19.20.05

                        [   27.744534] Workqueue: events dhd_deferred_work_handler [bcm4334x]

                        [   27.744552]  00000000 00000000 f646de1c c1861830 f646de44 c123e79e c1a2a4df c1ac55b4

                        [   27.744611]  000002f5 c183315e c183315e f56a0440 00000001 f5e25800 f646de54 c123e862

                        [   27.744665]  00000009 00000000 f646de74 c183315e 00000000 00000000 f56a01c0 f56a0440

                        [   27.744721] Call Trace:

                        [   27.744756]  [<c1861830>] dump_stack+0x16/0x18

                        [   27.744788]  [<c123e79e>] warn_slowpath_common+0x5e/0x80

                        [   27.744819]  [<c183315e>] ? cfg80211_disconnected+0xce/0xe0

                        [   27.744846]  [<c183315e>] ? cfg80211_disconnected+0xce/0xe0

                        [   27.744874]  [<c123e862>] warn_slowpath_null+0x22/0x30

                        [   27.744903]  [<c183315e>] cfg80211_disconnected+0xce/0xe0

                        [   27.745010]  [<f8b55451>] wl_cfg80211_hang+0x61/0xe0 [bcm4334x]

                        [   27.745043]  [<c16d6681>] ? netdev_run_todo+0x41/0x240

                        [   27.745070]  [<c16e8257>] ? netpoll_rx_enable+0x27/0x30

                        [   27.745150]  [<f8b263a0>] ? dhd_ethtool+0x240/0x240 [bcm4334x]

                        [   27.745228]  [<f8b263a0>] ? dhd_ethtool+0x240/0x240 [bcm4334x]

                        [   27.745307]  [<f8b263d3>] dhd_hang_process+0x33/0x40 [bcm4334x]

                        [   27.745393]  [<f8b2ece7>] dhd_deferred_work_handler+0xd7/0x240 [bcm4334x]

                        [   27.745420]  [<c186a2e5>] ? sub_preempt_count+0x55/0xe0

                        [   27.745499]  [<f8b263a0>] ? dhd_ethtool+0x240/0x240 [bcm4334x]

                        [   27.745529]  [<c125a3a9>] process_one_work+0x119/0x400

                        [   27.745556]  [<c186a21d>] ? add_preempt_count+0x7d/0xf0

                        [   27.745581]  [<c186a2e5>] ? sub_preempt_count+0x55/0xe0

                        [   27.745609]  [<c125af2e>] worker_thread+0xfe/0x330

                        [   27.745637]  [<c1866ba7>] ? _raw_spin_unlock_irqrestore+0x47/0x50

                        [   27.745665]  [<c125ae30>] ? manage_workers.isra.26+0x250/0x250

                        [   27.745691]  [<c12600b4>] kthread+0x94/0xa0

                        [   27.745716]  [<c186a2e5>] ? sub_preempt_count+0x55/0xe0

                        [   27.745749]  [<c186c177>] ret_from_kernel_thread+0x1b/0x28

                        [   27.745774]  [<c1260020>] ? kthread_create_on_node+0xc0/0xc0

                        [   27.745795] ---[ end trace 1f327cef63416d75 ]---

                        [   40.683997] g_multi gadget: high-speed config #1: Multifunction with RNDIS