söndag 9 oktober 2016

Wi-Fi Direct on raspberry pi 2 (jessie)

Wifi device: Plugable usb 2 wifi adapter with RTL8188CUS.

Several issues at start:

  • Can't list the device with iw list
  • Can't initiate P2P commands from wpa_cli
(however, ifconfig and iwconfig works as expected and the device can connect to wlan. wpa_supplicant.conf established previously with another device)

Installation, see RTL8188CUS.

Configuration, see wifi how-to-use. In my case I added wlan1 to /etc/network/interfaces. wpa_supplicant.conf was already configured for the existing wlan.

Install RTL drivers and software enabling wifi-direct, follow these instructions. Try to run the P2P_UI following these instructions. Tried connecting with LG G2 android. Success on some rare occassions. Most often received "UI unkown failed" (same as for teksaport).

Tried with a pristine jessie img and updated installation instructions provided by bass0324  on Wed Jul 30, 2014 2:39 am.  Same issue as above. Will soon test with TP-Link WN725N.


lördag 1 oktober 2016

Wi-Fi Protected Setup, WPS, on raspberry pi

There are many tutorials that explain how to connect a raspberry to a wifi hotspot, but I haven't seen this before.

You have a wi-fi dongle and want to configure your (headless) raspberry to connect to a wifi hotspot. I assume that you can use ssh to log into your rpi and that you can execute as sudo. I also assume that your router has a wps button.

As you probably know, wifi settings are stored in the file /etc/wpa_supplicant/wpa_supplicant.conf. If not previously configured, the content of this file might look like this:

>sudo cat /etc/wpa_supplicant/wpa_supplicant.conf
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=GB

Check that the wifi dongle is recognized by the system:

>iwconfig
wlan0     IEEE 802.11bgn  ESSID:off/any  
          Mode:Managed  Access Point: Not-Associated   Tx-Power=20 dBm   
          Retry short limit:7   RTS thr:off   Fragment thr:off
          Power Management:off
(device attached to wlan0)

Now, to set up wifi, you execute the following command (install wpa_cli if not already on the system):

>sudo wpa_cli wps_pbc
Selected interface 'wlan0'
OK

...and press the wps button on your router (within 2 minutes).

Check connection status with iwconfig or wpa_cli. On my system:

>sudo wpa_cli status
Selected interface 'wlan0'
bssid=e0:3f:49:09:a9:78
freq=2437
ssid=ASUS
id=0
mode=station
pairwise_cipher=CCMP
group_cipher=CCMP
key_mgmt=WPA2-PSK
wpa_state=COMPLETED
address=40:a5:ef:05:50:f5
uuid=de509928-92bf-5eda-8b02-83a0641a95ca

The important parameter is wpa_state, and that it's state is COMPLETED.

IP-address can be checked with;

> hostname -I
192.168.1.93 192.168.1.21

Two addresses, one for eth0, and the other is for the wlan0.

Check that wpa_supplicant.conf file has been updated and verify that rpi reconnects to the hotspot after reboot.

Refs: