public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
From: Albert Huang <ashuang@gmail.com>
To: Marcel Holtmann <marcel@holtmann.org>
Cc: BlueZ Mailing List <bluez-devel@lists.sourceforge.net>
Subject: Re: [Bluez-devel] how to do inquiry with RSSI in bluetooth 1.2 devices?
Date: Tue, 19 Oct 2004 20:11:15 -0400	[thread overview]
Message-ID: <ef9938ec041019171179f1e8d0@mail.gmail.com> (raw)
In-Reply-To: <ef9938ec04101916584d188ffc@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 223 bytes --]

> Attached is a patch for bluez-libs.  Two functions are added.

please ignore previous message.  That patch doesn't follow the
naming/tabbing conventions in the rest of bluez-libs.  Attached is a
patch that does.

-albert

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: libs-inquiry-mode-ash-2.diff --]
[-- Type: text/x-patch; name="libs-inquiry-mode-ash-2.diff", Size: 2215 bytes --]

Index: src/hci.c
===================================================================
RCS file: /cvsroot/bluez/libs/src/hci.c,v
retrieving revision 1.44
diff -u -r1.44 hci.c
--- src/hci.c	6 Oct 2004 17:39:54 -0000	1.44
+++ src/hci.c	20 Oct 2004 00:08:41 -0000
@@ -1295,3 +1295,57 @@
 
 	return 0;
 }
+
+int hci_read_inquiry_mode(int dd, uint8_t *mode, int to)
+{
+	struct hci_request rq;
+	read_inquiry_mode_rp rp;
+
+	memset(&rq, 0, sizeof(rq));
+	rq.ogf = OGF_HOST_CTL;
+	rq.ocf = OCF_READ_INQUIRY_MODE;
+	rq.event = EVT_CMD_COMPLETE;
+	rq.cparam = 0;
+	rq.clen = 0;
+	rq.rparam = &rp;
+	rq.rlen = READ_INQUIRY_MODE_RP_SIZE;
+
+	if( hci_send_req( dd, &rq, to ) < 0 )
+		return -1;
+
+	if (rp.status) {
+		errno = EIO;
+		return -1;
+	}
+
+	*mode = rp.mode;
+	return 0;
+}
+
+int hci_write_inquiry_mode(int dd, uint8_t mode, int to)
+{
+	write_inquiry_mode_cp cp;
+	struct hci_request rq;
+	write_inquiry_mode_rp rp;
+	cp.mode = mode;
+
+	memset(&cp, 0, sizeof(cp));
+	memset(&rq, 0, sizeof(rq));
+	rq.ogf = OGF_HOST_CTL;
+	rq.ocf = OCF_WRITE_INQUIRY_MODE;
+	rq.event = EVT_CMD_COMPLETE;
+	rq.cparam = &cp;
+	rq.clen = WRITE_INQUIRY_MODE_CP_SIZE;
+	rq.rparam = &rp;
+	rq.rlen = EVT_CMD_COMPLETE_SIZE + WRITE_INQUIRY_MODE_RP_SIZE;
+
+	if( hci_send_req( dd, &rq, to ) < 0 )
+		return -1;
+
+	if (rp.status) {
+		errno = EIO;
+		return -1;
+	}
+
+	return 0;
+}
Index: include/hci_lib.h
===================================================================
RCS file: /cvsroot/bluez/libs/include/hci_lib.h,v
retrieving revision 1.25
diff -u -r1.25 hci_lib.h
--- include/hci_lib.h	24 Apr 2004 12:09:55 -0000	1.25
+++ include/hci_lib.h	20 Oct 2004 00:08:41 -0000
@@ -88,6 +88,8 @@
 int hci_switch_role(int dd, bdaddr_t peer, int role, int to);
 int hci_park_mode(int dd, uint16_t handle, uint16_t max_interval, uint16_t min_interval, int to);
 int hci_exit_park_mode(int dd, uint16_t handle, int to);
+int hci_read_inquiry_mode(int dd, uint8_t *mode, int to);
+int hci_write_inquiry_mode(int dd, uint8_t mode, int to);
 
 int hci_for_each_dev(int flag, int(*func)(int s, int dev_id, long arg), long arg);
 int hci_get_route(bdaddr_t *bdaddr);

  reply	other threads:[~2004-10-20  0:11 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-12 19:59 [Bluez-devel] how to do inquiry with RSSI in bluetooth 1.2 devices? Albert Huang
2004-10-13  9:00 ` Marcel Holtmann
2004-10-15 18:32   ` Albert Huang
2004-10-16 12:10     ` Marcel Holtmann
2004-10-19 21:44       ` Albert Huang
2004-10-19 21:55         ` Marcel Holtmann
2004-10-19 23:58           ` Albert Huang
2004-10-20  0:11             ` Albert Huang [this message]
2004-10-25  7:43               ` 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=ef9938ec041019171179f1e8d0@mail.gmail.com \
    --to=ashuang@gmail.com \
    --cc=albert@csail.mit.edu \
    --cc=bluez-devel@lists.sourceforge.net \
    --cc=marcel@holtmann.org \
    /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