teksaport
Posts: 4
Joined: Tue Dec 29, 2015 4:24 am

Re: Wifi Direct Enabled

Wed Jan 06, 2016 4:57 am

Hi bass0324, thank you for these instructions, it seems that I am almost there, but not fully, and wondered if you had any suggestions.

I have a Pi 2 B, kernel 3.18.7-v7+ (Wheezy). I have the edimax EW-7811UN (reportedly with the realtek hardware). I cloned the GitHub, ran the install, ran the P2P_UI and it worked. I ran the commands e, then 1 and right then my android was found and listed in the lower box of the UI. I continued with the commands a, m, but it told me to select the number, not the mac address (Please insert the number in the scan list:), so I entered 01 (and I've also tried just 1) as that's the only device in the list. I then typed p and then 1 and immediately my android prompted me with "Invitation to connect, Connect with RTL8192CU in xx seconds (counting down from 30), Type the required PIN:" and counts down until it times out, but then starts back up again asking for the PIN.

Meanwhile on the Pi the P2P_UI keeps refreshing over and over changing the Status= line between "UI unkown failed, P2P_STATE_FIND_PHASE_SEARCH, P2P_STATE_LISTEN, P2P_STATE_FIND_PHASE_LISTEN, P2P_STATE_NONE". Your instructions didn't say anything about the P2P_UI refreshing over and over so I don't know if that's a problem or if it's expected.

On my Pi, I enter the PIN shown on the P2P_UI screen "12345670", the android finally said it was Connected. I would have thought that was all that was needed and I could go about using the connection.

Then I exited the P2P_UI and it dropped my WifiDirect connection. I've reconnected several times and even been able to ssh into the Pi from an android ssh client. But it didn't last and eventually I got dropped. I wondered if like the Pi, the WifiDirect page on the android had to remain showing like P2P_UI? Does P2P_UI have to remain running for WifiDirect to stay connected? Is there something more I need to do once connected so that I can exit P2P_UI? It seems that something isn't quite right to feel like this is working correctly.

Thanks
John





bass0324 wrote:All,

Sorry for not getting back to you as quickly as I would have liked. Here are the commands I used in order to test on a brand new raspbian build:

sudo apt-get update && sudo apt-get upgrade && sudo apt-get install firmware-realtek
mkdir ~/Wifi_Direct
cd ~/Wifi_Direct
git clone https://github.com/bass0324/rtl8192cu.git
cd rtl8192cu/WiFi_Direct_User_Interface/
chmod 777 ./install.sh
./install.sh
sudo ./P2P_UI wlan0

This then brings up a GUI in which these commands were run in order to connect to another device:

e
1
a
m
- Select the mac address of the device you wish to connect to (should be named same as android device)
p
1

On the wifi direct device (android in my case) type in the password

12345670

Once this is complete, you should now have a completed Wifi Direct interface between your Android device and the Raspberry Pi. In order to implement this in other ways, there is C code in the same folder the ./P2P_UI code is run which contains all of the commands used by the GUI in order to create the connection. These commands can be manipulated in other code in order to do what you need them to do. Let me know if there is any other questions you guys may have.

Regards,

John

Gordon2
Posts: 23
Joined: Wed Jan 16, 2013 10:45 pm

Re: Wifi Direct Enabled

Wed Feb 10, 2016 5:26 pm

Well I have WiFi Direct working great to send a live video stream from the RasPi to my Android Nexus-7 (with almost no lag in the video). I am doing this by SSHing into the RasPi via the Ethernet, then running P2P_UI to set up the WiFi for the direct connection.

However I want to be able to establish the WiFi direct connection without having to use the P2P_UI user interface (or even logging into the RasPi). I suspect that P2P_NO_UI might be the trick but when I run "sudo ./P2P_NO_UI wlan0" is starts the interface but still asks the RasPi user to enter the WPS configuration method, and even then it fails. Maybe I need a config file?

Can anyone get me started in the right direction to autostart WiFi Direct on the RasPi with no intervention from a user? Or am I barking up the wrong tree and maybe should use ad-hoc mode instead?

As to the recent question about the link dying when you quit P2P_UI, yes that is the behavior to be expected (therein lies my problem). And yes, the UI screen does refresh as the commands are executed by the UI in the background.

Update: I tried the video streaming from the RasPi when the RasPi was set us as an a WiFi access point. The lag was about 17 seconds, totally useless for my purpose.

bass0324
Posts: 19
Joined: Fri Aug 31, 2012 2:32 pm

Re: Wifi Direct Enabled

Sun May 01, 2016 12:23 pm

Hi Gordon,

In order to make it automatic, you will have to make code modifications to the files you create when running the install script in my guide. I did this when doing my initial testing of wifi direct, and can be seen here:
https://github.com/bass0324/Senior_Desi ... /rtl8192cu

I modified a few files there which allowed me to run one script to initiate the wifi direct connection. I also added the ability to store the Mac address to file and read it from there rather than selecting it every time.

You may be able to use this code directly for what you are wishing to do. Just create a file named device.txt and place the Mac address in there and the script should read from that file and connect automatically. Use the no ui script with this one.

In order to start the script at boot without having to log in, add the following line to /etc/rc.local
<Path_to_dir>/P2P_NO_UI &

Let me know if you have any issues with this or if things don't work. It has been a while since I've used these scripts so I am not sure the exact state of them.
Gordon2 wrote:Well I have WiFi Direct working great to send a live video stream from the RasPi to my Android Nexus-7 (with almost no lag in the video). I am doing this by SSHing into the RasPi via the Ethernet, then running P2P_UI to set up the WiFi for the direct connection.

However I want to be able to establish the WiFi direct connection without having to use the P2P_UI user interface (or even logging into the RasPi). I suspect that P2P_NO_UI might be the trick but when I run "sudo ./P2P_NO_UI wlan0" is starts the interface but still asks the RasPi user to enter the WPS configuration method, and even then it fails. Maybe I need a config file?

Can anyone get me started in the right direction to autostart WiFi Direct on the RasPi with no intervention from a user? Or am I barking up the wrong tree and maybe should use ad-hoc mode instead?

As to the recent question about the link dying when you quit P2P_UI, yes that is the behavior to be expected (therein lies my problem). And yes, the UI screen does refresh as the commands are executed by the UI in the background.

Update: I tried the video streaming from the RasPi when the RasPi was set us as an a WiFi access point. The lag was about 17 seconds, totally useless for my purpose.

ccordovag
Posts: 2
Joined: Wed Apr 20, 2016 7:20 pm

Re: Wifi Direct Enabled

Wed May 11, 2016 5:04 pm

Hi brass0324,

I have the pi one month ago and I followed your instruction for enable Wifi Direct. The issue is when I run the UI, select the option "e" then "1", the UI goes crazy, showing this message: wlan0 no private ioctls.
As I read, it must be by the interface broadcom built-in isn´t supported. Do you have any suggestion or information how I can run wifi direct on pi 3?
thank you.

roberto.andrade
Posts: 1
Joined: Wed Dec 03, 2014 5:31 pm

Re: Wifi Direct Enabled

Thu Jun 09, 2016 3:07 am

Does anyone know if the extra dongle is needed for the Pi 3 as well?

bass0324
Posts: 19
Joined: Fri Aug 31, 2012 2:32 pm

Re: Wifi Direct Enabled

Mon Sep 26, 2016 4:18 pm

For those attempting to use WiFi direct with the rpi 3, you will still need an external wireless adapter as the wireless chip used on board does not support the WiFi direct interface. Hopefully that will get updated in the future with a new chips etc that does support it, but until then, please utilize an adapter which supports WiFi direct.

ahmedawad
Posts: 42
Joined: Mon Apr 18, 2016 11:44 am
Location: Bremen, DE

Re: Wifi Direct Enabled

Fri Oct 20, 2017 10:27 am

bass0324 wrote:
Mon Sep 26, 2016 4:18 pm
For those attempting to use WiFi direct with the rpi 3, you will still need an external wireless adapter as the wireless chip used on board does not support the WiFi direct interface. Hopefully that will get updated in the future with a new chips etc that does support it, but until then, please utilize an adapter which supports WiFi direct.
@bass0324 I found many posts for people who already used WifiDirect using wpa_cli on Pi3. please can you confirm if this applies to RPI3 model B. I made their trials but nothing worked for me.

https://raspberrypi.stackexchange.com/q ... -fi-direct

https://stackoverflow.com/questions/440 ... pi-3-linux

Thanks in advance

kartikdesai
Posts: 1
Joined: Tue Dec 19, 2017 5:22 am

Re: Wifi Direct Enabled

Tue Dec 19, 2017 5:27 am

Hello,

I am facing the error in p2p_connect. So can you please provide the step wise procedure for connecting RPI 3 and android device.

Once it gets connected and the disconnects

Return to “General discussion”