Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

invalid field detected *device.Device1Properties.Bonded #193

Closed
vlappa opened this issue Sep 6, 2023 · 5 comments
Closed

invalid field detected *device.Device1Properties.Bonded #193

vlappa opened this issue Sep 6, 2023 · 5 comments
Labels

Comments

@vlappa
Copy link

vlappa commented Sep 6, 2023

I'm running code (on Linux) based on the heartrate-monitor example. The server is a board with a esp32 chip, using the esp32 BLE C++ library.
I do get this warning. Any idea what triggers this?

scanning...
WARN[0000] MapToStruct: invalid field detected *device.Device1Properties.Bonded
WARN[0000] MapToStruct: invalid field detected *device.Device1Properties.Bonded
WARN[0000] MapToStruct: invalid field detected *device.Device1Properties.Bonded
WARN[0000] MapToStruct: invalid field detected *device.Device1Properties.Bonded
WARN[0000] MapToStruct: invalid field detected *device.Device1Properties.Bonded
WARN[0000] MapToStruct: invalid field detected *device.Device1Properties.Bonded
WARN[0000] MapToStruct: invalid field detected *device.Device1Properties.Bonded
WARN[0000] MapToStruct: invalid field detected *device.Device1Properties.Bonded
WARN[0000] MapToStruct: invalid field detected *device.Device1Properties.Bonded
WARN[0000] MapToStruct: invalid field detected *device.Device1Properties.Bonded
found device: 40:22:D8:3B:ED:16 -59 ESP32
WARN[0000] MapToStruct: invalid field detected *device.Device1Properties.Bonded
connected to 40:22:D8:3B:ED:16
discovering services/characteristics
found service adaf0200-c332-42a8-93bd-25e905756cb8
found characteristic adaf0201-c332-42a8-93bd-25e905756cb8

@deadprogram
Copy link
Member

Hello @vlappa I would guess that the version of BlueZ installed on your Linux machine does not match version we are using for this package.

What kernel version/BlueZ version are your running?

@vlappa
Copy link
Author

vlappa commented Sep 15, 2023

Arch Linux:
bluez 5.69-1
6.1.38.12.realtime1-4-rt-lts
6.1.53-1

I think I got the same message on both.

@TirelessDev
Copy link
Contributor

Can confirm, I have had this pop up when playing around with Bluez configs. In my case, I was compiling 5.69 for a Raspberry Pi 4 and playing with the configuration to see if that fixed the Bluetooth connectivity issues I was having (it didn't). Reinstalling the original 5.55 that came with Raspbian cleared things up.

However, I believe what caused it was enabling experimental features in Bluez which I think added extra fields to its Device1 object that it registers on DBus thus the errors. They are harmless, but obviously not fun to see.

aykevl added a commit that referenced this issue Jan 3, 2024
This is a big rewrite to use DBus calls directly instead of going
through go-bluetooth first.

This is a big change, but I believe it is an improvement. While the
go-bluetooth works for many cases, it's a layer in between that I
believe hurts more than it helps. Without it, we can just program
directly against the BlueZ D-Bus API. The end result is about 10% more
code.

With this rewrite, I fixed the following issues:

  * All MapToStruct warnings are gone, like in
    #193.
  * Advertisements can be restarted after they were stopped. Previously
    this resulted in a panic.
  * Looking at the source code of go-bluetooth, it appears that it
    includes devices from a different Bluetooth adapter than the one
    that's currently scanning. This is fixed with the rewrite.
  * Fix a bug in Adapter.AddService where it would only allow adding a
    single service. Multiple services can now be added.
    This was actually the motivating bug that led me down to rewrite the
    whole thing because I couldn't figure out where the bug was in
    go-bluetooth (it's many layers deep).
  * The `WriteEvent` callback in a characteristic now also gets the
    'offset' parameter which wasn't provided by go-bluetooth.

This rewrite also avoids go-bluetooth specific workarounds like
#74 and
#121.

I have tested all examples in the smoketest-linux Makefile target. They
all still work with this rewrite.
aykevl added a commit that referenced this issue Jan 3, 2024
This is a big rewrite to use DBus calls directly instead of going
through go-bluetooth first.

This is a big change, but I believe it is an improvement. While the
go-bluetooth works for many cases, it's a layer in between that I
believe hurts more than it helps. Without it, we can just program
directly against the BlueZ D-Bus API. The end result is about 10% more
code.

With this rewrite, I fixed the following issues:

  * All MapToStruct warnings are gone, like in
    #193.
  * Advertisements can be restarted after they were stopped. Previously
    this resulted in a panic.
  * Looking at the source code of go-bluetooth, it appears that it
    includes devices from a different Bluetooth adapter than the one
    that's currently scanning. This is fixed with the rewrite.
  * Fix a bug in Adapter.AddService where it would only allow adding a
    single service. Multiple services can now be added.
    This was actually the motivating bug that led me down to rewrite the
    whole thing because I couldn't figure out where the bug was in
    go-bluetooth (it's many layers deep).
  * The `WriteEvent` callback in a characteristic now also gets the
    'offset' parameter which wasn't provided by go-bluetooth.

This rewrite also avoids go-bluetooth specific workarounds like
#74 and
#121.

I have tested all examples in the smoketest-linux Makefile target. They
all still work with this rewrite.
@aykevl
Copy link
Member

aykevl commented Jan 3, 2024

#216 fixes this issue by not using the code that causes these warnings.

deadprogram pushed a commit that referenced this issue Jan 3, 2024
This is a big rewrite to use DBus calls directly instead of going
through go-bluetooth first.

This is a big change, but I believe it is an improvement. While the
go-bluetooth works for many cases, it's a layer in between that I
believe hurts more than it helps. Without it, we can just program
directly against the BlueZ D-Bus API. The end result is about 10% more
code.

With this rewrite, I fixed the following issues:

  * All MapToStruct warnings are gone, like in
    #193.
  * Advertisements can be restarted after they were stopped. Previously
    this resulted in a panic.
  * Looking at the source code of go-bluetooth, it appears that it
    includes devices from a different Bluetooth adapter than the one
    that's currently scanning. This is fixed with the rewrite.
  * Fix a bug in Adapter.AddService where it would only allow adding a
    single service. Multiple services can now be added.
    This was actually the motivating bug that led me down to rewrite the
    whole thing because I couldn't figure out where the bug was in
    go-bluetooth (it's many layers deep).
  * The `WriteEvent` callback in a characteristic now also gets the
    'offset' parameter which wasn't provided by go-bluetooth.

This rewrite also avoids go-bluetooth specific workarounds like
#74 and
#121.

I have tested all examples in the smoketest-linux Makefile target. They
all still work with this rewrite.
@deadprogram
Copy link
Member

Now closing since 0.9.0 has been released. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants