1 2 Previous Next 20 Replies Latest reply on Jun 22, 2015 10:48 PM by mhahn

    Enabling Wi-Fi Direct in wpa_supplicant package

    mjstanis

      Hi everyone,

       

      I'm trying to get Wi-Fi Direct or P2P (802.11: Part 1: P2P aka WiFi Direct - Introduction and Configuration of wpa_supplicant in Linux kernel version 3.8.3) working on Galileo.  So far, I've been able to bring up my Wi-Fi card, but I cannot tell if the current version of wpa_supplicant (2.0) supports Wi-Fi Direct.  Based on my testing using the tutorial in the link above, I suspect I need to compile it in.

       

      I tried to compile wpa_supplicant 2.2  from source on Galileo, but I'm running into errors with libnl.  Is there a way for me to edit the defconfig file of wpa_supplicant so that I can bitbake a new custom image that supports Wi-Fi direct?

       

      Thanks!

      Matt

        • 1. Re: Enabling Wi-Fi Direct in wpa_supplicant package
          mhahn

           

          I'm trying to get Wi-Fi Direct or P2P (802.11: Part 1: P2P aka WiFi Direct - Introduction and Configuration of wpa_supplicant in Linux kernel version 3.8.3) working on Galileo.  So far, I've been able to bring up my Wi-Fi card, but I cannot tell if the current version of wpa_supplicant (2.0) supports Wi-Fi Direct.  Based on my testing using the tutorial in the link above, I suspect I need to compile it in.

           

           

          on WiFi direct see also howto - Linux Wireless

           

           

          I tried to compile wpa_supplicant 2.2  from source on Galileo, but I'm running into errors with libnl.  Is there a way for me to edit the defconfig file of wpa_supplicant so that I can bitbake a new custom image that supports Wi-Fi direct?

           

          sure: generate a bbappend file which has a section like below

           

          do_configure_append () {

            # Activate config options needed by connman and tethering

            echo "CONFIG_WPS=y" >> wpa_supplicant/.config

            echo "CONFIG_AP=y" >> wpa_supplicant/.config

          [...]

          }

          • 2. Re: Re: Enabling Wi-Fi Direct in wpa_supplicant package
            AlexT_Intel

            do_configure_append () {

              # Activate config options needed by connman and tethering

              echo "CONFIG_WPS=y" >> wpa_supplicant/.config

              echo "CONFIG_AP=y" >> wpa_supplicant/.config

            [...]

            }

            Or do it like here (more files, but IMHO [and arguably] more Yocto-proper approach): https://github.com/alext-mkrs/meta-alext-galileo/tree/master/recipes-addfeatures/enable_gspca_pac207_webcam

            I.e. create a config snippet file with entries you want to modify + a .bbappend file with statements, which add the snippet file into SRC_URI and bitbake will then do the magic of merging default config and your snippet together.

            • 3. Re: Enabling Wi-Fi Direct in wpa_supplicant package
              mjstanis

              Thanks mhan, I appreciate the other link.  I think I had taken a look at that one too.  I'm going to follow Alex's format and and start a bitbake.  While it's running, a few questions for you both:

               

              1) Should the echo command in the .cfg file refer to wpa_supplicant/ or ../wpa_supplicant/ since it is located in the files/ directory?

              2) I see that there's a file called wpa_supplicant.conf in the bitbake package directory for wpa_supplicant.  However, it's only a sample conf file.  Should I append the CONFIG entries to .config or wpa_supplicant.conf?

               

              Thanks again!

              Matt

              • 4. Re: Enabling Wi-Fi Direct in wpa_supplicant package
                mjstanis

                Hey guys,

                 

                Well, my first try didn't seem to work.  When I run wpa_supplicant with my P2P conf file using mhan's link, I get a bunch of unrecognized command errors.  Below is a tarball of my directory structure in my yocto build dir, complete with my custom bbappend script:

                 

                http://mattstaniszewski.net/files/wpa-supplicant.tar.gz

                 

                Let me know what y'all think might be up.

                 

                Thanks!

                Matt

                • 5. Re: Re: Enabling Wi-Fi Direct in wpa_supplicant package
                  AlexT_Intel

                  1) Should the echo command in the .cfg file refer to wpa_supplicant/ or ../wpa_supplicant/ since it is located in the files/ directory?

                  2) I see that there's a file called wpa_supplicant.conf in the bitbake package directory for wpa_supplicant.  However, it's only a sample conf file.  Should I append the CONFIG entries to .config or wpa_supplicant.conf?

                  1) That refers to a directory within the yocto_build/tmp/work, the one used for building the wpa_supplicant (where bitbake unpacks the sources and builds them), not the directory where the recipes are stored;

                   

                  2) You need to append to the ".config"  file. It is used to configure the wpa_supplicant for compilation, "wpa_supplicant.conf" is used to configure the compiled program for actually doing its supplicant job.

                   

                  Let me know what y'all think might be up.

                  The reason is that you're mixing two [different] approaches mhahn and I proposed You don't need to do both.

                   

                  do_configre_append() function (mhahn's approach) should go into .bbappend file, not *.cfg (which is from my approach). The .bbappend file should be located in a different layer than the main .bb recipe (looks like you've put it into the original one).

                   

                  Instead of digging further into what's wrong right now, let me tell you how to do it right and then you can go from that . You can follow the instructions on cloning and enabling my layer, then modify the abovementioned recipe, that's one approach (see instructions here: alext-mkrs/meta-alext-galileo · GitHub). Here's a little bit simpler one, which uses one of the existing layers:

                   

                  Assuming you have BSP unpacked into meta-clanton_v1.0.0 directory and you've run the setup.sh so it's fully ready for building.

                   

                  cd meta-clanton_v1.0.0/meta-clanton-distro
                  mkdir -p recipes-mjstanis/wpa_supplicant_with_wifip2p/files && cd recipes-mjstanis/wpa_supplicant_with_wifip2p
                  echo -e 'FILESEXTRAPATHS_prepend := "${THISDIR}/files:"\nSRC_URI += "file://wifi_p2p.cfg"' >> wpa-supplicant_2.0.bbappend
                  echo -e 'CONFIG_DRIVER_NL80211=y\nCONFIG_CTRL_IFACE=y\nCONFIG_WPS=y\nCONFIG_WPS2=y\nCONFIG_P2P=y\nCONFIG_AP=y' >> ./files/wifi_p2p.cfg
                  

                   

                  Now run bitbake and it should build it for you. If not - please post the build output, that would help the troubleshooting.

                  • 6. Re: Enabling Wi-Fi Direct in wpa_supplicant package
                    mjstanis

                    Thanks Alex, that explains a lot :-)

                     

                    I went ahead and built a new image using your simple approach above.  I believe it suceeded, but I still am unable to tell if WiFi direct support is working on my Galileo.  I can start wpa_supplicant with a .conf file (as explained in howto - Linux Wireless), but the p2p_find and other p2p commands don't work.  I also have to remove the device_name and device_type fields from the .conf file to get wpa_supplicant to run.

                     

                    To make sure it's a WiFi card issue and not a bad image install, could you tell me where I can grab the build output to post?

                     

                    Thanks again!

                    Matt

                    • 7. Re: Enabling Wi-Fi Direct in wpa_supplicant package
                      mhahn

                      I actually haven't tested WiFi direct on Galileo yet. So was looking for your feedback whether you get it running

                      To make sure it's a WiFi card issue and not a bad image install, could you tell me where I can grab the build output to post?

                      You should have build/work/...../temp subfolders for all packages with various log files for all stages (do_configure, do_compile ....)

                      Just check the respective files for probably wpa_supplicant

                      • 8. Re: Re: Enabling Wi-Fi Direct in wpa_supplicant package
                        mjstanis

                        Hi mhahn,

                         

                        I dug up all the log files from my Galileo.  The most relevant appears to be the do_compile log, which I've pasted below.  I would have expected a source file with 'p2p' in the name would have been compiled, but I don't see that in the log.  What do you think?

                         

                        DEBUG: Executing shell function do_compile

                        NOTE: make -j 14 -e MAKEFLAGS= -C wpa_supplicant

                        make: Entering directory `/home/matt/meta-clanton_v0.7.5_image_sdk/yocto_build/tmp/work/i586-poky-linux/wpa-supplicant/2.0-r1/wpa_supplicant-2.0/wpa_supplicant'

                          CC  eap_register.c

                          CC  ../src/utils/wpabuf.c

                          CC  ../src/utils/os_unix.c

                          CC  ../src/rsn_supp/preauth.c

                          CC  notify.c

                          CC  ../src/utils/wpa_debug.c

                          CC  ../src/utils/common.c

                          CC  ../src/rsn_supp/pmksa_cache.c

                          CC  ../src/rsn_supp/wpa_ie.c

                          CC  ../src/eap_peer/eap_tls.c

                          CC  ../src/utils/eloop.c

                          CC  config_file.c

                          CC  ../src/rsn_supp/peerkey.c

                          CC  ../src/eap_common/eap_peap_common.c

                          CC  ../src/eap_peer/mschapv2.c

                          CC  ../src/eap_peer/eap_md5.c

                          CC  ../src/eap_peer/eap_gtc.c

                          CC  ../src/eap_peer/eap_otp.c

                          CC  ../src/common/wpa_common.c

                          CC  ../src/eap_common/chap.c

                          CC  ../src/eap_peer/eap_methods.c

                          CC  ../src/eap_peer/eap_leap.c

                          CC  ../src/eap_peer/eap_mschapv2.c

                          CC  ../src/crypto/ms_funcs.c

                          CC  bss.c

                          CC  ../src/eap_peer/eap_ttls.c

                          CC  ../src/eap_peer/eap_peap.c

                          CC  ../src/crypto/aes-unwrap.c

                          CC  ../src/crypto/rc4.c

                          CC  ../src/crypto/md5.c

                          CC  ../src/crypto/crypto_gnutls.c

                          CC  ../src/eap_peer/eap_tls_common.c

                          CC  ../src/crypto/random.c

                          CC  ../src/eapol_supp/eapol_supp_sm.c

                          CC  config.c

                          CC  ../src/rsn_supp/wpa.c

                          CC  ../src/crypto/tls_gnutls.c

                          CC  ctrl_iface_unix.c

                          CC  dbus/dbus_old.c

                          CC  ../src/eap_peer/eap.c

                          CC  dbus/dbus_new_helpers.c

                          CC  dbus/dbus_dict_helpers.c

                          CC  ../src/utils/base64.c

                          CC  ../src/crypto/sha1-prf.c

                          CC  dbus/dbus_common.c

                          CC  ../src/common/ieee802_11_common.c

                          CC  dbus/dbus_old_handlers.c

                          CC  dbus/dbus_new.c

                          CC  sme.c

                          CC  ../src/eap_common/eap_common.c

                          CC  ../src/crypto/sha1-tlsprf.c

                          CC  ../src/drivers/driver_common.c

                          CC  ../src/crypto/sha1.c

                          CC  ../src/crypto/sha1-pbkdf2.c

                          CC  blacklist.c

                          CC  main.c

                          CC  dbus/dbus_new_handlers.c

                          CC  ../src/utils/radiotap.c

                          CC  ../src/drivers/netlink.c

                          CC  ../src/drivers/linux_ioctl.c

                          CC  ../src/drivers/drivers.c

                          CC  ../src/drivers/rfkill.c

                          CC  ../src/drivers/driver_wired.c

                        sed -e 's|\@BINDIR\@|/usr/sbin|g' systemd/wpa_supplicant.service.in >systemd/wpa_supplicant.service

                        sed -e 's|\@BINDIR\@|/usr/sbin|g' systemd/wpa_supplicant.service.arg.in >systemd/wpa_supplicant@.service

                        sed -e 's|\@BINDIR\@|/usr/sbin|g' systemd/wpa_supplicant-nl80211.service.arg.in >systemd/wpa_supplicant-nl80211@.service

                        sed -e 's|\@BINDIR\@|/usr/sbin|g' systemd/wpa_supplicant-wired.service.arg.in >systemd/wpa_supplicant-wired@.service

                        sed -e 's|\@BINDIR\@|/usr/sbin|g' dbus/fi.epitest.hostap.WPASupplicant.service.in >dbus/fi.epitest.hostap.WPASupplicant.service

                        sed -e 's|\@BINDIR\@|/usr/sbin|g' dbus/fi.w1.wpa_supplicant1.service.in >dbus/fi.w1.wpa_supplicant1.service

                          CC  ctrl_iface.c

                          CC  wpas_glue.c

                          CC  scan.c

                          CC  ../src/l2_packet/l2_packet_linux.c

                          CC  ../src/utils/edit_simple.c

                          CC  wpa_passphrase.c

                          CC  events.c

                          CC  ../src/common/wpa_ctrl.c

                          CC  wpa_supplicant.c

                          CC  ../src/drivers/driver_wext.c

                          CC  wpa_cli.c

                          LD  wpa_cli

                          LD  wpa_passphrase

                          CC  ../src/drivers/driver_nl80211.c

                          LD  wpa_supplicant

                        make: Leaving directory `/home/matt/meta-clanton_v0.7.5_image_sdk/yocto_build/tmp/work/i586-poky-linux/wpa-supplicant/2.0-r1/wpa_supplicant-2.0/wpa_supplicant'

                        DEBUG: Shell function do_compile finished

                        • 9. Re: Re: Enabling Wi-Fi Direct in wpa_supplicant package
                          mhahn

                          why would you expect something with "p2p"? Check the sources (for me in build/tmp/work/i586-poky-linux/wpa-supplicant/2.1-r0/wpa_supplicant-2.1/wpa_supplicant/) - mostly relevant: wpa_cli.c.

                          You need to check whether CONFIG_P2P really has been applie (check the .config file).

                           

                          Does wpa_cli actually work for you?

                           

                          FYI: in addition to howto - Linux Wireless there is an even more comprehensive README for P2P in the wpa_supplicant sources: build/tmp/work/i586-poky-linux/wpa-supplicant/2.1-r0/wpa_supplicant-2.1/wpa_supplicant/README_P2P. In the examples subdirectory you find several scripts for P2P.

                          • 10. Re: Re: Enabling Wi-Fi Direct in wpa_supplicant package
                            mjstanis

                            Hey mhahn,

                             

                            When I had tried compiling wpa_supplicant from source, I thought I had seen a file with 'p2p' in the name, but I guess I was wrong.

                             

                            Strangely, my build/tmp/work/i586-poky-linux/wpa-supplicant/2.0-r1 (I'm still on 0.7.5) shows only a temp/ and pseudo/ directory.  I haven't been able to find wpa_cli.c or README_P2P in the entire build dir.

                             

                            I can run wpa_cli, but none of the commands for P2P (p2p_find) seem to work.

                             

                            Perhaps it's time to upgrade to the latest FW and BSP :-)

                             

                            Thanks!

                            Matt

                            • 11. Re: Enabling Wi-Fi Direct in wpa_supplicant package
                              mhahn

                              upgrading to latest FW & BSP is a good idea in any case

                              • 12. Re: Re: Enabling Wi-Fi Direct in wpa_supplicant package
                                mjstanis

                                Yea I figured.  Alright, I updated to the 1.0.0 FW, IDE and LSB image (using Sergey's instructions for building the LSB image: Intel Galileo - Building Linux Image - Malinov Family Web Presence).  I now see the README-P2P, which is VERY descriptive and will be helpful.

                                 

                                However, now I don't see iwlwifi coming up when I boot, even though the LSB image includes a kernel with iwlwifi support.  My WiFi card shows up in lspci, but for some reason it's not getting detected.

                                 

                                I'll have to work on that tonight, but after that hurdle, I'm pretty optimistic that the README will help me get P2P working finally :-)

                                 

                                Keep you posted,

                                Matt

                                • 13. Re: Re: Re: Enabling Wi-Fi Direct in wpa_supplicant package
                                  mjstanis

                                  Alright, well turns out that my .bb file for the SDK image I built didn't save.  I rebuilt with the correct options and now my 1.0.0 image is up and running with the right tools and P2P options enabled.  I can see my wifi cards, connect to the network and the two boards can ping each other.

                                   

                                  However, following the README in the wpa_supplicant build directory as (attached), I run into the same issues as below:

                                   

                                  In run-time configuration file (wpa_supplicant.conf), some parameters

                                  for P2P may be set. In order to make the devices easier to recognize,

                                  device_name and device_type should be specified. For example,

                                  something like this should be included:

                                   

                                   

                                  ctrl_interface=/var/run/wpa_supplicant

                                  device_name=My P2P Device

                                  device_type=1-0050F204-1

                                   

                                  Adding these lines in wpa_supplicant.conf yields the following results:

                                   

                                  root@galileo:~# Successfully initialized wpa_supplicant

                                  Line 6: unknown global field 'device_name=Galileo'.

                                  Line 6: Invalid configuration line 'device_name=Galileo'.

                                  Line 7: unknown global field 'device_type=1-0050F204-1'.

                                  Line 7: Invalid configuration line 'device_type=1-0050F204-1'.

                                  Failed to read or parse configuration '/etc/wpa_supplicant.conf'.

                                   

                                  I commented out those lines, which allows wpa_supplicant to load.  However, then in wpa_cli I attempt a few of the WiFi direct commands (i.e. p2p_find and p2p_listen) and get:

                                   

                                  Selected interface 'wlan0'

                                   

                                   

                                  Interactive mode

                                   

                                   

                                  > p2p_find

                                  Unknown command 'p2p_find'

                                  > p2p_listen

                                  Unknown command 'p2p_listen'

                                   

                                  Typing 'help' gives a list of commands, none of which are WiFi direct related (p2p_*).

                                   

                                  At this point, I'm almost positive I have everything in wpa_supplicant and the kernel compiled correctly.  Is it fair to say my WiFi card just might not support WiFi direct or is something else up?

                                   

                                  Thanks!

                                  Matt

                                  • 14. Re: Enabling Wi-Fi Direct in wpa_supplicant package
                                    mhahn

                                    well, there might also be issues with wpa_supplicant.

                                    Can't help you out of experience. Just can share my thoughts of what I'd do next:

                                     

                                    - run wpa_supplicant in debug mode (see e.g. How to enable debug mode in wpa_supplicant? (Page 1) — Developers Only — OpenWrt)

                                    - if that's not yet enough deep dive into wpa_supplicant code [e.g. check the code why your p2p commands are not taken]

                                     

                                    Good luck

                                    1 2 Previous Next