I have a task to write a C program to advertise bluetooth on ubuntu. I use Ubuntu 22.04 and bluetooth 5.2. I use bluetooth.h, hci.h and hci_lib.h libraries to do it. But the program reports an error that it cannot interact with bluetooth using hci.
I tried to turn on advertising by using the command "bluetoothctl -> advertise on" and I can completely capture packets using other devices. So what is the cause of this problem?