I am attempting to work with the org.bluez.Profile1 in BlueZ 5.44. When connecting with a new device via the NewConnection DBus method, we get a file descriptor to work with. I am fairly confused on what state this file descriptor is in, and what I need to do in order to read/write from it. Simply calling read/write does not behave as expected for me.

In the file test/test-profile, I see this line of python code:

self.fd = fd.take()

I am struggling to find the Linux C equivalent to the take method. Any advice on how to configure this fd in C code so I can read/write with the fd would be very helpful!



My issue ended up being with the gdbus-codegen tool I was using. When using that tool, each fd parameter is actually an index to a GUnixFDList (documentation on that object here). In order to have the GUnixFDList passed with the method NewConnection, I had to annotate the method in xml as org.gtk.GDBus.C.UnixFD. Annotation documentation can be found here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.