dualsense-ts 6.2.0 → 6.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LINUX_HID.md +85 -0
- package/README.md +83 -12
- package/dist/dualsense.d.ts +28 -8
- package/dist/dualsense.d.ts.map +1 -1
- package/dist/dualsense.js +57 -17
- package/dist/dualsense.js.map +1 -1
- package/dist/hid/bt_checksum.d.ts +7 -0
- package/dist/hid/bt_checksum.d.ts.map +1 -1
- package/dist/hid/bt_checksum.js +33 -1
- package/dist/hid/bt_checksum.js.map +1 -1
- package/dist/hid/dualsense_hid.d.ts +77 -0
- package/dist/hid/dualsense_hid.d.ts.map +1 -1
- package/dist/hid/dualsense_hid.js +193 -0
- package/dist/hid/dualsense_hid.js.map +1 -1
- package/dist/hid/factory_info.d.ts +53 -0
- package/dist/hid/factory_info.d.ts.map +1 -0
- package/dist/hid/factory_info.js +166 -0
- package/dist/hid/factory_info.js.map +1 -0
- package/dist/hid/firmware_info.d.ts +46 -0
- package/dist/hid/firmware_info.d.ts.map +1 -0
- package/dist/hid/firmware_info.js +109 -0
- package/dist/hid/firmware_info.js.map +1 -0
- package/dist/hid/hid_provider.d.ts +12 -0
- package/dist/hid/hid_provider.d.ts.map +1 -1
- package/dist/hid/hid_provider.js +13 -0
- package/dist/hid/hid_provider.js.map +1 -1
- package/dist/hid/index.d.ts +3 -0
- package/dist/hid/index.d.ts.map +1 -1
- package/dist/hid/index.js +3 -0
- package/dist/hid/index.js.map +1 -1
- package/dist/hid/node_hid_provider.d.ts +2 -0
- package/dist/hid/node_hid_provider.d.ts.map +1 -1
- package/dist/hid/node_hid_provider.js +14 -0
- package/dist/hid/node_hid_provider.js.map +1 -1
- package/dist/hid/pairing_info.d.ts +9 -0
- package/dist/hid/pairing_info.d.ts.map +1 -0
- package/dist/hid/pairing_info.js +33 -0
- package/dist/hid/pairing_info.js.map +1 -0
- package/dist/hid/web_hid_provider.d.ts +14 -0
- package/dist/hid/web_hid_provider.d.ts.map +1 -1
- package/dist/hid/web_hid_provider.js +79 -8
- package/dist/hid/web_hid_provider.js.map +1 -1
- package/dist/id.d.ts +4 -0
- package/dist/id.d.ts.map +1 -1
- package/dist/manager.d.ts +57 -4
- package/dist/manager.d.ts.map +1 -1
- package/dist/manager.js +248 -66
- package/dist/manager.js.map +1 -1
- package/nodehid_example/debug.ts +43 -13
- package/nodehid_example/single.ts +29 -0
- package/package.json +1 -1
- package/src/dualsense.ts +73 -23
- package/src/hid/bt_checksum.ts +39 -0
- package/src/hid/dualsense_hid.ts +230 -0
- package/src/hid/factory_info.ts +206 -0
- package/src/hid/firmware_info.ts +157 -0
- package/src/hid/hid_provider.ts +22 -0
- package/src/hid/index.ts +3 -0
- package/src/hid/node_hid_provider.ts +14 -0
- package/src/hid/pairing_info.ts +33 -0
- package/src/hid/web_hid_provider.ts +87 -8
- package/src/id.ts +5 -0
- package/src/manager.ts +285 -71
- package/webhid_example/build/asset-manifest.json +3 -3
- package/webhid_example/build/index.html +1 -1
- package/webhid_example/build/static/js/main.1c1a2c23.js +3 -0
- package/webhid_example/build/static/js/main.1c1a2c23.js.map +1 -0
- package/webhid_example/src/App.tsx +7 -1
- package/webhid_example/src/hud/AudioIndicator.tsx +116 -0
- package/webhid_example/src/hud/BatteryIndicator.tsx +4 -2
- package/webhid_example/src/hud/ColorIndicator.tsx +72 -0
- package/webhid_example/src/hud/ControllerConnection.tsx +29 -2
- package/webhid_example/src/hud/Debugger.tsx +31 -1
- package/webhid_example/src/hud/LightbarFadeButtons.tsx +2 -2
- package/webhid_example/src/hud/MuteLedControls.tsx +3 -2
- package/webhid_example/src/hud/index.tsx +2 -0
- package/webhid_example/build/static/js/main.2ac31d24.js +0 -3
- package/webhid_example/build/static/js/main.2ac31d24.js.map +0 -1
- /package/webhid_example/build/static/js/{main.2ac31d24.js.LICENSE.txt → main.1c1a2c23.js.LICENSE.txt} +0 -0
package/LINUX_HID.md
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# Linux HID and the DualSense
|
|
2
|
+
|
|
3
|
+
## The Problem
|
|
4
|
+
|
|
5
|
+
On Linux, the kernel's `hid_playstation` driver claims DualSense controllers and creates gamepad, motion sensor, and touchpad input devices. This has two side effects that affect `dualsense-ts`:
|
|
6
|
+
|
|
7
|
+
1. **SET_REPORT feature reports are blocked over Bluetooth.** The `hidp` Bluetooth HID transport does not support the `HIDIOCSFEATURE` ioctl, returning `EIO`. This means the test command protocol (Feature Reports `0x80`/`0x81`) cannot be used, and factory info (controller body color, serial number, board revision) is unavailable over Bluetooth when using `node-hid`.
|
|
8
|
+
|
|
9
|
+
2. **Unwanted input devices are created.** The kernel registers the controller as a gamepad, touchpad, and motion sensor, which can cause the controller to move the mouse cursor or generate unwanted input events on the desktop.
|
|
10
|
+
|
|
11
|
+
Neither issue affects WebHID in Chrome, which bypasses the kernel's HID driver entirely and communicates with the Bluetooth controller through its own userspace stack.
|
|
12
|
+
|
|
13
|
+
## What Works Today
|
|
14
|
+
|
|
15
|
+
| Feature | USB (node-hid) | USB (WebHID) | BT (node-hid, Linux) | BT (WebHID) |
|
|
16
|
+
|---------|---------------|-------------|----------------------|-------------|
|
|
17
|
+
| Input reports (buttons, sticks, etc.) | Yes | Yes | Yes | Yes |
|
|
18
|
+
| Output reports (rumble, LEDs, etc.) | Yes | Yes | Yes | Yes |
|
|
19
|
+
| Firmware info (Feature Report 0x20 read) | Yes | Yes | Yes | Yes |
|
|
20
|
+
| Factory info (Feature Report 0x80 write) | Yes | Yes | **No** | Yes |
|
|
21
|
+
|
|
22
|
+
## Why It Fails
|
|
23
|
+
|
|
24
|
+
The data flow for HID feature reports on Linux:
|
|
25
|
+
|
|
26
|
+
```
|
|
27
|
+
Application (node-hid)
|
|
28
|
+
-> ioctl(HIDIOCSFEATURE) on /dev/hidrawN
|
|
29
|
+
-> hid_hw_raw_request() in kernel HID core
|
|
30
|
+
-> hid_playstation driver (or hid-generic)
|
|
31
|
+
-> hidp_set_raw_report() for Bluetooth transport
|
|
32
|
+
-> Returns -EIO (not implemented)
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
The `hidp` transport layer's `SET_REPORT` implementation for feature reports returns an error because the Bluetooth HID specification's SET_REPORT transaction is not fully implemented in the Linux `hidp` driver.
|
|
36
|
+
|
|
37
|
+
Chrome's WebHID takes a different path:
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
Chrome WebHID API
|
|
41
|
+
-> Chrome's internal Bluetooth HID client
|
|
42
|
+
-> BlueZ D-Bus API or direct L2CAP
|
|
43
|
+
-> SET_REPORT transaction sent directly to device
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Potential Kernel Patch
|
|
47
|
+
|
|
48
|
+
The `hid_playstation` driver could be patched to pass through SET_REPORT feature reports to the underlying transport. The relevant kernel source files are:
|
|
49
|
+
|
|
50
|
+
- `drivers/hid/hid-playstation.c` — the PlayStation HID driver
|
|
51
|
+
- `net/bluetooth/hidp/core.c` — the Bluetooth HID transport
|
|
52
|
+
|
|
53
|
+
### Approach 1: Fix `hidp` SET_REPORT for Feature Reports
|
|
54
|
+
|
|
55
|
+
The root cause is in `net/bluetooth/hidp/core.c`. The `hidp_set_raw_report()` function needs to properly implement SET_REPORT for feature reports over the Bluetooth control channel (L2CAP). Currently, this code path either returns `-EIO` or is missing entirely.
|
|
56
|
+
|
|
57
|
+
The fix would involve:
|
|
58
|
+
1. Constructing a `HIDP_TRANS_SET_REPORT | HIDP_DATA_RTYPE_FEATURE` header
|
|
59
|
+
2. Sending the report data over the L2CAP control channel
|
|
60
|
+
3. Waiting for the acknowledgment from the device
|
|
61
|
+
|
|
62
|
+
This would benefit all Bluetooth HID devices on Linux, not just the DualSense.
|
|
63
|
+
|
|
64
|
+
### Approach 2: Route Through `uhid`
|
|
65
|
+
|
|
66
|
+
An alternative approach is to have `hid_playstation` create a `uhid` device alongside the standard hidraw interface, similar to how Chrome's WebHID works. This would allow userspace applications to send feature reports through the `uhid` interface while the kernel driver continues to handle standard input processing.
|
|
67
|
+
|
|
68
|
+
### Approach 3: Userspace Bluetooth HID
|
|
69
|
+
|
|
70
|
+
As a library-level workaround, `dualsense-ts` could implement direct L2CAP communication for Bluetooth DualSense controllers on Linux, bypassing the kernel HID stack entirely. This is similar to what Chrome does and would involve:
|
|
71
|
+
|
|
72
|
+
1. Using the BlueZ D-Bus API to discover and connect to the controller
|
|
73
|
+
2. Opening L2CAP sockets directly to the HID control and interrupt channels
|
|
74
|
+
3. Sending SET_REPORT transactions over the control channel
|
|
75
|
+
|
|
76
|
+
This approach is complex but would give full feature parity without requiring kernel modifications.
|
|
77
|
+
|
|
78
|
+
## References
|
|
79
|
+
|
|
80
|
+
- [Linux kernel HID subsystem documentation](https://www.kernel.org/doc/html/latest/hid/index.html)
|
|
81
|
+
- [Bluetooth HID Profile specification](https://www.bluetooth.com/specifications/specs/human-interface-device-profile-1-1/)
|
|
82
|
+
- [hid-playstation driver source](https://github.com/torvalds/linux/blob/master/drivers/hid/hid-playstation.c)
|
|
83
|
+
- [hidp core source](https://github.com/torvalds/linux/blob/master/net/bluetooth/hidp/core.c)
|
|
84
|
+
- [Chrome WebHID implementation](https://chromium.googlesource.com/chromium/src/+/refs/heads/main/services/device/hid/)
|
|
85
|
+
- [daidr/dualsense-tester](https://github.com/daidr/dualsense-tester) — WebHID reference implementation that works over Bluetooth
|
package/README.md
CHANGED
|
@@ -1,9 +1,23 @@
|
|
|
1
1
|
# dualsense-ts
|
|
2
2
|
|
|
3
|
-
`dualsense-ts` is the natural interface for your DualSense controller.
|
|
3
|
+
`dualsense-ts` is the natural interface for your DualSense controller. Simple to use, fully-typed, fully-featured, and supports wired and wireless connections in both node.js and the browser.
|
|
4
4
|
|
|
5
5
|
**[Live demo](https://nsfm.github.io/dualsense-ts/)** - connect a controller and try it out!
|
|
6
6
|
|
|
7
|
+
## Features
|
|
8
|
+
|
|
9
|
+
- **Rich input API** providing synchronous, event, iterator, or promise-based updates
|
|
10
|
+
- **Bluetooth and USB** support in the browser or node.js
|
|
11
|
+
- **Automatic connection and reconnection** even when connection type changes
|
|
12
|
+
- **Multiplayer support**, allowing up to 31 connected controllers at a time
|
|
13
|
+
- **Lighting control** - RGB light bars, player LEDs, and mute button
|
|
14
|
+
- **Full haptics control** - independent left/right rumble plus complete trigger haptic configuration
|
|
15
|
+
- **Touchpad support** with full multi-touch handling
|
|
16
|
+
- **Motion tracking** via gyroscope and accelerometer readings
|
|
17
|
+
- **Battery status** including level and charging state
|
|
18
|
+
- **Peripheral status** for connected headphones and microphone
|
|
19
|
+
- **Firmware info** checks providing controller color, hardware/software versions, and more
|
|
20
|
+
|
|
7
21
|
## Getting started
|
|
8
22
|
|
|
9
23
|
### Installation
|
|
@@ -235,7 +249,7 @@ console.log(controller.right.trigger.feedback.config);
|
|
|
235
249
|
console.log(controller.right.trigger.feedback.effect); // TriggerEffect.Off
|
|
236
250
|
```
|
|
237
251
|
|
|
238
|
-
Feedback state is automatically restored if the controller disconnects and reconnects
|
|
252
|
+
Feedback state is automatically restored if the controller disconnects and reconnects - no handling required on your end.
|
|
239
253
|
|
|
240
254
|
#### Trigger effects
|
|
241
255
|
|
|
@@ -249,7 +263,7 @@ Feedback state is automatically restored if the controller disconnects and recon
|
|
|
249
263
|
| `TriggerEffect.Vibration` | Zone-based oscillation with amplitude and frequency |
|
|
250
264
|
| `TriggerEffect.Machine` | Dual-amplitude vibration with frequency and period control |
|
|
251
265
|
|
|
252
|
-
Each effect accepts a unique set of configuration options
|
|
266
|
+
Each effect accepts a unique set of configuration options; your editor's type hints will guide you through the available parameters for each effect. The [interactive demo](https://nsfm.github.io/dualsense-ts/) includes full slider controls for every effect and parameter, making it a great tool for finding the right values.
|
|
253
267
|
|
|
254
268
|
Effect names are based on [Nielk1's DualSense trigger effect documentation](https://gist.github.com/Nielk1/6d54cc2c00d2201ccb8c2720ad7538db).
|
|
255
269
|
|
|
@@ -283,11 +297,60 @@ controller.mute.status.on("change", ({ state }) => {
|
|
|
283
297
|
});
|
|
284
298
|
```
|
|
285
299
|
|
|
286
|
-
The `{r, g, b}` format is
|
|
300
|
+
The `{r, g, b}` format is compatible with popular color libraries. Pass the output of `colord().toRgb()`, `tinycolor().toRgb()`, or `Color().object()` straight to `lightbar.set()`.
|
|
287
301
|
|
|
288
302
|
The mute LED cannot be controlled (the firmware toggles it on and off with the button) but you can read its current state. `controller.mute` allows you to read the button like a normal input, while `controller.mute.status` is a toggle input tied to the LED's state.
|
|
289
303
|
|
|
290
|
-
|
|
304
|
+
#### Audio Peripherals
|
|
305
|
+
|
|
306
|
+
The controller reports whether a microphone and/or headphones are connected via the 3.5mm jack:
|
|
307
|
+
|
|
308
|
+
```typescript
|
|
309
|
+
controller.headphone.on("change", ({ state }) => {
|
|
310
|
+
console.log(`Headphones ${state ? "" : "dis"}connected`);
|
|
311
|
+
});
|
|
312
|
+
|
|
313
|
+
controller.microphone.on("change", ({ state }) => {
|
|
314
|
+
console.log(`Microphone ${state ? "" : "dis"}connected`);
|
|
315
|
+
});
|
|
316
|
+
|
|
317
|
+
controller.headphone.state; // true when headphones are plugged in
|
|
318
|
+
controller.microphone.state; // true when a microphone is available
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
#### Color and Serial Number
|
|
322
|
+
|
|
323
|
+
`dualsense-ts` reads the controller's body color and serial number from factory info after connection:
|
|
324
|
+
|
|
325
|
+
```typescript
|
|
326
|
+
import { DualsenseColor } from "dualsense-ts";
|
|
327
|
+
|
|
328
|
+
controller.color; // DualsenseColor.CosmicRed
|
|
329
|
+
controller.serialNumber; // Factory-stamped serial number
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
`color` returns a `DualsenseColor` enum value (`DualsenseColor.Unknown` when factory info is unavailable).
|
|
333
|
+
|
|
334
|
+
#### Firmware and Factory Info
|
|
335
|
+
|
|
336
|
+
`dualsense-ts` automatically reads firmware details and factory information from the device after connection. These values may take a moment to populate.
|
|
337
|
+
|
|
338
|
+
```typescript
|
|
339
|
+
const fw = controller.firmwareInfo;
|
|
340
|
+
const v = fw.mainFirmwareVersion;
|
|
341
|
+
console.log(`Firmware: ${v.major}.${v.minor}.${v.patch}`);
|
|
342
|
+
console.log(`Built: ${fw.buildDate} ${fw.buildTime}`);
|
|
343
|
+
console.log(`Hardware: ${fw.hardwareInfo}`);
|
|
344
|
+
|
|
345
|
+
const fi = controller.factoryInfo;
|
|
346
|
+
console.log(`Color: ${fi.colorName}`); // e.g. "Cosmic Red"
|
|
347
|
+
console.log(`Board: ${fi.boardRevision}`); // e.g. "BDM-030"
|
|
348
|
+
console.log(`Serial: ${fi.serialNumber}`);
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
The `firmwareInfo` property includes build date/time, firmware versions, hardware info, and device info. The `factoryInfo` property includes the controller's body color, board revision, and serial number.
|
|
352
|
+
|
|
353
|
+
## Using `dualsense-ts` with React
|
|
291
354
|
|
|
292
355
|
Check out [the example app](./webhid_example/) for more details.
|
|
293
356
|
|
|
@@ -377,14 +440,14 @@ manager.on("change", ({ active, players }) => {
|
|
|
377
440
|
});
|
|
378
441
|
```
|
|
379
442
|
|
|
380
|
-
In Node.js, the manager polls for new devices automatically. In the browser, you'll need to request permission via a user gesture:
|
|
443
|
+
In Node.js, the manager polls for new devices automatically. In the browser, you'll still need to request permission via a user gesture:
|
|
381
444
|
|
|
382
445
|
```typescript
|
|
383
446
|
// React / plain JS
|
|
384
447
|
<button onClick={manager.getRequest()}>Add Controllers</button>
|
|
385
448
|
```
|
|
386
449
|
|
|
387
|
-
|
|
450
|
+
This only applies to the first connection for each controller.
|
|
388
451
|
|
|
389
452
|
### Accessing controllers
|
|
390
453
|
|
|
@@ -421,7 +484,7 @@ manager.get(0)?.playerLeds.setBrightness(Brightness.Low);
|
|
|
421
484
|
|
|
422
485
|
### Reconnection
|
|
423
486
|
|
|
424
|
-
When a controller disconnects, its slot is preserved. If the same controller reconnects
|
|
487
|
+
When a controller disconnects, its slot is preserved. If the same controller reconnects, even through a different connection type (USB to Bluetooth or vice versa), it returns to its original slot with the same player number. Reconnection matching uses hardware identity provided by the controller's firmware.
|
|
425
488
|
|
|
426
489
|
### Slot management
|
|
427
490
|
|
|
@@ -444,7 +507,13 @@ Using `new Dualsense()` directly continues to work exactly as before, allowing y
|
|
|
444
507
|
|
|
445
508
|
## Known Issues
|
|
446
509
|
|
|
447
|
-
|
|
510
|
+
### Linux - can't use multiple controllers over Bluetooth
|
|
511
|
+
|
|
512
|
+
Identical Bluetooth devices are not given separate HID interfaces under some circumstances. You may still use multiple USB-connected controllers plus one Bluetooth controller.
|
|
513
|
+
|
|
514
|
+
### Linux - can't access factory info over Bluetooth connection in Node.js
|
|
515
|
+
|
|
516
|
+
Factory info uses the HID SET_REPORT feature report protocol, which the Linux kernel's `hid_playstation` driver does not pass through over Bluetooth. This mainly limits your ability to check the controller's body color and serial number. Factory info is still available over USB or Bluetooth in the browser. See [LINUX_HID.md](LINUX_HID.md) for investigation details.
|
|
448
517
|
|
|
449
518
|
## Other Dualsense Variants
|
|
450
519
|
|
|
@@ -458,7 +527,9 @@ The PS4 DualShock controller is not supported.
|
|
|
458
527
|
|
|
459
528
|
## Credits
|
|
460
529
|
|
|
461
|
-
- [CamTosh](https://github.com/CamTosh)'s [node-dualsense](https://github.com/CamTosh/node-dualsense)
|
|
462
|
-
- [flok](https://github.com/flok)'s [pydualsense](https://github.com/flok/pydualsense)
|
|
463
|
-
- [nondebug](https://github.com/nondebug)'s [dualsense reference](https://github.com/nondebug/dualsense)
|
|
530
|
+
- [CamTosh](https://github.com/CamTosh)'s [node-dualsense](https://github.com/CamTosh/node-dualsense) - HID report reference
|
|
531
|
+
- [flok](https://github.com/flok)'s [pydualsense](https://github.com/flok/pydualsense) - HID report reference
|
|
532
|
+
- [nondebug](https://github.com/nondebug)'s [dualsense reference](https://github.com/nondebug/dualsense) - WebHID reference
|
|
533
|
+
- [daidr](https://github.com/daidr)'s [dualsense-tester](https://github.com/daidr/dualsense-tester) — firmware/factory info reference
|
|
534
|
+
- [nowrep](https://github.com/nowrep)'s [dualsensectl](https://github.com/nowrep/dualsensectl) - firmware info reference
|
|
464
535
|
- [Contributors to `dualsense-ts` on Github](https://github.com/nsfm/dualsense-ts/graphs/contributors)
|
package/dist/dualsense.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Momentary, Dpad, DpadParams, Mute, Unisense, UnisenseParams, Touchpad, Gyroscope, GyroscopeParams, Accelerometer, AccelerometerParams, Battery, BatteryParams, Lightbar, PlayerLeds } from "./elements";
|
|
2
2
|
import { Input, InputParams } from "./input";
|
|
3
|
-
import { DualsenseHID } from "./hid";
|
|
3
|
+
import { DualsenseHID, FirmwareInfo, FactoryInfo, DualsenseColor } from "./hid";
|
|
4
4
|
import { Intensity } from "./math";
|
|
5
5
|
/** Settings for your Dualsense controller and each of its inputs */
|
|
6
6
|
export interface DualsenseParams extends InputParams {
|
|
@@ -70,30 +70,50 @@ export declare class Dualsense extends Input<Dualsense> {
|
|
|
70
70
|
readonly accelerometer: Accelerometer;
|
|
71
71
|
/** Battery level and charging status */
|
|
72
72
|
readonly battery: Battery;
|
|
73
|
+
/** Whether a microphone is connected (e.g. headset mic or USB mic) */
|
|
74
|
+
readonly microphone: Momentary;
|
|
75
|
+
/** Whether headphones are connected to the controller's 3.5mm jack */
|
|
76
|
+
readonly headphone: Momentary;
|
|
73
77
|
/** The RGB light bar at the top of the controller */
|
|
74
78
|
readonly lightbar: Lightbar;
|
|
75
79
|
/** The 5 white player indicator LEDs */
|
|
76
80
|
readonly playerLeds: PlayerLeds;
|
|
77
|
-
/**
|
|
81
|
+
/**
|
|
82
|
+
* Buffered battery reading, sampled on a slow cadence
|
|
83
|
+
* Battery readings are prone to flip-flopping, so we buffer them
|
|
84
|
+
*/
|
|
78
85
|
private readonly pendingBattery;
|
|
79
|
-
/** Represents the underlying HID device. Provides input events */
|
|
86
|
+
/** Represents the underlying HID device. Provides input events. */
|
|
80
87
|
readonly hid: DualsenseHID;
|
|
88
|
+
/**
|
|
89
|
+
* Firmware and hardware information.
|
|
90
|
+
* Contains sensible defaults until the device reports its actual values.
|
|
91
|
+
*/
|
|
92
|
+
get firmwareInfo(): FirmwareInfo;
|
|
93
|
+
/**
|
|
94
|
+
* Factory information (serial number, body color, board revision).
|
|
95
|
+
* Contains sensible defaults until the device reports its actual values.
|
|
96
|
+
* On Linux over Bluetooth the defaults persist (kernel limitation).
|
|
97
|
+
*/
|
|
98
|
+
get factoryInfo(): FactoryInfo;
|
|
81
99
|
/** A virtual button representing whether or not a controller is connected */
|
|
82
100
|
readonly connection: Momentary;
|
|
101
|
+
/** True if any input at all is active or changing */
|
|
83
102
|
get active(): boolean;
|
|
84
103
|
/** Returns `true` if the controller is connected via Bluetooth */
|
|
85
104
|
get wireless(): boolean;
|
|
86
|
-
/**
|
|
87
|
-
get
|
|
88
|
-
/**
|
|
89
|
-
get serialNumber(): string
|
|
105
|
+
/** Body color of the controller */
|
|
106
|
+
get color(): DualsenseColor;
|
|
107
|
+
/** Factory-stamped serial number of the controller */
|
|
108
|
+
get serialNumber(): string;
|
|
90
109
|
constructor(params?: DualsenseParams);
|
|
110
|
+
/** Average rumble strength across both halves of the controller. */
|
|
91
111
|
private get rumbleIntensity();
|
|
92
112
|
/** Reset adaptive trigger feedback on both sides to the default linear feel */
|
|
93
113
|
resetTriggerFeedback(): void;
|
|
94
114
|
/** Check or adjust rumble intensity evenly across both sides of the controller */
|
|
95
115
|
rumble(intensity?: Intensity): number;
|
|
96
|
-
/** Distributes HID event values to the controller's inputs */
|
|
116
|
+
/** Distributes HID event values to the controller's public inputs. */
|
|
97
117
|
private processHID;
|
|
98
118
|
}
|
|
99
119
|
//# sourceMappingURL=dualsense.d.ts.map
|
package/dist/dualsense.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dualsense.d.ts","sourceRoot":"","sources":["../src/dualsense.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,IAAI,EACJ,UAAU,EACV,IAAI,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wC;IACxC,SAAgB,OAAO,EAAE,OAAO,CAAC;IACjC,sEAAsE;IACtE,SAAgB,UAAU,EAAE,SAAS,CAAC;IACtC,sEAAsE;IACtE,SAAgB,SAAS,EAAE,SAAS,CAAC;IACrC,qDAAqD;IACrD,SAAgB,QAAQ,WAAkB;IAC1C,wCAAwC;IACxC,SAAgB,UAAU,aAAoB;IAE9C;;;OAGG;IACH,OAAO,CAAC,QAAQ,CAAC,cAAc,CAG7B;IAEF,mEAAmE;IACnE,SAAgB,GAAG,EAAE,YAAY,CAAC;IAElC;;;OAGG;IACH,IAAW,YAAY,IAAI,YAAY,CAEtC;IAED;;;;OAIG;IACH,IAAW,WAAW,IAAI,WAAW,CAEpC;IAED,6EAA6E;IAC7E,SAAgB,UAAU,EAAE,SAAS,CAAC;IAEtC,qDAAqD;IACrD,IAAW,MAAM,IAAI,OAAO,CAI3B;IAED,kEAAkE;IAClE,IAAW,QAAQ,IAAI,OAAO,CAE7B;IAED,mCAAmC;IACnC,IAAW,KAAK,IAAI,cAAc,CAIjC;IAED,sDAAsD;IACtD,IAAW,YAAY,IAAI,MAAM,CAEhC;gBAEW,MAAM,GAAE,eAAoB;IAqMxC,oEAAoE;IACpE,OAAO,KAAK,eAAe,GAE1B;IAED,+EAA+E;IACxE,oBAAoB,IAAI,IAAI;IAKnC,kFAAkF;IAC3E,MAAM,CAAC,SAAS,CAAC,EAAE,SAAS,GAAG,MAAM;IAM5C,sEAAsE;IACtE,OAAO,CAAC,UAAU;CAyDnB"}
|
package/dist/dualsense.js
CHANGED
|
@@ -6,6 +6,22 @@ const input_1 = require("./input");
|
|
|
6
6
|
const hid_1 = require("./hid");
|
|
7
7
|
/** Represents a Dualsense controller */
|
|
8
8
|
class Dualsense extends input_1.Input {
|
|
9
|
+
/**
|
|
10
|
+
* Firmware and hardware information.
|
|
11
|
+
* Contains sensible defaults until the device reports its actual values.
|
|
12
|
+
*/
|
|
13
|
+
get firmwareInfo() {
|
|
14
|
+
return this.hid.firmwareInfo;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Factory information (serial number, body color, board revision).
|
|
18
|
+
* Contains sensible defaults until the device reports its actual values.
|
|
19
|
+
* On Linux over Bluetooth the defaults persist (kernel limitation).
|
|
20
|
+
*/
|
|
21
|
+
get factoryInfo() {
|
|
22
|
+
return this.hid.factoryInfo;
|
|
23
|
+
}
|
|
24
|
+
/** True if any input at all is active or changing */
|
|
9
25
|
get active() {
|
|
10
26
|
return Object.values(this).some((input) => input !== this && input instanceof input_1.Input && input.active);
|
|
11
27
|
}
|
|
@@ -13,13 +29,16 @@ class Dualsense extends input_1.Input {
|
|
|
13
29
|
get wireless() {
|
|
14
30
|
return this.hid.wireless;
|
|
15
31
|
}
|
|
16
|
-
/**
|
|
17
|
-
get
|
|
18
|
-
|
|
32
|
+
/** Body color of the controller */
|
|
33
|
+
get color() {
|
|
34
|
+
const { colorCode } = this.hid.factoryInfo;
|
|
35
|
+
if (colorCode in hid_1.DualsenseColorMap)
|
|
36
|
+
return hid_1.DualsenseColorMap[colorCode];
|
|
37
|
+
return hid_1.DualsenseColor.Unknown;
|
|
19
38
|
}
|
|
20
|
-
/**
|
|
39
|
+
/** Factory-stamped serial number of the controller */
|
|
21
40
|
get serialNumber() {
|
|
22
|
-
return this.hid.
|
|
41
|
+
return this.hid.factoryInfo.serialNumber;
|
|
23
42
|
}
|
|
24
43
|
constructor(params = {}) {
|
|
25
44
|
super(params);
|
|
@@ -28,7 +47,10 @@ class Dualsense extends input_1.Input {
|
|
|
28
47
|
this.lightbar = new elements_1.Lightbar();
|
|
29
48
|
/** The 5 white player indicator LEDs */
|
|
30
49
|
this.playerLeds = new elements_1.PlayerLeds();
|
|
31
|
-
/**
|
|
50
|
+
/**
|
|
51
|
+
* Buffered battery reading, sampled on a slow cadence
|
|
52
|
+
* Battery readings are prone to flip-flopping, so we buffer them
|
|
53
|
+
*/
|
|
32
54
|
this.pendingBattery = {
|
|
33
55
|
peakLevel: 0,
|
|
34
56
|
status: hid_1.ChargeStatus.Discharging,
|
|
@@ -43,6 +65,8 @@ class Dualsense extends input_1.Input {
|
|
|
43
65
|
name: "Mute",
|
|
44
66
|
...(params.mute ?? {}),
|
|
45
67
|
});
|
|
68
|
+
this.microphone = new elements_1.Momentary({ icon: "🎤", name: "Microphone" });
|
|
69
|
+
this.headphone = new elements_1.Momentary({ icon: "🎧", name: "Headphone" });
|
|
46
70
|
this.options = new elements_1.Momentary({
|
|
47
71
|
icon: "⋯",
|
|
48
72
|
name: "Options",
|
|
@@ -116,6 +140,10 @@ class Dualsense extends input_1.Input {
|
|
|
116
140
|
...(params.battery ?? {}),
|
|
117
141
|
});
|
|
118
142
|
this.connection[input_1.InputSet](false);
|
|
143
|
+
// If a HID instance was supplied externally (e.g. by DualsenseManager),
|
|
144
|
+
// the owner is responsible for driving discovery + reconnection. Otherwise
|
|
145
|
+
// construct a default platform provider and run our own discovery loop.
|
|
146
|
+
const externallyManaged = params.hid != null;
|
|
119
147
|
this.hid = params.hid ?? new hid_1.DualsenseHID(new hid_1.PlatformHIDProvider());
|
|
120
148
|
this.hid.register((state) => {
|
|
121
149
|
this.processHID(state);
|
|
@@ -124,22 +152,31 @@ class Dualsense extends input_1.Input {
|
|
|
124
152
|
const triggerFeedbackMemo = { left: "", right: "" };
|
|
125
153
|
const lightbarMemo = { key: "" };
|
|
126
154
|
const playerLedsMemo = { key: "" };
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
155
|
+
// Mirror transport-level connect/disconnect into the connection Momentary,
|
|
156
|
+
// and invalidate output memos on rising-edge connect so the output loop
|
|
157
|
+
// re-pushes desired state to the new device.
|
|
158
|
+
this.hid.onConnectionChange((connected) => {
|
|
131
159
|
this.connection[input_1.InputSet](connected);
|
|
132
|
-
if (connected
|
|
133
|
-
// Invalidate memos so the output loop restores desired state on reconnect.
|
|
160
|
+
if (connected) {
|
|
134
161
|
triggerFeedbackMemo.left = "";
|
|
135
162
|
triggerFeedbackMemo.right = "";
|
|
136
163
|
lightbarMemo.key = "";
|
|
137
164
|
playerLedsMemo.key = "";
|
|
138
165
|
}
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
166
|
+
});
|
|
167
|
+
// Seed the initial state in case the provider was already attached.
|
|
168
|
+
this.connection[input_1.InputSet](this.hid.provider.connected);
|
|
169
|
+
// Standalone mode: poll for devices and reconnect on drop. In managed
|
|
170
|
+
// mode the manager owns this and we must NOT race with it.
|
|
171
|
+
if (!externallyManaged) {
|
|
172
|
+
setInterval(() => {
|
|
173
|
+
if (!this.hid.provider.connected) {
|
|
174
|
+
void Promise.resolve(this.hid.provider.connect()).catch(() => {
|
|
175
|
+
/* surfaced via onError */
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
}, 200);
|
|
179
|
+
}
|
|
143
180
|
/** Refresh battery state on a slow cadence to filter transient glitches */
|
|
144
181
|
setInterval(() => {
|
|
145
182
|
if (!this.connection.active)
|
|
@@ -196,6 +233,7 @@ class Dualsense extends input_1.Input {
|
|
|
196
233
|
}
|
|
197
234
|
}, 1000 / 30);
|
|
198
235
|
}
|
|
236
|
+
/** Average rumble strength across both halves of the controller. */
|
|
199
237
|
get rumbleIntensity() {
|
|
200
238
|
return (this.left.rumble() + this.right.rumble()) / 2;
|
|
201
239
|
}
|
|
@@ -210,13 +248,15 @@ class Dualsense extends input_1.Input {
|
|
|
210
248
|
this.right.rumble(intensity);
|
|
211
249
|
return this.rumbleIntensity;
|
|
212
250
|
}
|
|
213
|
-
/** Distributes HID event values to the controller's inputs */
|
|
251
|
+
/** Distributes HID event values to the controller's public inputs. */
|
|
214
252
|
processHID(state) {
|
|
215
253
|
this.ps[input_1.InputSet](state["Playstation" /* InputId.Playstation */]);
|
|
216
254
|
this.options[input_1.InputSet](state["Options" /* InputId.Options */]);
|
|
217
255
|
this.create[input_1.InputSet](state["Create" /* InputId.Create */]);
|
|
218
256
|
this.mute[input_1.InputSet](state["Mute" /* InputId.Mute */]);
|
|
219
257
|
this.mute.status[input_1.InputSet](state["MuteLed" /* InputId.MuteLed */]);
|
|
258
|
+
this.microphone[input_1.InputSet](state["Microphone" /* InputId.Microphone */]);
|
|
259
|
+
this.headphone[input_1.InputSet](state["Headphone" /* InputId.Headphone */]);
|
|
220
260
|
this.triangle[input_1.InputSet](state["Triangle" /* InputId.Triangle */]);
|
|
221
261
|
this.circle[input_1.InputSet](state["Circle" /* InputId.Circle */]);
|
|
222
262
|
this.cross[input_1.InputSet](state["Cross" /* InputId.Cross */]);
|
package/dist/dualsense.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dualsense.js","sourceRoot":"","sources":["../src/dualsense.ts"],"names":[],"mappings":";;;AAAA,yCAgBoB;AACpB,mCAAuD;AACvD,+BAOe;AAuCf,wCAAwC;AACxC,MAAa,SAAU,SAAQ,aAAgB;IAkD7C,IAAW,MAAM;QACf,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,CAC7B,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,KAAK,IAAI,IAAI,KAAK,YAAY,aAAK,IAAI,KAAK,CAAC,MAAM,CACpE,CAAC;IACJ,CAAC;IAED,kEAAkE;IAClE,IAAW,QAAQ;QACjB,OAAO,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC;IAC3B,CAAC;IAED,uEAAuE;IACvE,IAAW,QAAQ;QACjB,OAAO,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC;IACpC,CAAC;IAED,mEAAmE;IACnE,IAAW,YAAY;QACrB,OAAO,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,YAAY,CAAC;IACxC,CAAC;IAED,YAAY,SAA0B,EAAE;QACtC,KAAK,CAAC,MAAM,CAAC,CAAC;QAvEA,UAAK,GAAc,IAAI,CAAC;QAgCxC,qDAAqD;QACrC,aAAQ,GAAG,IAAI,mBAAQ,EAAE,CAAC;QAC1C,wCAAwC;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,CAAC;QAEtD,MAAM,KAAK,GAAG,KAAK,2CAAsB,CAAC;QAC1C,IAAI,KAAK,GAAG,IAAI,CAAC,cAAc,CAAC,SAAS,EAAE;YACzC,IAAI,CAAC,cAAc,CAAC,SAAS,GAAG,KAAK,CAAC;SACvC;QACD,IAAI,CAAC,cAAc,CAAC,MAAM,GAAG,KAAK,6CAAuB,CAAC;IAC5D,CAAC;CACF;AAnXD,8BAmXC"}
|
|
@@ -1,2 +1,9 @@
|
|
|
1
1
|
export declare function computeBluetoothReportChecksum(buffer: Uint8Array): number;
|
|
2
|
+
/**
|
|
3
|
+
* Compute CRC-32 for a Bluetooth feature report.
|
|
4
|
+
* The CRC covers the HID transaction header (0x53), the report ID,
|
|
5
|
+
* and all payload bytes except the last 4 (which hold the CRC itself).
|
|
6
|
+
* Uses standard CRC-32 with final inversion.
|
|
7
|
+
*/
|
|
8
|
+
export declare function computeFeatureReportChecksum(reportId: number, buffer: Uint8Array): number;
|
|
2
9
|
//# sourceMappingURL=bt_checksum.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bt_checksum.d.ts","sourceRoot":"","sources":["../../src/hid/bt_checksum.ts"],"names":[],"mappings":"AAiDA,wBAAgB,8BAA8B,CAAC,MAAM,EAAE,UAAU,GAAG,MAAM,CAOzE"}
|
|
1
|
+
{"version":3,"file":"bt_checksum.d.ts","sourceRoot":"","sources":["../../src/hid/bt_checksum.ts"],"names":[],"mappings":"AAiDA,wBAAgB,8BAA8B,CAAC,MAAM,EAAE,UAAU,GAAG,MAAM,CAOzE;AAeD;;;;;GAKG;AACH,wBAAgB,4BAA4B,CAC1C,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,UAAU,GACjB,MAAM,CAeR"}
|
package/dist/hid/bt_checksum.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Ported from pydualsense/pydualsense/checksum.py
|
|
3
3
|
// Computes the Bluetooth output-report checksum for report 0x31.
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.computeBluetoothReportChecksum = void 0;
|
|
5
|
+
exports.computeFeatureReportChecksum = exports.computeBluetoothReportChecksum = void 0;
|
|
6
6
|
const hashTable = new Uint32Array([
|
|
7
7
|
0xd202ef8d, 0xa505df1b, 0x3c0c8ea1, 0x4b0bbe37, 0xd56f2b94, 0xa2681b02,
|
|
8
8
|
0x3b614ab8, 0x4c667a2e, 0xdcd967bf, 0xabde5729, 0x32d70693, 0x45d03605,
|
|
@@ -57,4 +57,36 @@ function computeBluetoothReportChecksum(buffer) {
|
|
|
57
57
|
return result >>> 0;
|
|
58
58
|
}
|
|
59
59
|
exports.computeBluetoothReportChecksum = computeBluetoothReportChecksum;
|
|
60
|
+
/** Standard CRC-32 lookup table (polynomial 0xEDB88320) */
|
|
61
|
+
const crc32Table = (() => {
|
|
62
|
+
const table = [];
|
|
63
|
+
for (let n = 0; n < 256; n++) {
|
|
64
|
+
let c = n;
|
|
65
|
+
for (let k = 0; k < 8; k++) {
|
|
66
|
+
c = c & 1 ? 0xedb88320 ^ (c >>> 1) : c >>> 1;
|
|
67
|
+
}
|
|
68
|
+
table[n] = c >>> 0;
|
|
69
|
+
}
|
|
70
|
+
return table;
|
|
71
|
+
})();
|
|
72
|
+
/**
|
|
73
|
+
* Compute CRC-32 for a Bluetooth feature report.
|
|
74
|
+
* The CRC covers the HID transaction header (0x53), the report ID,
|
|
75
|
+
* and all payload bytes except the last 4 (which hold the CRC itself).
|
|
76
|
+
* Uses standard CRC-32 with final inversion.
|
|
77
|
+
*/
|
|
78
|
+
function computeFeatureReportChecksum(reportId, buffer) {
|
|
79
|
+
let crc = 0xffffffff >>> 0;
|
|
80
|
+
// Feed prefix bytes: 0x53 (SET_REPORT feature) + report ID
|
|
81
|
+
crc = (crc >>> 8) ^ crc32Table[(crc ^ 0x53) & 0xff];
|
|
82
|
+
crc = (crc >>> 8) ^ crc32Table[(crc ^ reportId) & 0xff];
|
|
83
|
+
// Feed payload data (exclude last 4 bytes reserved for CRC)
|
|
84
|
+
const dataLen = buffer.length - 4;
|
|
85
|
+
for (let i = 0; i < dataLen; i++) {
|
|
86
|
+
crc = (crc >>> 8) ^ crc32Table[(crc ^ buffer[i]) & 0xff];
|
|
87
|
+
}
|
|
88
|
+
// Final XOR (standard CRC-32 finalization)
|
|
89
|
+
return (crc ^ 0xffffffff) >>> 0;
|
|
90
|
+
}
|
|
91
|
+
exports.computeFeatureReportChecksum = computeFeatureReportChecksum;
|
|
60
92
|
//# sourceMappingURL=bt_checksum.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bt_checksum.js","sourceRoot":"","sources":["../../src/hid/bt_checksum.ts"],"names":[],"mappings":";AAAA,kDAAkD;AAClD,iEAAiE;;;AAEjE,MAAM,SAAS,GAAG,IAAI,WAAW,CAAC;IAChC,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IACtE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IACtE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IACtE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IACtE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IACtE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IACtE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IACtE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IACtE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IACtE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EA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