Code Monkey home page Code Monkey logo

dualsensectl's People

Contributors

nowrep avatar shadowwa avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dualsensectl's Issues

Does not compile on debian sid

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?

Support n devices

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.

Command `lightbar on` overrides command `lightbar [0-255]` -> Remains ONLY BLUE

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.

  • My DualSense version: 0307

List Dependancies

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.

Missing device ID

Hi,

I can only see USB listed under devices, does it mean a driver is needed or a sync?

Battery percentage always shown as "100" if plugged in

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:
image

I couldn't find any logs so let me know if theres a debug mode or something I can activate to provide more info.

Controller not aware of dualsensectl microphone muting

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.

Fails to build

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

Documentation with working examples

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 macro
  • monitor

Bash completion and UDEV rule example scripts would be a nice add-on too.

Question:

is there a way to make use of the controller microphone? sadly i did not find any way to do so

Fails to compile due to warnings

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);
      |             ^~~~~~~~~~~~~~~

Installing error on Ubuntu 23.04

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

Python support

Will there ever be python support in the near future?

ask for a source (no issue)

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.

Not all DualSenseCTL command options work in Terminal . . .

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.

  • Using version v0.2.

Díky za odpověď . . .

Request: optional JSON output for commands

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.