From: Rex Tsai <chihchun@debian.org.tw>
To: bluez-devel@lists.sourceforge.net
Subject: [Bluez-devel] patch for read number of supported iac
Date: Wed, 08 Jun 2005 13:59:22 +0800 [thread overview]
Message-ID: <42A6893A.1050708@debian.org.tw> (raw)
[-- Attachment #1.1: Type: text/plain, Size: 89 bytes --]
Hi,
The API is missing. I don't know why. The attachments are my patches.
regards
-Rex
[-- Attachment #1.2: nosiac-libs-2.17.diff --]
[-- Type: text/x-patch, Size: 1791 bytes --]
--- bluez-libs-2.17.orig/src/hci.c
+++ bluez-libs-2.17/src/hci.c
@@ -1298,6 +1298,29 @@
return hci_send_req(dd, &rq, to);
}
+int hci_read_number_of_supported_iac(int dd, uint8_t *num_iac, int to)
+{
+ read_number_of_supported_iac_rp rp;
+ struct hci_request rq;
+
+ memset(&rq, 0, sizeof(rq));
+ rq.ogf = OGF_HOST_CTL;
+ rq.ocf = OCF_READ_NUMBER_OF_SUPPORTED_IAC;
+ rq.rparam = &rp;
+ rq.rlen = READ_NUMBER_OF_SUPPORTED_IAC_RP_SIZE;
+
+ if (hci_send_req(dd, &rq, to) < 0)
+ return -1;
+
+ if (rp.status) {
+ errno = EIO;
+ return -1;
+ }
+
+ *num_iac = rp.num_support_iac;
+ return 0;
+}
+
int hci_read_current_iac_lap(int dd, uint8_t *num_iac, uint8_t *lap, int to)
{
read_current_iac_lap_rp rp;
--- bluez-libs-2.17.orig/include/hci_lib.h
+++ bluez-libs-2.17/include/hci_lib.h
@@ -84,6 +84,7 @@
int hci_write_class_of_dev(int dd, uint32_t cls, int to);
int hci_read_voice_setting(int dd, uint16_t *vs, int to);
int hci_write_voice_setting(int dd, uint16_t vs, int to);
+int hci_read_number_of_supported_iac(int dd, uint8_t *num_iac, int to);
int hci_read_current_iac_lap(int dd, uint8_t *num_iac, uint8_t *lap, int to);
int hci_write_current_iac_lap(int dd, uint8_t num_iac, uint8_t *lap, int to);
int hci_read_stored_link_key(int dd, bdaddr_t *bdaddr, uint8_t all, int to);
--- bluez-libs-2.17.orig/include/hci.h
+++ bluez-libs-2.17/include/hci.h
@@ -808,6 +808,13 @@
#define WRITE_LINK_SUPERVISION_TIMEOUT_RP_SIZE 3
#define MAX_IAC_LAP 0x40
+#define OCF_READ_NUMBER_OF_SUPPORTED_IAC 0x0038
+typedef struct {
+ uint8_t status;
+ uint8_t num_support_iac;
+} __attribute__ ((packed)) read_number_of_supported_iac_rp;
+#define READ_NUMBER_OF_SUPPORTED_IAC_RP_SIZE 2
+
#define OCF_READ_CURRENT_IAC_LAP 0x0039
typedef struct {
uint8_t status;
[-- Attachment #1.3: nosiac-utils-2.17.diff --]
[-- Type: text/x-patch, Size: 1336 bytes --]
--- bluez-utils-2.17.orig/tools/hciconfig.c
+++ bluez-utils-2.17/tools/hciconfig.c
@@ -143,6 +143,27 @@
}
}
+static void cmd_nosiac(int ctl, int hdev, char *opt)
+{
+ int s = hci_open_dev(hdev);
+
+ if (s < 0) {
+ fprintf(stderr, "Can't open device hci%d: %s (%d)\n",
+ hdev, strerror(errno), errno);
+ exit(1);
+ }
+ {
+ uint8_t n;
+ if (hci_read_number_of_supported_iac(s, &n, 1000) < 0) {
+ printf("Failed to read IAC from hci%d: %s\n", hdev, strerror(errno));
+ exit(1);
+ }
+ print_dev_hdr(&di);
+ printf("\tNumber of supported IAC: %d\n", n);
+ }
+ close(s);
+}
+
static void cmd_iac(int ctl, int hdev, char *opt)
{
int s = hci_open_dev(hdev);
@@ -1323,6 +1344,7 @@
{ "name", cmd_name, "[name]", "Get/Set local name" },
{ "class", cmd_class, "[class]", "Get/Set class of device" },
{ "voice", cmd_voice, "[voice]", "Get/Set voice setting" },
+ { "nosiac", cmd_nosiac, 0, "Display number of supported inquiry access code" },
{ "iac", cmd_iac, "[iac]", "Get/Set inquiry access code" },
{ "inqmode", cmd_inq_mode, "[mode]", "Get/set inquiry mode" },
{ "inqparms", cmd_inq_parms, "[win:int]", "Get/Set inquiry scan window and interval" },
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 256 bytes --]
reply other threads:[~2005-06-08 5:59 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=42A6893A.1050708@debian.org.tw \
--to=chihchun@debian.org.tw \
--cc=bluez-devel@lists.sourceforge.net \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.