Wifi direct android linux

How to set up a Wifi-Direct connection between Android and Linux

I want to connect two devices using Wifi-Direct. One is a pc with Linux (during my test I’m using Linux Mint 17.2), the other is an Android smartphone (Samsung Galaxy S3 with Android 4.3. Not rooted and don’t want to root). Reading a number of guides on the internet, I decided to use wpa_supplicant in Linux and to create an app for Android. This is one of the best guides I found for wpa_supplicant: https://web.archive.org/web/20210114180304/https://processors.wiki.ti.com/index.php/OMAP_Wireless_Connectivity_NLCP_WiFi_Direct_Configuration_Scripts When I run iw list I see that the «Supported interface modes:» allows P2P_client and P2P_GO. My wpa_supplicant.conf contains:

ctrl_interface=/var/run/wpa_supplicant update_config=1 ap_scan=1 device_name=My-pc device_type=1-0050F204-1 driver_param=use_p2p_group_interface=1 p2p_go_intent=15 p2p_go_ht40=1 

The app is very similar to this example (it’s from a book) https://github.com/retomeier/Wrox-ProfessionalAndroid-4E/blob/9741a8b62005d49519b1decfea21e7213fdd94a3/Snippets_ch18/app/src/main/java/com/professionalandroid/apps/myapplication/WiFiDirectActivity.java It works as expected. When I try it with two Android devices, they can see each other and connect (it appear the Wifi-Direct icon). Now I am trying to connect Android and Linux, but I guess I don’t really understand how wpa_supplicant works. I also saw this question that is very similar to what I asked, but it doesn’t really answer my doubts. Direct Wifi Communication between android smartphone and other devices My problem is that I can’t understand how to do the handshake between the two devices and how to set up the network. Wpa_supplicant is my problem. I run:

sudo wpa_supplicant -wlan0 -Dnl80211 -c/etc/wpa_supplicant.conf sudo wpa_cli 
  • The device_name (and other parameters) weren’t set as I specifiend in the .conf file
  • wpa_supplicant continues to try to connect to all the networks
  • p2p_find was really slow.

so I went into /usr/share/dbus-1/system-services and moved away the two files

fi.epitest.hostap.WPASupplicant.service fi.w1.wpa_supplicant1.service 
sudo killall wpa_supplicant 

and it really dies, disconnecting me from Wifi without reconnecting the following second. Now I can launch wpa_supplicant and the three problems are resolved.

I go into wpa_cli, launch «p2p_find» and at the same time, I enable the search from within the app.

Android and Linux can now see each other.

P2P-DEVICE-FOUND 00:11:22:44:88:ff p2p_dev_addr=00:11:22:44:88:ff pri_dev_type=10-0050F204-5 name='GT-I9300' config_methods=0x188 dev_capab=0x24 group_capab=0x0 vendor_elems=1 new=0 

With «p2p_peers» I can see the cellphone MAC.

Here I can’t go ahead. I tried various possibilities, but none of them worked. My objective is to have Linux as Group Owner.

  • Question 1.1: Which is the correct way to handshake the two devices?
  • Question 1.2: When I try p2p_connect I often get «Michael MIC failure detected» between the results, what does it means in this contest?
  • Question 1.3: Android currently tries to connect with PBC. There is a way to connect with PIN?
Читайте также:  Pi zero wifi adapter

Seeing that I couldn’t connect Android/Linux, I tried to do some practice with Linux/Linux (Linux Mint as GO, Ubuntu as Client), following examples from internet like the ones in the first link. I have a number of problems even here.

p2p_connect MAC_UBUNTU pin auth 
p2p_connect MAC_MINT PIN_GENERATED_BY_MINT 

When I write the psp_connect in Mint, it creates a new interface p2p_wlan0 _0, and it returns

P2P-DEVICE-LOST p2p_dev_addr=MAC_UBUNTU 

then the p2p_connect launched from Ubuntu fails.

  • Question 2.1 Why it switches interface when creating the group?
  • Question 2.2 What is the correct way to handle this change? After the change I can’t p2p_find Ubuntu anymore (I have to wait some time or restart everything)
  • Question 2.3 Should Ubuntu change it’s interface?
  • Question 2.3 In the new interface I should set the IP for both Ubuntu and Mint. how should I do this with static IPs?
  • Question 2.4 If I want to set up for example a DHCP server and client?
  • Question 1.4 And with Android(client) / Linux(GO)?

Источник

ubuntu wifi direct android

How do I connect my Android phone to Ubuntu wirelessly?

To pair, open the KDE Connect app on your Android device. From the main screen look for your system under “Available devices”. Tap the name of your system and hit the big blue “Request Pairing” button to fling a pair request over to your Ubuntu box.

How do I turn on WIFI Direct on my Android?

To turn on Wi-Fi Direct, go into Settings -> Connections -> Wi-Fi then tap on the Wi-Fi Direct tab at the top. Your smartphone will start scanning for devices that you can connect to.

How do I use WIFI Direct on Linux?

You can use the open source implementation of wifi direct from the wpa_supplicant version 2.0. You can download it from http://hostap.epitest.fi/wpa_supplicant/ . Look at the the answer How to get wifi direct( wifi p2p) on my HP DM1 laptop?.

How can I access my Android phone from Ubuntu?

  1. Safely remove your connected device in Ubuntu.
  2. Turn off the device. Remove the SD card from the device.
  3. Turn on the device without the SD card.
  4. Turn off the device again.
  5. Put the SD card back in and turn on the device again.

How do I connect my smartphone to Ubuntu?

  1. Open the KDE Connect app on your phone.
  2. Select the “Pair a new device” option.
  3. You should see your system’s name appear in the list of “Atvailable devices”.
  4. Tap your system to send a pair request to your system.

How can I remotely access my Android phone from Ubuntu?

Step 1) On your Android Phone, install the KDE Connect app from Google Play. Step 2) Launch the KDE Connect app on your phone and tap GSConnect to pair. Note that your Ubuntu PC and Android Phone must be on the same Wi-Fi network. Step 3) Tap on “Request Pairing” on your phone.

Читайте также:  Prestigio подключение к wifi

What is Android WIFI Direct?

Wi-Fi Direct is a connection that allows for device-to-device communication, linking devices together without a nearby centralized network. One device acts as an access point, and the other device connects to it using Wi-Fi Protected Setup (WPS) and Wi-Fi Protected Access (WPA/WPA2) security protocols.

How do I use WIFI Direct on Samsung?

  1. Open Settings on you device and Select Wi-Fi. .
  2. Tap Wi-Fi Direct. .
  3. Locate and select the device you would like to connect to. .
  4. The other device will receive an Invitation to connect, Tap Accept for the connection to be made.

Can you share internet with WIFI Direct?

Android (4.0 or later) natively has a Wi-Fi Direct option in the Settings app on supported devices. To share files using Wi-Fi Direct, you can use any File Manager app to share files via the Wi-Fi Direct option from Share menu.

What can WIFI Direct do?

Wi-Fi Direct (also known as peer-to-peer or P2P) allows your application to quickly find and interact with nearby devices, at a range beyond the capabilities of Bluetooth. The Wi-Fi peer-to-peer (P2P) APIs allow applications to connect to nearby devices without needing to connect to a network or hotspot.

How do I connect my smartphone to Linux?

  1. Connect the 2 devices using a USB cable.
  2. With the Android device, navigate to the home page.
  3. Swipe down from the top of the page. .
  4. Tap on the message. .
  5. Tap on the Camera (PTP) checkbox.
  6. Swipe down from home page again, and you will see that the tablet is mounted as a camera.
  7. Reset the USB device under Linux.

How do I project my screen in Ubuntu?

  1. Open the Activities overview and start typing Displays.
  2. Click Displays to open the panel.
  3. In the display arrangement diagram, drag your displays to the relative positions you want. .
  4. Click Primary Display to choose your primary display. .
  5. Select the orientation, resolution or scale, and refresh rate.
  6. Click Apply.

Can I view my Android phone screen on my laptop?

To connect your smartphone’s display to your Windows PC, simply run the Connect app that comes with Windows 10 version 1607 (via the Anniversary Update). This app just sits there and waits for incoming connections. . On Android, navigate to Settings, Display, Cast (or Screen Mirroring). Voila!

Install KVM on Ubuntu 20.04

Install

How to Install KVM on Ubuntu 20.04Step 1: Check Virtualization Support in Ubuntu. Before installing KVM on Ubuntu, we are first going to verify if the.

What is .htaccess File and Basic Uses

Htaccess

htaccess file allows you to set server configurations for a specific directory. This could be the root directory for your website or an /images or /do.

How to Use pexpect in Python

Pexpect

How do I run Pexpect in Python?How do you spawn with Pexpect?How do I import a Pexpect module into Python?How do I increase my Pexpect buffer size?How.

Latest news, practical advice, detailed reviews and guides. We have everything about the Linux operating system

Источник

WiFi Direct in Linux

In WiFi, device to device communication is already possible with original IEEE 802.11 standard with ad-hoc mode, but this never became popular because of its lack of efficient power saving support or extended QoS capabilities. WiFi direct is built upon the successful IEEE 802.11 infrastructure mode and it lets devices to negotiate roles and decide which device plays the AP like functionality and which will take the client role. WiFi Direct support is available in Android from version 4.0. Here is an article which explains Wi-Fi Direct protocol in detail and to know more about roles in wifi direct and connection establishment methods, this article is a must read.

Читайте также:  Не работает wi fi на iPhone и iPad

Rest of the post gives a brief introduction to roles and connection establishment procedure in p2p and also documents wpa_supplicant DBus APIs to help development of WiFi Direct applications in Linux.

Note: P2P i.e., peer to peer means a direct connection between two devices for data exchange with out any access point. P2P is a usage name to WiFi Direct.

Usually devices that provide the services act as P2P GO and device that scans and initiate the connection procedure are P2P client devices. Unlike 802.11 infrastructure mode, roles in WiFi direct are dynamic and decided by negotiation. Service discovery is a L2 protocol in WiFi Direct. A device can find the services provided by the other device without establishing a connection. Below are the high level procedural steps involved in p2p association and connection establishment procedure:

  1. Device discovery
  2. Role negotiation
  3. Service discovery
  4. security provisioning
  5. Power saving

P2P using wpa_supplicant:

DBus bus name of wpa_supplicant is fi.w1.wpa_supplicant. Below are wpa_supplicant DBus interfaces for using P2P with wpa_supplicant.

  • fi.w1.wpa_supplicant1:
    • Method
      • GetInterface: returns object path of interface that wpa_supplicant already controls.
      • Debug level:
      • This interface is implemented by objects that represent p2p peer device
      • All the P2P operations can be performed using this interface.
      • Methods:
        • AddService: Method to add a service.
        • AddPersistentGroup: Method.
        • Properties
          • Members: ao – contains all the object paths that are part of this p2p group. This property only shows up on GO devices.
          • Role: “s” – Role of this device in this group. possible values “GO” or “client”
          • SSID: “ay” – SSID of this group
          • BSSID: “ay” – P2P group BSSID
          • Frequency: “q” – The frequency (in MHz) of the group operating channel.
          • Passphrase: “s” – Passphrase used in the group. This is always available on the GO.
          • WPSVendorExtensions: “aay” – WPS vendor extension attributes used on the GO. This is valid only the in the GO role. An empty array is returned in P2P Client role. At maximum, 10 separate vendor extension byte arrays can be configured. The GO device will include the configured attributes in WPS exchanges.
          • PeerJoined: “o” – A peer device has joined the group. This is indicated only on the GO device. The object_path received in this signal is of peer device. Peer is represented by fi.w1.wpa_supplicant1.Peer interface.
          • PeerRemoved: “o” – A peer device has left the group. This is indicated only on the GO device.

          Источник

Оцените статью
Adblock
detector