Hostapd on Asus Nano 10 rtl8192cu Bananian Pi

After spent some time trying to setup Hostapd on Asus Nano 10 rtl8192cu, I never get to work properly and buy another USB Hi fi dongle.

As it make use of some files, I wrote this for archive purposes.

apt-get install linux-headers

ln -s /usr/src/linux-headers-3.4.104-bananian/arch/arm /usr/src/linux-headers-3.4.104-bananian/arch/armv7l

apt-get install git
git clone https://github.com/dz0ny/rt8192cu.git
cd rt8192cu
make
sudo make install
wget https://mirrors.romanrm.net/sunxi/hostapd/RTL8192xC_USB_linux_v3.4.4_4749.20121105.zip
unzip RTL8192xC_USB_linux_v3.4.4_4749.20121105.zip
cd RTL8188C_8192C_USB_linux_v3.4.4_4749.20121105
cd wpa_supplicant_hostapd
unzip wpa_supplicant_hostapd-0.8_rtw_20120803.zip
cd wpa_supplicant_hostapd-0.8
cd hostapd
make
cp hostapd hostapd_cli /usr/local/sbin/

mv /usr/sbin/hostapd /usr/sbin/hostapd.old
mv /usr/sbin/hostapd_cli /usr/sbin/hostapd_cli.old

ln -s /usr/local/sbin/hostapd /usr/sbin/hostapd
ln -s /usr/local/sbin/hostapd_cli /usr/sbin/hostapd_cli

modprobe -v 8192cu

iwconfig

Testing

hostapd /etc/hostapd/hostapd.conf

root@server ..apd/wpa_supplicant_hostapd-0.8/hostapd # hostapd /etc/hostapd/hostapd.conf
Configuration file: /etc/hostapd/hostapd.conf
drv->ifindex=6
l2_packet_init: ioctl[SIOCGIFINDEX]: No such device
no br0 interface , let l2_sock_recv==l2_sock_xmit=0x0xf66638
Failed to request a scan of neighboring BSSes
+rtl871x_sta_deauth_ops, ff:ff:ff:ff:ff:ff is deauth, reason=2
rtl871x_set_key_ops
rtl871x_set_key_ops
rtl871x_set_key_ops
rtl871x_set_key_ops
Using interface wlan1 with hwaddr 38:d5:47:0a:ca:03 and ssid ‘vfxira’
rtl871x_set_wps_assoc_resp_ie
rtl871x_set_wps_beacon_ie
rtl871x_set_wps_probe_resp_ie
rtl871x_set_key_ops
rtl871x_set_beacon_ops
rtl871x_set_hidden_ssid_ops
ioctl[RTL_IOCTL_HOSTAPD]: Invalid argument

File used in compilation:

RTL8192xC_USB_linux_v3.4.4_4749.20121105


 

Alternative files

Realtek website?

http://152.104.125.41/downloads/downloadsView.aspx?Langid=1&PNid=21&PFid=48&Level=5&Conn=4&ProdID=277&DownTypeID=3&GetDown=false&Downloads=true

File for 8192CU:

0001-RTL8188C_8192C_USB_linux_v4.0.2_9000.20130911

 


Errors solved in process above

make ARCH=armv7l CROSS_COMPILE= -C /lib/modules/3.4.104+/build M=/root/driver/RTL8188C_8192C_USB_linux_v4.0.5_11249.20140422/driver/rtl8188C_8192C_usb_linux_v4.0.5_11249.20140422 modules
make: *** /lib/modules/3.4.104+/build: no such file or directory. End.
make: *** [modules] Error 2
could not read interface wlan0 flags no such device hostapd
lsmod (check to see the module : no found do next)
modprobe -v 8192cu

Check the wlanX to use in hostapd.conf
iwconfig

 


Config File interfaces

vi /etc/network/interfaces
auto lo
iface lo inet loopback

# prepare interfaces for bridge
iface eth0 inet manual
iface wlan1 inet manual

# setup bridge
auto br0
iface br0 inet static
bridge_ports wlan1 eth0
address 192.168.1.2
netmask 255.255.255.0
broadcast 192.168.1.255
network 192.168.1.0
gateway 192.168.1.1
up ip route add 192.168.0.0/24 via 192.168.1.254

 

/etc/init.d/networking restart

Config File hostapd

vi /etc/hostapd/hostapd.conf

interface=wlan1
driver=rtl871xdrv
country_code=PT
ssid=sisssd
wpa_passphrase=xxx

ctrl_interface=/var/run/hostapd
bridge=br0
driver=rtl871xdrv
hw_mode=g
channel=6
wpa=2
beacon_int=100
hw_mode=g
ieee80211n=1
wme_enabled=1
ht_capab=[SHORT-GI-20][SHORT-GI-40][HT40+]
wpa_key_mgmt=WPA-PSK
wpa_pairwise=CCMP
max_num_sta=8
wpa_group_rekey=86400

/etc/init.d/hostapd restart

 

Bananian linux source

git clone https://github.com/nisenbeck/linux-bananapi.git /usr/src/linux-bananian

https://github.com/LeMaker/linux-sunxi

Alternative driver and hostpad

https://github.com/desflynn/realtek-8192cu-concurrent-softAP

 

Links

https://bogeskov.dk/UsbAccessPoint.html (main howto)

https://mirrors.romanrm.net/sunxi/hostapd/ (hostapd source)

https://github.com/dz0ny/rt8192cu (driver source)

https://wannabe-nerd.tweakblogs.net/blog/10870/wifi-access-point-using-a-realtek-8192cu-based-usb-wifi-dongle-with-a-raspberry-pi.html

http://forum.lemaker.org/thread-8852-1-1.html

http://forum.banana-pi.org/t/bananian-tutorial-how-to-use-can-bus-on-bananapi-with-bananian/634

Source of Module.symvers

http://kiecblog.blogspot.pt/2015/06/xiaomi-wifi-mt7601-driver-install-on.html

Module.symvers-3.4.13

Generate Module.symvers

https://unix.stackexchange.com/questions/24704/how-to-generate-module-symvers

 

Compile modules

http://forum.lemaker.org/forum.php?mod=viewthread&tid=941&page=1#pid17337

Haven’t tried the tarball provided by the op but you could use the source tree from LeMaker
1.Clone the kernel sources from LeMaker’s git to /usr/src directory
git clone –depth=1 https://github.com/LeMaker/linux-bananapi.git /usr/src/linux-bpi
2.Copy over the running kernel’s .config file to the above source directory.
zcat /proc/config.gz > /usr/src/linux-bpi/.config

3.Copy over Module.symvers file to the source directory: Bananian Module.symvers

3a. Case the enviromentvariable arch is not arm, but armv7l, I created a symlink in the sourcefolder with ln -s /usr/src/linux-bpi/arch/arm /usr/src/linux-bpi/arch/armv7l

4.from a terminal cd into /usr/src/linux-bpi and run the commands(which prepares the sources for compiling out-of-tree modules)
make menuconfig
make prepare
make scripts

5.Create a symlink in /lib/modules/3.4.90 called “build” and pointing to /usr/src/linux-bpi
cd into /lib/modules/3.4.90
ln -s /usr/src/linux-bpi build