2011-01-25 13:12:09

by Pavan Savoy

[permalink] [raw]
Subject: why scan_disable during hciops_power_off

when hciops gets a set_powered with powered=0, then hciops_power_off is called.
However in here we write the SCAN_ENABLE (=0) to the device and then
do the HCIDEVDOWN...

so couple of questions,
1. are there controllers there which even after doing hci0 down,
allows other devices to be scanned?
for those what do hci0 down mean ? radio not switched off ?

2. what happens to the response? in case hci0 down is considered as
say close of UART?
There is a case I have a combo chip, and I need to keep UART opened,
because someone else is using the UART, and then
I do this power_off, the hci0 interface is down, and bluetooth just
dumps down the scan_disable and quits, but the response
which comes from the device has no takers....

so shouldn't hciops use a hci_send_req before HCIDEVDOWN ?

regards,
Pavan


2011-01-26 10:51:41

by Pavan Savoy

[permalink] [raw]
Subject: Re: why scan_disable during hciops_power_off

On Tue, Jan 25, 2011 at 9:47 PM, Pavan Savoy <[email protected]> wrote:
> On Tue, Jan 25, 2011 at 9:41 PM, Marcel Holtmann <[email protected]> wrote:
>> Hi Johan,
>>
>>> > >> 1. are there controllers there which even after doing hci0 down,
>>> > >> allows other devices to be scanned?
>>> > >> for those what do hci0 down mean ? radio not switched off ?
>>> > >
>>> > > Good point, perhaps this is driver dependent, so we do it just be safe guard.
>>> >
>>> > I hope all devices and drivers out there consider the hci0 down as the
>>> > radio OFF,
>>> > I don't think there is a reason for it to be otherwise....
>>> > so why the safe-guard ?
>>>
>>> IIRC Marcel added this due to paranoia with the non-connectable GAP test
>>> case with the BITE tester. The test kept failing even though the device
>>> was in DOWN state.
>>
>> we also had the case where we considered non-connectable as off when the
>> HCI devdown was not working properly. However this is a long time ago
>> and has been fixed properly. So we might can remove this now.
>
> Oo...
> I want to send the patch, I want to send the patch ..
> Can I please .....

i've posted the patch..

>
>> Regards
>>
>> Marcel
>>
>>
>>
>

2011-01-25 16:17:41

by Pavan Savoy

[permalink] [raw]
Subject: Re: why scan_disable during hciops_power_off

On Tue, Jan 25, 2011 at 9:41 PM, Marcel Holtmann <[email protected]> wrote:
> Hi Johan,
>
>> > >> 1. are there controllers there which even after doing hci0 down,
>> > >> allows other devices to be scanned?
>> > >> for those what do hci0 down mean ? radio not switched off ?
>> > >
>> > > Good point, perhaps this is driver dependent, so we do it just be safe guard.
>> >
>> > I hope all devices and drivers out there consider the hci0 down as the
>> > radio OFF,
>> > I don't think there is a reason for it to be otherwise....
>> > so why the safe-guard ?
>>
>> IIRC Marcel added this due to paranoia with the non-connectable GAP test
>> case with the BITE tester. The test kept failing even though the device
>> was in DOWN state.
>
> we also had the case where we considered non-connectable as off when the
> HCI devdown was not working properly. However this is a long time ago
> and has been fixed properly. So we might can remove this now.

Oo...
I want to send the patch, I want to send the patch ..
Can I please .....


> Regards
>
> Marcel
>
>
>

2011-01-25 16:11:42

by Marcel Holtmann

[permalink] [raw]
Subject: Re: why scan_disable during hciops_power_off

Hi Johan,

> > >> 1. are there controllers there which even after doing hci0 down,
> > >> allows other devices to be scanned?
> > >> for those what do hci0 down mean ? radio not switched off ?
> > >
> > > Good point, perhaps this is driver dependent, so we do it just be safe guard.
> >
> > I hope all devices and drivers out there consider the hci0 down as the
> > radio OFF,
> > I don't think there is a reason for it to be otherwise....
> > so why the safe-guard ?
>
> IIRC Marcel added this due to paranoia with the non-connectable GAP test
> case with the BITE tester. The test kept failing even though the device
> was in DOWN state.

we also had the case where we considered non-connectable as off when the
HCI devdown was not working properly. However this is a long time ago
and has been fixed properly. So we might can remove this now.

Regards

Marcel



2011-01-25 16:08:30

by Johan Hedberg

[permalink] [raw]
Subject: Re: why scan_disable during hciops_power_off

Hi,

On Tue, Jan 25, 2011, Pavan Savoy wrote:
> >> 1. are there controllers there which even after doing hci0 down,
> >> allows other devices to be scanned?
> >> for those what do hci0 down mean ? radio not switched off ?
> >
> > Good point, perhaps this is driver dependent, so we do it just be safe guard.
>
> I hope all devices and drivers out there consider the hci0 down as the
> radio OFF,
> I don't think there is a reason for it to be otherwise....
> so why the safe-guard ?

IIRC Marcel added this due to paranoia with the non-connectable GAP test
case with the BITE tester. The test kept failing even though the device
was in DOWN state.

Johan

2011-01-25 15:58:45

by Pavan Savoy

[permalink] [raw]
Subject: Re: why scan_disable during hciops_power_off

On Tue, Jan 25, 2011 at 8:57 PM, Luiz Augusto von Dentz
<[email protected]> wrote:
> Hi,
>
> On Tue, Jan 25, 2011 at 3:12 PM, Pavan Savoy <[email protected]> wrote:
>> when hciops gets a set_powered with powered=0, then hciops_power_off is called.
>> However in here we write the SCAN_ENABLE (=0) to the device and then
>> do the HCIDEVDOWN...
>>
>> so couple of questions,
>> 1. are there controllers there which even after doing hci0 down,
>> allows other devices to be scanned?
>> for those what do hci0 down mean ? radio not switched off ?
>
> Good point, perhaps this is driver dependent, so we do it just be safe guard.

I hope all devices and drivers out there consider the hci0 down as the
radio OFF,
I don't think there is a reason for it to be otherwise....
so why the safe-guard ?

>> 2. what happens to the response? in case hci0 down is considered as
>> say close of UART?
>> There is a case I have a combo chip, and I need to keep UART opened,
>> because someone else is using the UART, and then
>> I do this power_off, the hci0 interface is down, and bluetooth just
>> dumps down the scan_disable and quits, but the response
>> which comes from the device has no takers....
>>
>> so shouldn't hciops use a hci_send_req before HCIDEVDOWN ?
>
> It should and Im almost sure we do send it before, if we do sent it
> latter than it is probably a bug.

we do send it before, but don't really care about the response.
I was mentioning here use of hci_send_req instead of hci_send_cmd
before HCIDEVDOWN, so
that the function waits for response and finishes up work before the DEVDOWN....

>
> --
> Luiz Augusto von Dentz
> Computer Engineer
>

2011-01-25 15:27:52

by Luiz Augusto von Dentz

[permalink] [raw]
Subject: Re: why scan_disable during hciops_power_off

Hi,

On Tue, Jan 25, 2011 at 3:12 PM, Pavan Savoy <[email protected]> wrote:
> when hciops gets a set_powered with powered=0, then hciops_power_off is called.
> However in here we write the SCAN_ENABLE (=0) to the device and then
> do the HCIDEVDOWN...
>
> so couple of questions,
> 1. are there controllers there which even after doing hci0 down,
> allows other devices to be scanned?
> for those what do hci0 down mean ? radio not switched off ?

Good point, perhaps this is driver dependent, so we do it just be safe guard.

> 2. what happens to the response? in case hci0 down is considered as
> say close of UART?
> There is a case I have a combo chip, and I need to keep UART opened,
> because someone else is using the UART, and then
> I do this power_off, the hci0 interface is down, and bluetooth just
> dumps down the scan_disable and quits, but the response
> which comes from the device has no takers....
>
> so shouldn't hciops use a hci_send_req before HCIDEVDOWN ?

It should and Im almost sure we do send it before, if we do sent it
latter than it is probably a bug.


--
Luiz Augusto von Dentz
Computer Engineer