
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
xbox-hid-controller
Advanced tools
Original Xbox Controller API using node-hid HID device
First, you require the module, and run listControllers to get
a list of HID devices that look like on Original Xbox Controller.
The array returned is a filtered version of HID.devices() from the
node-hid module.
Then, you create an XboxController object, which is a subclass of
HID.HID, and subscribe to the values event emitted. Events
will be emitted whenever the state of the controller changes.
var xhc = require('xbox-hid-controller');
var controllers = xhc.listControllers();
console.log(controllers);
var controller = new xhc.XboxController(controllers[0].path);
controller.on('values', function(values) {
console.log(values);
});
[ { vendorId: 1118,
productId: 645,
path: 'USB_045e_0285_fd121000',
serialNumber: '',
manufacturer: 'Unknown Third-Party',
product: 'Xbox Controller',
release: 256,
interface: -1 } ]
{ up: 0,
down: 0,
left: 0,
right: 0,
start: 0,
back: 0,
las: 0,
ras: 0,
a: 0,
b: 0,
x: 0,
y: 0,
black: 0,
white: 0,
ltrigger: 0,
rtrigger: 0,
lasX: 896,
lasY: -1228,
rasX: 0,
rasY: 413 }
{ up: 0,
down: 0,
left: 0,
right: 0,
start: 0,
back: 0,
las: 0,
ras: 0,
a: 0,
b: 0,
x: 0,
y: 0,
black: 0,
white: 0,
ltrigger: 0,
rtrigger: 0,
lasX: 1344,
lasY: -1228,
rasX: 0,
rasY: 413 }
...
xhc.listControllers([product])List all HID devices that look like Xbox Controllers.
product: the name to use to filter the list of HID devices, defaults to Xbox Controllerxhc.listAll()List all HID devices. Same as HID.devices()
new XboxController(path)Create a new XboxController object that emits values events whenever
the controllers state is changed.
vaules: emitted whenever the controllers state is changed, contains information
about the buttons pressed and axis movedBecause this class is a subclass of HID.HID from
node-hid, you can also subscribe
to the events emitted directly by this object.
error: any possible error with the HID devicedata: the raw data buffer from the device, this is parsed for you
and emitted in a nicer form with the values eventnpm install xbox-hid-controller
To use the tools in the examples/ directory, you must install the dev dependencies from npm
git clone git://github.com/bahamas10/node-xbox-hid-controller.git
cd node-xbox-hid-controller
npm install
npm install -d
You must first installed this driver http://xhd.sourceforge.net/ for the original Xbox controller to be recognized by OS X.
If you are running Mountain Lion, Mavericks, or above, you need to download this version of the driver specifically for it to work http://macman860.wordpress.com/2013/05/03/xbox-driver-for-mac-os-x-lion/
MIT
FAQs
Original Xbox Controller API using node-hid HID device
We found that xbox-hid-controller demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.