linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] sixaxis: Fix another problem with already setup devices
@ 2019-06-07  6:54 Bastien Nocera
  2019-06-07  6:54 ` [PATCH 2/2] sixaxis: Throw an error when cable setup fails Bastien Nocera
  2019-06-13  9:54 ` [PATCH 1/2] sixaxis: Fix another problem with already setup devices Szymon Janc
  0 siblings, 2 replies; 3+ messages in thread
From: Bastien Nocera @ 2019-06-07  6:54 UTC (permalink / raw)
  To: linux-bluetooth

If the device went through any kind of pairing once, it might have been
set as trusted. Make sure to set the device as untrusted before starting
the cable pairing authorization so that we don't exit early from
process_auth_queue() (which considers trusted devices to be paired).
---
 plugins/sixaxis.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/plugins/sixaxis.c b/plugins/sixaxis.c
index fed68d2d8..12638829b 100644
--- a/plugins/sixaxis.c
+++ b/plugins/sixaxis.c
@@ -365,6 +365,7 @@ static bool setup_device(int fd, const char *sysfs_path,
 
 	btd_device_device_set_name(device, cp->name);
 	btd_device_set_pnpid(device, cp->source, cp->vid, cp->pid, cp->version);
+	btd_device_set_trusted(device, false);
 	btd_device_set_temporary(device, true);
 
 	closure = g_new0(struct authentication_closure, 1);
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] sixaxis: Throw an error when cable setup fails
  2019-06-07  6:54 [PATCH 1/2] sixaxis: Fix another problem with already setup devices Bastien Nocera
@ 2019-06-07  6:54 ` Bastien Nocera
  2019-06-13  9:54 ` [PATCH 1/2] sixaxis: Fix another problem with already setup devices Szymon Janc
  1 sibling, 0 replies; 3+ messages in thread
From: Bastien Nocera @ 2019-06-07  6:54 UTC (permalink / raw)
  To: linux-bluetooth

If btd_request_authorization_cable_configured() fails, throw an error
and free resources.
---
 plugins/sixaxis.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/plugins/sixaxis.c b/plugins/sixaxis.c
index 12638829b..939fed759 100644
--- a/plugins/sixaxis.c
+++ b/plugins/sixaxis.c
@@ -384,6 +384,12 @@ static bool setup_device(int fd, const char *sysfs_path,
 					adapter_bdaddr, &device_bdaddr,
 					HID_UUID, agent_auth_cb, closure);
 
+	if (closure->auth_id == 0) {
+		error("sixaxis: could not request cable authorization");
+		auth_closure_destroy(closure, true);
+		return false;
+	}
+
 	g_hash_table_insert(pending_auths, closure->sysfs_path, closure);
 
 	return true;
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/2] sixaxis: Fix another problem with already setup devices
  2019-06-07  6:54 [PATCH 1/2] sixaxis: Fix another problem with already setup devices Bastien Nocera
  2019-06-07  6:54 ` [PATCH 2/2] sixaxis: Throw an error when cable setup fails Bastien Nocera
@ 2019-06-13  9:54 ` Szymon Janc
  1 sibling, 0 replies; 3+ messages in thread
From: Szymon Janc @ 2019-06-13  9:54 UTC (permalink / raw)
  To: Bastien Nocera; +Cc: linux-bluetooth

Hi Bastien,

On Friday, 7 June 2019 08:54:10 CEST Bastien Nocera wrote:
> If the device went through any kind of pairing once, it might have been
> set as trusted. Make sure to set the device as untrusted before starting
> the cable pairing authorization so that we don't exit early from
> process_auth_queue() (which considers trusted devices to be paired).
> ---
>  plugins/sixaxis.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/plugins/sixaxis.c b/plugins/sixaxis.c
> index fed68d2d8..12638829b 100644
> --- a/plugins/sixaxis.c
> +++ b/plugins/sixaxis.c
> @@ -365,6 +365,7 @@ static bool setup_device(int fd, const char *sysfs_path,
> 
>  	btd_device_device_set_name(device, cp->name);
>  	btd_device_set_pnpid(device, cp->source, cp->vid, cp->pid, cp-
>version);
> +	btd_device_set_trusted(device, false);
>  	btd_device_set_temporary(device, true);
> 
>  	closure = g_new0(struct authentication_closure, 1);

Both patches applied, thanks.


-- 
pozdrawiam
Szymon Janc



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-06-13 15:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-07  6:54 [PATCH 1/2] sixaxis: Fix another problem with already setup devices Bastien Nocera
2019-06-07  6:54 ` [PATCH 2/2] sixaxis: Throw an error when cable setup fails Bastien Nocera
2019-06-13  9:54 ` [PATCH 1/2] sixaxis: Fix another problem with already setup devices Szymon Janc

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).