Please ignore my previous posting. I compiled btgatt-server and btgatt-client wrong. I didn't use autotools. With autotool built binaries both btgatt-client and btgatt-server seemed to behave correctly. Thank you! 2024년 12월 11일 (수) 오전 10:54, Jeonghum Joh <oosaprogrammer@xxxxxxxxx>님이 작성: > > Hello list, > > I tested bluez tools - btgatt-server and btgatt-client. > Both of them stopped working complaining "Failed to initialize console". > > So I just prevented it from exiting, and everything seemed to work fine. > > I changed as shown below: > > btgatt-server.c > > me@mypc:~/Projects/bluez/tools$ git diff > diff --git a/tools/btgatt-server.c b/tools/btgatt-server.c > index 90a6c9b0a..e2e999eb2 100644 > --- a/tools/btgatt-server.c > +++ b/tools/btgatt-server.c > @@ -1242,9 +1242,9 @@ int main(int argc, char *argv[]) > EPOLLIN | EPOLLRDHUP | EPOLLHUP | EPOLLERR, > prompt_read_cb, server, NULL) < 0) { > fprintf(stderr, "Failed to initialize console\n"); > - server_destroy(server); > - > - return EXIT_FAILURE; > +// server_destroy(server); > +// > +// return EXIT_FAILURE; > } > > printf("Running GATT server\n"); > > > btgatt-client.c > > buntu@ubuntu-desktop:~/Projects/bluez/tools$ git diff > diff --git a/tools/btgatt-client.c b/tools/btgatt-client.c > index b47914da3..ad7f8bb02 100644 > --- a/tools/btgatt-client.c > +++ b/tools/btgatt-client.c > @@ -1857,7 +1857,7 @@ int main(int argc, char *argv[]) > EPOLLIN | EPOLLRDHUP | EPOLLHUP | EPOLLERR, > prompt_read_cb, cli, NULL) < 0) { > fprintf(stderr, "Failed to initialize console\n"); > - return EXIT_FAILURE; > +// return EXIT_FAILURE; > } > > print_prompt(); > > > The prints of them is as shown below: > > btgatt-server.c > > $ ./btgatt-server > > Started listening on ATT channel. Waiting for connections > > Connect from DC:A6:32:AB:74:1F > > Failed to initialize console > > Running GATT server > > [GATT server]# Device Name Extended Properties Read called > > [GATT server]# Service Changed CCC Write called > > [GATT server]# Service Changed Enabled: true > > > > btgatt-client.c > > $ sudo ./btgatt-client -d A8:93:4A:96:88:F4 > > Connecting to device... Done > > Failed to initialize console > > [GATT client]# Service Added - UUID: 00001800-0000-1000-8000-00805f9b34fb start: 0x0001 end: 0x0006 > > [GATT client]# Service Added - UUID: 00001801-0000-1000-8000-00805f9b34fb start: 0x0007 end: 0x000a > > [GATT client]# GATT discovery procedures complete > > [GATT client]# > > service - start: 0x0001, end: 0x0006, type: primary, uuid: 00001800-0000-1000-8000-00805f9b34fb > > charac - start: 0x0002, value: 0x0003, props: 0x82, ext_props: 0x0001, uuid: 00002a00-0000-1000-8000-00805f9b34fb > > descr - handle: 0x0004, uuid: 00002900-0000-1000-8000-00805f9b34fb > > charac - start: 0x0005, value: 0x0006, props: 0x02, ext_props: 0x0000, uuid: 00002a01-0000-1000-8000-00805f9b34fb > > > > service - start: 0x0007, end: 0x000a, type: primary, uuid: 00001801-0000-1000-8000-00805f9b34fb > > charac - start: 0x0008, value: 0x0009, props: 0x22, ext_props: 0x0000, uuid: 00002a05-0000-1000-8000-00805f9b34fb > > descr - handle: 0x000a, uuid: 00002902-0000-1000-8000-00805f9b34fb > > > > btgatt-server.c tested on a labtop + ubuntu 22.04 > btgatt-client.c tested on a raspberrypi + ubuntu 22.04 > > Before starting of the btgatt-server I did things as shown below: > > $ sudo btmgmt -i hci0 power off > > $ sudo btmgmt -i hci0 le on > > $ sudo btmgmt -i hci0 connectable on > > $ sudo btmgmt -i hci0 privacy off > > $ sudo btmgmt -i hci0 advertising on > > $ sudo btmgmt -i hci0 power on > > $ hciconfig > > hci0: Type: Primary Bus: USB > > BD Address: A8:93:4A:96:88:F4 ACL MTU: 1021:6 SCO MTU: 240:8 > > UP RUNNING PSCAN > > RX bytes:16771 acl:0 sco:0 events:2280 errors:0 > > TX bytes:554822 acl:0 sco:0 commands:2280 errors:0 > > > > Did I fix the problem correctly? > > Thank you in advance!