Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Whats Next #1

Closed
safeeulbashir opened this issue Mar 23, 2018 · 3 comments
Closed

Whats Next #1

safeeulbashir opened this issue Mar 23, 2018 · 3 comments

Comments

@safeeulbashir
Copy link

I was going through your code. I am able to run the code. But how can i discover the service or connect with other device.

@NaniteFactory
Copy link
Owner

NaniteFactory commented Mar 25, 2018

If you've run the script successfully on the Linux side (which I suppose would be the server), you'll get an interface named something like p2p-wlan0-0, then it will start listening for a connection from the other client trying to connect to it.

For the Android client I simply used this sample application by Google. It comes with all the basic features for the Wifi Direct connection, like discover, requesting connections, etc.
https://android.googlesource.com/platform/development/+/master/samples/WiFiDirectDemo
The app can show you a list of all nearby Wifi Direct devices, what they call peers. The list may include the server on which you've run the script. Just tap on it, click on the connect button then it should do the work.
It's as easy as that so play around with it a bit and if you have further questions please let me know I'll try to answer as much as I know.

I hope this helped :)

@safeeulbashir
Copy link
Author

Thank you. I am actually trying to establish an wifi direct channel between two raspberry pie for file transfer. I am not sure how I can use this to do that. I would appreciate if you could enlighten me about that.

@NaniteFactory
Copy link
Owner

NaniteFactory commented Apr 13, 2018

@safeeulbashir

For that case, the process is well described here: http://processors.wiki.ti.com/index.php/OMAP_Wireless_Connectivity_NLCP_WiFi_Direct_Configuration_Scripts#Connect_in_pbc_.28Push_button_Control.29_where_EVM_.231_is_defined_as_the_group_owner

I think this would probably work but I'm not sure because I haven't really tried it...

After that you run the script on the server, in the client use these commands in the order (I presume that wlan1 is your interface and that it does support Wifi Direct) :

$ sudo wpa_cli -i wlan1 terminate -B
$ sudo wpa_cli -i p2p-wlan1-0 terminate -B

$ sudo wpa_supplicant -d -Dnl80211 -c /etc/wpa_supplicant.conf -i wlan1 -B # wpa_supplicant.conf should be put in /etc/ before this
$ sudo wpa_cli -i p2p-wlan1-0

p2p_find # enter the connection process. if this returns fail, it means that your device does not support wifi direct.
p2p_peers # shows the mac address of your peer(server).
p2p_connect xx:xx:xx:xx:xx:xx pbc join p2p_go_intent=0 # (please replace xx:xx:xx:xx:xx:xx with your server's mac address.)

+)
/etc/wpa_supplicant.conf of the client device be like

ctrl_interface=/var/run/wpa_supplicant
update_config=1

ap_scan=1

device_name=somedevice
device_type=1-0050F204-1

# optional, can be useful for monitoring, forces
# wpa_supplicant to use only channel 1 rather than
# 1, 6 and 11:
p2p_listen_reg_class=81
p2p_listen_channel=1
p2p_oper_reg_class=81
p2p_oper_channel=1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants