linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Small help needed, get capability info
@ 2018-12-07  1:08 Проклов Александр Валерьевич
  0 siblings, 0 replies; only message in thread
From: Проклов Александр Валерьевич @ 2018-12-07  1:08 UTC (permalink / raw)
  To: linux-bluetooth

  Hello All,
I making patch for autopair device if pincode define in main.conf.
I'm not a programmer, and now i am having trouble with read capability info.

After "agent->capability" bluetoothctl crash with segmentation error.
Please help me get capability info.
If i using agent_get_io_capability(agent); for get info, bluetoothctl 
also crash with segmentation error.

My example:
--- ./autopair.c_old	2018-11-30 14:32:55.000000000 +0800
+++ ./plugins/autopair.c	2018-12-05 10:10:59.000000000 +0800
@@ -35,12 +35,14 @@

  #include "src/plugin.h"
  #include "src/adapter.h"
  #include "src/device.h"
  #include "src/log.h"
  #include "src/storage.h"
+#include "src/agent.h"

  /*
   * Plugin to handle automatic pairing of devices with reduced user
@@ -62,6 +64,8 @@
  	char pinstr[7];
  	char name[25];
  	uint32_t class;
+	struct agent *agent;

  	ba2str(device_get_address(device), addr);

@@ -143,7 +147,18 @@
  		}
  		break;
- 	}
-
+	default:
+	/*check capability=NOINPUTNOOUTPUT and use DefaultPin=0000 or from 
main.conf if available*/
+	
+	DBG("capability string %d, agent->capability);
+	
+	/*if (agent->capability == 0x03) {
+	    DBG("capability set to NOINPUTNOOUTPUT use defaultpin");
+		if (attempt > 1)
+			return 0;
+		memcpy(pinbuf, main_opts.defaultpin, 4);
+		return 4;
+	}*/
+	break;
+	}
  	return 0;
  }








---------------------
Best regards,
Aleksandr Proklov

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2018-12-07  0:07 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-07  1:08 Small help needed, get capability info Проклов Александр Валерьевич

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).