static int bluesleep_write_proc_lpm(struct file *file, const char *buffer, unsigned long count, void *data) { char b; if (count < 1) return -EINVAL; if (copy_from_user(&b, buffer, 1)) return -EFAULT; if (b == '0') { /* HCI_DEV_UNREG */ bluesleep_stop(); has_lpm_enabled = false; bsi->uport = NULL; } else { /* HCI_DEV_REG */ if (!has_lpm_enabled) { has_lpm_enabled = true; if (bluesleep_uart_dev) bsi->uport = bluesleep_get_uart_port(); /* if bluetooth started, start bluesleep*/ bluesleep_start(); } } return count; }
static int bluesleep_write_proc_lpm(struct file *file, const char *buffer, unsigned long count, void *data) { char b; if (count < 1) return -EINVAL; if (copy_from_user(&b, buffer, 1)) return -EFAULT; if (b == '0') { BT_ERR("(bluesleep_write_proc_lpm) Unreg HCI notifier."); /* HCI_DEV_UNREG */ bluesleep_stop(); bt_enabled = false; //bsi->uport = NULL; } else if (b == '1') { BT_ERR("(bluesleep_write_proc_lpm) Reg HCI notifier."); /* HCI_DEV_REG */ if (!bt_enabled) { bt_enabled = true; bsi->uport = bluesleep_get_uart_port(); /* if bluetooth started, start bluesleep*/ bluesleep_start(); } } else if (b == '2') { BT_ERR("(bluesleep_write_proc_lpm) don`t control ext_wake & uart clk"); if(bt_enabled) { bt_enabled = false; bluesleep_abnormal_stop(); } } return count; }