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 19:58:29 -0400 [thread overview]
Message-ID: <ef9938ec04101916584d188ffc@mail.gmail.com> (raw)
In-Reply-To: <1098222911.23046.5.camel@pegasus>
[-- Attachment #1: Type: text/plain, Size: 502 bytes --]
> You should re-read the HCI part of the Bluetooth specification, because
> the OGF and OCF values are packed in a specific format. If the latest
> version of hcidump shows unknown then you should think about an error on
> your side, because I already added full Bluetooth 1.2 support.
Attached is a patch for bluez-libs. Two functions are added.
int hci_read_inquiry_mode(int dd, uint8_t *mode, int to);
int hci_write_inquiry_mode(int dd, uint8_t mode, int to);
Thanks for all your help!
-albert
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: libs-inquiry-mode-ash.diff --]
[-- Type: text/x-patch; name="libs-inquiry-mode-ash.diff", Size: 2275 bytes --]
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 19 Oct 2004 23:49:21 -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);
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 19 Oct 2004 23:49:22 -0000
@@ -1295,3 +1295,54 @@
return 0;
}
+
+int hci_read_inquiry_mode(int dd, uint8_t *mode, int to)
+{
+ struct hci_request req;
+ read_inquiry_mode_rp rp;
+
+ req.ogf = OGF_HOST_CTL;
+ req.ocf = OCF_READ_INQUIRY_MODE;
+ req.event = EVT_CMD_COMPLETE;
+ req.cparam = 0;
+ req.clen = 0;
+ req.rparam = &rp;
+ req.rlen = READ_INQUIRY_MODE_RP_SIZE;
+
+ if( hci_send_req( dd, &req, 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 wim_cp;
+ struct hci_request req;
+ write_inquiry_mode_rp rp;
+ wim_cp.mode = mode;
+
+ req.ogf = OGF_HOST_CTL;
+ req.ocf = OCF_WRITE_INQUIRY_MODE;
+ req.event = EVT_CMD_COMPLETE;
+ req.cparam = &wim_cp;
+ req.clen = WRITE_INQUIRY_MODE_CP_SIZE;
+ req.rparam = &rp;
+ req.rlen = EVT_CMD_COMPLETE_SIZE + WRITE_INQUIRY_MODE_RP_SIZE;
+
+ if( hci_send_req( dd, &req, to ) < 0 )
+ return -1;
+
+ if (rp.status) {
+ errno = EIO;
+ return -1;
+ }
+
+ return 0;
+}
next prev parent reply other threads:[~2004-10-19 23:58 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 [this message]
2004-10-20 0:11 ` Albert Huang
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=ef9938ec04101916584d188ffc@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