nowrep / dualsensectl Goto Github PK
View Code? Open in Web Editor NEWLinux tool for controlling PS5 DualSense controller
License: GNU General Public License v2.0
Linux tool for controlling PS5 DualSense controller
License: GNU General Public License v2.0
I've installed development packages and libraries, but still only get this:
in ~/src/dualsensectl on main
➜ make
gcc -o dualsensectl -DDUALSENSECTL_VERSION=\"0.1\" -Wall -Wextra -pedantic -I/usr/include/dbus-1.0 -I/usr/lib/x86_64-linux-gnu/dbus-1.0/include -I/usr/include/hidapi -O2 -s -DNDEBUG -ldbus-1 -lhidapi-hidraw main.c
/usr/bin/ld: /tmp/ccRJFH2q.o: in function `dualsense_send_output_report':
main.c:(.text+0xa0): undefined reference to `hid_write'
/usr/bin/ld: main.c:(.text+0xf0): undefined reference to `hid_error'
/usr/bin/ld: /tmp/ccRJFH2q.o: in function `dualsense_bt_disconnect.isra.0':
main.c:(.text+0x21a): undefined reference to `dbus_error_init'
/usr/bin/ld: main.c:(.text+0x227): undefined reference to `dbus_bus_get'
/usr/bin/ld: main.c:(.text+0x234): undefined reference to `dbus_error_is_set'
/usr/bin/ld: main.c:(.text+0x25d): undefined reference to `dbus_message_new_method_call'
/usr/bin/ld: main.c:(.text+0x278): undefined reference to `dbus_connection_send_with_reply_and_block'
/usr/bin/ld: main.c:(.text+0x285): undefined reference to `dbus_message_unref'
/usr/bin/ld: main.c:(.text+0x28d): undefined reference to `dbus_error_is_set'
/usr/bin/ld: main.c:(.text+0x2aa): undefined reference to `dbus_message_iter_init'
/usr/bin/ld: main.c:(.text+0x2b2): undefined reference to `dbus_message_iter_get_element_count'
/usr/bin/ld: main.c:(.text+0x2cc): undefined reference to `dbus_message_iter_recurse'
/usr/bin/ld: main.c:(.text+0x30e): undefined reference to `dbus_message_iter_next'
/usr/bin/ld: main.c:(.text+0x331): undefined reference to `dbus_message_iter_recurse'
/usr/bin/ld: main.c:(.text+0x33e): undefined reference to `dbus_message_iter_get_basic'
/usr/bin/ld: main.c:(.text+0x346): undefined reference to `dbus_message_iter_next'
/usr/bin/ld: main.c:(.text+0x34e): undefined reference to `dbus_message_iter_get_element_count'
/usr/bin/ld: main.c:(.text+0x35b): undefined reference to `dbus_message_iter_recurse'
/usr/bin/ld: main.c:(.text+0x39e): undefined reference to `dbus_message_iter_recurse'
/usr/bin/ld: main.c:(.text+0x3ab): undefined reference to `dbus_message_iter_get_basic'
/usr/bin/ld: main.c:(.text+0x3d6): undefined reference to `dbus_message_iter_next'
/usr/bin/ld: main.c:(.text+0x43c): undefined reference to `dbus_message_iter_next'
/usr/bin/ld: main.c:(.text+0x444): undefined reference to `dbus_message_iter_get_element_count'
/usr/bin/ld: main.c:(.text+0x453): undefined reference to `dbus_message_iter_recurse'
/usr/bin/ld: main.c:(.text+0x4aa): undefined reference to `dbus_message_iter_next'
/usr/bin/ld: main.c:(.text+0x4ba): undefined reference to `dbus_message_iter_recurse'
/usr/bin/ld: main.c:(.text+0x4c5): undefined reference to `dbus_message_iter_get_basic'
/usr/bin/ld: main.c:(.text+0x4f7): undefined reference to `dbus_message_iter_next'
/usr/bin/ld: main.c:(.text+0x502): undefined reference to `dbus_message_iter_recurse'
/usr/bin/ld: main.c:(.text+0x512): undefined reference to `dbus_message_iter_get_basic'
/usr/bin/ld: main.c:(.text+0x51a): undefined reference to `dbus_message_iter_next'
/usr/bin/ld: main.c:(.text+0x564): undefined reference to `dbus_message_iter_next'
/usr/bin/ld: main.c:(.text+0x58b): undefined reference to `dbus_message_iter_next'
/usr/bin/ld: main.c:(.text+0x5a9): undefined reference to `dbus_message_unref'
/usr/bin/ld: main.c:(.text+0x5c6): undefined reference to `dbus_message_new_method_call'
/usr/bin/ld: main.c:(.text+0x5e1): undefined reference to `dbus_connection_send_with_reply_and_block'
/usr/bin/ld: main.c:(.text+0x5ec): undefined reference to `dbus_message_unref'
/usr/bin/ld: main.c:(.text+0x5f4): undefined reference to `dbus_error_is_set'
/usr/bin/ld: main.c:(.text+0x60a): undefined reference to `dbus_message_unref'
/usr/bin/ld: main.c:(.text+0x614): undefined reference to `dbus_connection_unref'
/usr/bin/ld: main.c:(.text+0x62c): undefined reference to `dbus_message_iter_next'
/usr/bin/ld: main.c:(.text+0x637): undefined reference to `dbus_message_iter_recurse'
/usr/bin/ld: main.c:(.text+0x644): undefined reference to `dbus_message_iter_get_basic'
/usr/bin/ld: main.c:(.text+0x654): undefined reference to `dbus_message_iter_next'
/usr/bin/ld: main.c:(.text+0x69c): undefined reference to `dbus_message_unref'
/usr/bin/ld: main.c:(.text+0x6b1): undefined reference to `dbus_message_unref'
/usr/bin/ld: /tmp/ccRJFH2q.o: in function `main':
main.c:(.text.startup+0xd3): undefined reference to `hid_open'
/usr/bin/ld: main.c:(.text.startup+0x10b): undefined reference to `hid_get_feature_report'
/usr/bin/ld: main.c:(.text.startup+0x304): undefined reference to `hid_error'
/usr/bin/ld: main.c:(.text.startup+0x39d): undefined reference to `hid_read_timeout'
/usr/bin/ld: main.c:(.text.startup+0x650): undefined reference to `hid_error'
collect2: error: ld returned 1 exit status
make: *** [Makefile:20: all] Error 1
Did i miss something?
Hi, is there any chance to support more than one device?
I have two dualsense controllers connected to my PC.
I would love to monitor battery for both pads and have ability to turn them off separately.
As mentioned,
dualsensectl lightbar on
overrides dualsensectl lightbar 255 255 255 255
-> WHITE colour
this makes changing colors and brightness on the controller impossible . . .
The only way to change colors is to use dualsensectl lightbar off
and then dualsensectl lightbar [0-255]
...................
dualsensectl lightbar 0 0 0 0
turns off the lightbar too, but in another sense.
Repo does not list any dependencies but fails to build without things not available by default in Ubuntu. Please list EVERYTHING needed to build in the build instructions for fellow idiots like me who are not developers.
Hi,
I can only see USB listed under devices, does it mean a driver is needed or a sync?
When plugging in the controller via usb, dualsensectl battery
shows 100.
disconnecting the usb and using bluetooth directly after then shows actual battery.
Example where I first tested on bluetooth and then plugged in usb:
I couldn't find any logs so let me know if theres a debug mode or something I can activate to provide more info.
Hello. I want to mute the dualsenese's microphone each time it is connected. I have succeeded but there is a problem.
When you mute it via dualsensectl, it seems the controller does not know that the microphone is muted, so if you try to un-mute it from the dedicated button in the controller, it will try to mute again (the led lights up an it stays muted).
Steps to replicate:
$ dualsensectl microphone off
and then press the mute button on your controller.
Currently I'm using https://github.com/Etaash-mathamsetty/trigger-control/ to control the adaptive trigger of the DualSense controller, which is GUI app.
I'd like to use command line to automate the process, e.g. apply preset when controller is connected using udev.
It would be very useful if dualsensectl can support config adaptive trigger, make it the most feature rich command line tool for DualSense.
title
Under ubuntu 22.04, with libdbus-1-dev, libhidapi-hidraw0 and libhidapy-dev packages installed, I get the following uponn "make":
$ make gcc -o dualsensectl -DDUALSENSECTL_VERSION=\"0.1\" -Wall -Wextra -pedantic -I/usr/include/dbus-1.0 -I/usr/lib/x86_64-linux-gnu/dbus-1.0/include -I/usr/include/hidapi -O2 -s -DNDEBUG -ldbus-1 -lhidapi-hidraw main.c /usr/bin/ld: /tmp/ccGRR8hJ.o: in function
dualsense_send_output_report':
main.c:(.text+0xa0): undefined reference to hid_write' /usr/bin/ld: main.c:(.text+0xee): undefined reference to
hid_error'
/usr/bin/ld: /tmp/ccGRR8hJ.o: in function dualsense_bt_disconnect.isra.0': main.c:(.text+0x226): undefined reference to
dbus_error_init'
/usr/bin/ld: main.c:(.text+0x233): undefined reference to dbus_bus_get' /usr/bin/ld: main.c:(.text+0x240): undefined reference to
dbus_error_is_set'
/usr/bin/ld: main.c:(.text+0x269): undefined reference to dbus_message_new_method_call' /usr/bin/ld: main.c:(.text+0x284): undefined reference to
dbus_connection_send_with_reply_and_block'
/usr/bin/ld: main.c:(.text+0x291): undefined reference to dbus_message_unref' /usr/bin/ld: main.c:(.text+0x299): undefined reference to
dbus_error_is_set'
/usr/bin/ld: main.c:(.text+0x2b6): undefined reference to dbus_message_iter_init' /usr/bin/ld: main.c:(.text+0x2be): undefined reference to
dbus_message_iter_get_element_count'
/usr/bin/ld: main.c:(.text+0x2d8): undefined reference to dbus_message_iter_recurse' /usr/bin/ld: main.c:(.text+0x316): undefined reference to
dbus_message_iter_next'
/usr/bin/ld: main.c:(.text+0x339): undefined reference to dbus_message_iter_recurse' /usr/bin/ld: main.c:(.text+0x346): undefined reference to
dbus_message_iter_get_basic'
/usr/bin/ld: main.c:(.text+0x34e): undefined reference to dbus_message_iter_next' /usr/bin/ld: main.c:(.text+0x356): undefined reference to
dbus_message_iter_get_element_count'
/usr/bin/ld: main.c:(.text+0x363): undefined reference to dbus_message_iter_recurse' /usr/bin/ld: main.c:(.text+0x3a6): undefined reference to
dbus_message_iter_recurse'
/usr/bin/ld: main.c:(.text+0x3b6): undefined reference to dbus_message_iter_get_basic' /usr/bin/ld: main.c:(.text+0x3d7): undefined reference to
dbus_message_iter_next'
/usr/bin/ld: main.c:(.text+0x45c): undefined reference to dbus_message_iter_next' /usr/bin/ld: main.c:(.text+0x464): undefined reference to
dbus_message_iter_get_element_count'
/usr/bin/ld: main.c:(.text+0x473): undefined reference to dbus_message_iter_recurse' /usr/bin/ld: main.c:(.text+0x4c3): undefined reference to
dbus_message_iter_next'
/usr/bin/ld: main.c:(.text+0x4d3): undefined reference to dbus_message_iter_recurse' /usr/bin/ld: main.c:(.text+0x4de): undefined reference to
dbus_message_iter_get_basic'
/usr/bin/ld: main.c:(.text+0x509): undefined reference to dbus_message_iter_next' /usr/bin/ld: main.c:(.text+0x514): undefined reference to
dbus_message_iter_recurse'
/usr/bin/ld: main.c:(.text+0x524): undefined reference to dbus_message_iter_get_basic' /usr/bin/ld: main.c:(.text+0x52c): undefined reference to
dbus_message_iter_next'
/usr/bin/ld: main.c:(.text+0x576): undefined reference to dbus_message_iter_next' /usr/bin/ld: main.c:(.text+0x59e): undefined reference to
dbus_message_iter_next'
/usr/bin/ld: main.c:(.text+0x5c4): undefined reference to dbus_message_unref' /usr/bin/ld: main.c:(.text+0x5e1): undefined reference to
dbus_message_new_method_call'
/usr/bin/ld: main.c:(.text+0x5fc): undefined reference to dbus_connection_send_with_reply_and_block' /usr/bin/ld: main.c:(.text+0x607): undefined reference to
dbus_message_unref'
/usr/bin/ld: main.c:(.text+0x60f): undefined reference to dbus_error_is_set' /usr/bin/ld: main.c:(.text+0x625): undefined reference to
dbus_message_unref'
/usr/bin/ld: main.c:(.text+0x62f): undefined reference to dbus_connection_unref' /usr/bin/ld: main.c:(.text+0x64c): undefined reference to
dbus_message_iter_next'
/usr/bin/ld: main.c:(.text+0x657): undefined reference to dbus_message_iter_recurse' /usr/bin/ld: main.c:(.text+0x664): undefined reference to
dbus_message_iter_get_basic'
/usr/bin/ld: main.c:(.text+0x674): undefined reference to dbus_message_iter_next' /usr/bin/ld: main.c:(.text+0x6ae): undefined reference to
dbus_message_unref'
/usr/bin/ld: main.c:(.text+0x6c3): undefined reference to dbus_message_unref' /usr/bin/ld: /tmp/ccGRR8hJ.o: in function
main':
main.c:(.text.startup+0xfc): undefined reference to hid_open' /usr/bin/ld: main.c:(.text.startup+0x134): undefined reference to
hid_get_feature_report'
/usr/bin/ld: main.c:(.text.startup+0x324): undefined reference to hid_error' collect2: error: ld returned 1 exit status make: *** [Makefile:20: all] Error 1
First, thank you for this incredibly useful tool!
Please consider appending working examples off the README page for each command
crafted for this useful tool. While the mainstream ones are easily discernible with value-checking, there is need especially for:
attenuation
trigger
with each embedded vibration macromonitor
Bash completion and UDEV rule example scripts would be a nice add-on too.
is there a way to make use of the controller microphone? sadly i did not find any way to do so
Here's the output of the make
command:
make
gcc main.c -o dualsensectl -DDUALSENSECTL_VERSION=\"0.5\" -Wall -Wextra -pedantic -I/usr/include/dbus-1.0 -I/usr/lib/x86_64-linux-gnu/dbus-1.0/include -I/usr/include/hidapi -O2 -s -DNDEBUG -ldbus-1 -lhidapi-hidraw -ludev
main.c: In function ‘read_file_hex’:
main.c:1021:5: warning: ignoring return value of ‘fscanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
1021 | fscanf(f, "%x", &out);
| ^~~~~~~~~~~~~~~~~~~~~
main.c: In function ‘read_file_str’:
main.c:1032:5: warning: ignoring return value of ‘fread’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
1032 | fread(buf, size, 1, f);
| ^~~~~~~~~~~~~~~~~~~~~~
main.c: In function ‘run_sh_command’:
main.c:999:13: warning: ignoring return value of ‘system’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
999 | system(command);
| ^~~~~~~~~~~~~~~
Running make && make install
in Ubuntu 23.04 gives the following error:
Package hidapi-hidraw was not found in the pkg-config search path.
Perhaps you should add the directory containing `hidapi-hidraw.pc'
to the PKG_CONFIG_PATH environment variable
Package 'hidapi-hidraw', required by 'virtual:world', not found
Package hidapi-hidraw was not found in the pkg-config search path.
Perhaps you should add the directory containing `hidapi-hidraw.pc'
to the PKG_CONFIG_PATH environment variable
Package 'hidapi-hidraw', required by 'virtual:world', not found
Package libudev was not found in the pkg-config search path.
Perhaps you should add the directory containing `libudev.pc'
to the PKG_CONFIG_PATH environment variable
Package 'libudev', required by 'virtual:world', not found
gcc main.c -o dualsensectl -DDUALSENSECTL_VERSION=\"0.4\" -Wall -Wextra -pedantic -I/usr/include/dbus-1.0 -I/usr/lib/x86_64-linux-gnu/dbus-1.0/include -O2 -s -DNDEBUG -ldbus-1
main.c:19:10: fatal error: hidapi/hidapi.h: No such file or directory
19 | #include <hidapi/hidapi.h>
| ^~~~~~~~~~~~~~~~~
compilation terminated.
make: *** [Makefile:21: all] Error 1
Will there ever be python support in the near future?
Line 714 in 602ffe4
Seems you can use 0xff value which means unspecified
. This way you can control speaker/mic/jack volumes independently.
Hi,
I'm not sure if this is the right channel, please correct me if not.
I am trying to port the functions you provided (Lightbar controll, LED controll, ...) for the ESP32, based on the Arduino library (https://github.com/rodneybakiskan/ps5-esp32).
So I would like to ask where you got your information for the PS5 Linux tool, regarding the structure of the ble package. In particular, I am interested in the structure of the package to control the controller (LEDs, Rumbl motor,...).
I would be very happy about a hint or a source.
Hi!
As in the title.
Had a quick look in the kernel driver: https://elixir.bootlin.com/linux/latest/source/drivers/hid/hid-playstation.c#L1181 ,
and it seems that charging_status
decoding is now slightly wrong in dualsensectl.
Swapping around lines 434 and 438 in main.c seems to help ;)
martin@NVisen-MiniPC--Garuda-KDE ~ (master)> dualsensectl
Usage: dualsensectl command [ARGS]
Commands:
power-off Turn off the controller (BT only)
battery Get the controller battery level
lightbar STATE Enable (on) or disable (off) lightbar
lightbar RED GREEN BLUE [BRIGHTNESS] Set lightbar color and brightness (0-255)
player-leds NUMBER Set player LEDs (1-5) or disabled (0)
microphone STATE Enable (on) or disable (off) microphone
microphone-led STATE Enable (on) or disable (off) microphone LED
martin@NVisen-MiniPC--Garuda-KDE ~ (master) [1]> dualsensectl power-off
Controller is not connected via BT
martin@NVisen-MiniPC--Garuda-KDE ~ (master) [1]> dualsensectl battery
85
martin@NVisen-MiniPC--Garuda-KDE ~ (master)> dualsensectl on
Invalid command
martin@NVisen-MiniPC--Garuda-KDE ~ (master) [2]> dualsensectl lightbar on
martin@NVisen-MiniPC--Garuda-KDE ~ (master)> dualsensectl lightbar off
martin@NVisen-MiniPC--Garuda-KDE ~ (master)> dualsensectl lightbar on
[martin@NVisen-MiniPC--Garuda-KDE ~ (master)> dualsensectl lightbar 0
Invalid state
martin@NVisen-MiniPC--Garuda-KDE ~ (master) [1]> dualsensectl lightbar 1
Invalid state
martin@NVisen-MiniPC--Garuda-KDE ~ (master) [1]> dualsensectl lightbar BLUE 1
Invalid arguments
martin@NVisen-MiniPC--Garuda-KDE ~ (master) [2]> dualsensectl lightbar blue 1
Invalid arguments
martin@NVisen-MiniPC--Garuda-KDE ~ (master) [2]> dualsensectl lightbar 2
Invalid state
martin@NVisen-MiniPC--Garuda-KDE ~ (master) [1]> dualsensectl lightbar 50
Invalid state
martin@NVisen-MiniPC--Garuda-KDE ~ (master) [1]> dualsensectl lightbar 255
Invalid state
martin@NVisen-MiniPC--Garuda-KDE ~ (master) [1]> dualsensectl player-leds 1
martin@NVisen-MiniPC--Garuda-KDE ~ (master)> dualsensectl player-leds 2
martin@NVisen-MiniPC--Garuda-KDE ~ (master)> dualsensectl player-leds 3
martin@NVisen-MiniPC--Garuda-KDE ~ (master)> dualsensectl player-leds 4
martin@NVisen-MiniPC--Garuda-KDE ~ (master)> dualsensectl player-leds 5
martin@NVisen-MiniPC--Garuda-KDE ~ (master)> dualsensectl player-leds 1]
martin@NVisen-MiniPC--Garuda-KDE ~ (master)> dualsensectl microphone on
martin@NVisen-MiniPC--Garuda-KDE ~ (master)> dualsensectl microphone off
martin@NVisen-MiniPC--Garuda-KDE ~ (master)> dualsensectl microphone on
martin@NVisen-MiniPC--Garuda-KDE ~ (master)> dualsensectl microphone off
martin@NVisen-MiniPC--Garuda-KDE ~ (master)> dualsensectl microphone-led off
martin@NVisen-MiniPC--Garuda-KDE ~ (master)> dualsensectl microphone off
martin@NVisen-MiniPC--Garuda-KDE ~ (master)> dualsensectl microphone-led on
lightbar STATE Enable (on) or disable (off) lightbar
lightbar RED GREEN BLUE [BRIGHTNESS] Set lightbar color and brightness (0-255)
player-leds NUMBER Set player LEDs (1-5) or disabled (0)
These three commands do not work either via USB or BlueTooth.
I tried many options, none of them gives me results.
Díky za odpověď . . .
Hi!
Thanks for this amazing project.
I would like to inquire about the possibility of adding an optional json output mode to commands like list
, info
, battery
etc.
I believe this would help a lot especially in automating / writing simple gui tools around dualsensectl
.
If there's interest in this, I'm not against giving it a shot myself, but I don't want to step on anyone's toes if this isn't a desirable goal for this project.
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.