Re: [PATCH BlueZ 1/1] obexd: Fix failure to register bt transport

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

 



ti, 2025-06-24 kello 15:23 +0100, Pete Beardmore kirjoitti:
> On initial logind update, the internal 'active' state is FALSE. Where
> querying the current state (`sd_uid_get_state`) returns 'active' we do
> NOT want to short-circuit the update to the internal state value and
> ultimate transport initialisation.
> ---
>  obexd/src/logind.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/obexd/src/logind.c b/obexd/src/logind.c
> index b4279b209..e681dd39f 100644
> --- a/obexd/src/logind.c
> +++ b/obexd/src/logind.c
> @@ -68,7 +68,7 @@ static int update(void)
>  		return res;
>  
>  	if (state_is_active) {
> -		if (!active)
> +		if (active)
>  			return 0;
>  	} else {
>  		res = sd_uid_get_seats(uid, 1, NULL);

Just above this line there appears to be

	state_is_active = g_strcmp0(state, "active");

which looks like it's inverted too.

What this function probably should do is to make it simpler and
something like

	state_is_active = (g_strcmp0(state, "active") == 0);

	/* if active but no seat, consider as not active */
	if (state_is_active && sd_uid_get_seats(uid, 1, NULL) == 0)
		state_is_active = FALSE;

	if (state_is_active == active)
		return;

	active = state_is_active;
	emit callbacks;

-- 
Pauli Virtanen





[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