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

socket.error: [Errno 107] Transport endpoint is not connected (Gentoo) #22

Open
dtony opened this issue Feb 12, 2014 · 38 comments
Open
Labels

Comments

@dtony
Copy link

dtony commented Feb 12, 2014

I got this error when trying to run ps4drv on Gentoo. The entire trace is :

ds4drv
[info][controller 1] Created devices /dev/input/js2 (joystick) /dev/input/event10 (evdev) 
[info][bluetooth] Scanning for devices
[info][bluetooth] Found device A4:15:66:6F:3B:A0
Traceback (most recent call last):
  File "/usr/bin/ds4drv", line 9, in <module>
    load_entry_point('ds4drv==0.3.0', 'console_scripts', 'ds4drv')()
  File "/usr/lib64/python2.7/site-packages/ds4drv/__main__.py", line 325, in main
    for device in backend.devices:
  File "/usr/lib64/python2.7/site-packages/ds4drv/backends/bluetooth.py", line 117, in devices
    device = self.find_device()
  File "/usr/lib64/python2.7/site-packages/ds4drv/backends/bluetooth.py", line 106, in find_device
    return BluetoothDS4Device.connect(bdaddr)
  File "/usr/lib64/python2.7/site-packages/ds4drv/backends/bluetooth.py", line 34, in connect
    return cls(addr, ctl_socket, int_socket)
  File "/usr/lib64/python2.7/site-packages/ds4drv/backends/bluetooth.py", line 41, in __init__
    super(BluetoothDS4Device, self).__init__(addr, "bluetooth")
  File "/usr/lib64/python2.7/site-packages/ds4drv/device.py", line 70, in __init__
    self.set_operational()
  File "/usr/lib64/python2.7/site-packages/ds4drv/backends/bluetooth.py", line 66, in set_operational
    self.set_led(255, 255, 255)
  File "/usr/lib64/python2.7/site-packages/ds4drv/device.py", line 82, in set_led
    self._control()
  File "/usr/lib64/python2.7/site-packages/ds4drv/device.py", line 75, in _control
    flash_led2=self._led_flash[1], **kwargs)
  File "/usr/lib64/python2.7/site-packages/ds4drv/device.py", line 130, in control
    self.write_report(report_id, pkt)
  File "/usr/lib64/python2.7/site-packages/ds4drv/backends/bluetooth.py", line 63, in write_report
    self.ctl_sock.sendall(hid + data)
  File "/usr/lib64/python2.7/socket.py", line 224, in meth
    return getattr(self._sock,name)(*args)
socket.error: [Errno 107] Transport endpoint is not connected

bluez version is 4.101

@chrippa
Copy link
Owner

chrippa commented Feb 12, 2014

Does this happen everytime you try to connect the controller or only sometimes?

@dtony
Copy link
Author

dtony commented Feb 12, 2014

It happens everytime. If you need any other information tell me.

@chrippa
Copy link
Owner

chrippa commented Feb 12, 2014

What kernel version, Python version and bluetooth dongle are you using?

@dtony
Copy link
Author

dtony commented Feb 13, 2014

$ uname -a
Linux obelix 3.10.25-gentoo #1 SMP Thu Feb 6 12:33:07 CET 2014 x86_64 AMD FX(tm)-8120 Eight-Core Processor AuthenticAMD GNU/Linux
$ python2.7 --version
Python 2.7.5
$ lsusb
Bus 002 Device 002: ID 0a5c:2101 Broadcom Corp. BCM2045 Bluetooth

The usb dongle is plugged on usb3 socket.
I have another dongle, will test with it.

Edit : It work fine with the other dongle :

Bus 002 Device 003: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)

Is there a need for bluetooth 4.0, because it work under windows with both dongles.

@petretRaf
Copy link

Exactly the same error here. Some news?

@chrippa
Copy link
Owner

chrippa commented Feb 13, 2014

Is there a need for bluetooth 4.0, because it work under windows with both dongles.

Well, what seems to be happening is that the connection to the device is instantly dropped. I have no idea why though, it could be due to incomplete or bad driver for your dongle in bluez.

You could try pairing it in bluez first (requires bluez 5.14) and then run ds4drv in hidraw mode (ds4drv --hidraw).

Exactly the same error here. Some news?

What bluetooth dongle, bluez version and kernel do you use?

@petretRaf
Copy link

$ uname -a
Linux laptop 3.11.0-15-generic #25-Ubuntu SMP Thu Jan 30 17:22:01 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
$ python --version
Python 2.7.5+
$ lsusb
Bus 001 Device 020: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)

bluez 5.14

@chrippa
Copy link
Owner

chrippa commented Feb 13, 2014

bluez 5.14

Since you use bluez 5.14, does pairing it normally work?

@petretRaf
Copy link

$ bluetoothctl
[bluetooth]# version
Version 5.14

And now for pairing normally how should i do?
[bluetooth]# pair + MAC?

edit: I get this : Device not available

@chrippa
Copy link
Owner

chrippa commented Feb 13, 2014

And now for pairing normally how should i do?

$ bluetoothctl -a
[bluetooth]# scan on
[bluetooth]# trust MAC
[bluetooth]# pair MAC

@petretRaf
Copy link

[bluetooth]# scan on No default controller available

@chrippa
Copy link
Owner

chrippa commented Feb 13, 2014

No default controller available

Try this:

[bluetooth]# show
[bluetooth]# select <MAC of bluetooth dongle>

@petretRaf
Copy link

[bluetooth]# show No default controller available

How can i set a default controller?

@chrippa
Copy link
Owner

chrippa commented Feb 13, 2014

[bluetooth]# show No default controller available

Ah, my bad, seems like I gave you wrong command, this is the correct command to show your controllers: [bluetooth]# list
Then do [bluetooth]# select <MAC of bluetooth dongle> to set the default controller.

@petretRaf
Copy link

[bluetooth]# list [bluetooth]# select 60:6c:66:5b:f9:c2 Controller 60:6c:66:5b:f9:c2 not available

List shows me nothing, and even with the MAC of my bluetooth dongle it doesn't set the default controller. I don't understand..

edit : I tried with 2 bluetooth dongles, 1 on USB, and 1 of my laptop

@chrippa
Copy link
Owner

chrippa commented Feb 13, 2014

That's odd, what is the output of hciconfig?

@petretRaf
Copy link

$ hciconfig hci0: Type: BR/EDR Bus: USB BD Address: 00:15:83:0C:BF:EB ACL MTU: 339:8 SCO MTU: 128:2 UP RUNNING PSCAN RX bytes:555 acl:0 sco:0 events:32 errors:0 TX bytes:385 acl:0 sco:0 commands:26 errors:0

and with my other dongle :

hci0: Type: BR/EDR Bus: USB BD Address: 60:6C:66:5B:F9:C2 ACL MTU: 310:10 SCO MTU: 64:8 UP RUNNING PSCAN RX bytes:589 acl:0 sco:0 events:34 errors:0 TX bytes:898 acl:0 sco:0 commands:33 errors:0

@chrippa
Copy link
Owner

chrippa commented Feb 13, 2014

Got no clue what could be wrong, I guess you could try a different bluetooth tool like gnome-bluetooth to do the pairing.

@petretRaf
Copy link

When i started ./configure for bluez 5.14, i get this error :
checking systemd system unit dir... configure: error: systemd system unit directory is required
So i had to launch ./configure --disable-systemd but the dbus daemon which is started automatically by systemd, is used to read settings and for PIN pairing. Do you think it could be my problem?

@chrippa
Copy link
Owner

chrippa commented Feb 14, 2014

Yes, if bluetoothd is not running it's probably not possible to pair. Perhaps you should check if there is a package available for your distro instead of building manually to make sure things are correctly setup on your system. If not, check if there is a init script in /etc/init.d/ to start the daemon.

@mtorromeo
Copy link
Contributor

I just experienced the "Transport endpoint is not connected" error.
I have 2 dongles. The first one works fine and it's a bluetooth 4.0 usb dongle.
The second one gives me the transport error and it's a bluetooth 2.0 usb dongle.

The fact is that standard pairing is also problematic because it asks for a PIN, which does not happen to be necessary with the other device.

I managed to pair it using bluetoothctl after enabling the agent:

[bluetooth]# scan on
[bluetooth]# trust MAC
[bluetooth]# agent on
[bluetooth]# pair MAC
Request PIN code
[agent] Enter PIN code: 0000

And then "ds4drv --hidraw" worked fine.

Recap:

  • Without the "agent on" command, pair fails with "Failed to pair: org.bluez.Error.AuthenticationRejected" with the bluetooth 2 dongle.
  • The agent/pin steps are not necessary with the bluetooth 4 dongle.

@petretRaf
Copy link

I tried pairing my DS4 with bluez-simple-agent hci0 MAC, but i get this error :
Creating device failed: org.bluez.Error.ConnectionAttemptFailed: Page Timeout.

@mtorromeo
Copy link
Contributor

I was using bluez 5.14, I don't know about bluez 4

@chrippa
Copy link
Owner

chrippa commented Feb 14, 2014

I've pushed f3db91b which will make sure we don't crash when this happens, and will attempt to retry the connection. I don't think that will help much though, since it seems like our way of connecting directly to the DS4 without pairing only works on some dongles.

For the record, the bluetooth dongle I'm using is built into my motherboard (Asus P8Z68-V) and is v2.1. It seems like 2.0 dongles have issues, but might work if paired in bluez 5.14 as @mtorromeo describes.

@petretRaf
Copy link

It's now working!!! Thanks, i don't know why i can't do the pairing/connection with bluetoothctl, but with this last commit i don't have the socket.error anymore!

edit: after starting ds4drv a second time, i get the socket.error again ... T_T

@nr1971
Copy link

nr1971 commented Feb 15, 2014

I've got this error a few times now as well. I'm on Ubuntu 13.10 x64 with bluez 4 and using a broadcom BCM2046B1 2.0 dongle. I'm running the driver in raw bluetooth mode and everything works fine. While I haven't figured out a way to reliably reproduce it I did find a way to get past the error by running blueman (bluetooth-manager) and deleting the wireless controller from the devices list. After that I can connect as usual. My laptop also has built-in bluetooth and a couple times I've seen the controller show up in the device list for the internal bluetooth as well. Again deleting it from the list of devices and trying to reconnect always results in success.

@chrippa
Copy link
Owner

chrippa commented Feb 15, 2014

Again deleting it from the list of devices and trying to reconnect always results in success.

Sounds like bluetoothd might be interfering somehow, try killing it and see if it helps.

@chrippa chrippa added the bug label Mar 2, 2014
@bluejorts
Copy link

I've solved this error, at least on Arch Linux ARM (running on a Raspberry Pi). I had to restart the bluetooth service, then go into bluetoothctl and power on the device. Commands are below.

systemctl restart bluetooth
systemctl enable bluetooth
bluetoothctl
power on
exit
ds4drv

@bakkerthehacker
Copy link

I also have this issue. Following the instructions here i got it work on Linux Mint 17 using the command

bluez-simple-agent hci0 <my ds4 mac> remove

it prints out Creating device failed: org.bluez.Error.ConnectionAttemptFailed: Page Timeout but it still works

@Ape
Copy link
Collaborator

Ape commented Jul 12, 2015

Suddenly this problem started to occur for me. I fixed this with bluetoothctl and "remove MAC".

@Wayne-Twinborn
Copy link

To add, on a raspberry pi it worked fine until I added a line to rc.local to run it silently at boot. Even after removing the single line from the script, this issue is still persisting.

The pi is running a modified version of debian with all the core functions of the OS in tact.

Here's the output

pi@raspisan ~ $ sudo ds4drv
[info][controller 1] Created devices /dev/input/js0 (joystick) /dev/input/event1 (evdev)
[info][bluetooth] Scanning for devices
[info][bluetooth] Found device AC:FD:93:01:89:03
[error][bluetooth] Unable to connect to detected device: Failed to set operational mode: [Errno 107] Transport endpoint is not connected
[info][bluetooth] Scanning for devices
[info][bluetooth] Found device AC:FD:93:01:89:03
[error][bluetooth] Unable to connect to detected device: Failed to set operational mode: [Errno 107] Transport endpoint is not connected
[info][bluetooth] Scanning for devices  

It loops at that point for as long as the controller is in pair mode. The above was on a single pairing attempt.

@Forsok
Copy link

Forsok commented Aug 20, 2015

I had the same problem, after i paired the controller with my PS4.
bluez-test-device remove xx:xx:xx:xx:xx:xx
worked for me.

@Ape
Copy link
Collaborator

Ape commented Aug 31, 2015

If the bluetoothctl trick doesn't work, make sure that you have bluetooth.service running on systemd (if you are using systemd).

@apryamostanov
Copy link

Forsok, many thanks.
PS4 controller has some issue.
bluez-test-device remove xx:xx:xx:xx:xx:xx
helped.

@rodrigo-ceccato
Copy link

Any updates? Having the same issue on Fedora 32 (Tranposrt endpoint is not connected)

@maxie7
Copy link

maxie7 commented Dec 3, 2020

bluez-test-device remove xx:xx:xx:xx:xx:xx doesn't help;
With sudo apt-cache search bluez-test i found and installed bluez-test-scripts && bluez-test-tools, but I have the same result
'command not found'...

sudo ds4drv
[info][controller 1] Created devices /dev/input/js0 (joystick) /dev/input/event15 (evdev)
[info][bluetooth] Scanning for devices
[info][bluetooth] Found device A4:53:85:A6:17:E6
[error][bluetooth] Unable to connect to detected device: Failed to set operational mode: [Errno 107] Transport endpoint is not connected
[info][bluetooth] Scanning for devices
[info][bluetooth] Found device A4:53:85:A6:17:E6

@maxie7
Copy link

maxie7 commented Dec 3, 2020

I've read a lot of docs && I suppose that it's due to bluetooth dongle... It has bluetooth 2.1

@rodrigo-ceccato
Copy link

Yep... I upgraded my bluetooth dongle (it was from 2007) yesterday, and now everything works fine...

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