This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Enabling hostapd in iMX6 using WL1271 chipset ?

Other Parts Discussed in Thread: WL1271

We have a custom iMX6 based platform running Android JellyBean with Linux kernel 3.0.35 with a TiWi-BLE Wlan/Bluetooth device using the SDIO interface for WLAN.

To setup a wifi Access point used the following command after loading the necessary modules,

hostapd -dd /data/misc/wifi/hostapd.conf


Then I got this error,

wl1271: firmware booted (Rev 6.2.1.0.54)
chown[ctrl_interface]: Operation not permitted
wl1271: down

Here is sample of my hostapd.conf,

driver=nl80211
ctrl_interface=/dev/socket
ctrl_interface_group=0
hw_mode=g
ssid=AndroidAP
ieee80211d=1

Is this error is related to do with anything with the parameters in hostapd.conf file?

  • Hi,

    This basically means that chown of /dev/socket is failing.
    You can try to manually chown /dev/socket to see if it makes a difference (or try running hostapd as root).

    Regards,
    Gigi Joseph.
  • Hi Joseph,
    what does ctrl_interface and ctrl_interface_group specify?
  • Hi,

    Please see below from the code:

    /**
    * ctrl_interface - Parameters for the control interface
    *
    * If this is specified, %wpa_supplicant will open a control interface
    * that is available for external programs to manage %wpa_supplicant.
    * The meaning of this string depends on which control interface
    * mechanism is used. For all cases, the existence of this parameter
    * in configuration is used to determine whether the control interface
    * is enabled.
    *
    * For UNIX domain sockets (default on Linux and BSD): This is a
    * directory that will be created for UNIX domain sockets for listening
    * to requests from external programs (CLI/GUI, etc.) for status
    * information and configuration. The socket file will be named based
    * on the interface name, so multiple %wpa_supplicant processes can be
    * run at the same time if more than one interface is used.
    * /var/run/wpa_supplicant is the recommended directory for sockets and
    * by default, wpa_cli will use it when trying to connect with
    * %wpa_supplicant.
    *
    * Access control for the control interface can be configured
    * by setting the directory to allow only members of a group
    * to use sockets. This way, it is possible to run
    * %wpa_supplicant as root (since it needs to change network
    * configuration and open raw sockets) and still allow GUI/CLI
    * components to be run as non-root users. However, since the
    * control interface can be used to change the network
    * configuration, this access needs to be protected in many
    * cases. By default, %wpa_supplicant is configured to use gid
    * 0 (root). If you want to allow non-root users to use the
    * control interface, add a new group and change this value to
    * match with that group. Add users that should have control
    * interface access to this group.


    /**
    * ctrl_interface_group - Control interface group (DEPRECATED)
    *
    * This variable is only used for backwards compatibility. Group for
    * UNIX domain sockets should now be specified using GROUP=group in
    * ctrl_interface variable.
    */


    Regards,
    Gigi Joseph.
  • Hi GigiJoseph,
    I tried to change the permission for ctrl_interface using chown but didnt worked out
  • Hi,

    You mean from the command line the chown is failing?
    Can you try running hostapd as root?

    Regards,
    Gigi Joseph.
  • Hi Joseph,
    I executed the following chown command from android shell as root
  • Hi,

    I don't see the command :)
    Also, do you have the hostapd as a service in the init.rc ? If not, can you try (as below)?

    chown wifi wifi /data/misc/wifi/hostapd.conf

    service hostapd_bin /system/bin/hostapd -dd /data/misc/wifi/hostapd.conf
    socket wpa_wlan0 dgram 660 wifi wifi
    disabled
    oneshot

    Regards,
    Gigi Joseph.
  • Hi,
    Thanks Joseph I got hostapd working only when ieee80211n=0 in my hostapd.conf file. How to enable 80211n in it?
  • Hi Teddy,

    Setting "ieee80211n=1" is the correct way to enable 11n.
    Can you share the hostapd logs (with option: "-dd") ?

    Also, the version that you are using seems very old. Can you upgrade to the latest release (R5 SP7)? The build script is available here: https://github.com/TI-ECS/build-utilites/blob/master/wl12xx_build.sh

    Regards,
    Gigi Joseph.
  • Hi Joesph,

    These are the log messages,

    D/hostapd ( 3384): BSS count 1, BSSID mask 00:00:00:00:00:00 (0 bits)

    D/hostapd ( 3384): nl80211: Regulatory information - country=00

    D/hostapd ( 3384): nl80211: 2402-2472 @ 40 MHz

    D/hostapd ( 3384): nl80211: 2457-2482 @ 20 MHz

    D/hostapd ( 3384): nl80211: 2474-2494 @ 20 MHz

    D/hostapd ( 3384): nl80211: 5170-5250 @ 40 MHz

    D/hostapd ( 3384): nl80211: 5735-5835 @ 40 MHz

    .....

    .....

    E/hostapd ( 3384): Mode: IEEE 802.11g  Channel: 6  Frequency: 2437 MHz

    D/hostapd ( 3384): nl80211: Set freq 2437 (ht_enabled=1, vht_enabled=0, bandwidth=20 MHz, cf1=2437 MHz, cf2=0 MHz)

    D/hostapd ( 3384): nl80211: Failed to set channel (freq=2437): -22 (Invalid argument)

    E/hostapd ( 3384): Could not set channel for kernel driver

    E/hostapd ( 3384): wlan0: Unable to setup interface.

  • Hi Teddy,

    Thanks - this looks more like a version mismatch between the hostapd version and the kernel version.
    I guess once you upgrade to the latest versions (ol_R5.SP7.01), you should not see this error.

    Regards,
    Gigi Joseph.
  • Hi Joesph,
    For Internet Connectivity, My board has support for Ethernet only. Then, How to add support for it in hostapd such that stations connected to my HostAp can access Internet.
  • Hi Teddy,

    Please see: http://processors.wiki.ti.com/index.php/OMAP_Wireless_Connectivity_Ethernet_WLAN_Bridge

    Regards,
    Gigi Joseph.
  • Hi Joseph,
    I am not able to build brctl binary for android. Do u i need to use any specific toolchain for it?
  • Hi Teddy,

    The normal cross compiler that you used for android should work. But I am assuming somebody would have already ported it to Android. Maybe you can just search the internet for the binary.

    Regards,
    Gigi Joseph.
  • Hi Joesph,
    Thanks for the Document. Can u provide me the steps for static connection insteald of DHCP?
  • Hi Teddy,

    For static ip, you don't need to run the DHCP Server/client.
    On the AP side, you can bring up the interface by doing "ifconfig wlan0 192.168.1.1 netmask 255.255.255.0 up" and then run the hostapd.

    On the station side, make sure the netmask is the same as the AP side and the "gateway" IP should match the AP IP address.

    Regards,
    Gigi Joseph.
  • Hi Joseph,

    When a station is connected to my board (HostAp), I am not able to access the Internet.
    Ex. If I ping google, It is able to resolve its IP but no packet transmission takes place.