public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
From: Marcel Holtmann <marcel@holtmann.org>
To: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: sniff mode
Date: Mon, 24 Aug 2009 11:40:57 -0700	[thread overview]
Message-ID: <1251139257.2950.60.camel@localhost.localdomain> (raw)
In-Reply-To: <2d5a2c100908241126k6cf31de0s282c0f360b6948ec@mail.gmail.com>

Hi Luiz,

> It is just me or hci_conn_enter_active_mode will never do what its
> name suggests. This check will always succeed:
> 
> 	if (conn->mode != HCI_CM_SNIFF || !conn->power_save)
> 		goto timer;

so conn->power_save is used to disable automatic sniff mode for incoming
connections. Mainly HID since they manager it by themselves.

> But in hci_mode_change_evt whatever mode different than HCI_CM_ACTIVE
> reset power_save to zero:
> 
> 
> 		if (!test_and_clear_bit(HCI_CONN_MODE_CHANGE_PEND, &conn->pend)) {
> 			if (conn->mode == HCI_CM_ACTIVE)
> 				conn->power_save = 1;
> 			else
> 				conn->power_save = 0;
> 		}

And again, we are not setting the sniff mode. We disable automatic sniff
mode feature.

> So it seems that if mode is SNIFF power_save is 0, so this check will
> only fail if mode is in fact HCI_CM_ACTIVE, and then latter on we got
> this:
> 
> 
> 	if (!test_and_set_bit(HCI_CONN_MODE_CHANGE_PEND, &conn->pend)) {
> 		struct hci_cp_exit_sniff_mode cp;
> 		cp.handle = cpu_to_le16(conn->handle);
> 		hci_send_cmd(hdev, HCI_OP_EXIT_SNIFF_MODE, sizeof(cp), &cp);
> 	}
> 
> I was expecting that only when mode is HCI_CM_SNIFF it would send
> HCI_OP_EXIT_SNIFF_MODE, or Im missing something?

This reads as if NO mode change is pending, then exit from sniff mode.

Regards

Marcel



  reply	other threads:[~2009-08-24 18:40 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-24 18:26 sniff mode Luiz Augusto von Dentz
2009-08-24 18:40 ` Marcel Holtmann [this message]
2009-08-24 19:26   ` Luiz Augusto von Dentz
2009-08-24 19:33     ` Marcel Holtmann
2009-08-24 20:58       ` Luiz Augusto von Dentz
2009-08-24 21:12         ` Marcel Holtmann
2009-08-26  7:21       ` Ville Tervo
2009-08-26 18:04         ` Marcel Holtmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1251139257.2950.60.camel@localhost.localdomain \
    --to=marcel@holtmann.org \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=luiz.dentz@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox