* [Bluez-devel] patch to add read/write inquiry scan type functionality
@ 2005-06-15 19:58 Albert Huang
2005-06-16 14:05 ` Marcel Holtmann
0 siblings, 1 reply; 2+ messages in thread
From: Albert Huang @ 2005-06-15 19:58 UTC (permalink / raw)
To: BlueZ Mailing List
[-- Attachment #1: Type: text/plain, Size: 167 bytes --]
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
[-- Attachment #2: libs-albert-istype.diff --]
[-- Type: text/plain, Size: 3223 bytes --]
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);
[-- Attachment #3: utils-albert-istype.diff --]
[-- Type: text/plain, Size: 1759 bytes --]
Index: tools/hciconfig.c
===================================================================
RCS file: /cvsroot/bluez/utils/tools/hciconfig.c,v
retrieving revision 1.62
diff -u -r1.62 hciconfig.c
--- tools/hciconfig.c 1 May 2005 14:54:11 -0000 1.62
+++ tools/hciconfig.c 15 Jun 2005 18:26:49 -0000
@@ -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" },
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [Bluez-devel] patch to add read/write inquiry scan type functionality
2005-06-15 19:58 [Bluez-devel] patch to add read/write inquiry scan type functionality Albert Huang
@ 2005-06-16 14:05 ` Marcel Holtmann
0 siblings, 0 replies; 2+ messages in thread
From: Marcel Holtmann @ 2005-06-16 14:05 UTC (permalink / raw)
To: bluez-devel
Hi Albert,
> 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
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2005-06-16 14:05 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-06-15 19:58 [Bluez-devel] patch to add read/write inquiry scan type functionality Albert Huang
2005-06-16 14:05 ` Marcel Holtmann
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.