Files
nanakura dc26878386
CI / Lint (push) Canceled after 0s
CI / Build Test (stage-web) (push) Canceled after 0s
CI / Build Test (ui-loading-screens) (push) Canceled after 0s
CI / Build Test (ui-transitions) (push) Canceled after 0s
CI / Unit Test (push) Canceled after 0s
CI / Type Check (push) Canceled after 0s
CI / Check Provenance (push) Canceled after 0s
Sync Labels / sync-labels (push) Successful in 1m43s
chore: prune unused apps and services for the moeka fork
- Remove stage-tamagotchi, stage-pocket, server, and engine workspaces with their workflows, addons, and docs
- Switch the toolchain from pnpm to bun, replace lockfiles with bun.lock
- Rewrite remaining product references to Moeka
2026-09-14 16:40:49 +07:00
..

@proj-airi/input-playstation-dualsense-5

This package reads and writes Sony PlayStation 5 DualSense reports through WebHID. It has no UI code.

The package supports the standard DualSense controller with product ID 0x0ce6. It supports USB and Bluetooth reports.

Use the package

Call requestDualSenseDevice() from a user action. WebHID requires a user action before it shows the device chooser.

import {
  createDefaultDualSenseOutputState,
  DualSenseController,
  requestDualSenseDevice,
} from '@proj-airi/input-playstation-dualsense-5'

const device = await requestDualSenseDevice()
if (!device)
  throw new Error('No DualSense device was selected.')

const controller = new DualSenseController(device)
const stopInput = controller.onInputReport((report) => {
  console.info(report.state.sticks.left)
})

await controller.open()

const output = createDefaultDualSenseOutputState()
await controller.sendOutput({
  ...output,
  lightbar: { red: 124, green: 178, blue: 232 },
})

stopInput()
await controller.close()

Use getGrantedDualSenseDevices() to find devices that already have permission. Use onDualSenseConnectionChange() to observe connect and disconnect events.

When to use it

Use this package when a Chromium renderer needs raw DualSense input, motion sensors, touch points, LEDs, rumble, or adaptive triggers.

Do not use this package for a generic gamepad. Use the Gamepad API when standard buttons and axes are sufficient.

WebHID requires a secure context. The host browser must support WebHID.

Reference