Linux-Bluetooth Archive on lore.kernel.org
 help / Atom feed
* Small help needed, get capability info
@ 2018-12-07  1:08 Проклов Александр Валерьевич
  0 siblings, 0 replies; 1+ messages 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] 1+ messages in thread

only message in thread, back to index

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 Проклов Александр Валерьевич

Linux-Bluetooth Archive on lore.kernel.org

Archives are clonable: git clone --mirror https://lore.kernel.org/linux-bluetooth/0 linux-bluetooth/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-bluetooth linux-bluetooth/ https://lore.kernel.org/linux-bluetooth \
		linux-bluetooth@vger.kernel.org linux-bluetooth@archiver.kernel.org
	public-inbox-index linux-bluetooth


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-bluetooth


AGPL code for this site: git clone https://public-inbox.org/ public-inbox