chrippa / ds4drv Goto Github PK
View Code? Open in Web Editor NEWA Sony DualShock 4 userspace driver for Linux
License: MIT License
A Sony DualShock 4 userspace driver for Linux
License: MIT License
Many games require Xbox360 controller. ds4drv has --emulate-xpad to emulate one, but some games don't work with that. xboxdrv is another driver that can emulate Xbox360 controllers. The games are working with xboxdrv (with DualShock4 + BlueZ).
Seems that xboxdrv provides some additional interfaces or is in some way more compatible compared to ds4drv. xboxdrv is open source so it should be possible to track down what is missing.
I'd like to use ds4drv instead of BlueZ + xboxdrv because ds4drv has many useful DualShock 4 specific features and is very easily customized.
Games that expect Xbox360 controller and work with ds4drv --emulate-xpad (and with xboxdrv):
Games that expect Xbox360 controller but only work with xboxdrv:
When I run Kodi (15.1 Isengard) first, then run ds4drv it crashes Kodi.
When I run ds4drv first, then Kodi won't start (immidietly crashes).
I've found an issue on Kodi project: #15826 it's quite old (7 months) and it seems has not received any attention. Is it possible the problem is on ds4drv side?
If you need any more info, just ask, ill try to deliver any logs/info necessary.
pi@openbot ~ $ sudo ds4drv --led 0055ff
[info][Controller 1] Created devices /dev/input/js0 (joystick) /dev/input/event0 (evdev)
[info][Bluetooth] Scanning for devices
[info][Bluetooth] Found device XX:XX:XX:XX:XX:XX
[info][Controller 1] Connected to XX:XX:XX:XX:XX:XX
[info][Bluetooth] Scanning for devices
[warning] Got simplified HID report, ignoring
Exception in thread Thread-1:
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 552, in __bootstrap_inner
self.run()
File "/usr/lib/python2.7/threading.py", line 505, in run
self.__target(_self.__args, *_self.__kwargs)
File "/usr/local/lib/python2.7/dist-packages/ds4drv.py", line 909, in read_device
for report in device.reports:
File "/usr/local/lib/python2.7/dist-packages/ds4drv.py", line 608, in reports
report = self.read_report()
File "/usr/local/lib/python2.7/dist-packages/ds4drv.py", line 576, in read_report
S16LE.unpack(buf[16:18])[0],
error: unpack requires a string argument of length 2
But the led is blue :)
Can someone tell me how to fix?
$ ds4drv Traceback (most recent call last): File "/usr/local/bin/ds4drv", line 9, in <module> load_entry_point('ds4drv==0.5.0', 'console_scripts', 'ds4drv')() File "build/bdist.linux-x86_64/egg/ds4drv/__main__.py", line 151, in main File "build/bdist.linux-x86_64/egg/ds4drv/__main__.py", line 120, in create_controller_thread File "build/bdist.linux-x86_64/egg/ds4drv/__main__.py", line 35, in __init__ File "build/bdist.linux-x86_64/egg/ds4drv/__main__.py", line 93, in load_options File "build/bdist.linux-x86_64/egg/ds4drv/__main__.py", line 38, in fire_event File "build/bdist.linux-x86_64/egg/ds4drv/eventloop.py", line 86, in fire_event File "build/bdist.linux-x86_64/egg/ds4drv/eventloop.py", line 92, in process_events File "build/bdist.linux-x86_64/egg/ds4drv/actions/input.py", line 79, in load_options File "build/bdist.linux-x86_64/egg/ds4drv/uinput.py", line 425, in create_uinput_device File "build/bdist.linux-x86_64/egg/ds4drv/uinput.py", line 234, in __init__ File "build/bdist.linux-x86_64/egg/ds4drv/uinput.py", line 290, in create_device File "/usr/local/lib/python2.7/dist-packages/evdev/uinput.py", line 107, in __init__ _uinput.create(self.fd, name, vendor, product, version, bustype, absinfo) IOError: [Errno 22] Invalid argument
I've been attempting to configure ds4drv, but have hit a snag regarding hidraw/USB connectivity and the 'NoneType' object has no attribute '...'
Python exception. The exception occurs when attempting to switch away from either of the mame
or snes
profiles. I've tried updating to the current development version of ds4drv, as well as performing a bit of debugging myself: trying emulate-xpad = false
in the two profiles on the supposition it may have been carried over from the xpad profile, and going so far as to modify actions/input.py
in an attempt to bypass the thrown exception - to no avail. Please see the relevant details below.
Linux atla 3.11.0-12-generic #19-Ubuntu SMP Wed Oct 9 16:20:46 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
[ds4drv]
#daemon = true
hidraw = true
[bindings]
PS+Up = exec-background xdotool key XF86AudioRaiseVolume
PS+Down = exec-background xdotool key XF86AudioLowerVolume
PS+Left = prev-profile
PS+Right = next-profile
[controller:1]
battery-flash = true
led = ffffff
profiles=xpad,mame,snes
[profile:xpad]
led = 071f07
emulate-xpad = true
[profile:mame]
led = 1f1f07
mapping = mame
[profile:snes]
led = 1f071f
mapping = snes
[mapping:mame]
KEY_UP = dpad_up
KEY_DOWN = dpad_down
KEY_LEFT = dpad_left
KEY_RIGHT = dpad_right
KEY_LEFTCTRL = button_cross
KEY_LEFTALT = button_circle
KEY_SPACE = button_square
KEY_LEFTSHIFT = button_triangle
KEY_1 = button_options
KEY_5 = button_share
[mapping:snes]
KEY_UP = dpad_up
KEY_DOWN = dpad_down
KEY_LEFT = dpad_left
KEY_RIGHT = dpad_right
KEY_Z = button_cross
KEY_X = button_circle
KEY_A = button_square
KEY_S = button_triangle
KEY_D = button_l1
KEY_C = button_r1
KEY_APOSTROPHE = button_share
KEY_ENTER = button_options
ds4drv >/tmp/ds4drv.log 2>&1
[info][controller 1] Created devices /dev/input/js2 (joystick) /dev/input/event15 (evdev)
[info][controller 1] Connected to USB Controller (1C:66:6D:0D:09:81 hidraw0)
[info][hidraw] Scanning for devices
[info][controller 1] Battery: Fully charged
[info][controller 1] Switching to profile: xpad
[info][controller 1] Switching to profile: mame
[info][controller 1] Switching to profile: snes
[error][controller 1] Failed to execute action: 'NoneType' object has no attribute 'close'
Traceback (most recent call last):
File "/usr/local/bin/ds4drv", line 9, in <module>
load_entry_point('ds4drv==0.5.0', 'console_scripts', 'ds4drv')()
File "/usr/local/lib/python2.7/dist-packages/ds4drv-0.5.0-py2.7.egg/ds4drv/__main__.py", line 154, in main
for device in backend.devices:
File "/usr/local/lib/python2.7/dist-packages/ds4drv-0.5.0-py2.7.egg/ds4drv/backends/hidraw.py", line 148, in devices
for hidraw_device in itertools.chain(existing_devices, future_devices):
File "/usr/local/lib/python2.7/dist-packages/ds4drv-0.5.0-py2.7.egg/ds4drv/backends/hidraw.py", line 127, in _get_future_devices
for device in iter(monitor.poll, None):
File "/usr/local/lib/python2.7/dist-packages/pyudev/monitor.py", line 340, in poll
rlist, _, _ = select.select([self], [], [], timeout)
KeyboardInterrupt
--- ds4drv/actions/input.py 2014-06-22 00:39:46.841204526 -0400
+++ /usr/local/lib/python2.7/dist-packages/ds4drv-0.5.0-py2.7.egg/ds4drv/actions/input.py 2014-06-22 00:26:13.545201662 -0400
@@ -72,7 +72,8 @@
self.mouse = None
if self.joystick and self.joystick_layout != joystick_layout:
- self.joystick.device.close()
+ if self.joystick.device is not None:
+ self.joystick.device.close()
joystick = create_uinput_device(joystick_layout)
self.joystick = joystick
elif not self.joystick:
Trackpad works greatly as a mouse, but in some situations I would like to use an analog stick as a mouse.
Currently, this can be done using either of these mappings:
REL_X = left_analog_x
ABS_X = left_analog_x
However, they control the cursor only when I move the analog stick. I would like to have a mapping option that continuously moves mouse when I am holding an analog stick outside the center.
Relative analog mouse movement needs to be applied with constant intervals, not when the device reports are emitted. There is some jitter on the device report frequency, especially when the controller is not close to the bluetooth receiver or there is something blocking the signal. This is not an issue with button presses as the delay and jitter are really small, but it is noticable when using relative analog stick mouse mappings.
So, I think we need a separate timer for emitting the relative analog mouse movements.
In addition, related to this issue, I think it would be useful to see some information about the device report frequency and jitter. Technically collecting this data shouldn't be very hard. The raw statistics could be shown with --dump-reports
and some signal quality information could be shown always.
I am writing a driver for ds4 on node.js. Do you have any byte sequence reference?
If I use the example .conf file and enable profile switching, I see that it toggles through an xpad, kbmouse, and default profile. I never created the default one, and the profile switching has only been specified for xpad and the kbmouse one with a profiles = xpad,kbmouse
.
Here's my issue: I use hidraw mode on Arch Linux, which is fine because BlueZ is new enough. My main problem is that, when paired over bluetooth, 2 controllers are created by the system. Here is Dolphin Emulator's controller configuration page using raw bluetooth mode:
and under hidraw mode:
Now, this may not seem to be an issue, but in Borderlands 2, it crashes the entire game. Yup. Pretty bad bug, and I much prefer hidraw mode (by the way, you should submit a kernel patch for led support when you get the chance). I'll see if I can find a workaround for Borderlands, but the long term solution would be to solve this double controller nonsense. Yay linux.
Full Output:
"
hila@Hila:~$ sudo ds4drv --hidraw
[info][controller 1] Created devices /dev/input/js1 (joystick) /dev/input/event11 (evdev)
[info][controller 1] Connected to USB Controller (1C:66:6D:42:A1:A6 hidraw3)
[info][hidraw] Scanning for devices
[info][controller 1] Battery: 45%
[info][controller 1] Battery: 54%
"
What can it be? Suggestions?
Thanks a lot!
When using the controller in keyboard mode, the typematic repeat rate only applies to X11 sessions. When switching to console, the keys work, but no repeat occurs (and I haven't found a way to change this strange behavior yet). As far as I can tell, the keycodes for key press and release events are communicated properly (as diagnosed with the command line utility showkey
).
Any ideas whether this is a ds4drv or a kernel issue and, more importantly, how to fix it?
[parker@lenovo ~]$ sudo ds4drv
Traceback (most recent call last):
File "/usr/bin/ds4drv", line 9, in <module>
load_entry_point('ds4drv==0.5.0', 'console_scripts', 'ds4drv')()
File "/usr/lib/python3.5/site-packages/ds4drv/__main__.py", line 132, in main
options = load_options()
File "/usr/lib/python3.5/site-packages/ds4drv/config.py", line 199, in load_options
config.load(path)
File "/usr/lib/python3.5/site-packages/ds4drv/config.py", line 74, in load
self.read([filename])
File "/usr/lib/python3.5/configparser.py", line 697, in read
self._read(fp, filename)
File "/usr/lib/python3.5/configparser.py", line 1090, in _read
fpname, lineno)
configparser.DuplicateOptionError: While reading from '/etc/ds4drv.conf' [line 118]: option 'rel_wheelup' in section 'mapping:keyboard' already exists
The ds4drv.conf that comes with git has the options duplicated on line 118
I tried running ds4drv but I get this error. Eventhought bluetooth finds the controller and steam even recognizes it already.
Traceback (most recent call last):
File "/usr/local/bin/ds4drv", line 9, in <module>
load_entry_point('ds4drv==0.5.0', 'console_scripts', 'ds4drv')()
File "build/bdist.linux-x86_64/egg/ds4drv/__main__.py", line 151, in main
File "build/bdist.linux-x86_64/egg/ds4drv/__main__.py", line 120, in create_controller_thread
File "build/bdist.linux-x86_64/egg/ds4drv/__main__.py", line 35, in __init__
File "build/bdist.linux-x86_64/egg/ds4drv/__main__.py", line 93, in load_options
File "build/bdist.linux-x86_64/egg/ds4drv/__main__.py", line 38, in fire_event
File "build/bdist.linux-x86_64/egg/ds4drv/eventloop.py", line 86, in fire_event
File "build/bdist.linux-x86_64/egg/ds4drv/eventloop.py", line 92, in process_events
File "build/bdist.linux-x86_64/egg/ds4drv/actions/input.py", line 79, in load_options
File "build/bdist.linux-x86_64/egg/ds4drv/uinput.py", line 425, in create_uinput_device
File "build/bdist.linux-x86_64/egg/ds4drv/uinput.py", line 234, in __init__
File "build/bdist.linux-x86_64/egg/ds4drv/uinput.py", line 290, in create_device
File "/usr/local/lib/python2.7/dist-packages/evdev/uinput.py", line 107, in __init__
_uinput.create(self.fd, name, vendor, product, version, bustype, absinfo)
IOError: [Errno 22] Invalid argument
Previously ds4drv
worked correctly with python-evdev
0.5.0. I upgraded python-evdev
to version 0.6.0 and now ds4drv
fails on start with this:
Traceback (most recent call last):
File "/bin/ds4drv", line 9, in <module>
load_entry_point('ds4drv==0.5.0', 'console_scripts', 'ds4drv')()
File "/usr/lib/python3.5/site-packages/ds4drv/__main__.py", line 374, in main
thread = create_controller_thread(index + 1, controller_options)
File "/usr/lib/python3.5/site-packages/ds4drv/__main__.py", line 343, in create_controller_thread
controller = DS4Controller(index, controller_options, dynamic=dynamic)
File "/usr/lib/python3.5/site-packages/ds4drv/__main__.py", line 59, in __init__
self.load_options(self.options)
File "/usr/lib/python3.5/site-packages/ds4drv/__main__.py", line 117, in load_options
self.fire_event("load-options", options)
File "/usr/lib/python3.5/site-packages/ds4drv/__main__.py", line 62, in fire_event
self.loop.fire_event(event, *args)
File "/usr/lib/python3.5/site-packages/ds4drv/eventloop.py", line 70, in fire_event
self.process_events()
File "/usr/lib/python3.5/site-packages/ds4drv/eventloop.py", line 75, in process_events
callback(*args)
File "/usr/lib/python3.5/site-packages/ds4drv/actions.py", line 282, in load_options
joystick = create_uinput_device(joystick_layout)
File "/usr/lib/python3.5/site-packages/ds4drv/uinput.py", line 363, in create_uinput_device
device = UInputDevice(mapping)
File "/usr/lib/python3.5/site-packages/ds4drv/uinput.py", line 227, in __init__
self.create_device(layout)
File "/usr/lib/python3.5/site-packages/ds4drv/uinput.py", line 268, in create_device
product=layout.product, version=layout.version)
File "/usr/lib/python3.5/site-packages/evdev/uinput.py", line 107, in __init__
_uinput.create(self.fd, name, vendor, product, version, bustype, absinfo)
SystemError: Objects/longobject.c:403: bad argument to internal function
I didn't want to put this as a bug but I am trying to get more info on this issue. I got ds4drv working in steamos but I'm noticing a little bit of input lag. It isn't a ton but it does affect usability when compared with having the controller hooked up through usb. Is this noticeable for others?
I could only get it to work when not in hidraw mode. Would having hidraw mode working improve upon this?
I'm not very familar with systemd, so please close this if appropriate.
ds4drv.service often fails to start, despite having the proper bluetooth dependencies in the .service file. I'm not sure whats causing it, but I was able to get it working by changing the
Restart=on-abort
to
Restart=on-failure
I know it shouldn't have to restart at all, so this is not really a fix. I was thinking maybe there is something else that needs to start before ds4drv.service can load correctly, but I'm not completely sure how to figure out what.
This project has been dead for some time now, but I'd like to rescue it. I'll start this by merging two important pull requests (#72 and #65) and making a new release.
In addition to these fixes there are many issues and pull requests that have been forgotten. Some of them have been closed due to inactivity. Please bring up any issues or pull requests that you think are still relevant and we'll review them.
This really irks me with both the official linux 3.15 kernel driver and this driver. Custom mapping in some games is pretty much impossible to do correctly since the trigger button is activated as soon as the trigger axis is past 0%, while the axis mapping generally requires much more movement before it's detected for mapping (Steam Big Picture shows this, not that it matters in this app but still).
If the Xbox 360 controller is mapped that way then it's sort of alright, but it's super annoying in games that I want to or have to have custom mapping on.
When I rotate the controller forward or backward it makes up/down (sometimes also left and right) inputs on the dpad. This is extremely annoying and I would like to turn this "feature" off, if it is one. The only way to stop it is to use the emulate-xpad mode, which isn't favorable (goodbye PS4 specific icons and L3/R3 buttons). I connect the controller through USB in hidraw mode.
There are cases where it would be useful to bind an axis to a button. Examples include games such as Urban Terror and Minecraft, where switching weapons and items is bound to mousewheel up and down. Mapping the mousewheel to the joysticks would not be ideal since you would want the joysticks for movement and controlling the camera. It would be a good feature to be able to map the wheel axis to buttons.
I've tested with Rogue Legacy, Hotline Miami, Nuclear Throne, and Risk of Rain. Rogue Legacy and Hotline Miami receive input without ds4drv running but don't when it is running. Nuclear Throne and Risk of Rain don't receive input whether ds4drv is running or not.
I'm using hidraw with the controller connected with USB, using the default config.
I have tried all three emulation options.
I checked all buttons and analogue controls with --dump-reports and they were all functioning.
Edit: Actually, Hotline Miami seems to work with ds4drv if I select joystick handle 1 in the initial dialog. The mapping is off but emulate-xpad fixes it.
every time I install i can't get it to install. This is what i get when I run the command.
$ ds4drv
[error][controller 1] Failed to create input device: "/dev/uinput" cannot be opened for writing
[info][bluetooth] Scanning for devices
please help and thank you.
It connected, but ignored my configuration ( in /etc/), then crashed after trying to launch Steam Big Picture.
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 810, in __bootstrap_inner
self.run()
File "/usr/lib/python2.7/threading.py", line 763, in run
self.__target(*self.__args, **self.__kwargs)
File "build/bdist.linux-x86_64/egg/ds4drv/__main__.py", line 132, in run
self.loop.run()
File "build/bdist.linux-x86_64/egg/ds4drv/eventloop.py", line 102, in run
callback()
File "build/bdist.linux-x86_64/egg/ds4drv/__main__.py", line 119, in read_report
report = self.device.read_report()
File "build/bdist.linux-x86_64/egg/ds4drv/backends/bluetooth.py", line 47, in read_report
ret = self.int_sock.recv_into(self.buf)
error: [Errno 110] Connection timed out
The joystick device lingered for a bit, and will stay a phantom device if I dont wait for it to dissapear before restarting ds4drv.
Upon restart, the controller connects and understands the config.
It would be nice if we could define keystrokes like:
KEY_LEFTSHIFT+KEY_UP = button_l1
To further this line of thinking it would be really, really great if we could define whole macros:
KEY_V,DELAY(500),KEY_1 = button_r2
...and with button combinations on the other side as well:
KEY_LEFTSHIFT+KEY_TAB = button_l3+button_r3
I have some research to be able playing audio on DS4.
Audio data send by opcode 0x14, 0x15, 0x17, 0x19.
And code by SBC audio codec.
I used this python script to wrap the audio data
play.py
This script takes the SBC audio data and send it to DS4
You can use gstreamer to prepare audio data.
gst-launch-1.0 -q audiotestsrc ! sbcenc ! 'audio/x-sbc,channels=2,rate=32000,channel-mode=dual,blocks=16,subbands=8,bitpool=25' ! queue ! fdsink | ./play.py
But there is a small problem, periodically occur stuttering.
But it may be caused by improper operation with HID device.
I hope this helps to add audio support.
Installation fails with this error:
Command "/usr/bin/python -c "import setuptools, tokenize;file='/tmp/pip-build-jK6NYC/evdev/setup.py';exec(compile(getattr(tokenize, 'open', open)(file).read().replace('\r\n', '\n'), file, 'exec'))" install --record /tmp/pip-o3VBQV-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-jK6NYC/evdev
It seems like it might be a compiler error but i don't know how to proceed
Hi
anyone else is getting this issue? any idea?
Dist: Debian 3.2.63-2+deb7u1
hw: Intel Corporation Centrino Wireless-N 1030
driver: iwlwifi
Analog controllers have inherit incorrectness that require calibration. This varies from device to device, so it should be user configurable. Calibration includes setting the minimum, maximum, center and deadzone values for axes.
Currently calibration parameters can be modified on the Python code (axes_options
on uinput.py
), but not with the configuration file. I also believe that this calibration should not be done per mapping but per device (or per configuration file since most users only have one controller). The calibration should be applied before any further mappings or other input logic is processed.
In addition the default deadzone for axes should be lowered from 15 to 5 (or even as low as 3 or 4). DualShock 4 is a really good controller in terms of deadzones, so we should not waste that quality.
[info][Controller 1] Created devices /dev/input/js0 (joystick) /dev/input/event0 (evdev)
[info][Bluetooth] Scanning for devices
[info][Bluetooth] Found device XX:XX:XX:XX:XX:XX
[warning][Bluetooth] Unable to connect to detected device: [Errno 13] Permission denied
hi , i was testing this driver on Raspberry Pi , and i can't connect the controller because an socket error (i think) is returned.
In find_devices()
except socket.error as err:
Daemon.warn("Unable to connect to detected device: {0}", err,
subprefix=BLUETOOTH_LOG)
do you know how upgrade permission for socket ?
When any buttons are pressed, it looks like the hat values are returning to 0. The dpad essentially goes to center when any buttons are pressed. Analog axis work as expected.
Current functionality:
When using the "emulate-xpad" option in the [Controller:1] section, ds4drv will create a virtual /dev/input/js* device. When switching to the [Keyboard] profile, however, this virtual device dissapears. It will re-appear when switching back, as expected.
Feature request:
It would be nice to keep this virtual js device, even when switching to a keyboard/mouse profile. This is because in some games, they lose joystick control if the joystick device dissapears temporarily. (These are often the same games that do not support "hot-pluggin" of joysticks). For this reason, it's impossible to switch over to the keyboard profile for a moment and then switch back. I think it would be helpful if the virtual js device would remain in these cases.
Thanks for all your work on this!
I am using a brand new DualShock 4 controller and my motherboard's built in Bluetooth (not a plug-in dongle). By simply pairing the DS4 controller in the Linux desktop, I can get very basic functionality. I would like to use the touchpad and mouse emulation and to the best of my knowledge, ds4drv is the only way to do that.
When trying to connect my DS4 controller using ds4drv, I receive the Errno 107 "Transport endpoint is not connected'. I am using the SteamOS Beta branch with Bluez 5.36.
Correct me if I am wrong but based on the documentation, it would appear ds4drv has never been tested without using a plug-in dongle.
I have four profiles setup in my ds4drv.conf, default, xpad, xpad-wireless and desktop. I have assigned a combo of R1+L1+RIGHT for cycling forward and R1+L1+LEFT for going back. If I cycle to my "desktop" profile, which has the keyboard and mouse mapped to the controller, I'm unable to change back to the other profiles. In my desktop profile I have BTN_EXTRA = R1, BTN_SIDE = L1 and BTN_LEFT = dpad_left. So maybe the driver is not picking up the combo to change profiles because of those mappings?
[info][bluetooth] Scanning for devices
[info][bluetooth] Found device A4:15:66:BF:CF:98
[info][controller 1] Connected to Bluetooth Controller (A4:15:66:BF:CF:98)
[info][bluetooth] Scanning for devices
[info][controller 1] Battery: 12%
Traceback (most recent call last):
File "/usr/local/bin/ds4drv", line 9, in
load_entry_point('ds4drv==0.4.3', 'console_scripts', 'ds4drv')()
File "/usr/local/lib/python2.7/dist-packages/ds4drv/main.py", line 427, in main
for device in backend.devices:
File "/usr/local/lib/python2.7/dist-packages/ds4drv/backends/bluetooth.py", line 126, in devices
device = self.find_device()
File "/usr/local/lib/python2.7/dist-packages/ds4drv/backends/bluetooth.py", line 112, in find_device
for bdaddr, name in self.scan():
File "/usr/local/lib/python2.7/dist-packages/ds4drv/backends/bluetooth.py", line 106, in scan
devices.append((bdaddr.decode("ascii"), name.decode("ascii")))
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 15: ordinal not in range(128)
Exception in thread Thread-1 (most likely raised during interpreter shutdown):
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 551, in bootstrap_inner
File "/usr/lib/python2.7/threading.py", line 504, in run
File "/usr/local/lib/python2.7/dist-packages/ds4drv/__main.py", line 206, in read_device
File "/usr/local/lib/python2.7/dist-packages/ds4drv/device.py", line 220, in reports
File "/usr/local/lib/python2.7/dist-packages/ds4drv/backends/bluetooth.py", line 56, in read_report
<type 'exceptions.TypeError'>: 'NoneType' object is not callable
patryk@patryk-laptop:$ ^C$ ^C
patryk@patryk-laptop:
patryk@patryk-laptop:~$
It installs fine but I recieve this error when launching ds4drv http://imgur.com/43N9R5D (using Python 2.7-dev)
I think it has something to do with the packages I have? Though I did install all the dependencies, any ideas?
When using the hidraw mode, ds4drv grabs the original joystick device (provided by the kernel drivers) and creates a new device. The original device is still present for the rest of the system, but it is disabled. Seems like the original device is causing problems. -@Ape
As above. Running either minecraft 1.7.10 with liteloader installed or FEZ from steam with this running causes a hang in both, and both remain hung until ds4drv is killed. Immediatly after running systemctl stop ds4drv.service
both resume function, while the latter, even if I kill all steam and such processes continues to run in D state
, and will not even respond to SIGKILL, but once I disable it it kills off properly.
Hi,
I use ubuntu 14.04 with bluez 5.18 and bluetooth 2.0 and bluetooth 2.1 adapters to test your program. I work really well in normal mode, but nothing happens in hidraw mode, any ideas ?
PS: Note that when I pair the remote in Ubuntu using the bluetooth manager, the remote gets disconnected shortly after the pairing, I don't know if this is normal.
Here is the normal output:
[info][controller 1] Created devices /dev/input/js0 (joystick) /dev/input/event16 (evdev)
[info][bluetooth] Scanning for devices
[info][bluetooth] Found device A4:15:66:88:5E:9A
[info][controller 1] Connected to Bluetooth Controller (A4:15:66:88:5E:9A)
[info][bluetooth] Scanning for devices
[info][controller 1] Battery: Fully charged
Hidraw mode:
[info][controller 1] Created devices /dev/input/js0 (joystick) /dev/input/event16 (evdev)
[info][hidraw] Scanning for devices
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
Hi,
I am using a Raspberry Pi3 with internal Bluetooth and RetroPie 3.6 installed. After installation as described in http://blog.petrockblock.com/forums/topic/tutorial-retropie-with-dualshock-4-and-bluetooth/
I can pair the Dualshock 4 controller, but I am having major lags compared to connecting it via USB. Here is the output which also confirms the lag by [warning][controller 1] Signal strength is low (21 reports/s)
pi@retropie:~ $ ds4drv --led 000008
[info][controller 1] Created devices /dev/input/js0 (joystick) /dev/input/event0 (evdev)
[info][bluetooth] Scanning for devices
[info][bluetooth] Found device D0:27:88:5F:36:15
[info][controller 1] Connected to Bluetooth Controller (D0:27:88:5F:36:15)
[info][bluetooth] Scanning for devices
[info][controller 1] Battery: 37%
[warning][controller 1] Signal strength is low (15 reports/s)
[warning][controller 1] Signal strength is low (21 reports/s)
[warning][controller 1] Signal strength is low (19 reports/s)
[info][controller 1] Battery: 25%
[warning][controller 1] Signal strength is low (26 reports/s)
Is there something I could do in order to increase the signal strength?
With the hid-sony kernel module adding better support for this device into the kernel itself, is this still relevant for normal usage, eg none of the profiles and xpad and such?
Not sure where the issue lies (OS or drivers or both) but when running steam OS, or simply steam in big picture mode in linux and DS4drv it creates a loop of "up" inputs until all open controllers are paired. Meaning if I run the command ds4drv which creates controllers on the fly, it will continue this behavior until I pair the first controller. This is tolerable, but the main issue is if I use the config file and configure 4 separate controllers the issue persists unless I pair all 4 controllers. Bt adapter the kinivo BTD-400.
when using multiple controller for example 2.
In Steam Big Picture Mode there is always an input what it makes nearly impossible to navigate in there,
also in games I notice this problem that there is unwanted input. I think always games where you can control the main menu with all four controllers not only with the first.
When I make the config file only with one controller everything works as expected.
My config file:
[ds4drv]
daemon=false
hidraw=false
[controller:1]
led=0000ff
emulate-xpad=true
battery-flash=true
trackpad-mouse=true
[controller:2]
led=ff0000
emulate-xpad=true
battery-flash=true
trackpad-mouse=true
[controller:3]
led=00ff00
emulate-xpad=true
battery-flash=true
trackpad-mouse=true
[controller:4]
led=ffff00
emulate-xpad=true
battery-flash=true
trackpad-mouse=true
[bindings]
PS+Triangle = exec-background killall -KILL pcsxr PCSX2 mupen64plus dolphin-emu snes9x-gtk reicast PPSSPPSDL
Edit:
found out that the default axis values for the non used controllers, that were created by the config file are wrong. This explains the strange behavior in steam and some games.
yeah, I personally have no use for the led on board, so I'd like to be able to just 'turn it off' entirely to conserve battery.
Btw, many thanks for setting this up; I'm liking the ds4 <=> linux interaction much better than the ds3 and the horrid setup of sixad and qtsixa; the trackpad is a pretty nice plus too.
[info][bluetooth] Scanning for devices
Traceback (most recent call last):
File "/usr/local/bin/ds4drv", line 9, in
load_entry_point('ds4drv==0.4.3', 'console_scripts', 'ds4drv')()
File "/usr/local/lib/python2.7/dist-packages/ds4drv/main.py", line 427, in main
for device in backend.devices:
File "/usr/local/lib/python2.7/dist-packages/ds4drv/backends/bluetooth.py", line 126, in devices
device = self.find_device()
File "/usr/local/lib/python2.7/dist-packages/ds4drv/backends/bluetooth.py", line 112, in find_device
for bdaddr, name in self.scan():
File "/usr/local/lib/python2.7/dist-packages/ds4drv/backends/bluetooth.py", line 106, in scan
devices.append((bdaddr.decode("ascii"), name.decode("ascii")))
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 15: ordinal not in range(128)
I'm using the "hidraw = true" option with bluetooth pairing (new Bluez).
In the previous release (2.0 maybe?), a dummy js0 device was created when ds4drv was started. This was good, because it was reserved until the controller was paired.
Now, no joystick device is created until I connect via bluetooth first. Then the bluetooth joystick becomes /js0, and the ds4drv becomes /js1. This doesn't work well because a lot of games only work with /js0.
edit: The last version to work as expected was v3.0. Thanks!
New problem with the iogear gbu421. I can't do more than 2 controllers. See error below.
desktop@steamos:/Downloads/ds4drv/ds4drv$ sudo ds4drv/Downloads/ds4drv/ds4drv$
[info][controller 1] Created devices /dev/input/js0 (joystick) /dev/input/event4 (evdev)
[info][bluetooth] Scanning for devices
[info][bluetooth] Found device A4:15:66:67:59:D3
[info][controller 1] Connected to Bluetooth Controller (A4:15:66:67:59:D3)
[info][bluetooth] Scanning for devices
[info][controller 1] Battery: 62%
[info][bluetooth] Found device A4:15:66:DC:08:91
[info][controller 2] Created devices /dev/input/js1 (joystick) /dev/input/event16 (evdev)
[info][controller 2] Connected to Bluetooth Controller (A4:15:66:DC:08:91)
[info][bluetooth] Scanning for devices
[info][controller 2] Battery: 75%
[info][bluetooth] Found device A4:15:66:67:57:92
[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
[error][bluetooth] Error while scanning for devices: 'hcitool scan' returned error. Make sure your bluetooth device is powered up with 'hciconfig hciX up'.
desktop@steamos:
Currently if you try to use --hidraw
with a bluetooth device and a unpatched kernel we get some crazy freezing and sometimes even crashes the system. This happens when we write a report to the hidraw device.
We need to detect if we are on a correct kernel before allowing bluetooth via hidraw. Until we have a known kernel release containing fixed report sending this seems impossible to check though.
Many gamepads report the gamepad axis data with circular maximum values. That means that the 2 dimensional distance from axis center is never more than the maximum value of a single axis. DualShock 4 reports almost, but not quite, square axis. There's more explanation about the idea on xboxdrv man page, see --square-axis.
The square axis causes issues especially when combined with --emulate-xpad and games that expect circular axis. I suggest that we add something like --circular-axis that maps the input values (inverse of xboxdrv's --square-axis). --emulate-xpad should probably imply this option as it's required for full emulation.
Hi, I recently installed your driver in my distro of Ubuntu 12.04.5 LTS and tried both the USB hidraw mode and the raw bluetooth mode. Sadly, when I play Bastion, the L2/LT trigger of my ds4 doesn't respond. I've used this controller in Windows 7 and it does work (it isn't a hardware issue). App jstest-gtk in Ubuntu even recognizes the trigger as being pressed/moved. Is there any way to solve this? It's the only button that is not responding at all in this OS. Thanks.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.