Closed Ape closed 10 years ago
Actually, it might be useful to provide means for any custom bindings. Users could configure arbitrary commands to button combinations using the configuration file. This would allow for example volume control or launching applications using ds4 controllers.
The way you disconnect the device in raw bluetooth mode will not work unless the device has been paired in bluez unfortunately, at least that is my experience. I don't think having a feature that only works in one mode is a good idea.
Actually, it might be useful to provide means for any custom bindings. Users could configure arbitrary commands to button combinations using the configuration file. This would allow for example volume control or launching applications using ds4 controllers.
Sounds like a good idea, I have something like this in mind for the config file:
# Global bindings across all profiles
[bindings]
r1+l1+ps = exec:somecommand
[profile:someprofile]
bindings = stuff
[bindings:stuff]
trackpad+r1+l1 = exec:somecommand
I'd like to have some way for disconnecting my controllers. If we could give controller specific parameters to the exec programs that would be one.
For example:
trackpad+r1+l1 = exec:ds4disconnecter $bdaddr
Then I would just make a shell script called ds4disconnecter that calls bluetoothctl and disconnects the specified controller.
Other useful parameters would include at least the ds4drv controller number, and why not for example the name of the current profile.
EDIT: And battery level would be really cool parameter to have. I would make a binding that makes my computer yell me the battery status using text-to-speech.
Good ideas! Are you interested in implementing this or should I?
If you are interested in implementing this right now, go ahead. I can also take a look at this later.
I came up with some possible binding commands and played with the syntax:
[bindings]
# cycle to the next profile
ps+dpad_right = next_profile
ps+dpad_left = prev_profile
# go directly to specified profile
ps+dpad_up = profile kbmouse
# exec foobarctl with argument list ["arg1", "arg2"]
ps+cross = exec foobarctl arg1 arg2
# keywords are replaced with the actual values
ps+triangle = exec ds4disconnecter $bdaddr
Lauri, regarding battery notification, it would be really cool to use something like python-notify to announce low battery warnings, profile changes, etc.
Battery notification events would be a really nice feature to have. However, that would require something more than just button bindings. We would have to have actions bound to some kind of events.
If you have any ideas for the configuration syntax, please tell. We need to configure at least the trigger condition (i.e. "$report.battery < 2"), test interval (i.e. check for the event every 60 seconds), and what to do if the event is triggered again (i.e. some kind of cooldown maybe). The executed action would be similar to button binding actions.
By the way, this pull request isn't probably the best place to discuss further feature requests that aren't even related to controller disconnection. Should we have some kind of a mailing list or does anybody have ideas for that?
Sorry to continue clogging up this pull request, but how about a Google Group? I made this tentative group: http://groups.google.com/forum/#!forum/ds4drv
If this will do, lets move discussion there. Otherwise, I'd be happy to participate in one that you guys suggest.
I think it's OK to use the issue tracker to create feature requests aswell as a bug reports, but for other questions and discussions we can use the google group.
This pull request is pretty much handled and I will close it. The conclusion was that there there will be no special action for controller disconnection, but a general command executing mechanism was implemented. You can use this configuration for controller disconnection:
[bindings]
ps+l2+r2 = exec-background sh -c 'echo "disconnect $device_addr" | bluetoothctl'
You may create a new feature request for battery notification events or any other ideas that were discussed.
I think it's really useful to be able to disconnect controllers quickly using a button combination. This implements that.
Supports raw bluetooth and hidraw bluetooth backends, but not usb. Hidraw disconnection requires bluetoothctl (i.e. bluez-utilz). I couldn't find any cleaner interface for managing the bluez devices.
This patch is mainly a request for comments and a proof of concept.