コード例 #1
0
static int bluetooth_set_radiosw(int radio_on, int update_rfk)
{
	int value;

	if (!bluetooth_present)
		return -ENODEV;

	/* WLSW overrides bluetooth in firmware/hardware, but there is no
	 * reason to risk weird behaviour. */
	if (get_wlsw(&value) && !value && radio_on)
		return -EPERM;

	if (get_gbdc(&value))
		return -EIO;
	if (radio_on)
		value |= TP_ACPI_BLUETOOTH_RADIOSSW;
	else
		value &= ~TP_ACPI_BLUETOOTH_RADIOSSW;
	if (set_sbdc(value))
		return -EIO;

	if (update_rfk)
		bluetooth_update_rfk();

	return 0;
}
コード例 #2
0
static void lensl_radio_rfkill_query(struct rfkill *rfk, void *data)
{
	int ret, value = 0;
	ret = get_wlsw(&value);
	if (ret)
		return;
	rfkill_set_hw_state(rfk, !value);
}
コード例 #3
0
static int lensl_radio_get(struct lensl_radio *radio, int *hw_blocked,
				int *value)
{
	int wlsw;

	*hw_blocked = 0;
	if (!radio)
		return -EINVAL;
	if (!radio->present)
		return -ENODEV;
	if (!get_wlsw(&wlsw) && !wlsw)
		*hw_blocked = 1;
	if (radio->get_acpi(value))
		return -EIO;
	return 0;
}
コード例 #4
0
static int bluetooth_get_radiosw(void)
{
	int value = 0;

	if (!bluetooth_present)
		return -ENODEV;

	/* WLSW overrides bluetooth in firmware/hardware, reflect that */
	if (bluetooth_pretend_blocked || (!get_wlsw(&value) && !value))
		return RFKILL_STATE_HARD_BLOCKED;

	if (get_gbdc(&value))
		return -EIO;

	return ((value & TP_ACPI_BLUETOOTH_RADIOSSW) != 0) ?
		RFKILL_STATE_UNBLOCKED : RFKILL_STATE_SOFT_BLOCKED;
}