dualsense-ts 6.3.0 → 6.5.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 +74 -10
- package/SECURITY.md +24 -0
- package/dist/dualsense.d.ts +24 -8
- package/dist/dualsense.d.ts.map +1 -1
- package/dist/dualsense.js +53 -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 +8 -0
- package/dist/hid/hid_provider.d.ts.map +1 -1
- package/dist/hid/hid_provider.js +7 -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/input.d.ts +6 -0
- package/dist/input.d.ts.map +1 -1
- package/dist/input.js +24 -0
- package/dist/input.js.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 +35 -13
- package/nodehid_example/single.ts +32 -5
- package/package.json +1 -1
- package/src/dualsense.ts +65 -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 +14 -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/input.ts +25 -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.2ba4cfae.js +3 -0
- package/webhid_example/build/static/js/main.2ba4cfae.js.map +1 -0
- package/webhid_example/src/App.tsx +5 -1
- package/webhid_example/src/hud/AudioIndicator.tsx +4 -2
- 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 +1 -0
- package/webhid_example/build/static/js/main.fcf0c900.js +0 -3
- package/webhid_example/build/static/js/main.fcf0c900.js.map +0 -1
- /package/webhid_example/build/static/js/{main.fcf0c900.js.LICENSE.txt → main.2ba4cfae.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
|
|
@@ -96,6 +110,14 @@ controller.dpad.on("press", (dpad, input) =>
|
|
|
96
110
|
// Your Dualsense may provide over 250 `input` events per second, so use this sparingly
|
|
97
111
|
// These events are not available for nested inputs, like the example above
|
|
98
112
|
controller.left.analog.x.on("input", console.log)
|
|
113
|
+
|
|
114
|
+
// Remove a specific listener
|
|
115
|
+
const handler = ({ active }) => console.log(active);
|
|
116
|
+
controller.cross.on("press", handler);
|
|
117
|
+
controller.cross.off("press", handler);
|
|
118
|
+
|
|
119
|
+
// Remove all listeners for an event
|
|
120
|
+
controller.cross.removeAllListeners("press");
|
|
99
121
|
```
|
|
100
122
|
|
|
101
123
|
- _Promises_: Wait for one-off inputs using `await`:
|
|
@@ -235,7 +257,7 @@ console.log(controller.right.trigger.feedback.config);
|
|
|
235
257
|
console.log(controller.right.trigger.feedback.effect); // TriggerEffect.Off
|
|
236
258
|
```
|
|
237
259
|
|
|
238
|
-
Feedback state is automatically restored if the controller disconnects and reconnects
|
|
260
|
+
Feedback state is automatically restored if the controller disconnects and reconnects - no handling required on your end.
|
|
239
261
|
|
|
240
262
|
#### Trigger effects
|
|
241
263
|
|
|
@@ -249,7 +271,7 @@ Feedback state is automatically restored if the controller disconnects and recon
|
|
|
249
271
|
| `TriggerEffect.Vibration` | Zone-based oscillation with amplitude and frequency |
|
|
250
272
|
| `TriggerEffect.Machine` | Dual-amplitude vibration with frequency and period control |
|
|
251
273
|
|
|
252
|
-
Each effect accepts a unique set of configuration options
|
|
274
|
+
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
275
|
|
|
254
276
|
Effect names are based on [Nielk1's DualSense trigger effect documentation](https://gist.github.com/Nielk1/6d54cc2c00d2201ccb8c2720ad7538db).
|
|
255
277
|
|
|
@@ -283,7 +305,7 @@ controller.mute.status.on("change", ({ state }) => {
|
|
|
283
305
|
});
|
|
284
306
|
```
|
|
285
307
|
|
|
286
|
-
The `{r, g, b}` format is
|
|
308
|
+
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
309
|
|
|
288
310
|
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
311
|
|
|
@@ -304,6 +326,38 @@ controller.headphone.state; // true when headphones are plugged in
|
|
|
304
326
|
controller.microphone.state; // true when a microphone is available
|
|
305
327
|
```
|
|
306
328
|
|
|
329
|
+
#### Color and Serial Number
|
|
330
|
+
|
|
331
|
+
`dualsense-ts` reads the controller's body color and serial number from factory info after connection:
|
|
332
|
+
|
|
333
|
+
```typescript
|
|
334
|
+
import { DualsenseColor } from "dualsense-ts";
|
|
335
|
+
|
|
336
|
+
controller.color; // DualsenseColor.CosmicRed
|
|
337
|
+
controller.serialNumber; // Factory-stamped serial number
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
`color` returns a `DualsenseColor` enum value (`DualsenseColor.Unknown` when factory info is unavailable).
|
|
341
|
+
|
|
342
|
+
#### Firmware and Factory Info
|
|
343
|
+
|
|
344
|
+
`dualsense-ts` automatically reads firmware details and factory information from the device after connection. These values may take a moment to populate.
|
|
345
|
+
|
|
346
|
+
```typescript
|
|
347
|
+
const fw = controller.firmwareInfo;
|
|
348
|
+
const v = fw.mainFirmwareVersion;
|
|
349
|
+
console.log(`Firmware: ${v.major}.${v.minor}.${v.patch}`);
|
|
350
|
+
console.log(`Built: ${fw.buildDate} ${fw.buildTime}`);
|
|
351
|
+
console.log(`Hardware: ${fw.hardwareInfo}`);
|
|
352
|
+
|
|
353
|
+
const fi = controller.factoryInfo;
|
|
354
|
+
console.log(`Color: ${fi.colorName}`); // e.g. "Cosmic Red"
|
|
355
|
+
console.log(`Board: ${fi.boardRevision}`); // e.g. "BDM-030"
|
|
356
|
+
console.log(`Serial: ${fi.serialNumber}`);
|
|
357
|
+
```
|
|
358
|
+
|
|
359
|
+
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.
|
|
360
|
+
|
|
307
361
|
## Using `dualsense-ts` with React
|
|
308
362
|
|
|
309
363
|
Check out [the example app](./webhid_example/) for more details.
|
|
@@ -394,13 +448,15 @@ manager.on("change", ({ active, players }) => {
|
|
|
394
448
|
});
|
|
395
449
|
```
|
|
396
450
|
|
|
397
|
-
In Node.js, the manager polls for new devices automatically. In the browser, you'll need to request permission via a user gesture:
|
|
451
|
+
In Node.js, the manager polls for new devices automatically. In the browser, you'll still need to request permission via a user gesture:
|
|
398
452
|
|
|
399
453
|
```typescript
|
|
400
454
|
// React / plain JS
|
|
401
455
|
<button onClick={manager.getRequest()}>Add Controllers</button>
|
|
402
456
|
```
|
|
403
457
|
|
|
458
|
+
This only applies to the first connection for each controller.
|
|
459
|
+
|
|
404
460
|
### Accessing controllers
|
|
405
461
|
|
|
406
462
|
```typescript
|
|
@@ -436,7 +492,7 @@ manager.get(0)?.playerLeds.setBrightness(Brightness.Low);
|
|
|
436
492
|
|
|
437
493
|
### Reconnection
|
|
438
494
|
|
|
439
|
-
When a controller disconnects, its slot is preserved. If the same controller reconnects
|
|
495
|
+
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.
|
|
440
496
|
|
|
441
497
|
### Slot management
|
|
442
498
|
|
|
@@ -459,7 +515,13 @@ Using `new Dualsense()` directly continues to work exactly as before, allowing y
|
|
|
459
515
|
|
|
460
516
|
## Known Issues
|
|
461
517
|
|
|
462
|
-
|
|
518
|
+
### Linux - can't use multiple controllers over Bluetooth
|
|
519
|
+
|
|
520
|
+
Identical Bluetooth devices are not given separate HID interfaces under some circumstances. You may still use multiple USB-connected controllers plus one Bluetooth controller.
|
|
521
|
+
|
|
522
|
+
### Linux - can't access factory info over Bluetooth connection in Node.js
|
|
523
|
+
|
|
524
|
+
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.
|
|
463
525
|
|
|
464
526
|
## Other Dualsense Variants
|
|
465
527
|
|
|
@@ -473,7 +535,9 @@ The PS4 DualShock controller is not supported.
|
|
|
473
535
|
|
|
474
536
|
## Credits
|
|
475
537
|
|
|
476
|
-
- [CamTosh](https://github.com/CamTosh)'s [node-dualsense](https://github.com/CamTosh/node-dualsense)
|
|
477
|
-
- [flok](https://github.com/flok)'s [pydualsense](https://github.com/flok/pydualsense)
|
|
478
|
-
- [nondebug](https://github.com/nondebug)'s [dualsense reference](https://github.com/nondebug/dualsense)
|
|
538
|
+
- [CamTosh](https://github.com/CamTosh)'s [node-dualsense](https://github.com/CamTosh/node-dualsense) - HID report reference
|
|
539
|
+
- [flok](https://github.com/flok)'s [pydualsense](https://github.com/flok/pydualsense) - HID report reference
|
|
540
|
+
- [nondebug](https://github.com/nondebug)'s [dualsense reference](https://github.com/nondebug/dualsense) - WebHID reference
|
|
541
|
+
- [daidr](https://github.com/daidr)'s [dualsense-tester](https://github.com/daidr/dualsense-tester) — firmware/factory info reference
|
|
542
|
+
- [nowrep](https://github.com/nowrep)'s [dualsensectl](https://github.com/nowrep/dualsensectl) - firmware info reference
|
|
479
543
|
- [Contributors to `dualsense-ts` on Github](https://github.com/nsfm/dualsense-ts/graphs/contributors)
|
package/SECURITY.md
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Security Policy
|
|
2
|
+
|
|
3
|
+
## Supported Versions
|
|
4
|
+
|
|
5
|
+
Only the latest published version of `dualsense-ts` receives security updates.
|
|
6
|
+
|
|
7
|
+
## Reporting a Vulnerability
|
|
8
|
+
|
|
9
|
+
If you discover a security vulnerability, please report it privately via [GitHub Security Advisories](https://github.com/nsfm/dualsense-ts/security/advisories/new).
|
|
10
|
+
|
|
11
|
+
Do not open a public issue for security vulnerabilities.
|
|
12
|
+
|
|
13
|
+
## Dependencies
|
|
14
|
+
|
|
15
|
+
`dualsense-ts` is committed to remaining a zero-dependency package, minimizing risk surface area. The peer dependency on `node-hid` is the only exception - please review their security standards before implementing `dualsense-ts` in node.js.
|
|
16
|
+
|
|
17
|
+
## Scope
|
|
18
|
+
|
|
19
|
+
`dualsense-ts` communicates with HID devices via WebHID (browser) and `node-hid` (Node.js). It does not make network requests, store credentials, or process untrusted input beyond raw HID reports from physically connected controllers.
|
|
20
|
+
|
|
21
|
+
Security concerns most likely to be relevant:
|
|
22
|
+
|
|
23
|
+
- Malformed HID report parsing leading to unexpected behavior
|
|
24
|
+
- Dependency vulnerabilities in `node-hid` or dev tooling
|
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 {
|
|
@@ -78,26 +78,42 @@ export declare class Dualsense extends Input<Dualsense> {
|
|
|
78
78
|
readonly lightbar: Lightbar;
|
|
79
79
|
/** The 5 white player indicator LEDs */
|
|
80
80
|
readonly playerLeds: PlayerLeds;
|
|
81
|
-
/**
|
|
81
|
+
/**
|
|
82
|
+
* Buffered battery reading, sampled on a slow cadence
|
|
83
|
+
* Battery readings are prone to flip-flopping, so we buffer them
|
|
84
|
+
*/
|
|
82
85
|
private readonly pendingBattery;
|
|
83
|
-
/** Represents the underlying HID device. Provides input events */
|
|
86
|
+
/** Represents the underlying HID device. Provides input events. */
|
|
84
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;
|
|
85
99
|
/** A virtual button representing whether or not a controller is connected */
|
|
86
100
|
readonly connection: Momentary;
|
|
101
|
+
/** True if any input at all is active or changing */
|
|
87
102
|
get active(): boolean;
|
|
88
103
|
/** Returns `true` if the controller is connected via Bluetooth */
|
|
89
104
|
get wireless(): boolean;
|
|
90
|
-
/**
|
|
91
|
-
get
|
|
92
|
-
/**
|
|
93
|
-
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;
|
|
94
109
|
constructor(params?: DualsenseParams);
|
|
110
|
+
/** Average rumble strength across both halves of the controller. */
|
|
95
111
|
private get rumbleIntensity();
|
|
96
112
|
/** Reset adaptive trigger feedback on both sides to the default linear feel */
|
|
97
113
|
resetTriggerFeedback(): void;
|
|
98
114
|
/** Check or adjust rumble intensity evenly across both sides of the controller */
|
|
99
115
|
rumble(intensity?: Intensity): number;
|
|
100
|
-
/** Distributes HID event values to the controller's inputs */
|
|
116
|
+
/** Distributes HID event values to the controller's public inputs. */
|
|
101
117
|
private processHID;
|
|
102
118
|
}
|
|
103
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,EACJ,QAAQ,EACR,cAAc,EACd,QAAQ,EACR,SAAS,EACT,eAAe,EACf,aAAa,EACb,mBAAmB,EACnB,OAAO,EACP,aAAa,EACb,QAAQ,EACR,UAAU,EACX,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,KAAK,EAAY,WAAW,EAAE,MAAM,SAAS,CAAC;AACvD,OAAO,EAEL,YAAY,
|
|
1
|
+
{"version":3,"file":"dualsense.d.ts","sourceRoot":"","sources":["../src/dualsense.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,IAAI,EACJ,UAAU,EACV,IAAI,EACJ,QAAQ,EACR,cAAc,EACd,QAAQ,EACR,SAAS,EACT,eAAe,EACf,aAAa,EACb,mBAAmB,EACnB,OAAO,EACP,aAAa,EACb,QAAQ,EACR,UAAU,EACX,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,KAAK,EAAY,WAAW,EAAE,MAAM,SA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AQ,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,
|
|
@@ -118,6 +140,10 @@ class Dualsense extends input_1.Input {
|
|
|
118
140
|
...(params.battery ?? {}),
|
|
119
141
|
});
|
|
120
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;
|
|
121
147
|
this.hid = params.hid ?? new hid_1.DualsenseHID(new hid_1.PlatformHIDProvider());
|
|
122
148
|
this.hid.register((state) => {
|
|
123
149
|
this.processHID(state);
|
|
@@ -126,22 +152,31 @@ class Dualsense extends input_1.Input {
|
|
|
126
152
|
const triggerFeedbackMemo = { left: "", right: "" };
|
|
127
153
|
const lightbarMemo = { key: "" };
|
|
128
154
|
const playerLedsMemo = { key: "" };
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
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) => {
|
|
133
159
|
this.connection[input_1.InputSet](connected);
|
|
134
|
-
if (connected
|
|
135
|
-
// Invalidate memos so the output loop restores desired state on reconnect.
|
|
160
|
+
if (connected) {
|
|
136
161
|
triggerFeedbackMemo.left = "";
|
|
137
162
|
triggerFeedbackMemo.right = "";
|
|
138
163
|
lightbarMemo.key = "";
|
|
139
164
|
playerLedsMemo.key = "";
|
|
140
165
|
}
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
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
|
+
}
|
|
145
180
|
/** Refresh battery state on a slow cadence to filter transient glitches */
|
|
146
181
|
setInterval(() => {
|
|
147
182
|
if (!this.connection.active)
|
|
@@ -198,6 +233,7 @@ class Dualsense extends input_1.Input {
|
|
|
198
233
|
}
|
|
199
234
|
}, 1000 / 30);
|
|
200
235
|
}
|
|
236
|
+
/** Average rumble strength across both halves of the controller. */
|
|
201
237
|
get rumbleIntensity() {
|
|
202
238
|
return (this.left.rumble() + this.right.rumble()) / 2;
|
|
203
239
|
}
|
|
@@ -212,7 +248,7 @@ class Dualsense extends input_1.Input {
|
|
|
212
248
|
this.right.rumble(intensity);
|
|
213
249
|
return this.rumbleIntensity;
|
|
214
250
|
}
|
|
215
|
-
/** Distributes HID event values to the controller's inputs */
|
|
251
|
+
/** Distributes HID event values to the controller's public inputs. */
|
|
216
252
|
processHID(state) {
|
|
217
253
|
this.ps[input_1.InputSet](state["Playstation" /* InputId.Playstation */]);
|
|
218
254
|
this.options[input_1.InputSet](state["Options" /* InputId.Options */]);
|
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;IAsD7C,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;QA3EA,UAAK,GAAc,IAAI,CAAC;QAoCxC,qDAAqD;QACrC,aAAQ,GAAG,IAAI,mBAAQ,EAAE,CAAC;QAC1C,wCAAwC;QACxB,eAAU,GAAG,IAAI,qBAAU,EAAE,CAAC;QAE9C,0DAA0D;QACzC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AAC,CAAC,CAAC,gBAAQ,CAAC,CAAC,KAAK,6BAAe,CAAC,CAAC;QACjD,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,gBAAQ,CAAC,CAAC,KAAK,+BAAgB,CAAC,CAAC;QACtD,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,gBAAQ,CAAC,CAAC,KAAK,+BAAgB,CAAC,CAAC;QACtD,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,gBAAQ,CAAC,CAAC,KAAK,+BAAgB,CAAC,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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