10 Replies Latest reply on Aug 3, 2015 3:18 PM by pcarranzav

    Working: Edison as access point.

    _h!ggs_

      I'm running a little trolling experiment at work and though others might like to know about it.

       

      I have the Edison setup as an wifi access point.

       

      Basic setup:

      Mac laptop (10.9.5) with RNDIS drivers, MacPorts 2.3.1, Intel XDK IoT 4.2 (You do need the RNDIS drivers. I don't think you need the rest)

      Edison with Arduino dev board running 3.10.17-poky-edison

       

      The RNDIS drivers on the mac allow you to use the USB cable to setup a TCP/IP interface to the Edison.

      I have the edison running hostapd to do the AP work and the default TCP/IP route is sent down the usb0 nic.

      Enable TCP/IP forwarding with sysctl.

      Use iptables to masquerade everything going up to the mac.

      Then on the mac system preferences you share your macs primary connection with the "Edison" network interface.

       

      Thats pretty much it. Works pretty good. DNS lookups seem to be a little slow but I'm getting ~100Mbps down the usb cable according to iperf.

       

      hostapd seems to die/crash on occasions but you can normally restart it without a reboot.

       

      I'd be happy to provide more details if anyone is interested.

       

      thx

       

      ...steve...

        • 1. Re: Working: Edison as access point.
          _h!ggs_

          So this whole thing works as long as the AP clients are all manually assigned. As soon as I add an opt (namesrv,dns etc) to the udhcpd.conf file and start hostapd it crashes pretty hard (can still get to it via ssh/usb but the wlan interface is dead. ifconfig just sits there not outputting anything.

          I can't really tell what causes this but it looks like a bad call to some ioctl on the wifi device.

           

          dmesg:

           

          [  799.373671] dhd_wlfc_deinit():3233, Already disabled!

          [  799.412481] CFG80211-ERROR) wl_cfg80211_disconnect : Reason 3

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

          [  799.412552] CFG80211-ERROR) wl_cfg80211_disconnect : error (-1)

          [  799.412612] wl_android_wifi_off in

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

          [  799.412990] wifi_platform_set_power = 0

          [  799.512749] dhd_detach(): thread:dhd_watchdog_thread:76 terminated OK

          [  799.512803] dhd_dpc_thread: Unexpected up_cnt 0

          [  799.512972] dhd_detach(): thread:dhd_dpc:77 terminated OK

          [  799.513362] CFG80211-ERROR) wl_event_handler : was terminated

          [  799.513552] wl_destroy_event_handler(): thread:wl_event_handler:75 terminated OK

          [  799.567801] sdhci_request:mmc2: SD bus clock not enabled

          [  799.567827] sdhci_request:mmc2: host->pwr 0x0, host->clock 0x0

          [  799.568002] sdhci_request:mmc2: SD bus clock not enabled

          [  799.568021] sdhci_request:mmc2: host->pwr 0x0, host->clock 0x0

          [  799.568329] found wifi platform device wlan

          [  799.568372] unregister wifi platform drivers

          [  799.602403] dhd_module_init in

          [  799.602439] found wifi platform device wlan

          [  799.602550] Power-up adapter 'DHD generic adapter'

          [  799.928363] wifi_platform_set_power = 1

          [  800.131998] wifi_platform_bus_enumerate device present 1

          [  800.157825] bcmsdh_sdmmc: bcmsdh_sdmmc_probe Enter

          [  800.158077] bcmsdh_sdmmc: bcmsdh_sdmmc_probe Enter

          [  800.158098] bus num (host idx)=2, slot num (rca)=1

          [  800.158113] found adapter info 'DHD generic adapter'

          [  800.240884] F1 signature OK, socitype:0x1 chip:0xa94c rev:0x2 pkg:0x0

          [  800.242566] DHD: dongle ram size is set to 524288(orig 524288) at 0x0

          [  800.244426] wifi_platform_get_mac_addr

          [  800.244475] wifi_get_mac_addr_intel: unable to open /config/wifi/mac.txt

          [  800.252337] wl_create_event_handler(): thread:wl_event_handler:16b started

          [  800.252899] CFG80211-ERROR) wl_event_handler : tsk Enter, tsk = 0xf5f41520

          [  800.259740] dhd_attach(): thread:dhd_watchdog_thread:16c started

          [  800.263292] dhd_attach(): thread:dhd_dpc:16d started

          [  800.263328] dhd_deferred_work_init: work queue initialized

          [  800.263971] Dongle Host Driver, version 1.141.59 (r)

          [  800.263971] Compiled in /data/jenkins_worker/workspace/edison-weekly/broadcom_cws/wlan/driver_bcm43x on Sep  8 2014 at 14:10:57

          [  800.265551] Register interface [wlan0]  MAC: 00:90:4c:11:22:33

          [  800.265551]

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

          [  800.266259] bcmsdh_sdmmc: bcmsdh_sdmmc_probe Enter

          [  800.266383] wifi_platform_set_power = 0

          [  800.267470] wifi_platform_bus_enumerate device present 0

          [  800.310987]

          [  800.310987] Dongle Host Driver, version 1.141.59 (r)

          [  800.310987] Compiled in /data/jenkins_worker/workspace/edison-weekly/broadcom_cws/wlan/driver_bcm43x on Sep  8 2014 at 14:10:57

          [  800.311024] wl_android_wifi_on in

          [  800.311044] wifi_platform_set_power = 1

          [  800.406792] dhd_wlfc_deinit():3233, Already disabled!

          [  800.957868] F1 signature OK, socitype:0x1 chip:0xa94c rev:0x2 pkg:0x0

          [  800.959345] DHD: dongle ram size is set to 524288(orig 524288) at 0x0

          [  800.961533] dhdsdio_download_firmware: firmware path=/etc/firmware/fw_bcmdhd.bin, nvram path=/etc/firmware/bcmdhd.cal

          [  801.088652] sdioh_request_buffer: [1] doing memory copy buf=f6f99000, len=2037

          [  801.092483] dhdsdio_write_vars: Download, Upload and compare of NVRAM succeeded.

          [  801.253452] dhd_bus_init: enable 0x06, ready 0x06 (waited 0us)

          [  801.254439] BUG: unable to handle kernel NULL pointer dereference at 00000002

          [  801.254556] IP: [<f8a8cd51>] dhd_prot_ioctl+0x61/0x670 [bcm4334x]

          [  801.254731] *pdpt = 0000000035774001 *pde = 0000000000000000

          [  801.254812] Oops: 0000 [#1] PREEMPT SMP

          [  801.254883] Modules linked in: bcm4334x(O-) usb_f_acm u_serial g_multi libcomposite bcm_bt_lpm [last unloaded: bcm4334x]

          [  801.255049] CPU: 1 PID: 196 Comm: wpa_supplicant Tainted: G           O 3.10.17-poky-edison+ #1

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

          [  801.255235] task: f5ec10b0 ti: f5690000 task.ti: f5690000

          [  801.255302] EIP: 0060:[<f8a8cd51>] EFLAGS: 00210287 CPU: 1

          [  801.255447] EIP is at dhd_prot_ioctl+0x61/0x670 [bcm4334x]

          [  801.255512] EAX: 00000000 EBX: f0144000 ECX: f5691d74 EDX: 00000000

          [  801.255583] ESI: f5691d74 EDI: f5691d74 EBP: f5691d48 ESP: f5691d08

          [  801.255654]  DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068

          [  801.255718] CR0: 8005003b CR2: 00000002 CR3: 3576e000 CR4: 001007f0

          [  801.255787] DR0: 00000000 DR1: 00000000 DR2: 00000000 DR3: 00000000

          [  801.255856] DR6: ffff0ff0 DR7: 00000400

          [  801.255902] Stack:

          [  801.255934]  f5691d24 c186a035 c186a035 00200282 00200282 f5691d74 00200282 f5691d30

          [  801.256080]  c18668d6 f0147850 f5691d40 00000000 00000000 f0144000 f5691d74 00000000

          [  801.256222]  f5691d64 f8a49fd8 f5691da4 00000044 00000044 00000003 f5691de8 f5691d90

          [  801.256365] Call Trace:

          [  801.256425]  [<c186a035>] ? sub_preempt_count+0x55/0xe0

          [  801.256499]  [<c186a035>] ? sub_preempt_count+0x55/0xe0

          [  801.256579]  [<c18668d6>] ? _raw_spin_unlock_irqrestore+0x26/0x50

          [  801.256715]  [<f8a49fd8>] dhd_wl_ioctl+0x48/0xb0 [bcm4334x]

          [  801.256845]  [<f8a4a070>] dhd_wl_ioctl_cmd+0x30/0x40 [bcm4334x]

          [  801.257004]  [<f8a8d72b>] dhd_prot_init+0x4b/0x80 [bcm4334x]

          [  801.257149]  [<f8a510f3>] dhd_dev_init_ioctl+0x13/0x20 [bcm4334x]

          [  801.257301]  [<f8a6417f>] wl_android_wifi_on+0x11f/0x1b0 [bcm4334x]

          [  801.257446]  [<f8a53e97>] dhd_open+0xb7/0x1f0 [bcm4334x]

          [  801.257530]  [<c16d56fb>] __dev_open+0xab/0x120

          [  801.257600]  [<c186689f>] ? _raw_spin_unlock_bh+0x1f/0x30

          [  801.257678]  [<c16d5961>] __dev_change_flags+0x81/0x160

          [  801.257755]  [<c16d5ac8>] dev_change_flags+0x18/0x50

          [  801.257831]  [<c1736f29>] devinet_ioctl+0x5f9/0x720

          [  801.257911]  [<c1737c0a>] inet_ioctl+0x6a/0x90

          [  801.257978]  [<c16c0b51>] sock_ioctl+0x121/0x270

          [  801.258047]  [<c16c0a30>] ? sock_unregister+0x50/0x50

          [  801.258121]  [<c132a6b6>] do_vfs_ioctl+0x2f6/0x540

          [  801.258195]  [<c145e52a>] ? inode_has_perm.isra.41.constprop.78+0x3a/0x50

          [  801.258285]  [<c145e5c7>] ? file_has_perm+0x87/0x90

          [  801.258362]  [<c145e98c>] ? selinux_file_ioctl+0x4c/0xf0

          [  801.258436]  [<c132a960>] SyS_ioctl+0x60/0x80

          [  801.258506]  [<c1866f48>] syscall_call+0x7/0xb

          [  801.258565] Code: 04 00 00 be ff ff ff ff 83 c4 34 89 f0 5b 5e 5f 5d c3 f6 05 00 d0 ab f8 02 0f 85 ca 04 00 00 81 7d 0c 00 20 00 00 7f 72 8b 45 f0 <80> 78 02 01 0f 84 f5 01 00 00 8b 55 f0 c6 42 02 01 8b 07 89 42

          [  801.259260] EIP: [<f8a8cd51>] dhd_prot_ioctl+0x61/0x670 [bcm4334x] SS:ESP 0068:f5691d08

          [  801.259442] CR2: 0000000000000002

          [  801.259505] ---[ end trace c57b20dfb2d5e1aa ]---

          [  801.544134] wpa_supplicant (196) used greatest stack depth: 5008 bytes left

          • 2. Re: Working: Edison as access point.
            SergeyK

            Steve,

             

            Would you mind posting your hostapd.conf, and steps to configure Edison as an access point? (you can hide sensitive information, e.g. SSID, and WPA passphrase if any)

             

            Thanks,
            Sergey

            • 3. Re: Working: Edison as access point.
              _h!ggs_

              Sorry for the Delay Sergey. Been a bit sick for a few days. Will try to upload tonight.

              • 4. Re: Working: Edison as access point.
                _h!ggs_

                Maybe I'm just tired or this forum software does allow attachments.

                Anyway....

                These links are to my config files:

                http://ud1.org/hostapd.conf

                http://ud1.org/udhcpd-for-hostapd.conf

                 

                Here is the little script to masq out of the NIC I have setup over the USB connection.

                 

                The config files are pretty much stock. No real changes.

                 

                But now for some reason whenever I start hostapd I get the error I posted above.

                • 5. Re: Working: Edison as access point.
                  Richard_H

                  Hi, Steve.

                  Have you had any luck with the Edison in AP mode, perhaps with the newer software?  I'm about to venture down a similar path, and looking to not reinvent the wheel.

                  Cheers,

                  Richard

                  • 6. Re: Working: Edison as access point.
                    _h!ggs_

                    Hey Richard,

                    I updated to weekly-120 and AP mode works great. I made no (or maybe a few) changes to the configs I posted above but it is pretty straight forward. Let me know if you have any specific questions.

                    • 7. Re: Working: Edison as access point.
                      ptkwrrjz55

                      Hi Steve, this sounds really good, I'm trying to redo this on my Intel Breakout board. Could you please post bit more specific instructions on how did you do this all?

                      • 8. Re: Working: Edison as access point.
                        _h!ggs_

                        I will try to post more details later today

                        • 9. Re: Working: Edison as access point.
                          _h!ggs_

                          The upstream from edison to host hasn't changed since the original post. (i.e. RNDIS drivers and a little iptables magic for masquerading)

                           

                          As for hostapd.conf. Set the ssid= line to my network name. Set wpa=2. Set the wpa_passphrase= to the password I wanted.

                          For udhcpd-for-hostpad.conf I think the only things I changed are the start and end ranges as well as the following options:

                          opt subnet 255.255.255.0

                          opt route 192.168.42.1 #Which is the static address for wlan0

                          opt dns 192.168.2.1 #which is the upstream static address of my host (OSX with the "Edison" RNDIS device set to 192.168.2.1)

                          opt domain <whatever you search domain is>

                           

                          In my case, because I have static ips on the edison to mac usb connection I had to set the default route to upstream

                          route add default gw 192.168.2.1 dev usb0

                           

                          Then enable the packets to cross nics

                          sysctl -w net.ipv4.ip_forward=1

                           

                          Then tell iptables to masquerade everything going up to the mac.

                          iptables --table nat --append POSTROUTING --out-interface usb0 -j MASQUERADE

                           

                          Of course, in your case, you may just want the edison to extend you network instead of hiding in your network.

                          In which case you will want to look at the bridge option in hostapd.conf and setup a bridge with brctl.

                          Then you shouldn't need any of the udhcp stuff as your networks main dhcp server will do the work for you.

                           

                          hope this helps.

                           

                          Let me know if you have any other questions.

                           

                           

                          ...steve...

                          • 10. Re: Working: Edison as access point.
                            pcarranzav

                            Hi Steve,

                            Could you please tell me what you mean by the weekly-120? (Maybe a link? ) I'm getting similar errors to what you used to have (that bad ioctl call) and I can't find a way to fix it, so I'm guessing I need a different BSP version.

                            Thanks!