[android-porting] Re: Porting Wifi driver on Android

2010-04-02 Thread dr3w
Hi Gaan,


I am trying to port the same driver for my beagleboard based
touchbook. I would greatly appreciate if you could post how you got it
working properly.

Thanks

On Mar 29, 2:00 am, Gaan gaan...@gmail.com wrote:
 after one month, it works.

 On 3月3日, 下午10時07分, Gaan gaan...@gmail.com wrote:

  I think stop trying it from GUI maybe a good idea.
  and I figure out why fail. because I pass ctrl_path /data/system/
  wpa_supplicant/ra0 to wpa_ctrl_open
  but I didn't creat ra0 this directory under /data/system/
  wpa_supplicant
  after I creat directory ra0, log has changed.

  E/Wap_Supplicant(  963): wpa_ctrl_open (3)ctrl_path=/data/system/
  wpa_supplicant/ra0
  E/Wap_Supplicant(  963): wpa_ctrl_open (5)dest.sun_path=/data/system/
  wpa_supplicant/ra0 sizeof(ctrl-dest.sun_path)=108 ctrl_path=/data/
  system/wpa_supplicant/ra0
  E/Wap_Supplicant(  963): wpa_ctrl_open (6)ctrl-s=61 ctrl-dest=30b812 
  sizeof(ctrl-dest)=110

  E/Wap_Supplicant(  963): wpa_ctrl_open (5)
  E/WifiHW  (  963): Unable to open connection to supplicant on /data/
  system/wpa_supplicant/ra0: Connection refused

  On 3月3日, 下午9時51分, pavan savoy pavan.sa...@gmail.com wrote:

   I am not sure it's gonna help - but when I faced this kind of problem.
   I stopped trying it from GUI.

   I made sure - my supplicant ran from console (as root), I tried connecting
   with a wpa_cli and did all the steps inwifi.c manually (inserting
   modules/fw_download or whatever is specific to chip)

   Only then issues with UI become easier to crack.
   (sorry for the suggestion being more philosophical than technical).

   regards,
   Pavan

   2010/3/3 Gaan gaan...@gmail.com

Hi, savoy
I did in wpa_supplicant.conf and init.rc
here goes my wpa_supplicant.conf  init.rc

== external/wpa_supplicant/wpa_supplicant.conf ==
# global configuration (shared by all network blocks)
#
# Parameters for the control interface. If this is specified,
wpa_supplicant
# will open a control interface that is available for external
programs to
# manage wpa_supplicant. The meaning of this string depends on which
control
# interface mechanism is used. For all cases, the existance of this
parameter
# in configuration is used to determine whether the control interface
is
# enabled.
#
# For UNIX domain sockets (default on Linux and BSD): This is a
directory that
# will be created for UNIX domain sockets for listening to requests
from
# external programs (CLI/GUI, etc.) for status information and
configuration.
# The socket file will be named based on the interface name, so
multiple
# wpa_supplicant processes can be run at the same time if more than
one
# interface is used.
# /var/run/wpa_supplicant is the recommended directory for sockets and
by
# default, wpa_cli will use it when trying to connect with
wpa_supplicant.
#
# Access control for the control interface can be configured by
setting the
# directory to allow only members of a group to use sockets. This way,
it is
# possible to run wpa_supplicant as root (since it needs to change
network
# configuration and open raw sockets) and still allow GUI/CLI
components to be
# run as non-root users. However, since the control interface can be
used to
# change the network configuration, this access needs to be protected
in many
# cases. By default, wpa_supplicant is configured to use gid 0 (root).
If you
# want to allow non-root users to use the control interface, add a new
group
# and change this value to match with that group. Add users that
should have
# control interface access to this group. If this variable is
commented out or
# not included in the configuration file, group will not be changed
from the
# value it got by default when the directory or socket was created.
#
# When configuring both the directory and group, use following format:
# DIR=/var/run/wpa_supplicant GROUP=wheel
# DIR=/var/run/wpa_supplicant GROUP=0
# (group can be either group name or gid)
#
# For UDP connections (default on Windows): The value will be ignored.
This
# variable is just used to select that the control interface is to be
created.
# The value can be set to, e.g., udp (ctrl_interface=udp)
#
# For Windows Named Pipe: This value can be used to set the security
descriptor
# for controlling access to the control interface. Security descriptor
can be
# set using Security Descriptor String Format (see
   http://msdn.microsoft.com/
# library/default.asp?url=/library/en-us/secauthz/security/
# security_descriptor_string_format.asp). The descriptor string needs
to be
# prefixed with SDDL=. For example, ctrl_interface=SDDL=D: would set
an empty
# DACL (which will reject all connections). See README-Windows.txt for
more
# 

[android-porting] Re: Porting Wifi driver on Android

2010-03-29 Thread Gaan
after one month, it works.

On 3月3日, 下午10時07分, Gaan gaan...@gmail.com wrote:
 I think stop trying it from GUI maybe a good idea.
 and I figure out why fail. because I pass ctrl_path /data/system/
 wpa_supplicant/ra0 to wpa_ctrl_open
 but I didn't creat ra0 this directory under /data/system/
 wpa_supplicant
 after I creat directory ra0, log has changed.

 E/Wap_Supplicant(  963): wpa_ctrl_open (3)ctrl_path=/data/system/
 wpa_supplicant/ra0
 E/Wap_Supplicant(  963): wpa_ctrl_open (5)dest.sun_path=/data/system/
 wpa_supplicant/ra0 sizeof(ctrl-dest.sun_path)=108 ctrl_path=/data/
 system/wpa_supplicant/ra0
 E/Wap_Supplicant(  963): wpa_ctrl_open (6)ctrl-s=61 ctrl-dest=30b812 
 sizeof(ctrl-dest)=110

 E/Wap_Supplicant(  963): wpa_ctrl_open (5)
 E/WifiHW  (  963): Unable to open connection to supplicant on /data/
 system/wpa_supplicant/ra0: Connection refused

 On 3月3日, 下午9時51分, pavan savoy pavan.sa...@gmail.com wrote:



  I am not sure it's gonna help - but when I faced this kind of problem.
  I stopped trying it from GUI.

  I made sure - my supplicant ran from console (as root), I tried connecting
  with a wpa_cli and did all the steps inwifi.c manually (inserting
  modules/fw_download or whatever is specific to chip)

  Only then issues with UI become easier to crack.
  (sorry for the suggestion being more philosophical than technical).

  regards,
  Pavan

  2010/3/3 Gaan gaan...@gmail.com

   Hi, savoy
   I did in wpa_supplicant.conf and init.rc
   here goes my wpa_supplicant.conf  init.rc

   == external/wpa_supplicant/wpa_supplicant.conf ==
   # global configuration (shared by all network blocks)
   #
   # Parameters for the control interface. If this is specified,
   wpa_supplicant
   # will open a control interface that is available for external
   programs to
   # manage wpa_supplicant. The meaning of this string depends on which
   control
   # interface mechanism is used. For all cases, the existance of this
   parameter
   # in configuration is used to determine whether the control interface
   is
   # enabled.
   #
   # For UNIX domain sockets (default on Linux and BSD): This is a
   directory that
   # will be created for UNIX domain sockets for listening to requests
   from
   # external programs (CLI/GUI, etc.) for status information and
   configuration.
   # The socket file will be named based on the interface name, so
   multiple
   # wpa_supplicant processes can be run at the same time if more than
   one
   # interface is used.
   # /var/run/wpa_supplicant is the recommended directory for sockets and
   by
   # default, wpa_cli will use it when trying to connect with
   wpa_supplicant.
   #
   # Access control for the control interface can be configured by
   setting the
   # directory to allow only members of a group to use sockets. This way,
   it is
   # possible to run wpa_supplicant as root (since it needs to change
   network
   # configuration and open raw sockets) and still allow GUI/CLI
   components to be
   # run as non-root users. However, since the control interface can be
   used to
   # change the network configuration, this access needs to be protected
   in many
   # cases. By default, wpa_supplicant is configured to use gid 0 (root).
   If you
   # want to allow non-root users to use the control interface, add a new
   group
   # and change this value to match with that group. Add users that
   should have
   # control interface access to this group. If this variable is
   commented out or
   # not included in the configuration file, group will not be changed
   from the
   # value it got by default when the directory or socket was created.
   #
   # When configuring both the directory and group, use following format:
   # DIR=/var/run/wpa_supplicant GROUP=wheel
   # DIR=/var/run/wpa_supplicant GROUP=0
   # (group can be either group name or gid)
   #
   # For UDP connections (default on Windows): The value will be ignored.
   This
   # variable is just used to select that the control interface is to be
   created.
   # The value can be set to, e.g., udp (ctrl_interface=udp)
   #
   # For Windows Named Pipe: This value can be used to set the security
   descriptor
   # for controlling access to the control interface. Security descriptor
   can be
   # set using Security Descriptor String Format (see
  http://msdn.microsoft.com/
   # library/default.asp?url=/library/en-us/secauthz/security/
   # security_descriptor_string_format.asp). The descriptor string needs
   to be
   # prefixed with SDDL=. For example, ctrl_interface=SDDL=D: would set
   an empty
   # DACL (which will reject all connections). See README-Windows.txt for
   more
   # information about SDDL string format.
   #
   #ctrl_interface=wlan0
   ctrl_interface=DIR=/data/system/wpa_supplicant/ GROUP=system

   == system/core/rootdir/init.rc ==

  # give system access to wpa_supplicant.conf for backup and restore
   mkdir /data/misc/wifi0770 system system
  mkdir /data/misc/wifi/sockets 0770 system 

[android-porting] Re: Porting Wifi driver on Android

2010-03-03 Thread Gaan
I found the problem is that the directory /data/system/wpa_supplicant
is not creat after bootup
and I change to use Group system in create all relative directories.

out/target/product/generic/system/etc/wifi/wpa_supplicant.conf
still with  ctrl_interface=DIR=/data/system/wpa_supplicant/
GROUP=system

then there is the new log

And I also checked the wpa_supplicant source code.

==
I/power   (  961): *** set_screen_state 1
E/WifiHW  (  961): *** wifi_load_driver 
E/WifiHW  (  961): check_driver_loaded 1
I/WifiHW  (  961): Loading WiFi Modules
D/SettingsWifiEnabler( 1154): Received wifi state changed from
Disabled to Enabling
I/WifiHW  (  961): insmod
E/WifiHW  (  961): *** ok 
E/WifiHW  (  961): *** driver_status OK, ifconfig up 
I/WifiHW  (  961): **1** inside wifi_start_supplicant
I/WifiHW  (  961): **1** inside ensure_config_file_exists
E/WifiHW  (  961): ***wpa_supplicant -Dwext -ira0 -c /system/etc/wifi/
wpa_supplicant.conf ***
E/WifiHW  (  961): *** wpa_supplicant prop can't find ***
E/WifiHW  (  961): *** wpa_supplicant is running state***
E/WifiHW  (  961): *** wifi_connect_to_supplicant 
I/WifiHW  (  961): *** access OK ***
I/WifiHW  (  961): *** Interface directory = /data/system/
wpa_supplicant
I/WifiHW  (  961):  Interface name = /data/system/wpa_supplicant/ra0
***
E/Wap_Supplicant(  961): wpa_ctrl_open (5)dest.sun_path=/data/system/
wpa_supplicant/ra0 sizeof(ctrl-dest.sun_path)=108 ctrl_path=/data/
system/wpa_supplicant/ra0
E/Wap_Supplicant(  961): wpa_ctrl_open (6)ctrl-s=75 ctrl-
dest=3d6aea sizeof(ctrl-dest)=110
E/WifiHW  (  961): Unable to open connection to supplicant on /data/
system/wpa_supplicant/ra0: No such file or directory
D/WifiService(  961): ACTION_BATTERY_CHANGED pluggedType: 1
I/WifiHW  (  961): wifi_command called, cmd:BLACKLIST clear
E/WifiHW  (  961): *** wifi_send_command 
D/SettingsWifiEnabler( 1154): Received wifi state changed from
Enabling to Enabled
D/PowerManagerService(  961): setPowerState: mPowerState=6 newState=3
noChangeLights=false
D/PowerManagerService(  961):   oldKeyboardBright=false
newKeyboardBright=false
D/PowerManagerService(  961):   oldScreenBright=true
newScreenBright=true
D/PowerManagerService(  961):   oldButtonBright=true
newButtonBright=false
D/PowerManagerService(  961):   oldScreenOn=false newScreenOn=true
D/PowerManagerService(  961):   oldBatteryLow=false
newBatteryLow=false
I/power   (  961): *** set_screen_state 1
D/dalvikvm( 1023): GC freed 772 objects / 35496 bytes in 619ms
E/wpa_supplicant( 1169): Failed to initialize control interface 'DIR=/
data/system/wpa_supplicant/ GROUP=system'.
E/wpa_supplicant( 1169): You may have another wpa_supplicant process
already running or the file was
E/wpa_supplicant( 1169): left by an unclean termination of
wpa_supplicant in which case you will need
E/wpa_supplicant( 1169): to manually remove this file before starting
wpa_supplicant again.
I/wpa_supplicant( 1169): CTRL-EVENT-STATE-CHANGE id=-1 state=0
I//system/bin/wpa_supplicant( 1168): chown[ctrl_interface]: Operation
not permitted
D/dalvikvm(  961): GC freed 10660 objects / 603936 bytes in 266ms
I/logwrapper( 1168): /system/bin/wpa_supplicant terminated by
exit(255)
E/WifiHW  (  961): *** wifi_connect_to_supplicant 
E/WifiHW  (  961): Supplicant not running, cannot connect
I//system/bin/wpa_supplicant( 1172): chown[ctrl_interface]: Operation
not permitted
E/wpa_supplicant( 1173): Failed to initialize control interface 'DIR=/
data/system/wpa_supplicant/ GROUP=system'.
E/wpa_supplicant( 1173): You may have another wpa_supplicant process
already running or the file was
E/wpa_supplicant( 1173): left by an unclean termination of
wpa_supplicant in which case you will need
E/wpa_supplicant( 1173): to manually remove this file before starting
wpa_supplicant again.
I/wpa_supplicant( 1173): CTRL-EVENT-STATE-CHANGE id=-1 state=0
I/logwrapper( 1172): /system/bin/wpa_supplicant terminated by
exit(255)
E/WifiHW  (  961): *** wifi_connect_to_supplicant 
I/WifiHW  (  961): *** access OK ***
I/WifiHW  (  961): *** Interface directory = /data/system/
wpa_supplicant
I/WifiHW  (  961):  Interface name = /data/system/wpa_supplicant/ra0
***
E/Wap_Supplicant(  961): wpa_ctrl_open (5)dest.sun_path=/data/system/
wpa_supplicant/ra0 sizeof(ctrl-dest.sun_path)=108 ctrl_path=/data/
system/wpa_supplicant/ra0
E/Wap_Supplicant(  961): wpa_ctrl_open (6)ctrl-s=44 ctrl-
dest=3545e2 =110 sizeof(ctrl-dest)=1
E/Wap_Supplicant(  961): wpa_ctrl_open (5)
E/WifiHW  (  961): Unable to open connection to supplicant on /data/
system/wpa_supplicant/ra0: No such file or directory
I//system/bin/wpa_supplicant( 1177): chown[ctrl_interface]: Operation
not permitted
E/wpa_supplicant( 1178): Failed to initialize control interface 'DIR=/
data/system/wpa_supplicant/ GROUP=system'.
E/wpa_supplicant( 1178): You may have another wpa_supplicant process
already running or the file was
E/wpa_supplicant( 

Re: [android-porting] Re: Porting Wifi driver on Android

2010-03-03 Thread pavan savoy
aren't these problems similar to,
http://osdir.com/ml/android-porting/2009-02/msg00139.html
?

modifications are required in init.rc and .conf file - If I remember
correctly (does seem a long time ago ...).

regards,
Pavan

2010/3/3 Gaan gaan...@gmail.com

 I found the problem is that the directory /data/system/wpa_supplicant
 is not creat after bootup
 and I change to use Group system in create all relative directories.
 
 out/target/product/generic/system/etc/wifi/wpa_supplicant.conf
 still with  ctrl_interface=DIR=/data/system/wpa_supplicant/
 GROUP=system

 then there is the new log

 And I also checked the wpa_supplicant source code.

 ==
 I/power   (  961): *** set_screen_state 1
 E/WifiHW  (  961): *** wifi_load_driver 
 E/WifiHW  (  961): check_driver_loaded 1
 I/WifiHW  (  961): Loading WiFi Modules
 D/SettingsWifiEnabler( 1154): Received wifi state changed from
 Disabled to Enabling
 I/WifiHW  (  961): insmod
 E/WifiHW  (  961): *** ok 
 E/WifiHW  (  961): *** driver_status OK, ifconfig up 
 I/WifiHW  (  961): **1** inside wifi_start_supplicant
 I/WifiHW  (  961): **1** inside ensure_config_file_exists
 E/WifiHW  (  961): ***wpa_supplicant -Dwext -ira0 -c /system/etc/wifi/
 wpa_supplicant.conf ***
 E/WifiHW  (  961): *** wpa_supplicant prop can't find ***
 E/WifiHW  (  961): *** wpa_supplicant is running state***
 E/WifiHW  (  961): *** wifi_connect_to_supplicant 
 I/WifiHW  (  961): *** access OK ***
 I/WifiHW  (  961): *** Interface directory = /data/system/
 wpa_supplicant
 I/WifiHW  (  961):  Interface name = /data/system/wpa_supplicant/ra0
 ***
 E/Wap_Supplicant(  961): wpa_ctrl_open (5)dest.sun_path=/data/system/
 wpa_supplicant/ra0 sizeof(ctrl-dest.sun_path)=108 ctrl_path=/data/
 system/wpa_supplicant/ra0
 E/Wap_Supplicant(  961): wpa_ctrl_open (6)ctrl-s=75 ctrl-
 dest=3d6aea sizeof(ctrl-dest)=110
 E/WifiHW  (  961): Unable to open connection to supplicant on /data/
 system/wpa_supplicant/ra0: No such file or directory
 D/WifiService(  961): ACTION_BATTERY_CHANGED pluggedType: 1
 I/WifiHW  (  961): wifi_command called, cmd:BLACKLIST clear
 E/WifiHW  (  961): *** wifi_send_command 
 D/SettingsWifiEnabler( 1154): Received wifi state changed from
 Enabling to Enabled
 D/PowerManagerService(  961): setPowerState: mPowerState=6 newState=3
 noChangeLights=false
 D/PowerManagerService(  961):   oldKeyboardBright=false
 newKeyboardBright=false
 D/PowerManagerService(  961):   oldScreenBright=true
 newScreenBright=true
 D/PowerManagerService(  961):   oldButtonBright=true
 newButtonBright=false
 D/PowerManagerService(  961):   oldScreenOn=false newScreenOn=true
 D/PowerManagerService(  961):   oldBatteryLow=false
 newBatteryLow=false
 I/power   (  961): *** set_screen_state 1
 D/dalvikvm( 1023): GC freed 772 objects / 35496 bytes in 619ms
 E/wpa_supplicant( 1169): Failed to initialize control interface 'DIR=/
 data/system/wpa_supplicant/ GROUP=system'.
 E/wpa_supplicant( 1169): You may have another wpa_supplicant process
 already running or the file was
 E/wpa_supplicant( 1169): left by an unclean termination of
 wpa_supplicant in which case you will need
 E/wpa_supplicant( 1169): to manually remove this file before starting
 wpa_supplicant again.
 I/wpa_supplicant( 1169): CTRL-EVENT-STATE-CHANGE id=-1 state=0
 I//system/bin/wpa_supplicant( 1168): chown[ctrl_interface]: Operation
 not permitted
 D/dalvikvm(  961): GC freed 10660 objects / 603936 bytes in 266ms
 I/logwrapper( 1168): /system/bin/wpa_supplicant terminated by
 exit(255)
 E/WifiHW  (  961): *** wifi_connect_to_supplicant 
 E/WifiHW  (  961): Supplicant not running, cannot connect
 I//system/bin/wpa_supplicant( 1172): chown[ctrl_interface]: Operation
 not permitted
 E/wpa_supplicant( 1173): Failed to initialize control interface 'DIR=/
 data/system/wpa_supplicant/ GROUP=system'.
 E/wpa_supplicant( 1173): You may have another wpa_supplicant process
 already running or the file was
 E/wpa_supplicant( 1173): left by an unclean termination of
 wpa_supplicant in which case you will need
 E/wpa_supplicant( 1173): to manually remove this file before starting
 wpa_supplicant again.
 I/wpa_supplicant( 1173): CTRL-EVENT-STATE-CHANGE id=-1 state=0
 I/logwrapper( 1172): /system/bin/wpa_supplicant terminated by
 exit(255)
 E/WifiHW  (  961): *** wifi_connect_to_supplicant 
 I/WifiHW  (  961): *** access OK ***
 I/WifiHW  (  961): *** Interface directory = /data/system/
 wpa_supplicant
 I/WifiHW  (  961):  Interface name = /data/system/wpa_supplicant/ra0
 ***
 E/Wap_Supplicant(  961): wpa_ctrl_open (5)dest.sun_path=/data/system/
 wpa_supplicant/ra0 sizeof(ctrl-dest.sun_path)=108 ctrl_path=/data/
 system/wpa_supplicant/ra0
 E/Wap_Supplicant(  961): wpa_ctrl_open (6)ctrl-s=44 ctrl-
 dest=3545e2 =110 sizeof(ctrl-dest)=1
 E/Wap_Supplicant(  961): wpa_ctrl_open (5)
 E/WifiHW  (  961): Unable to open connection to supplicant on /data/
 

Re: [android-porting] Re: Porting Wifi driver on Android

2010-03-03 Thread pavan savoy
I am not sure it's gonna help - but when I faced this kind of problem.
I stopped trying it from GUI.

I made sure - my supplicant ran from console (as root), I tried connecting
with a wpa_cli and did all the steps in wifi.c manually (inserting
modules/fw_download or whatever is specific to chip)

Only then issues with UI become easier to crack.
(sorry for the suggestion being more philosophical than technical).

regards,
Pavan

2010/3/3 Gaan gaan...@gmail.com

 Hi, savoy
 I did in wpa_supplicant.conf and init.rc
 here goes my wpa_supplicant.conf  init.rc

 == external/wpa_supplicant/wpa_supplicant.conf ==
 # global configuration (shared by all network blocks)
 #
 # Parameters for the control interface. If this is specified,
 wpa_supplicant
 # will open a control interface that is available for external
 programs to
 # manage wpa_supplicant. The meaning of this string depends on which
 control
 # interface mechanism is used. For all cases, the existance of this
 parameter
 # in configuration is used to determine whether the control interface
 is
 # enabled.
 #
 # For UNIX domain sockets (default on Linux and BSD): This is a
 directory that
 # will be created for UNIX domain sockets for listening to requests
 from
 # external programs (CLI/GUI, etc.) for status information and
 configuration.
 # The socket file will be named based on the interface name, so
 multiple
 # wpa_supplicant processes can be run at the same time if more than
 one
 # interface is used.
 # /var/run/wpa_supplicant is the recommended directory for sockets and
 by
 # default, wpa_cli will use it when trying to connect with
 wpa_supplicant.
 #
 # Access control for the control interface can be configured by
 setting the
 # directory to allow only members of a group to use sockets. This way,
 it is
 # possible to run wpa_supplicant as root (since it needs to change
 network
 # configuration and open raw sockets) and still allow GUI/CLI
 components to be
 # run as non-root users. However, since the control interface can be
 used to
 # change the network configuration, this access needs to be protected
 in many
 # cases. By default, wpa_supplicant is configured to use gid 0 (root).
 If you
 # want to allow non-root users to use the control interface, add a new
 group
 # and change this value to match with that group. Add users that
 should have
 # control interface access to this group. If this variable is
 commented out or
 # not included in the configuration file, group will not be changed
 from the
 # value it got by default when the directory or socket was created.
 #
 # When configuring both the directory and group, use following format:
 # DIR=/var/run/wpa_supplicant GROUP=wheel
 # DIR=/var/run/wpa_supplicant GROUP=0
 # (group can be either group name or gid)
 #
 # For UDP connections (default on Windows): The value will be ignored.
 This
 # variable is just used to select that the control interface is to be
 created.
 # The value can be set to, e.g., udp (ctrl_interface=udp)
 #
 # For Windows Named Pipe: This value can be used to set the security
 descriptor
 # for controlling access to the control interface. Security descriptor
 can be
 # set using Security Descriptor String Format (see
 http://msdn.microsoft.com/
 # library/default.asp?url=/library/en-us/secauthz/security/
 # security_descriptor_string_format.asp). The descriptor string needs
 to be
 # prefixed with SDDL=. For example, ctrl_interface=SDDL=D: would set
 an empty
 # DACL (which will reject all connections). See README-Windows.txt for
 more
 # information about SDDL string format.
 #
 #ctrl_interface=wlan0
 ctrl_interface=DIR=/data/system/wpa_supplicant/ GROUP=system


 == system/core/rootdir/init.rc ==

# give system access to wpa_supplicant.conf for backup and restore
 mkdir /data/misc/wifi 0770 system system
mkdir /data/misc/wifi/sockets 0770 system system
mkdir /data/system 0775 system system
mkdir /data/system/wpa_supplicant 0770 system system
 mkdir /data/misc/dhcp 0770 dhcp dhcp
chown dhcp dhcp /data/misc/dhcp
chmod 0555 /system/bin/busybox

 and after booting up, I checked the directory, /data/system/
 wpa_supplicant  /data/misc/wifi/sockets both exist
 but it still can't connect. just don't know why???


 On 3月3日, 下午6時45分, pavan savoy pavan.sa...@gmail.com wrote:
  aren't these problems similar to,
 http://osdir.com/ml/android-porting/2009-02/msg00139.html
  ?
 
  modifications are required in init.rc and .conf file - If I remember
  correctly (does seem a long time ago ...).
 
  regards,
  Pavan
 
  2010/3/3 Gaan gaan...@gmail.com
 
 
 
   I found the problem is that the directory /data/system/wpa_supplicant
   is not creat after bootup
   and I change to use Group system in create all relative directories.
   
   out/target/product/generic/system/etc/wifi/wpa_supplicant.conf
   still with  ctrl_interface=DIR=/data/system/wpa_supplicant/
   GROUP=system
 
   then there is the new log
 
   And I also checked the wpa_supplicant 

[android-porting] Re: Porting Wifi driver on Android

2010-03-03 Thread Gaan
I think stop trying it from GUI maybe a good idea.
and I figure out why fail. because I pass ctrl_path /data/system/
wpa_supplicant/ra0 to wpa_ctrl_open
but I didn't creat ra0 this directory under /data/system/
wpa_supplicant
after I creat directory ra0, log has changed.

E/Wap_Supplicant(  963): wpa_ctrl_open (3)ctrl_path=/data/system/
wpa_supplicant/ra0
E/Wap_Supplicant(  963): wpa_ctrl_open (5)dest.sun_path=/data/system/
wpa_supplicant/ra0 sizeof(ctrl-dest.sun_path)=108 ctrl_path=/data/
system/wpa_supplicant/ra0
E/Wap_Supplicant(  963): wpa_ctrl_open (6)ctrl-s=61 ctrl-
dest=30b812 sizeof(ctrl-dest)=110
E/Wap_Supplicant(  963): wpa_ctrl_open (5)
E/WifiHW  (  963): Unable to open connection to supplicant on /data/
system/wpa_supplicant/ra0: Connection refused


On 3月3日, 下午9時51分, pavan savoy pavan.sa...@gmail.com wrote:
 I am not sure it's gonna help - but when I faced this kind of problem.
 I stopped trying it from GUI.

 I made sure - my supplicant ran from console (as root), I tried connecting
 with a wpa_cli and did all the steps in wifi.c manually (inserting
 modules/fw_download or whatever is specific to chip)

 Only then issues with UI become easier to crack.
 (sorry for the suggestion being more philosophical than technical).

 regards,
 Pavan

 2010/3/3 Gaan gaan...@gmail.com



  Hi, savoy
  I did in wpa_supplicant.conf and init.rc
  here goes my wpa_supplicant.conf  init.rc

  == external/wpa_supplicant/wpa_supplicant.conf ==
  # global configuration (shared by all network blocks)
  #
  # Parameters for the control interface. If this is specified,
  wpa_supplicant
  # will open a control interface that is available for external
  programs to
  # manage wpa_supplicant. The meaning of this string depends on which
  control
  # interface mechanism is used. For all cases, the existance of this
  parameter
  # in configuration is used to determine whether the control interface
  is
  # enabled.
  #
  # For UNIX domain sockets (default on Linux and BSD): This is a
  directory that
  # will be created for UNIX domain sockets for listening to requests
  from
  # external programs (CLI/GUI, etc.) for status information and
  configuration.
  # The socket file will be named based on the interface name, so
  multiple
  # wpa_supplicant processes can be run at the same time if more than
  one
  # interface is used.
  # /var/run/wpa_supplicant is the recommended directory for sockets and
  by
  # default, wpa_cli will use it when trying to connect with
  wpa_supplicant.
  #
  # Access control for the control interface can be configured by
  setting the
  # directory to allow only members of a group to use sockets. This way,
  it is
  # possible to run wpa_supplicant as root (since it needs to change
  network
  # configuration and open raw sockets) and still allow GUI/CLI
  components to be
  # run as non-root users. However, since the control interface can be
  used to
  # change the network configuration, this access needs to be protected
  in many
  # cases. By default, wpa_supplicant is configured to use gid 0 (root).
  If you
  # want to allow non-root users to use the control interface, add a new
  group
  # and change this value to match with that group. Add users that
  should have
  # control interface access to this group. If this variable is
  commented out or
  # not included in the configuration file, group will not be changed
  from the
  # value it got by default when the directory or socket was created.
  #
  # When configuring both the directory and group, use following format:
  # DIR=/var/run/wpa_supplicant GROUP=wheel
  # DIR=/var/run/wpa_supplicant GROUP=0
  # (group can be either group name or gid)
  #
  # For UDP connections (default on Windows): The value will be ignored.
  This
  # variable is just used to select that the control interface is to be
  created.
  # The value can be set to, e.g., udp (ctrl_interface=udp)
  #
  # For Windows Named Pipe: This value can be used to set the security
  descriptor
  # for controlling access to the control interface. Security descriptor
  can be
  # set using Security Descriptor String Format (see
 http://msdn.microsoft.com/
  # library/default.asp?url=/library/en-us/secauthz/security/
  # security_descriptor_string_format.asp). The descriptor string needs
  to be
  # prefixed with SDDL=. For example, ctrl_interface=SDDL=D: would set
  an empty
  # DACL (which will reject all connections). See README-Windows.txt for
  more
  # information about SDDL string format.
  #
  #ctrl_interface=wlan0
  ctrl_interface=DIR=/data/system/wpa_supplicant/ GROUP=system

  == system/core/rootdir/init.rc ==

 # give system access to wpa_supplicant.conf for backup and restore
  mkdir /data/misc/wifi 0770 system system
 mkdir /data/misc/wifi/sockets 0770 system system
 mkdir /data/system 0775 system system
 mkdir /data/system/wpa_supplicant 0770 system system
  mkdir /data/misc/dhcp 0770 dhcp dhcp
 chown dhcp dhcp /data/misc/dhcp
 

[android-porting] Re: Porting Wifi driver on Android

2010-03-03 Thread Gaan
there are one thing strange.
I think code flow in wpa_ctrl_open() ( wpa_ctrl.c ).
it should go into #ifdef ANDROID, but not outside.

I found that it will check the first char in ctrl_path, it can't be
/.
or it will go outside. unfortunately, I just gave the path /data/
system/

#ifdef ANDROID
chmod(ctrl-local.sun_path, S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP);
chown(ctrl-local.sun_path, AID_SYSTEM, AID_WIFI);
/*
 * If the ctrl_path isn't an absolute pathname, assume that
 * it's the name of a socket in the Android reserved namespace.
 * Otherwise, it's a normal UNIX domain socket appearing in the
 * filesystem.
 */
LOGE(wpa_ctrl_open (3)ctrl_path=%s ,ctrl_path);
if (ctrl_path != NULL   *ctrl_path != '/') {
os_snprintf(ctrl-dest.sun_path, sizeof(ctrl-dest.sun_path), 
wpa_
%s,
ctrl_path);
LOGE(wpa_ctrl_open (4)dest.sun_path=%s 
sizeof(ctrl-dest.sun_path)=
%d wpa_%s,ctrl-dest.sun_path,sizeof(ctrl-dest.sun_path),ctrl_path);
if (socket_local_client_connect(ctrl-s,
ctrl-dest.sun_path,

ANDROID_SOCKET_NAMESPACE_RESERVED,
SOCK_DGRAM)  0) {
close(ctrl-s);
unlink(ctrl-local.sun_path);
os_free(ctrl);
LOGE(wpa_ctrl_open (4));
return NULL;
}
return ctrl;
}
#endif
ctrl-dest.sun_family = AF_UNIX;
os_snprintf(ctrl-dest.sun_path, sizeof(ctrl-dest.sun_path), %s,
ctrl_path);
LOGE(wpa_ctrl_open (5)dest.sun_path=%s sizeof(ctrl-dest.sun_path)=
%d ctrl_path=%s,ctrl-dest.sun_path,sizeof(ctrl-
dest.sun_path),ctrl_path);
LOGE(wpa_ctrl_open (6)ctrl-s=%d ctrl-dest=%x sizeof(ctrl-dest)=
%d,ctrl-s, ctrl-dest,sizeof(ctrl-dest));
if (connect(ctrl-s, (struct sockaddr *) ctrl-dest,
sizeof(ctrl-dest))  0) {
close(ctrl-s);
unlink(ctrl-local.sun_path);
os_free(ctrl);
LOGE(wpa_ctrl_open (5));
return NULL;
}

return ctrl;


On 3月3日, 下午10時07分, Gaan gaan...@gmail.com wrote:
 I think stop trying it from GUI maybe a good idea.
 and I figure out why fail. because I pass ctrl_path 
 /data/system/wpa_supplicant/ra0 to wpa_ctrl_open
 but I didn't creat ra0 this directory under /data/system/wpa_supplicant
 after I creat directory ra0, log has changed.

 E/Wap_Supplicant(  963): wpa_ctrl_open 
 (3)ctrl_path=/data/system/wpa_supplicant/ra0
 E/Wap_Supplicant(  963): wpa_ctrl_open 
 (5)dest.sun_path=/data/system/wpa_supplicant/ra0 
 sizeof(ctrl-dest.sun_path)=108 ctrl_path=/data/
 system/wpa_supplicant/ra0
 E/Wap_Supplicant(  963): wpa_ctrl_open (6)ctrl-s=61 ctrl-dest=30b812 
 sizeof(ctrl-dest)=110

 E/Wap_Supplicant(  963): wpa_ctrl_open (5)
 E/WifiHW  (  963): Unable to open connection to supplicant on /data/
 system/wpa_supplicant/ra0: Connection refused

 On 3月3日, 下午9時51分, pavan savoy pavan.sa...@gmail.com wrote:



  I am not sure it's gonna help - but when I faced this kind of problem.
  I stopped trying it from GUI.

  I made sure - my supplicant ran from console (as root), I tried connecting
  with a wpa_cli and did all the steps in wifi.c manually (inserting
  modules/fw_download or whatever is specific to chip)

  Only then issues with UI become easier to crack.
  (sorry for the suggestion being more philosophical than technical).

  regards,
  Pavan

  2010/3/3 Gaan gaan...@gmail.com

   Hi, savoy
   I did inwpa_supplicant.conf and init.rc
   here goes mywpa_supplicant.conf  init.rc

   == external/wpa_supplicant/wpa_supplicant.conf ==
   # global configuration (shared by all network blocks)
   #
   # Parameters for the control interface. If this is specified,
  wpa_supplicant
   # will open a control interface that is available for external
   programs to
   # managewpa_supplicant. The meaning of this string depends on which
   control
   # interface mechanism is used. For all cases, the existance of this
   parameter
   # in configuration is used to determine whether the control interface
   is
   # enabled.
   #
   # For UNIX domain sockets (default on Linux and BSD): This is a
   directory that
   # will be created for UNIX domain sockets for listening to requests
   from
   # external programs (CLI/GUI, etc.) for status information and
   configuration.
   # The socket file will be named based on the interface name, so
   multiple
   #wpa_supplicantprocesses can be run at the same time if more than
   one
   # interface is used.
   # /var/run/wpa_supplicantis the recommended directory for sockets and
   by
   # default, wpa_cli will use it when trying to connect with
  wpa_supplicant.
   #
   # Access control for the 

[android-porting] Re: Porting Wifi driver on Android

2010-03-02 Thread Brandon
In your wpa_supplicant.conf, change your GROUP=system to GROUP=wifi.
If you create /data/system/wpa_supplicant using 0777 wifi wifi, your
group needs to be wifi so the correct permissions can be used. I had
this issue before until I changed the group, then it was able to make
the interface.

On Mar 2, 1:22 am, Gaan gaan...@gmail.com wrote:
 I found that it may kernel config relative.
 I open CONFIG_PACKET option in kernel.
 it seems wpa_supplicant start running.
 but now I have another problem.
 message with   is dumped by adding debug message code.

 === new log ==
 I/power   (  961): *** set_screen_state 1
 E/WifiHW  (  961): *** wifi_load_driver 
 E/WifiHW  (  961): check_driver_loaded 1
 I/WifiHW  (  961): Loading WiFi Modules
 D/SettingsWifiEnabler( 1169): Received wifi state changed from
 Disabled to Enabling
 I/WifiHW  (  961): insmod
 rtusb init ---
 ra0 (usb): not using net_device_ops yet
 usbcore: registered new interface driver rt2870
 E/WifiHW  (  961): *** ok 
 E/WifiHW  (  961): *** driver_status OK, ifconfig up 
 0x1300 = 00064300
 I/WifiHW  (  961): **1** inside wifi_start_supplicant
 I/WifiHW  (  961): **1** inside ensure_config_file_exists
 E/WifiHW  (  961):  system_property_find ***
 E/WifiHW  (  961): ***wpa_supplicant -Dwext -ira0 -c /system/etc/wifi/
 wpa_supplicant.conf ***
 E/WifiHW  (  961): *** wpa_supplicant is running state***
 D/WifiService(  961): ACTION_BATTERY_CHANGED pluggedType: 1
 E/WifiHW  (  961): *** wifi_connect_to_supplicant 
 I/WifiHW  (  961): *** Interface directory = /data/system/
 wpa_supplicant
 I/WifiHW  (  961):  Interface name = /data/system/wpa_supplicant/ra0
 ***
 E/WifiHW  (  961): Unable to open connection to supplicant on /data/
 system/wpa_supplicant/ra0: No such file or directory
 E/WifiHW  (  961): *** wifi_send_command 
 D/SettingsWifiEnabler( 1169): Received wifi state changed from
 Enabling to Enabled
 E/wpa_supplicant( 1389): Failed to initialize control interface 'DIR=/
 data/system/wpa_supplicant/ GROUP=system'.
 E/wpa_supplicant( 1389): You may have another wpa_supplicant process
 already running or the file was
 E/wpa_supplicant( 1389): left by an unclean termination of
 wpa_supplicant in which case you will need
 E/wpa_supplicant( 1389): to manually remove this file before starting
 wpa_supplicant again.
 I/wpa_supplicant( 1389): CTRL-EVENT-STATE-CHANGE id=-1 state=0
 I//system/bin/wpa_supplicant( 1387): chown[ctrl_interface]: Operation
 not permitted
 Terminate the task(RtmpMlmeTask) with pid(1385)!
 Terminate the task(RtmpCmdQTask) with pid(1386)!
 Terminate the task(RtmpTimerTask) with pid(1384)!
 I/logwrapper( 1387): /system/bin/wpa_supplicant terminated by
 exit(255)
 D/PowerManagerService(  961): setPowerState: mPowerState=6 newState=3
 noChangeLights=false
 D/PowerManagerService(  961):   oldKeyboardBright=false
 newKeyboardBright=false
 D/PowerManagerService(  961):   oldScreenBright=true
 newScreenBright=true
 D/PowerManagerService(  961):   oldButtonBright=true
 newButtonBright=false
 D/PowerManagerService(  961):   oldScreenOn=false newScreenOn=true
 D/PowerManagerService(  961):   oldBatteryLow=false
 newBatteryLow=false
 I/power   (  961): *** set_screen_state 1
 E/WifiHW  (  961): *** wifi_connect_to_supplicant 
 I/WifiHW  (  961): *** Interface directory = /data/system/
 wpa_supplicant
 I/WifiHW  (  961):  Interface name = /data/system/wpa_supplicant/ra0
 ***
 E/WifiHW  (  961): Unable to open connection to supplicant on /data/
 system/wpa_supplicant/ra0: No such file or directory
 0x1300 = 00064300
 E/wpa_supplicant( 1391): Failed to initialize control interface 'DIR=/
 data/system/wpa_supplicant/ GROUP=system'.
 E/wpa_supplicant( 1391): You may have another wpa_supplicant process
 already running or the file was
 E/wpa_supplicant( 1391): left by an unclean termination of
 wpa_supplicant in which case you will need
 E/wpa_supplicant( 1391): to manually remove this file before starting
 wpa_supplicant again.
 I/wpa_supplicant( 1391): CTRL-EVENT-STATE-CHANGE id=-1 state=0
 I//system/bin/wpa_supplicant( 1390): chown[ctrl_interface]: Operation
 not permitted
 Terminate the task(RtmpMlmeTask) with pid(1393)!
 Terminate the task(RtmpCmdQTask) with pid(1394)!
 Terminate the task(RtmpTimerTask) with pid(1392)!
 I/logwrapper( 1390): /system/bin/wpa_supplicant terminated by
 exit(255)
 E/WifiHW  (  961): *** wifi_connect_to_supplicant 
 I/WifiHW  (  961): *** Interface directory = /data/system/
 wpa_supplicant
 I/WifiHW  (  961):  Interface name = /data/system/wpa_supplicant/ra0
 ***
 E/WifiHW  (  961): Unable to open connection to supplicant on /data/
 system/wpa_supplicant/ra0: No such file or directory
 0x1300 = 00064300
 I//system/bin/wpa_supplicant( 1395): chown[ctrl_interface]: Operation
 not permitted
 E/wpa_supplicant( 1396): Failed to initialize control interface 'DIR=/
 data/system/wpa_supplicant/ GROUP=system'.
 

[android-porting] Re: Porting Wifi driver on Android

2010-02-25 Thread Brandon
Did you check your system/bin to see if wpa_supplicant was present?

Here is what's in my BoardConfig.mk in order to build wpa supplicant.

# Wifi related defines
BOARD_WPA_SUPPLICANT_DRIVER  := WEXT
BOARD_WPA_SUPPLICANT_PRIVATE_LIB :=

On Feb 23, 3:56 am, Gaan gaan...@gmail.com wrote:
 Hi everyone,
     I'm porting wifi driver (Ralink chip) on Android 2.0.1 board.
 first of all I made some modifies

 (1)   modify build/target/board/generic/BoardConfig.mk

 add HAVE_CUSTOM_WIFI_DRIVER_2 := true

 (2)   Android using wpa_supplicant to management wifi. Make sure
 external/wpa_supplicant/.config is looking like this

 # CONFIG_NO_WPA=y

 CONFIG_OS=unix

 CONFIG_IEEE8021X_EAPOL=y

 CONFIG_EAP_MD5=y

 CONFIG_EAP_MSCHAPV2=y

 CONFIG_EAP_TLS=y

 CONFIG_EAP_PEAP=y

 CONFIG_EAP_TTLS=y

 CONFIG_EAP_GTC=y

 CONFIG_EAP_OTP=y

 CONFIG_EAP_SIM=y

 CONFIG_EAP_AKA=y

 CONFIG_EAP_PSK=y

 CONFIG_EAP_SAKE=y

 CONFIG_EAP_GPSK=y

 CONFIG_EAP_PAX=y

 CONFIG_EAP_LEAP=y

 # CONFIG_EAP_FAST=y

 CONFIG_PKCS12=y

 # CONFIG_PCSC=y

 CONFIG_SMARTCARD=y

 CONFIG_WIRELESS_EXTENSION=y

 CONFIG_CTRL_IFACE=y

 # CONFIG_DRIVER_HOSTAP=y

 # CONFIG_DRIVER_HERMES=y

 # CONFIG_DRIVER_MADWIFI=y

 # CONFIG_DRIVER_ATMEL=y

 CONFIG_DRIVER_WEXT=y

 # CONFIG_DRIVER_NDISWRAPPER=y

 # CONFIG_DRIVER_BROADCOM=y

 # CONFIG_DRIVER_IPW=y

 # CONFIG_DRIVER_BSD=y

 # CONFIG_DRIVER_NDIS=y

 # CONFIG_DRIVER_TEST=y

 # CONFIG_DRIVER_CUSTOM=y

 # CONFIG_DEBUG_FILE=y

 # CONFIG_INTERNAL_LIBTOMMATH=y

 (3)   Enable wpa_supplicant compile option, modify external/
 wpa_supplicant/Android.mk

 (3.1)

 LOCAL_PATH := $(call my-dir)

 WPA_BUILD_SUPPLICANT := true

 ifneq ($(TARGET_SIMULATOR),true)

   ifneq ($(BOARD_WPA_SUPPLICANT_DRIVER),)

     WPA_BUILD_SUPPLICANT := true

     CONFIG_DRIVER_$(BOARD_WPA_SUPPLICANT_DRIVER) = y

   endif

 (3.2) remove mark symbol, and look like this

 

 local_target_dir := $(TARGET_OUT)/etc/wifi

 include $(CLEAR_VARS)

 LOCAL_MODULE := wpa_supplicant.conf

 LOCAL_MODULE_TAGS := user

 LOCAL_MODULE_CLASS := ETC

 LOCAL_MODULE_PATH := $(local_target_dir)

 LOCAL_SRC_FILES := $(LOCAL_MODULE)

 include $(BUILD_PREBUILT)

 #

 

 (4)   Modify wpa_supplicant setting file, and out/target/product/
 generic/system/etc/wifi/ will be created after #make in step (3) out/
 target/product/generic/system/etc/wifi/wpa_supplicant.conf

 (4.1)

 # The value can be set to, e.g., udp (ctrl_interface=udp)

 #

 # For Windows Named Pipe: This value can be used to set the security
 descriptor

 # for controlling access to the control interface. Security descriptor
 can be

 # set using Security Descriptor String Format (seehttp://msdn.microsoft.com/

 # library/default.asp?url=/library/en-us/secauthz/security/

 # security_descriptor_string_format.asp). The descriptor string needs
 to be

 # prefixed with SDDL=. For example, ctrl_interface=SDDL=D: would set
 an empty

 # DACL (which will reject all connections). See README-Windows.txt for
 more

 # information about SDDL string format.

 #

 #ctrl_interface=wlan0

 ctrl_interface=DIR=/data/system/wpa_supplicant/ GROUP=system

 (4.2) setting default AccessPoint value:

 # Only WPA-PSK is used. Any valid cipher combination is accepted.

 network={

        ssid=example         // AP name

        proto=WPA            //encypted method

        key_mgmt=WPA-PSK   //using psk

        pairwise=CCMP TKIP

        group=CCMP TKIP WEP104 WEP40

 psk=06b4be19da289f475aa46a33cb793029d4ab3db7a23ee92382eb0106c72ac7bb

        priority=2

 }

 (5)   Add directory which is needed when enable wifi under linux,

 System/core/rootdir/init.rc

     # give system access to wpa_supplicant.conf for backup and restore

     mkdir /data/misc/wifi 0770 wifi wifi

     chmod 0770 /data/misc/wifi

     chmod 0660 /data/misc/wifi/wpa_supplicant.conf

     mkdir /data/misc/wifi/sockets 0770 wifi wifi

     mkdir /data/misc/android 0770 wifi wifi

     mkdir /data/system/wpa_supplicant 0770 wifi wifi

     mkdir /data/misc/dhcp 0770 dhcp dhcp

     chown dhcp dhcp /data/misc/dhcp

     chmod 0555 /system/bin/busybox

 (6)   Modify HAL code, hardware/libhardware_legacy/wifi/wifi.c

 Re-define the include path

 #ifndef WIFI_DRIVER_MODULE_PATH

 //#define WIFI_DRIVER_MODULE_PATH        /system/lib/modules/wlan.ko

 #define WIFI_DRIVER_MODULE_PATH      /lib/modules/rt3070sta.ko

 #endif

 #ifndef WIFI_DRIVER_MODULE_NAME

 //#define WIFI_DRIVER_MODULE_NAME         wlan

 #define WIFI_DRIVER_MODULE_NAME         ra0

 #endif

 #ifndef WIFI_DRIVER_MODULE_ARG

 #define WIFI_DRIVER_MODULE_ARG          

 #endif

 #ifndef WIFI_FIRMWARE_LOADER

 #define WIFI_FIRMWARE_LOADER            

 #endif

 #define WIFI_TEST_INTERFACE             sta

 (7)   Make and place driver relative file after boot.
 place rt3070sta.ko at /lib/modules/
 place RT2870STA.dat at  /etc/Wireless/RT2870STA/  (it is driver
 needed)
 place libiw.so.29 at /lib  (it is driver needed)

 (8) select Settings - Wirelessnetworks