diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2006-07-03 04:02:33 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-07-03 22:53:58 -0400 |
commit | 04837f6447c7f3ef114cda1ad761822dedbff8cf (patch) | |
tree | 66dbb53e82550723191ffe54f0457eafc3a92d32 /include/net/bluetooth/hci.h | |
parent | da1f519851d1c66331363253f364bdb5d924ea96 (diff) |
[Bluetooth] Add automatic sniff mode support
This patch introduces the automatic sniff mode feature. This allows
the host to switch idle connections into sniff mode to safe power.
Signed-off-by: Ulisses Furquim <ulissesf@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'include/net/bluetooth/hci.h')
-rw-r--r-- | include/net/bluetooth/hci.h | 70 |
1 files changed, 56 insertions, 14 deletions
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h index 99c53f6b8252..b2bdb1aa0429 100644 --- a/include/net/bluetooth/hci.h +++ b/include/net/bluetooth/hci.h | |||
@@ -101,9 +101,10 @@ enum { | |||
101 | #define HCIINQUIRY _IOR('H', 240, int) | 101 | #define HCIINQUIRY _IOR('H', 240, int) |
102 | 102 | ||
103 | /* HCI timeouts */ | 103 | /* HCI timeouts */ |
104 | #define HCI_CONN_TIMEOUT (HZ * 40) | 104 | #define HCI_CONNECT_TIMEOUT (40000) /* 40 seconds */ |
105 | #define HCI_DISCONN_TIMEOUT (HZ * 2) | 105 | #define HCI_DISCONN_TIMEOUT (2000) /* 2 seconds */ |
106 | #define HCI_CONN_IDLE_TIMEOUT (HZ * 60) | 106 | #define HCI_IDLE_TIMEOUT (6000) /* 6 seconds */ |
107 | #define HCI_INIT_TIMEOUT (10000) /* 10 seconds */ | ||
107 | 108 | ||
108 | /* HCI Packet types */ | 109 | /* HCI Packet types */ |
109 | #define HCI_COMMAND_PKT 0x01 | 110 | #define HCI_COMMAND_PKT 0x01 |
@@ -145,7 +146,7 @@ enum { | |||
145 | #define LMP_TACCURACY 0x10 | 146 | #define LMP_TACCURACY 0x10 |
146 | #define LMP_RSWITCH 0x20 | 147 | #define LMP_RSWITCH 0x20 |
147 | #define LMP_HOLD 0x40 | 148 | #define LMP_HOLD 0x40 |
148 | #define LMP_SNIF 0x80 | 149 | #define LMP_SNIFF 0x80 |
149 | 150 | ||
150 | #define LMP_PARK 0x01 | 151 | #define LMP_PARK 0x01 |
151 | #define LMP_RSSI 0x02 | 152 | #define LMP_RSSI 0x02 |
@@ -160,13 +161,21 @@ enum { | |||
160 | #define LMP_PSCHEME 0x02 | 161 | #define LMP_PSCHEME 0x02 |
161 | #define LMP_PCONTROL 0x04 | 162 | #define LMP_PCONTROL 0x04 |
162 | 163 | ||
164 | #define LMP_SNIFF_SUBR 0x02 | ||
165 | |||
166 | /* Connection modes */ | ||
167 | #define HCI_CM_ACTIVE 0x0000 | ||
168 | #define HCI_CM_HOLD 0x0001 | ||
169 | #define HCI_CM_SNIFF 0x0002 | ||
170 | #define HCI_CM_PARK 0x0003 | ||
171 | |||
163 | /* Link policies */ | 172 | /* Link policies */ |
164 | #define HCI_LP_RSWITCH 0x0001 | 173 | #define HCI_LP_RSWITCH 0x0001 |
165 | #define HCI_LP_HOLD 0x0002 | 174 | #define HCI_LP_HOLD 0x0002 |
166 | #define HCI_LP_SNIFF 0x0004 | 175 | #define HCI_LP_SNIFF 0x0004 |
167 | #define HCI_LP_PARK 0x0008 | 176 | #define HCI_LP_PARK 0x0008 |
168 | 177 | ||
169 | /* Link mode */ | 178 | /* Link modes */ |
170 | #define HCI_LM_ACCEPT 0x8000 | 179 | #define HCI_LM_ACCEPT 0x8000 |
171 | #define HCI_LM_MASTER 0x0001 | 180 | #define HCI_LM_MASTER 0x0001 |
172 | #define HCI_LM_AUTH 0x0002 | 181 | #define HCI_LM_AUTH 0x0002 |
@@ -192,7 +201,7 @@ struct hci_rp_read_loc_version { | |||
192 | } __attribute__ ((packed)); | 201 | } __attribute__ ((packed)); |
193 | 202 | ||
194 | #define OCF_READ_LOCAL_FEATURES 0x0003 | 203 | #define OCF_READ_LOCAL_FEATURES 0x0003 |
195 | struct hci_rp_read_loc_features { | 204 | struct hci_rp_read_local_features { |
196 | __u8 status; | 205 | __u8 status; |
197 | __u8 features[8]; | 206 | __u8 features[8]; |
198 | } __attribute__ ((packed)); | 207 | } __attribute__ ((packed)); |
@@ -376,17 +385,32 @@ struct hci_cp_change_conn_link_key { | |||
376 | } __attribute__ ((packed)); | 385 | } __attribute__ ((packed)); |
377 | 386 | ||
378 | #define OCF_READ_REMOTE_FEATURES 0x001B | 387 | #define OCF_READ_REMOTE_FEATURES 0x001B |
379 | struct hci_cp_read_rmt_features { | 388 | struct hci_cp_read_remote_features { |
380 | __le16 handle; | 389 | __le16 handle; |
381 | } __attribute__ ((packed)); | 390 | } __attribute__ ((packed)); |
382 | 391 | ||
383 | #define OCF_READ_REMOTE_VERSION 0x001D | 392 | #define OCF_READ_REMOTE_VERSION 0x001D |
384 | struct hci_cp_read_rmt_version { | 393 | struct hci_cp_read_remote_version { |
385 | __le16 handle; | 394 | __le16 handle; |
386 | } __attribute__ ((packed)); | 395 | } __attribute__ ((packed)); |
387 | 396 | ||
388 | /* Link Policy */ | 397 | /* Link Policy */ |
389 | #define OGF_LINK_POLICY 0x02 | 398 | #define OGF_LINK_POLICY 0x02 |
399 | |||
400 | #define OCF_SNIFF_MODE 0x0003 | ||
401 | struct hci_cp_sniff_mode { | ||
402 | __le16 handle; | ||
403 | __le16 max_interval; | ||
404 | __le16 min_interval; | ||
405 | __le16 attempt; | ||
406 | __le16 timeout; | ||
407 | } __attribute__ ((packed)); | ||
408 | |||
409 | #define OCF_EXIT_SNIFF_MODE 0x0004 | ||
410 | struct hci_cp_exit_sniff_mode { | ||
411 | __le16 handle; | ||
412 | } __attribute__ ((packed)); | ||
413 | |||
390 | #define OCF_ROLE_DISCOVERY 0x0009 | 414 | #define OCF_ROLE_DISCOVERY 0x0009 |
391 | struct hci_cp_role_discovery { | 415 | struct hci_cp_role_discovery { |
392 | __le16 handle; | 416 | __le16 handle; |
@@ -407,7 +431,7 @@ struct hci_rp_read_link_policy { | |||
407 | __le16 policy; | 431 | __le16 policy; |
408 | } __attribute__ ((packed)); | 432 | } __attribute__ ((packed)); |
409 | 433 | ||
410 | #define OCF_SWITCH_ROLE 0x000B | 434 | #define OCF_SWITCH_ROLE 0x000B |
411 | struct hci_cp_switch_role { | 435 | struct hci_cp_switch_role { |
412 | bdaddr_t bdaddr; | 436 | bdaddr_t bdaddr; |
413 | __u8 role; | 437 | __u8 role; |
@@ -423,6 +447,14 @@ struct hci_rp_write_link_policy { | |||
423 | __le16 handle; | 447 | __le16 handle; |
424 | } __attribute__ ((packed)); | 448 | } __attribute__ ((packed)); |
425 | 449 | ||
450 | #define OCF_SNIFF_SUBRATE 0x0011 | ||
451 | struct hci_cp_sniff_subrate { | ||
452 | __le16 handle; | ||
453 | __le16 max_latency; | ||
454 | __le16 min_remote_timeout; | ||
455 | __le16 min_local_timeout; | ||
456 | } __attribute__ ((packed)); | ||
457 | |||
426 | /* Status params */ | 458 | /* Status params */ |
427 | #define OGF_STATUS_PARAM 0x05 | 459 | #define OGF_STATUS_PARAM 0x05 |
428 | 460 | ||
@@ -582,15 +614,15 @@ struct hci_ev_link_key_notify { | |||
582 | __u8 key_type; | 614 | __u8 key_type; |
583 | } __attribute__ ((packed)); | 615 | } __attribute__ ((packed)); |
584 | 616 | ||
585 | #define HCI_EV_RMT_FEATURES 0x0B | 617 | #define HCI_EV_REMOTE_FEATURES 0x0B |
586 | struct hci_ev_rmt_features { | 618 | struct hci_ev_remote_features { |
587 | __u8 status; | 619 | __u8 status; |
588 | __le16 handle; | 620 | __le16 handle; |
589 | __u8 features[8]; | 621 | __u8 features[8]; |
590 | } __attribute__ ((packed)); | 622 | } __attribute__ ((packed)); |
591 | 623 | ||
592 | #define HCI_EV_RMT_VERSION 0x0C | 624 | #define HCI_EV_REMOTE_VERSION 0x0C |
593 | struct hci_ev_rmt_version { | 625 | struct hci_ev_remote_version { |
594 | __u8 status; | 626 | __u8 status; |
595 | __le16 handle; | 627 | __le16 handle; |
596 | __u8 lmp_ver; | 628 | __u8 lmp_ver; |
@@ -611,6 +643,16 @@ struct hci_ev_pscan_rep_mode { | |||
611 | __u8 pscan_rep_mode; | 643 | __u8 pscan_rep_mode; |
612 | } __attribute__ ((packed)); | 644 | } __attribute__ ((packed)); |
613 | 645 | ||
646 | #define HCI_EV_SNIFF_SUBRATE 0x2E | ||
647 | struct hci_ev_sniff_subrate { | ||
648 | __u8 status; | ||
649 | __le16 handle; | ||
650 | __le16 max_tx_latency; | ||
651 | __le16 max_rx_latency; | ||
652 | __le16 max_remote_timeout; | ||
653 | __le16 max_local_timeout; | ||
654 | } __attribute__ ((packed)); | ||
655 | |||
614 | /* Internal events generated by Bluetooth stack */ | 656 | /* Internal events generated by Bluetooth stack */ |
615 | #define HCI_EV_STACK_INTERNAL 0xFD | 657 | #define HCI_EV_STACK_INTERNAL 0xFD |
616 | struct hci_ev_stack_internal { | 658 | struct hci_ev_stack_internal { |