run "setprop ctrl.start wpa_supplicant" manually


https://groups.google.com/forum/#!topic/android-porting/Cgv-rGMJwX0


  Richard Zhao
08/12/10
其他收件人: jithu...@gmail.com
static int control_supplicant(int startIt)
{
    char supp_status[PROPERTY_VALUE_MAX] = {''};
    const char *ctrl_prop = (startIt ? "ctl.start" : "ctl.stop");
    const char *desired_status = (startIt ? "running" : "stopped");
    int count = 20; /* wait at most 20 seconds for completion */

    if (property_get(SUPP_PROP_NAME, supp_status, NULL)
        && strcmp(supp_status, desired_status) == 0) {
        return 0;  /* supplicant already running */
    }
    property_set(ctrl_prop, SUPPLICANT_NAME);

    while (count-- > 0) {
        usleep(1000000);
        if (property_get(SUPP_PROP_NAME, supp_status, NULL)) {
            if (strcmp(supp_status, desired_status) == 0)
                return 0;
        }
    }
    return -1;
}

Do you know which line is to start wpa_supplicant?

Thanks
Richard

2008/12/9 Jithu Jance <jithu...@gmail.com>:
> Thanks a lot Richard. This is really a good pointer..
>
>>> Jithu Jance.
>
>
> On Tue, Dec 9, 2008 at 12:50 PM, Richard Zhao <linu...@gmail.com> wrote:
>>
>> I think it's :
>> GUI -> libhardware -> wpa_supplicant -> wext -> wifi driver
>> Your driver is using wireless externsion, right?
>>
>> libhardware is now using Ti wlan driver. Maybe we must modify
>> hardware/libhardware/wifi/wifi.c
>>
>> Thanks
>> Richard
>>
>> 2008/12/9 Jithu Jance <jithu...@gmail.com>:
>> > Hi Richard,
>> >
>> > You r welcome.. btw I am also stuck up there.. How did u manage to hook
>> > wpa_supplicant to GUI??? I saw Wifi Manager framework folder. I am
>> > confused
>> > how we could hook our wifi driver to the GUI.
>> >
>> > From your mail, i understand GUI talks to the wpa_supplicant which
>> > inturn
>> > talks to the wlandriver. But I didnt see anything in the wpa_supplican
>> > that
>> > is using the wifi manager framework. or is it some service like
>> > wifimanager
>> > which actually talks to the supplicant???
>> >
>> > GUI - wpa_supplicant - wlandriver
>> >
>> > if you have any idea on the above query pls help me out.
>> >
>> > What I did try was to connect using hyperterminal to the eval board and
>> > invoke supplicant through commandline. It worked but doesn't make sense
>> > as
>> > its not connected to the GUI. I want to use GUI for controlling my wifi
>> > driver
>> >
>> >
>> > Thanks..
>> >
>> >>> Jithu
>> >
>> >
>> > On Tue, Dec 9, 2008 at 7:32 AM, Richard Zhao <linu...@gmail.com> wrote:
>> >>
>> >> Hi Jithu,
>> >>
>> >> Thanks very much!
>> >> Now I compiled out wpa_supplicant, but the GUI always says
>> >> wpa_supplicant load failed.
>> >>
>> >> Thanks
>> >> Richard
>> >>
>> >> 2008/12/7 Jithu Jance <jithu...@gmail.com>:
>> >> > I saw ur question on wpa_supplicant for android
>> >> >
>> >> > I also got stuck at the same  problem.. then i modified Android.mk
>> >> > file
>> >> > in
>> >> > wpa_supplicant dir and changed BUILD_SUPPLICANT :=true. Make sure u
>> >> > edit
>> >> > .config file to include WEXT. and then build android again.. You can
>> >> > find
>> >> > wpa_supplicant in system/bin directory..
>> >> >
>> >> >>> Jithu Jance.
>> >> >
>> >
>> >
>
>

Richard Zhao
08/12/10
其他收件人: jithu...@gmail.com, android-...@googlegroups.com
I see "property_set(ctrl_prop, SUPPLICANT_NAME)" is starting the
wpa_supplicant service.
I tried to run "setprop ctrl.start wpa_supplicant" manually, but
wpa_supplicant is not run.
I've added something in init.rc:
service wpa_supplicant /system/bin/wpa_supplicant -Dwext -i eth1
-C/data/misc/wifi/sockets -c/system/etc/wifi/wpa_supplicant.conf
    user bluetooth
    group bluetooth net_bt_admin
    disabled

What's wrong?

Thanks
Richard

2008/12/10 Richard Zhao <linu...@gmail.com>:

- 显示引用文字 -
nagamatu
08/12/10
setprop uses property_set library included in system/core/libutil/
properties.c
this api will send property information for init process through
socket.
with the latest init source code, init shows error message when fails
to start service.

check existance of /dev/socket/property_service and update init with
the latest one.

--
nagamatu

On 12月10日, 午後3:40, "Richard Zhao" <linux...@gmail.com> wrote:
> I see "property_set(ctrl_prop, SUPPLICANT_NAME)" is starting the
> wpa_supplicant service.
> I tried to run "setprop ctrl.start wpa_supplicant" manually, but
> wpa_supplicant is not run.
> I've added something in init.rc:
> service wpa_supplicant /system/bin/wpa_supplicant -Dwext -i eth1
> -C/data/misc/wifi/sockets -c/system/etc/wifi/wpa_supplicant.conf
>     user bluetooth
>     group bluetooth net_bt_admin
>     disabled
>
> What's wrong?
>
> Thanks
> Richard
>
> 2008/12/10 Richard Zhao <linux...@gmail.com>:
>
> > static int control_supplicant(int startIt)
> > {
> >    char supp_status[PROPERTY_VALUE_MAX] = {''};
> >    const char *ctrl_prop = (startIt ? "ctl.start" : "ctl.stop");
> >    const char *desired_status = (startIt ? "running" : "stopped");
> >    int count = 20; /* wait at most 20 seconds for completion */
>
> >    if (property_get(SUPP_PROP_NAME, supp_status, NULL)
> >        && strcmp(supp_status, desired_status) == 0) {
> >        return 0;  /* supplicant already running */
> >    }
> >    property_set(ctrl_prop, SUPPLICANT_NAME);
>
> >    while (count-- > 0) {
> >        usleep(1000000);
> >        if (property_get(SUPP_PROP_NAME, supp_status, NULL)) {
> >            if (strcmp(supp_status, desired_status) == 0)
> >                return 0;
> >        }
> >    }
> >    return -1;
> > }
>
> > Do you know which line is to start wpa_supplicant?
>
> > Thanks
> > Richard
>
> > 2008/12/9 Jithu Jance <jithuja...@gmail.com>:
> >> Thanks a lot Richard. This is really a good pointer..
>
> >>>> Jithu Jance.
>
> >> On Tue, Dec 9, 2008 at 12:50 PM, Richard Zhao <linux...@gmail.com> wrote:
>
> >>> I think it's :
> >>> GUI -> libhardware -> wpa_supplicant -> wext -> wifi driver
> >>> Your driver is using wireless externsion, right?
>
> >>> libhardware is now using Ti wlan driver. Maybe we must modify
> >>> hardware/libhardware/wifi/wifi.c
>
> >>> Thanks
> >>> Richard
>
> >>> 2008/12/9 Jithu Jance <jithuja...@gmail.com>:
> >>> > Hi Richard,
>
> >>> > You r welcome.. btw I am also stuck up there.. How did u manage to hook
> >>> > wpa_supplicant to GUI??? I saw Wifi Manager framework folder. I am
> >>> > confused
> >>> > how we could hook our wifi driver to the GUI.
>
> >>> > From your mail, i understand GUI talks to the wpa_supplicant which
> >>> > inturn
> >>> > talks to the wlandriver. But I didnt see anything in the wpa_supplican
> >>> > that
> >>> > is using the wifi manager framework. or is it some service like
> >>> > wifimanager
> >>> > which actually talks to the supplicant???
>
> >>> > GUI - wpa_supplicant - wlandriver
>
> >>> > if you have any idea on the above query pls help me out.
>
> >>> > What I did try was to connect using hyperterminal to the eval board and
> >>> > invoke supplicant through commandline. It worked but doesn't make sense
> >>> > as
> >>> > its not connected to the GUI. I want to use GUI for controlling my wifi
> >>> > driver
>
> >>> > Thanks..
>
> >>> >>> Jithu
>
> >>> > On Tue, Dec 9, 2008 at 7:32 AM, Richard Zhao <linux...@gmail.com> wrote:
>
> >>> >> Hi Jithu,
>
> >>> >> Thanks very much!
> >>> >> Now I compiled out wpa_supplicant, but the GUI always says
> >>> >> wpa_supplicant load failed.
>
> >>> >> Thanks
> >>> >> Richard
>
> >>> >> 2008/12/7 Jithu Jance <jithuja...@gmail.com>:
- 显示引用文字 -
Richard Zhao
08/12/10
Re: [android-porting] Re: wpa_supplicaent
# ls /dev/socket/property_service
/dev/socket/property_service

I can't see any error message.
init I'm using is compiled out from android 1.0 source.

Thanks
Richard

2008/12/10 nagamatu <naga...@gmail.com>:

- 显示引用文字 -
nagamatu
08/12/10
Can you start wpa_supplicant by start command like:
    # start wpa_supplicant
This start command just do property_set("ctl.start", service_name)

And get the system property of "init.svc.wpa_supplicant".

--
nagamatu

On 12月10日, 午後4:57, "Richard Zhao" <linux...@gmail.com> wrote:
> # ls /dev/socket/property_service
> /dev/socket/property_service
>
> I can't see any error message.
> init I'm using is compiled out from android 1.0 source.
>
> Thanks
> Richard
>
> 2008/12/10 nagamatu <nagam...@gmail.com>:
- 显示引用文字 -
Richard Zhao
08/12/11
Re: [android-porting] Re: wpa_supplicaent
It still don't work.

2008/12/10 nagamatu <naga...@gmail.com>:


>
> Can you start wpa_supplicant by start command like:
>    # start wpa_supplicant
> This start command just do property_set("ctl.start", service_name)
>
> And get the system property of "init.svc.wpa_supplicant".
>
> --
> nagamatu
>
> On 12月10日, 午後4:57, "Richard Zhao" <linux...@gmail.com> wrote:
>> # ls /dev/socket/property_servi'ce
- 显示引用文字 -
Sean McNeil
08/12/11
Re: [android-porting] Re: wpa_supplicaent
Are you even certain you have the wpa_supplicant binary? Can you run the
command from the shell?
- 显示引用文字 -
Richard Zhao
08/12/12
Re: [android-porting] Re: wpa_supplicaent
Sure I can run it from console.
After "start wpa_supplicant", "getprop init.svc.wpa_supplicant" show
"restarting".

Thanks
Rihard

2008/12/11 Sean McNeil <seanm...@gmail.com>:

- 显示引用文字 -
nagamatu
08/12/13
If your wpa_supplicant is running as a service process, "getprop
init.svc.wpa_supplicant" shows "running".
In case of termination of service execution, status becomes "stopped".
And when service is not oneshot
mode, init will try to restart this service again.

First debug your wpa_supplicant by executing it from debugger or
strace.

--
nagamatu

On 12月12日, 午前9:20, "Richard Zhao" <linux...@gmail.com> wrote:
> Sure I can run it from console.
> After "start wpa_supplicant", "getprop init.svc.wpa_supplicant" show
> "restarting".
>
> Thanks
> Rihard
>
> 2008/12/11 Sean McNeil <seanmcne...@gmail.com>:
>
>
>
> > Are you even certain you have the wpa_supplicant binary? Can you run the
> > command from the shell?
>
> > Richard Zhao wrote:
> >> It still don't work.
>
> >> 2008/12/10 nagamatu <nagam...@gmail.com>:
- 显示引用文字 -
xiaope...@windriver.com
08/12/15
Re: [android-porting] Re: wpa_supplicaent
Maybe you need to make sure whether the directories like /data/misc/wifi
have the right permission for wpa_supplicant to read and write.

Xiaopeng
- 显示引用文字 -

原文地址:https://www.cnblogs.com/ztguang/p/12644913.html