Re: Serial Port connection with DBus API

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I don't feel I'm making progress on this so I've attached the output
from btmon in the hope that someone has the time to cast an eye over
it.

The values that are received into NewConnection are:
object device = /org/bluez/hci0/dev_64_BC_0C_F6_22_F8
 fd = 0
dict fd_properties = {}

if I do a os.isatty(fd) then I get returned True
if I do a os.ttyname(fd) then I get returned /dev/pts/0

That device is the terminal I'm running the Python code in and not the
serial port.

I feel like I'm missing something obvious but I can't spot it so any
suggestions would be welcome.

Thanks,
Barry


On 22 April 2017 at 21:46, Barry Byford <31baz66@xxxxxxxxx> wrote:
> On 22 April 2017 at 06:26, Johan Hedberg <johan.hedberg@xxxxxxxxx> wrote:
>> Hi Barry,
>>
>> On Fri, Apr 21, 2017, Barry Byford wrote:
>>> >> >             'Channel': GLib.Variant('i', 1),
>> ...
>>> However I'm now seeing this error appear in btmon when I try to bind
>>> to the RFCOMM socket:
>>>
>>> = bluetoothd: RFCOMM server failed for SerialPort: rfcomm_bind:
>>> Address already in use (98)
>>
>> I think that means that you already have some other service listening on
>> RFCOMM channel 1. Try using some other channel, or identify and stop the
>> other service that's using channel 1.
>
> Turns out it was me that was creating the other service. :-(
>
> Depending which order I bind to the socket or RegisterProfile, depends
> if I get the error in Bluetoothd or sockets.
>
> I can register the Serial Port profile successfully which allows me to
> connect from the (Bluedot) Android app and I can see information being
> sent to my Linux board in btmon. However I don't seem to be able to
> get at that information in my script.
>
> Looking at this a bit more, maybe the socket connection should be
> created from the 'fd' parameter passed to NewConnection. However when
> I try to get the socket with this:
>
> def NewConnection(self, path, fd, properties):
>   self.server_sock = socket.fromfd(fd, socket.AF_BLUETOOTH, socket.SOCK_STREAM,
>                                                        socket.BTPROTO_RFCOMM)
>   data = self.server_sock.recv(1024)
>
> It gives the following:
>
> Exception while handling org.bluez.Profile1.NewConnection()
> Traceback (most recent call last):
>   File "/usr/local/lib/python3.5/dist-packages/pydbus/registration.py",
> line 81, in call_method
>     result = method(*parameters, **kwargs)
>   File "BTclassic.py", line 67, in NewConnection
>     data = self.server_sock.recv(1024)
> OSError: [Errno 88] Socket operation on non-socket
>
> I had been following test/test-hfp as the basic structure but that
> doesn't seem to be working for me.
>
> Not sure where to go next with this

Attachment: btmon.log
Description: Binary data


[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux