* [Bluez-devel] patch for read number of supported iac
@ 2005-06-08 5:59 Rex Tsai
0 siblings, 0 replies; only message in thread
From: Rex Tsai @ 2005-06-08 5:59 UTC (permalink / raw)
To: bluez-devel
[-- 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 --]
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2005-06-08 5:59 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-06-08 5:59 [Bluez-devel] patch for read number of supported iac Rex Tsai
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox