thanhlev / keyboard_mouse_emulate_on_raspberry

Bluetooth Keyboard Mouse Emulator on Raspberry Pi
https://thanhlev.github.io/
MIT License
297 stars 103 forks source link

Address already in use #2

Closed ybonnamy closed 6 years ago

ybonnamy commented 6 years ago

Hi, I'd like to use the project but i keep getting this behaviour :

root@raspberrypi:~/src/BL_keyboard_RPI/server# python btk_server.py 
/usr/lib/python2.7/dist-packages/gtk-2.0/gtk/__init__.py:57: GtkWarning: could not open display
  warnings.warn(str(e), _gtk.Warning)
Setting up service
Setting up BT device
Configuring for name yBO_Keyboard
Configuring Bluez Profile
Reading service record
Profile registered 
Waiting for connections
Traceback (most recent call last):
  File "btk_server.py", line 226, in <module>
    myservice = BTKbService();
  File "btk_server.py", line 198, in __init__
    self.device.listen();
  File "btk_server.py", line 159, in listen
    self.scontrol.bind((self.MY_ADDRESS,self.P_CTRL))
  File "/usr/lib/python2.7/dist-packages/bluetooth/bluez.py", line 145, in bind
    return self._sock.bind (addrport)
_bluetooth.error: (98, 'Address already in use')

strace show that: bind(5, {sa_family=AF_BLUETOOTH, sa_data="\21\0\"\350q:\n\0\0\0\0\0"}, 14) = -1 EADDRINUSE (Address already in use)

i have tried to change the value of P_CTRL to something else than 17 but it does not help

if i understood correctly, the port 17 (0x0011) is also the attibute 0x0004 of the sdp service definition

root@raspberrypi:~/src/BL_keyboard_RPI/server# cat sdp_record.xml | grep -A 4 0x0004
        <attribute id="0x0004">
                <sequence>
                        <sequence>
                                <uuid value="0x0100" />
                                <uint16 value="0x0011" />

but i have currently no service using this port:

root@raspberrypi:~/src/BL_keyboard_RPI/server# sdptool browse --xml local | grep -A 4 0x0004
        <attribute id="0x0004">
                <sequence>
                        <sequence>
                                <uuid value="0x0100" />
                                <uint16 value="0x001f" />
--
        <attribute id="0x0004">
                <sequence>
                        <sequence>
                                <uuid value="0x0100" />
                                <uint16 value="0x001f" />
--
        <attribute id="0x0004">
                <sequence>
                        <sequence>
                                <uuid value="0x0100" />
                                <uint16 value="0x0017" />
--
        <attribute id="0x0004">
                <sequence>
                        <sequence>
                                <uuid value="0x0100" />
                                <uint16 value="0x0017" />

thx for your help.