Small help needed, get capability info
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:
plugins/autopair.c renamed from autopair.c_old +16 -2
@@ -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