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 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 runwpa_supplicantas 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_supplicantis 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_supplicantGROUP=wheel > > > # DIR=/var/run/wpa_supplicantGROUP=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 towpa_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_supplicant0770 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 thewpa_supplicantsource 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_supplicantprop can't find *** > > > > > E/WifiHW ( 961): ***wpa_supplicantis 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 anotherwpa_supplicantprocess > > > > > already running or the file was > > > > > E/wpa_supplicant( 1169): left by an unclean termination of > > > > >wpa_supplicantin which case you will need > > > > > E/wpa_supplicant( 1169): to manually remove this file before starting > > > > >wpa_supplicantagain. > > > > > 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_supplicantterminated 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=/ > > ... > > 閱讀更多 >> -- unsubscribe: android-porting+unsubscr...@googlegroups.com website: http://groups.google.com/group/android-porting