abandonware/wireless-tools

Error hostapd.enable

simar88 opened this issue · 6 comments

Hi @bakerface, as i told you i'm trying your module for node.js and i've a problem using
hostapd.enable() function.
I'm using your sample code:

var hostapd = require('wireless-tools/hostapd');

var options = {
  channel: 6,
  driver: 'rtl871xdrv',
  hw_mode: 'g',
  interface: 'wlan0',
  ssid: 'RaspberryPi',
  wpa: 2,
  wpa_passphrase: 'raspberry'
};

hostapd.enable(options, function(err) {
  // the access point was created
  if(err){
      console.log("HOSTAPD ERR:"+err);
      }
});

And using it i'm receiveing this error:

HOSTAPD ERR:Error: Command failed: /bin/sh -c cat <<EOF >wlan0-hostapd.conf && hostapd -B wlan0-hostapd.conf && rm -f wlan0-hostapd.conf
channel=6
driver=rtl871xdrv
hw_mode=g
interface=wlan0
ssid=RaspberryPi
wpa=2
wpa_passphrase=raspberry

I'm working on Rapsbery Pi 2 and i've hostapd installed but maybe i'm forgetting something, Can you help me and suggest me something?
Thanks in advance.
Simone

I have been testing with the Realtek WiFi adapter. If you are using this as well, you will need to build their version of hostapd for the Raspberry Pi. If you are using another adapter, the driver option may need to be changed.

Hi @bakerface what does it mean exactly "you will need to build their version of hostapd for the Raspberry Pi"?
It's not sufficient install hostapd but i need to do some other things to match it with the wifi adapter?
In this case can you suggest me how to do it?
Now i'm looking to identifiy my driver option so i can do all the things to make it work.
Thanks :)

Hey @simar88,
I followed these instructions to get the correct version of hostapd on my Raspberry Pi.

Hi @bakerface thanks for reply!
I've checked my usb driver and it's rt2800usb and the version for this is not present on the site that you suggested to me for make the own compilation of hostapd.
I don't understand only one thing at the moment. After installed hostapd i need always to do the steps for the configuration file in /etc/hostapd/hostapd.conf and for the other things related to the usual procedure of hostapd?
I thought (maybe i'm wrong) that the enable command of node.js modules is to use in substitution of this things.
Can you tell me something about it?
Thanks in advance.

Hopefully you can find the Realtek drivers for your WiFi adapter. I think you will just have to hunt it down on their site. You are correct. The commands in this package will create the configuration files on the fly before running the command. Once the command is finished it will remove the files as well.

Hi @bakerface i've got it working now :)
The solution came up after reinstall hostapd (traditional version) and use nl80211 as driver option.
I've only a mistake during the connection and i would like to know if you've had something similar.
At the moment i'm trying it with iOS device and seems that after password inserted it stay in loop, like if it can connect.
Thanks again for the help!