patch to add read/write inquiry scan type functionality
The attached patches add reading and writing of inquiry scan type (for interlaced inquiry scan)
One patch is for libs, the other is for utils
Regards,
Albert
Index: include/hci.h
===================================================================
RCS file: /cvsroot/bluez/libs/include/hci.h,v
retrieving revision 1.69
hci.h +17 -0
@@ -833,6 +833,23 @@ } __attribute__ ((packed)) set_afh_classification_rp;#define SET_AFH_CLASSIFICATION_RP_SIZE 1 +#define OCF_READ_INQUIRY_SCAN_TYPE 0x0042 +typedef struct { +uint8_t status; +uint8_t type; +} __attribute__ ((packed))read_inquiry_scan_type_rp ; +#define READ_INQUIRY_SCAN_TYPE_RP_SIZE 2 + +#define OCF_WRITE_INQUIRY_SCAN_TYPE 0x0043 +typedef struct { +uint8_t type; +} __attribute__ ((packed))write_inquiry_scan_type_cp ; +#define WRITE_INQUIRY_SCAN_TYPE_CP_SIZE 1 +typedef struct { +uint8_t status; +} __attribute__ ((packed))write_inquiry_scan_type_rp ; +#define WRITE_INQUIRY_SCAN_TYPE_RP_SIZE 1 +#define OCF_READ_INQUIRY_MODE 0x0044 typedef struct { uint8_t status;
Index: include/hci_lib.h
===================================================================
RCS file: /cvsroot/bluez/libs/include/hci_lib.h,v
retrieving revision 1.47
hci_lib.h +2 -0
@@ -97,6 +97,8 @@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_read_inquiry_scan_type (int dd,uint8_t *type,int to); +int hci_write_inquiry_scan_type (int dd,uint8_t type,int to);int hci_read_afh_mode (int dd,uint8_t *mode,int to);int hci_write_afh_mode (int dd,uint8_t mode,int to);int hci_read_transmit_power_level (int dd,uint16_t handle,uint8_t type,int8_t *level,int to);
Index: src/hci.c
===================================================================
RCS file: /cvsroot/bluez/libs/src/hci.c,v
retrieving revision 1.71
hci.c +51 -0
57 lines not on this page · raw message
Index: tools/hciconfig.c
===================================================================
RCS file: /cvsroot/bluez/utils/tools/hciconfig.c,v retrieving revision 1.62
hciconfig.c +35 -0
@@ -881,6 +881,40 @@ } } +static void cmd_inq_scan_type (int ctl,int hdev,char *opt) +{ +int dd; + + dd =hci_open_dev (hdev); +if (dd <0 ) { +fprintf (stderr,"Can't open device hci%d: %s (%d)\n" , + hdev,strerror (errno), errno); +exit (1 ); + } + +if (opt) { +uint8_t type =atoi (opt); + +if (hci_write_inquiry_scan_type (dd, type,2000 ) <0 ) { +fprintf (stderr,"Can't set inquiry scan type on hci%d: %s (%d)\n" , + hdev,strerror (errno), errno); +exit (1 ); + } + }else { +uint8_t type; + +if (hci_read_inquiry_scan_type (dd, &type,1000 ) <0 ) { +fprintf (stderr,"Can't read inquiry scan type on hci%d: %s (%d)\n" , + hdev,strerror (errno), errno); +exit (1 ); + } + +print_dev_hdr (&di); +printf ("\tInquiry scan type: %s\n" , + type ==1 ?"Interlaced Inquiry Scan" :"Standard Inquiry Scan" ); + } +} +static void cmd_inq_parms (int ctl,int hdev,char *opt) {struct hci_request rq;
@@ -1325,6 +1359,7 @@ { "voice", cmd_voice, "[voice]", "Get/Set voice setting" }, { "iac", cmd_iac, "[iac]", "Get/Set inquiry access code" }, { "inqmode", cmd_inq_mode, "[mode]", "Get/set inquiry mode" }, + { "istype", cmd_inq_scan_type, "[type]", "Get/set inquiry scan type" }, { "inqparms", cmd_inq_parms, "[win:int]", "Get/Set inquiry scan window and interval" }, { "pageparms", cmd_page_parms, "[win:int]", "Get/Set page scan window and interval" }, { "pageto", cmd_page_to, "[to]", "Get/Set page timeout" },
Marcel Holtmann
maintainerHi Albert,
Quoted 4 lines
The attached patches add reading and writing of inquiry scan type (for interlaced inquiry scan)
One patch is for libs, the other is for utils
I applied the patch and changed "istype" to "inqtype". I also added a section in the manual page about the new command. You also forgot to add decoding support for it to hcidump.
Regards
Marcel
-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies from IBM. Find simple to follow Roadmaps, straightforward articles, informative Webcasts and more! Get everything you need to get up to speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel