Re: Serial Port connection with DBus API

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

 



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
--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[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