Linux bluetooth development
 help / color / mirror / Atom feed
* Is it incorrect in checking of "NO_RESET" bit in hci_core.c:hci_dev_do_close()?
       [not found] <CACKG3XmHwTgbsWBwsckZ-tA5M9xBD0TBRme7mCJo7shd90L4=Q@mail.gmail.com>
@ 2012-10-15 15:01 ` chen kris
  2012-10-15 18:02   ` Marcel Holtmann
  0 siblings, 1 reply; 4+ messages in thread
From: chen kris @ 2012-10-15 15:01 UTC (permalink / raw)
  To: linux-bluetooth

static int hci_dev_do_close(struct hci_dev *hdev)
{
    ...

    /* Reset device */
    skb_queue_purge(&hdev->cmd_q);
    atomic_set(&hdev->cmd_cnt, 1);
    if (!test_bit(HCI_RAW, &hdev->flags) &&
                test_bit(HCI_QUIRK_NO_RESET, &hdev->quirks)) {
        set_bit(HCI_INIT, &hdev->flags);
        __hci_request(hdev, hci_reset_req, 0,
                    msecs_to_jiffies(250));
        clear_bit(HCI_INIT, &hdev->flags);
    }
    ...
}

I guess the condition should be as following:

    if (!test_bit(HCI_RAW, &hdev->flags) &&
                *! *test_bit(HCI_QUIRK_NO_RESET, &hdev->quirks))

it means the code should sent HCI_RESET, only if both of the following
conditions are met:
1. HCI_RAW is NOT set;
2. HCI_QUIRK_NO_RESET is *NOT* set.

thanks!

Bluefrog2012

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Is it incorrect in checking of "NO_RESET" bit in hci_core.c:hci_dev_do_close()?
  2012-10-15 15:01 ` Is it incorrect in checking of "NO_RESET" bit in hci_core.c:hci_dev_do_close()? chen kris
@ 2012-10-15 18:02   ` Marcel Holtmann
  2012-10-15 18:09     ` Anderson Lizardo
  0 siblings, 1 reply; 4+ messages in thread
From: Marcel Holtmann @ 2012-10-15 18:02 UTC (permalink / raw)
  To: chen kris; +Cc: linux-bluetooth

Hi Chen,

> static int hci_dev_do_close(struct hci_dev *hdev)
> {
>     ...
> 
>     /* Reset device */
>     skb_queue_purge(&hdev->cmd_q);
>     atomic_set(&hdev->cmd_cnt, 1);
>     if (!test_bit(HCI_RAW, &hdev->flags) &&
>                 test_bit(HCI_QUIRK_NO_RESET, &hdev->quirks)) {
>         set_bit(HCI_INIT, &hdev->flags);
>         __hci_request(hdev, hci_reset_req, 0,
>                     msecs_to_jiffies(250));
>         clear_bit(HCI_INIT, &hdev->flags);
>     }
>     ...
> }
> 
> I guess the condition should be as following:
> 
>     if (!test_bit(HCI_RAW, &hdev->flags) &&
>                 *! *test_bit(HCI_QUIRK_NO_RESET, &hdev->quirks))
> 
> it means the code should sent HCI_RESET, only if both of the following
> conditions are met:
> 1. HCI_RAW is NOT set;
> 2. HCI_QUIRK_NO_RESET is *NOT* set.

the name is confusing, when closing the device and NO_RESET is set, then
it needs to send the HCI Reset.

Regards

Marcel



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Is it incorrect in checking of "NO_RESET" bit in hci_core.c:hci_dev_do_close()?
  2012-10-15 18:02   ` Marcel Holtmann
@ 2012-10-15 18:09     ` Anderson Lizardo
  2012-10-16  9:49       ` chen kris
  0 siblings, 1 reply; 4+ messages in thread
From: Anderson Lizardo @ 2012-10-15 18:09 UTC (permalink / raw)
  To: Marcel Holtmann; +Cc: chen kris, linux-bluetooth

Hi,

On Mon, Oct 15, 2012 at 3:02 PM, Marcel Holtmann <marcel@holtmann.org> wrote:
> Hi Chen,
>
>> static int hci_dev_do_close(struct hci_dev *hdev)
>> {
>>     ...
>>
>>     /* Reset device */
>>     skb_queue_purge(&hdev->cmd_q);
>>     atomic_set(&hdev->cmd_cnt, 1);
>>     if (!test_bit(HCI_RAW, &hdev->flags) &&
>>                 test_bit(HCI_QUIRK_NO_RESET, &hdev->quirks)) {
>>         set_bit(HCI_INIT, &hdev->flags);
>>         __hci_request(hdev, hci_reset_req, 0,
>>                     msecs_to_jiffies(250));
>>         clear_bit(HCI_INIT, &hdev->flags);
>>     }
>>     ...
>> }
>>
>> I guess the condition should be as following:
>>
>>     if (!test_bit(HCI_RAW, &hdev->flags) &&
>>                 *! *test_bit(HCI_QUIRK_NO_RESET, &hdev->quirks))
>>
>> it means the code should sent HCI_RESET, only if both of the following
>> conditions are met:
>> 1. HCI_RAW is NOT set;
>> 2. HCI_QUIRK_NO_RESET is *NOT* set.
>
> the name is confusing, when closing the device and NO_RESET is set, then
> it needs to send the HCI Reset.

I was almost sure this flag has been renamed to something like
"HCI_QUIRK_RESET_ON_CLOSE" on recent kernels?

Regards,
-- 
Anderson Lizardo
Instituto Nokia de Tecnologia - INdT
Manaus - Brazil

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Is it incorrect in checking of "NO_RESET" bit in hci_core.c:hci_dev_do_close()?
  2012-10-15 18:09     ` Anderson Lizardo
@ 2012-10-16  9:49       ` chen kris
  0 siblings, 0 replies; 4+ messages in thread
From: chen kris @ 2012-10-16  9:49 UTC (permalink / raw)
  To: Anderson Lizardo; +Cc: Marcel Holtmann, linux-bluetooth

Hi, Marcel

Thanks!

Hi, Anderson

Sorry, the kernel source I used is compat-wireless-3.5-rc3-2-snpc.

I checked newer kernel code, it do have the new flag name.

now I know the meaning and logic of this flag, thanks!

Kris


On Tue, Oct 16, 2012 at 2:09 AM, Anderson Lizardo
<anderson.lizardo@openbossa.org> wrote:
> Hi,
>
> On Mon, Oct 15, 2012 at 3:02 PM, Marcel Holtmann <marcel@holtmann.org> wrote:
>> Hi Chen,
>>
>>> static int hci_dev_do_close(struct hci_dev *hdev)
>>> {
>>>     ...
>>>
>>>     /* Reset device */
>>>     skb_queue_purge(&hdev->cmd_q);
>>>     atomic_set(&hdev->cmd_cnt, 1);
>>>     if (!test_bit(HCI_RAW, &hdev->flags) &&
>>>                 test_bit(HCI_QUIRK_NO_RESET, &hdev->quirks)) {
>>>         set_bit(HCI_INIT, &hdev->flags);
>>>         __hci_request(hdev, hci_reset_req, 0,
>>>                     msecs_to_jiffies(250));
>>>         clear_bit(HCI_INIT, &hdev->flags);
>>>     }
>>>     ...
>>> }
>>>
>>> I guess the condition should be as following:
>>>
>>>     if (!test_bit(HCI_RAW, &hdev->flags) &&
>>>                 *! *test_bit(HCI_QUIRK_NO_RESET, &hdev->quirks))
>>>
>>> it means the code should sent HCI_RESET, only if both of the following
>>> conditions are met:
>>> 1. HCI_RAW is NOT set;
>>> 2. HCI_QUIRK_NO_RESET is *NOT* set.
>>
>> the name is confusing, when closing the device and NO_RESET is set, then
>> it needs to send the HCI Reset.
>
> I was almost sure this flag has been renamed to something like
> "HCI_QUIRK_RESET_ON_CLOSE" on recent kernels?
>
> Regards,
> --
> Anderson Lizardo
> Instituto Nokia de Tecnologia - INdT
> Manaus - Brazil

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-10-16  9:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <CACKG3XmHwTgbsWBwsckZ-tA5M9xBD0TBRme7mCJo7shd90L4=Q@mail.gmail.com>
2012-10-15 15:01 ` Is it incorrect in checking of "NO_RESET" bit in hci_core.c:hci_dev_do_close()? chen kris
2012-10-15 18:02   ` Marcel Holtmann
2012-10-15 18:09     ` Anderson Lizardo
2012-10-16  9:49       ` chen kris

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox