Index: include/hci_lib.h =================================================================== RCS file: /cvsroot/bluez/libs/include/hci_lib.h,v retrieving revision 1.25 diff -u -r1.25 hci_lib.h --- include/hci_lib.h 24 Apr 2004 12:09:55 -0000 1.25 +++ include/hci_lib.h 19 Oct 2004 23:49:21 -0000 @@ -88,6 +88,8 @@ int hci_switch_role(int dd, bdaddr_t peer, int role, int to); int hci_park_mode(int dd, uint16_t handle, uint16_t max_interval, uint16_t min_interval, int to); 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_for_each_dev(int flag, int(*func)(int s, int dev_id, long arg), long arg); int hci_get_route(bdaddr_t *bdaddr); Index: src/hci.c =================================================================== RCS file: /cvsroot/bluez/libs/src/hci.c,v retrieving revision 1.44 diff -u -r1.44 hci.c --- src/hci.c 6 Oct 2004 17:39:54 -0000 1.44 +++ src/hci.c 19 Oct 2004 23:49:22 -0000 @@ -1295,3 +1295,54 @@ return 0; } + +int hci_read_inquiry_mode(int dd, uint8_t *mode, int to) +{ + struct hci_request req; + read_inquiry_mode_rp rp; + + req.ogf = OGF_HOST_CTL; + req.ocf = OCF_READ_INQUIRY_MODE; + req.event = EVT_CMD_COMPLETE; + req.cparam = 0; + req.clen = 0; + req.rparam = &rp; + req.rlen = READ_INQUIRY_MODE_RP_SIZE; + + if( hci_send_req( dd, &req, to ) < 0 ) + return -1; + + if (rp.status) { + errno = EIO; + return -1; + } + + *mode = rp.mode; + return 0; +} + +int hci_write_inquiry_mode(int dd, uint8_t mode, int to) +{ + write_inquiry_mode_cp wim_cp; + struct hci_request req; + write_inquiry_mode_rp rp; + wim_cp.mode = mode; + + req.ogf = OGF_HOST_CTL; + req.ocf = OCF_WRITE_INQUIRY_MODE; + req.event = EVT_CMD_COMPLETE; + req.cparam = &wim_cp; + req.clen = WRITE_INQUIRY_MODE_CP_SIZE; + req.rparam = &rp; + req.rlen = EVT_CMD_COMPLETE_SIZE + WRITE_INQUIRY_MODE_RP_SIZE; + + if( hci_send_req( dd, &req, to ) < 0 ) + return -1; + + if (rp.status) { + errno = EIO; + return -1; + } + + return 0; +}