int l2cap_register_user(struct l2cap_conn *conn, struct l2cap_user *user);
void l2cap_unregister_user(struct l2cap_conn *conn, struct l2cap_user *user);
+#ifdef TIZEN_BT
+#ifdef CONFIG_BT_6LOWPAN
+/* IPSP : initialize/deinitialize 6lowpan */
+void bt_6lowpan_enable(void);
+void bt_6lowpan_disable(void);
+#else
+static inline void bt_6lowpan_enable(void) { }
+static inline void bt_6lowpan_disable(void) { }
+#endif
+#endif /* TIZEN_BT */
+
#endif /* __L2CAP_H */
return register_netdevice_notifier(&bt_6lowpan_dev_notifier);
}
+#ifdef TIZEN_BT
+void bt_6lowpan_enable(void)
+{
+ if (!enable_6lowpan) {
+ disconnect_all_peers();
+
+ enable_6lowpan = true;
+
+ if (listen_chan) {
+ l2cap_chan_close(listen_chan, 0);
+ l2cap_chan_put(listen_chan);
+ }
+
+ listen_chan = bt_6lowpan_listen();
+
+ register_netdevice_notifier(&bt_6lowpan_dev_notifier);
+ }
+}
+
+void bt_6lowpan_disable(void)
+{
+ if (enable_6lowpan) {
+ if (listen_chan) {
+ l2cap_chan_close(listen_chan, 0);
+ l2cap_chan_put(listen_chan);
+ listen_chan = NULL;
+ }
+ disconnect_devices();
+ unregister_netdevice_notifier(&bt_6lowpan_dev_notifier);
+ enable_6lowpan = false;
+ }
+}
+#endif
+
static void __exit bt_6lowpan_exit(void)
{
debugfs_remove(lowpan_enable_debugfs);
sizeof(struct mgmt_ev_vendor_specific_multi_adv_state_changed),
NULL);
}
+
+static int enable_bt_6lowpan(struct sock *sk, struct hci_dev *hdev,
+ void *data, u16 len)
+{
+ int err;
+ struct mgmt_cp_enable_6lowpan *cp = data;
+
+ BT_DBG("%s", hdev->name);
+
+ hci_dev_lock(hdev);
+
+ if (!hdev_is_powered(hdev)) {
+ err = mgmt_cmd_status(sk, hdev->id, MGMT_OP_ENABLE_6LOWPAN,
+ MGMT_STATUS_NOT_POWERED);
+ goto unlocked;
+ }
+
+ if (!lmp_le_capable(hdev)) {
+ err = mgmt_cmd_status(sk, hdev->id, MGMT_OP_ENABLE_6LOWPAN,
+ MGMT_STATUS_NOT_SUPPORTED);
+ goto unlocked;
+ }
+
+ if (cp->enable_6lowpan)
+ bt_6lowpan_enable();
+ else
+ bt_6lowpan_disable();
+
+ err = mgmt_cmd_complete(sk, hdev->id, MGMT_OP_ENABLE_6LOWPAN,
+ MGMT_STATUS_SUCCESS, NULL, 0);
+unlocked:
+ hci_dev_unlock(hdev);
+ return err;
+}
#endif /* TIZEN_BT */
static bool ltk_is_valid(struct mgmt_ltk_info *key)
{ le_set_scan_params, MGMT_LE_SET_SCAN_PARAMS_SIZE },
{ set_voice_setting, MGMT_SET_VOICE_SETTING_SIZE },
{ get_adv_tx_power, MGMT_GET_ADV_TX_POWER_SIZE },
+ { enable_bt_6lowpan, MGMT_ENABLE_BT_6LOWPAN_SIZE },
};
#endif