Re: [PATCH 2/2] rfkill: Set device powered even adapter is not created

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On Mon, Jan 16, 2012, Yu A Wang wrote:
> ---
>  src/rfkill.c |   13 ++++++++++---
>  1 files changed, 10 insertions(+), 3 deletions(-)
> 
> diff --git a/src/rfkill.c b/src/rfkill.c
> index b40c6e7..5d32fac 100644
> --- a/src/rfkill.c
> +++ b/src/rfkill.c
> @@ -128,11 +128,18 @@ static gboolean rfkill_event(GIOChannel *chan,
>  	if (id < 0)
>  		return TRUE;
>  
> +	DBG("RFKILL unblock for hci%d", id);
> +
>  	adapter = manager_find_adapter_by_id(id);
> -	if (!adapter)
> +	if (!adapter) {
> +		/*
> +		 * If device is rfkilled, the initialize operation
> +		 * may failed and adapter is not created, then we
> +		 * need to set the device powered directly.
> +		 */
> +		adapter_ops_set_powered(id, TRUE);
>  		return TRUE;
> -
> -	DBG("RFKILL unblock for hci%d", id);
> +	}
>  
>  	btd_adapter_restore_powered(adapter);

This looks more like a workaround to another issue: if the kernel is
aware of the adapter but user space isn't it means that something has
gone wrong during the initialization process and *that* should be fixed
instead of blindly attempting to power on the adapter id anyway.

Johan
--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux