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