Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can read but not write to a device #521

Open
VibingCreator opened this issue Nov 9, 2023 · 0 comments
Open

Can read but not write to a device #521

VibingCreator opened this issue Nov 9, 2023 · 0 comments

Comments

@VibingCreator
Copy link

I have an old game pad controller and I want to build an API to let people mess with it when I am playing games. I am able to read the data. Although there's a problem whenever I want to send it to the device. Once I inject the payload, the game pad starts vibrating until I plug it off from the computer. No data is passed whatsoever. Any ideas?

Example of read output:

<Buffer 7f 7f 00 20 00 00 00 00>
<Buffer 7f 7f 00 00 00 00 00 00>
<Buffer 7f 7f 00 08 00 00 00 00>
<Buffer 7f 7f 00 00 00 00 00 00>
<Buffer 7f 7f 00 04 00 00 00 00>
<Buffer 7f 7f 00 00 00 00 00 00>

Program:

const HID = require("node-hid");

const gamePad = new HID.HID(4797, 53290);

const ACCELERATE = [0x7f, 0x7f, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00];

gamePad.on("data", (data) => {
  console.log(data);
});

gamePad.on("error", (error) => {
  console.log(error);
});

setTimeout(() => {
  gamePad.write(ACCELERATE);
}, 3000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant