patch for read number of supported iac
Hi,
The API is missing. I don't know why. The attachments are my patches.
regards
-Rex
src/hci.c +23 -0
@@ -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;
include/hci_lib.h +1 -0
@@ -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);
include/hci.h +7 -0
@@ -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;
tools/hciconfig.c +22 -0
@@ -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" },