Index: include/hci.h =================================================================== RCS file: /cvsroot/bluez/libs/include/hci.h,v retrieving revision 1.69 diff -u -r1.69 hci.h --- include/hci.h 8 May 2005 12:24:54 -0000 1.69 +++ include/hci.h 15 Jun 2005 18:09:47 -0000 @@ -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 diff -u -r1.47 hci_lib.h --- include/hci_lib.h 1 May 2005 14:52:53 -0000 1.47 +++ include/hci_lib.h 15 Jun 2005 18:09:47 -0000 @@ -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 diff -u -r1.71 hci.c --- src/hci.c 1 May 2005 14:52:53 -0000 1.71 +++ src/hci.c 15 Jun 2005 18:09:48 -0000 @@ -1885,6 +1885,57 @@ return 0; } +int hci_read_inquiry_scan_type(int dd, uint8_t *type, int to) +{ + read_inquiry_scan_type_rp rp; + struct hci_request rq; + + memset(&rq, 0, sizeof(rq)); + rq.ogf = OGF_HOST_CTL; + rq.ocf = OCF_READ_INQUIRY_SCAN_TYPE; + rq.rparam = &rp; + rq.rlen = READ_INQUIRY_SCAN_TYPE_RP_SIZE; + + if (hci_send_req(dd, &rq, to) < 0) + return -1; + + if (rp.status) { + errno = EIO; + return -1; + } + + *type = rp.type; + return 0; +} + +int hci_write_inquiry_scan_type(int dd, uint8_t type, int to) +{ + write_inquiry_scan_type_cp cp; + write_inquiry_scan_type_rp rp; + struct hci_request rq; + + memset(&cp, 0, sizeof(cp)); + cp.type = type; + + memset(&rq, 0, sizeof(rq)); + rq.ogf = OGF_HOST_CTL; + rq.ocf = OCF_WRITE_INQUIRY_SCAN_TYPE; + rq.cparam = &cp; + rq.clen = WRITE_INQUIRY_SCAN_TYPE_CP_SIZE; + rq.rparam = &rp; + rq.rlen = WRITE_INQUIRY_SCAN_TYPE_RP_SIZE; + + if (hci_send_req(dd, &rq, to) < 0) + return -1; + + if (rp.status) { + errno = EIO; + return -1; + } + + return 0; +} + int hci_local_name(int dd, int len, char *name, int to) { return hci_read_local_name(dd, len, name, to);