Feeds:
Posts
Comments

Posts Tagged ‘Wi-Fi’

What is FitPC2i ?

fit-PC2 is a miniature fanless PC based on Atom CPU. It is extremely small and extremely energy efficient, but still packs the full set of PC features. fit-PC2 is made of an embedded grade motherboard in a die-cast aluminum shell. Here is FitPC2i Spec.

Step0: Install Ubuntu 12.04.5 Linux(32-bit)
Install Ubuntu 12.04-5 Server OS into FitPC2i from here

Step1: AP Mode supported?
Verify your wireless adapter supports Access Point mode. Install “iw” tool to verify the AP mode support. Execute following command to know the same

sudo apt-get -y install iw
iw list | grep -8 “Supported interface modes:”

max scan IEs length: 2257 bytes
Coverage class: 0 (up to 0m)
Supported Ciphers:
* WEP40 (00-0f-ac:1)
* WEP104 (00-0f-ac:5)
* TKIP (00-0f-ac:2)
* CCMP (00-0f-ac:4)
Available Antennas: TX 0 RX 0
Supported interface modes:
* IBSS
* managed
* AP
* AP/VLAN
* WDS
* monitor
* mesh point
software interface modes (can always be added):

If you are able to see “AP” in the supported modes, then your Wi-Fi interface(wlan0) can act as a Access Point using hostapd.

Step2:Install dependency packages
sudo apt-get install -y libnl-3-dev libssl-dev

Step3: Compiling Hostapd-2.3 from source code
wget http://w1.fi/releases/hostapd-2.3.tar.gz
tar zxvf hostapd-2.3.tar.gz
cd hostapd-2.3/hostapd

#copy the default config file like we used to copy the kernel configuration file before build.
cp defconfig .config

#Add this line to “.config” file CONFIG_LIBNL32=y
make
.. .. .. CC ../src/drivers/driver_common.c /usr/bin/ld: cannot find -lnl-genl-3 collect2: ld returned 1 exit status make: *** [hostapd] Error 1

Solution
sudo ln -s /lib/libnl-genl-3.so.200.3.0 /lib/libnl-genl-3.so
#Re-make again to complete the compilation
make

#Its Done!, Activate You Own Wi-Fi AP at your Home/Small Office.

Step4: hostapd.conf <– Your AP configurations

#set general/minimum configuration
interface=wlan0
hw_mode=g
driver=nl80211
utf8_ssid=1
ssid=”தமிழ்”
channel=2

Step5: Run hostapd along with hostapd.conf
sudo ./hostapd -d hostapd.conf

Step6: Connect from your Android mobile or laptop and check it.

We will discuss further with more AP configuration details soon.

Advertisements

Read Full Post »

கற்க கசடற

 

What is WPA_SUPPLICANT ?

wpa_supplicant is a daemon for wireless connection management on Andorid/Linux OS. You can check your laptop running will be using wpa_supplicant in background.

ps -aef | grep wpa_supplicant

Refer here: wpa_supplicant

 

Download

mkdir -p ~/work; cd ~/work;
wget http://hostap.epitest.fi/releases/wpa_supplicant-2.1.tar.gz
tar  zxvf wpa_supplicant-2.1.tar.gz
cd wpa_supplicant-2.1/
cd wpa_supplicant/
pwd
/home/tulashi/work/wpa_supplicant-2.1/wpa_supplicant

 

Build Environment

Install compilations utilities such as gcc, make etc.

sudo apt-get update

sudo apt-get -y build-dep gcc-4.6 build-essential

 

P2P Configuration

cp defconfig .config
echo “” >> .config
echo “#Arun Kumar: Enabling Modules for Wi-Fi Direct aka P2P” >> .config
echo CONFIG_P2P=y >> .config
echo CONFIG_AP=y >> .config
echo CONFIG_WPS=y >> .config

 

Compilation & Installation

make

You may or may not get errors while compiling the source codes.I have faced following compilation errors and given corresponding solutions for the same as follows

Error#1

#######################################################################
CC  ../src/drivers/driver_wired.c
../src/drivers/driver_nl80211.c:25:31: fatal error: netlink/genl/genl.h: No such file or directory
compilation terminated.
make: *** [../src/drivers/driver_nl80211.o] Error 1
#######################################################################

Solution #1
sudo apt-get -y install libssl-dev libnl-3-dev
echo CFLAGS +=-I/usr/include/libnl3/ >> .config

make

Error#2
../src/drivers/driver_nl80211.c:95:9: warning: passing argument 1 of ‘genl_ctrl_alloc_cache’ from incompatible pointer type [enabled by default]
/usr/include/libnl3/netlink/genl/ctrl.h:25:14: note: expected ‘struct nl_sock *’ but argument is of type ‘struct nl_handle *’
../src/drivers/driver_nl80211.c:95:9: error: too few arguments to function ‘genl_ctrl_alloc_cache’
/usr/include/libnl3/netlink/genl/ctrl.h:25:14: note: declared here

Solution #2

sudo apt-get install libnl-genl-3-dev
echo CONFIG_LIBNL32=y >> .config

make

Now compilation succeeded.

 

wpa_supplicant is really compiled

tulashi@arunx:~/work/wpa_supplicant-2.1/wpa_supplicant$ file wpa_supplicant
wpa_supplicant: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.24, BuildID[sha1]=0xd69c0b4bbafd67e19dfc86a66bfffdd10c2e2de8, not stripped

 

Running WPA_SUPPLICANT

 

run wpa_supplicant as daemon

 

Run the compiled wpa_supplicant for command lines options as mentioned below

tulashi@arunx:~/work/wpa_supplicant-2.1/wpa_supplicant$ ./wpa_supplicant -h
wpa_supplicant v2.1
Copyright (c) 2003-2014, Jouni Malinen <j@w1.fi> and contributors

This software may be distributed under the terms of the BSD license.
See README for more details.

This product includes software developed by the OpenSSL Project
for use in the OpenSSL Toolkit (http://www.openssl.org/)

usage:
wpa_supplicant [-BddhKLqqtvW] [-P] [-g] \
[-G<group>] \
-i<ifname> -c [-C] [-D] [-p<driver_param>] \
[-b<br_ifname>] [-e<entropy file>] \
[-o<override driver>] [-O<override ctrl>] \
[-N -i -c [-C] [-D] \
[-p<driver_param>] [-b<br_ifname>] [-I<config file>] …]

drivers:
nl80211 = Linux nl80211/cfg80211
wext = Linux wireless extensions (generic)
wired = Wired Ethernet driver
options:
-b = optional bridge interface name
-B = run daemon in the background
-c = Configuration file
-C = ctrl_interface parameter (only used if -c is not)
-i = interface name
-I = additional configuration file
-d = increase debugging verbosity (-dd even more)
-D = driver name (can be multiple drivers: nl80211,wext)
-e = entropy file
-g = global ctrl_interface
-G = global ctrl_interface group
-K = include keys (passwords, etc.) in debug output
-t = include timestamp in debug messages
-h = show this help text
-L = show license (BSD)
-o = override driver parameter for new interfaces
-O = override ctrl_interface parameter for new interfaces
-p = driver parameters
-P = PID file
-q = decrease debugging verbosity (-qq even less)
-v = show version
-W = wait for a control interface monitor before starting
-N = start describing new interface
example:
wpa_supplicant -Dnl80211 -iwlan0 -c/etc/wpa_supplicant.conf

 

wpa_cli : p2p commands

Wpa_Supplicant needs client to communicate i.e wpa_cli

tulashi@arunx:~/work/wpa_supplicant-2.1/wpa_supplicant$ ./wpa_cli -h
wpa_cli [-pctrl sockets>] [-i] [-hvB] [-a] \
[-P<pid file>] [-g<global ctrl>] [-G<ping interval>]  [command..]
-h = help (show this usage text)
-v = shown version information
-a = run in daemon mode executing the action file based on events from
wpa_supplicant
-B = run a daemon in the background
default path: /var/run/wpa_supplicant
default interface: first interface found in socket path
commands:
status [verbose] = get current WPA/EAPOL/EAP status
ifname = get current interface name
ping = pings wpa_supplicant
relog = re-open log-file (allow rolling logs)
note <text> = add a note to wpa_supplicant debug log
mib = get MIB variables (dot1x, dot11)
help [command] = show usage help
interface [ifname] = show interfaces/select interface
level <debug level> = change debug level
license = show full wpa_cli license
quit = exit wpa_cli
set = set variables (shows list of variables when run without arguments)
get <name> = get information
logon = IEEE 802.1X EAPOL state machine logon
logoff = IEEE 802.1X EAPOL state machine logoff
pmksa = show PMKSA cache
reassociate = force reassociation
preauthenticate = force preauthentication
identity <network id> <identity> = configure identity for an SSID
password <network id> <password> = configure password for an SSID
new_password <network id> <password> = change password for an SSID
pin <network id> <pin> = configure pin for an SSID
otp = configure one-time-password for an SSID
passphrase = configure private key passphrase
for an SSID
sim <network id> <pin> = report SIM operation result
bssid = set preferred BSSID for an SSID
blacklist <BSSID> = add a BSSID to the blacklist
blacklist clear = clear the blacklist
blacklist = display the blacklist
log_level <level> [<timestamp>] = update the log level/timestamp
log_level = display the current log level and log options
list_networks = list configured networks
select_network <network id> = select a network (disable others)
enable_network <network id> = enable a network
disable_network <network id> = disable a network
add_network = add a network
remove_network <network id> = remove a network
set_network <network id> <variable> <value> = set network variables (shows
list of variables when run without arguments)
get_network <network id> <variable> = get network variables
list_creds = list configured credentials
add_cred = add a credential
remove_cred <cred id> = remove a credential
set_cred <cred id> <variable> <value> = set credential variables
save_config = save the current configuration
disconnect = disconnect and wait for reassociate/reconnect command before
connecting
reconnect = like reassociate, but only takes effect if already disconnected
scan = request new BSS scan
scan_results = get latest scan results
bss < | > = get detailed scan result info
get_capability <eap/pairwise/group/key_mgmt/proto/auth_alg/channels/freq/modes> = get capabilies
reconfigure = force wpa_supplicant to re-read its configuration file
terminate = terminate wpa_supplicant
interface_add <ifname> <confname> <driver> <ctrl_interface> <driver_param>
<bridge_name> = adds new interface, all parameters but <ifname>
are optional
interface_remove <ifname> = removes the interface
interface_list = list available interfaces
ap_scan <value> = set ap_scan parameter
scan_interval <value> = set scan_interval parameter (in seconds)
bss_expire_age = set BSS expiration age parameter
bss_expire_count = set BSS expiration scan count parameter
bss_flush = set BSS flush age (0 by default)
stkstart = request STK negotiation with
ft_ds <addr> = request over-the-DS FT with <addr>
wps_pbc [BSSID] = start Wi-Fi Protected Setup: Push Button Configuration
wps_pin [PIN] = start WPS PIN method (returns PIN, if not hardcoded)
wps_check_pin <PIN> = verify PIN checksum
wps_cancel Cancels the pending WPS operation
wps_reg = start WPS Registrar to configure an AP
wps_ap_pin [params..] = enable/disable AP PIN
wps_er_start [IP address] = start Wi-Fi Protected Setup External Registrar
wps_er_stop = stop Wi-Fi Protected Setup External Registrar
wps_er_pin <UUID> <PIN> = add an Enrollee PIN to External Registrar
wps_er_pbc <UUID> = accept an Enrollee PBC using External Registrar
wps_er_learn <UUID> <PIN> = learn AP configuration
wps_er_set_config <UUID> <network id> = set AP configuration for enrolling
wps_er_config <UUID> <PIN> <SSID> <auth> <encr> <key> = configure AP
ibss_rsn = request RSN authentication with in IBSS
sta <addr> = get information about an associated station (AP)
all_sta = get information about all associated stations (AP)
deauthenticate = deauthenticate a station
disassociate <addr> = disassociate a station
chan_switch <cs_count> [sec_channel_offset=] [center_freq1=] [center_freq2=] [bandwidth=] [blocktx] [ht|vht] = CSA parameters
suspend = notification of suspend/hibernate
resume = notification of resume/thaw
drop_sa = drop SA without deauth/disassoc (test command)
roam = roam to the specified BSS
p2p_find [timeout] [type=*] = find P2P Devices for up-to timeout seconds
p2p_stop_find = stop P2P Devices search
p2p_connect <“pbc”|PIN> [ht40] = connect to a P2P Device
p2p_listen [timeout] = listen for P2P Devices for up-to timeout seconds
p2p_group_remove <ifname> = remove P2P group interface (terminate group if GO)
p2p_group_add [ht40] = add a new P2P group (local end as GO)
p2p_prov_disc <addr> <method> = request provisioning discovery
p2p_get_passphrase = get the passphrase for a group (GO only)
p2p_serv_disc_req <addr> <TLVs> = schedule service discovery request
p2p_serv_disc_cancel_req <id> = cancel pending service discovery request
p2p_serv_disc_resp <freq> <addr> <dialog token> <TLVs> = service discovery response
p2p_service_update = indicate change in local services
p2p_serv_disc_external <external> = set external processing of service discovery
p2p_service_flush = remove all stored service entries
p2p_service_add <bonjour|upnp> <query|version> <response|service> = add a local service
p2p_service_del <bonjour|upnp> <query|version> [|service] = remove a local service
p2p_reject <addr> = reject connection attempts from a specific peer
p2p_invite <cmd> [peer=addr] = invite peer
p2p_peers [discovered] = list known (optionally, only fully discovered) P2P peers
p2p_peer <address> = show information about known P2P peer
p2p_set <field> <value> = set a P2P parameter
p2p_flush = flush P2P state
p2p_cancel = cancel P2P group formation
p2p_unauthorize

= unauthorize a peer

p2p_presence_req [<duration> <interval>] [<duration> <interval>] = request GO presence
p2p_ext_listen [<period> <interval>] = set extended listen timing
p2p_remove_client <address|iface=address> = remove a peer from all groups
sta_autoconnect <0/1> = disable/enable automatic reconnection
tdls_discover = request TDLS discovery with
tdls_setup = request TDLS setup with
tdls_teardown = tear down TDLS with
signal_poll = get signal parameters
pktcnt_poll = get TX/RX packet counters
reauthenticate = trigger IEEE 802.1X/EAPOL reauthentication
raw <params..> = Sent unprocessed command
flush = flush wpa_supplicant state
radio_work = radio_work <show/add/done>

 

ஃ படித்தைமைக்கு மிக்க நன்றி || Thanks for visiting my blog ஃ

Read Full Post »

#connect adb over wi-fi
adb shell setprop service.adb.tcp.port 5555 && stop adbd && start adbd
adb connect

#Unlock your Android screen
adb shell input keyevent 82

#Lock your Android screen
adb shell input keyevent 6
adb shell input keyevent 26

#Open default browser
adb shell input keyevent 23

#Keep your android phone volume up(+)
adb shell input keyevent 24

#Keep your android phone volume down(-)
adb shell input keyevent 25

#Go to your Android Home screen
adb shell input keyevent 3

#Take Screenshot from adb
adb shell screenshot /sdcard/test.png

#Another Screen capture command
#screencap [-hp] [-d display-id] [FILENAME]
# -h: this message
# -p: save the file as a png.
# -d: specify the display id to capture, default 0

#start clock app
adb shell am start com.google.android.deskclock

#stop clock app
adb shell am force-stop com.google.android.deskclock

#start wifi settings manager
adb shell am start -a android.intent.action.MAIN -n com.android.settings/.wifi.WifiSettings

#Testing wifi status – Thanks Saimadhu
adb shell am start -n com.android.settings/.wifi.WifiStatusTest

Below commands only works on Rooted Devices – Thanks Pooja Shah for asking the questions
#wifi on
adb shell svc wifi enable

#wifi off
adb shell svc wifi disable

#Mobile Data on
adb shell svc data enable

#Mobile Data off
adb shell svc data disable

I hope some one will benefits 🙂

Read Full Post »

What is Wi-Fi Direct ?

Wi-Fi Direct nothing but Wi-Fi Peer-to-Peer[P2P] Communication without using wireless AP[Access Point]. Wi-Fi Direct standard Developed by Wi-Fi Alliance group and it act as a “Soft AP” with WPA2-PSK security features.

What are all software required for Wi-Fi P2P operations ??

  1. wi-fi NIC Driver – kernel driver module
  2. cfg80211 –> 80211 configuration
  3. iw – wireless Tool for configuration
  4. libnl – Network Link Library
  5. wpa_supplicant –> Manages P2P operations at user-space
  6. wpa_cli  – client tool to interact with wpa_supplicant in daemon mode.

 

On Android  from ICS – wpa_supplicant V0.8.x supports Wi-Fi Direct.

  • You need to install libnl and openssl libraries for wpa_supplicant

 

On Ubuntu – wpa_supplicant V1.1 supports Wi-Fi Direct.

  • You need to install libnl and openssl libraries for wpa_supplicant

 

Here my continuation posts.

Read Full Post »