-
Notifications
You must be signed in to change notification settings - Fork 46
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
Multiple Controllers #68
Comments
Hey @tlee732, I did not think to add multiple controller support. The following are the connecting pieces that the library uses to choose the device to connect to: [The config has a vendorId Device Id combo] (https://github.com/rdepena/node-dualshock-controller/blob/master/controllerConfigurations/dualShock4.json#L2) That is used to query the list of connected devices, Actual filter function. The filter function could be modified to accept a path as well but you would have to know the path and feed it to the library. |
Refactor use of globals in config module in favor of `Config` object instances that can be encapsulated by each `Controller`, avoiding race conditions when doing multiple async instantiations. Introduce `index` controller option that specifies which of the discovered HID devices for the given controller config (those matching product and vendor IDs) to use. Example: let ds1 = dualShock({ config: "dualshock4", index: 0 }), ds2 = dualShock({ config: "dualshock4", index: 1 }), ds3 = dualShock({ config: "dualshock3", index: 0 });
Removed use of global config module in favor of `Config` objects that can be encapsulated by each `Controller` instance, allowing distinct instantiations of the latter and avoiding race conditions should instantiation take place within async events. Introduced `index` controller option that specifies which of the discovered HID devices (matched vendor and product ID) to use for the given controller config. Example: let ds1 = dualShock({ config: "dualshock4", index: 0 }), ds2 = dualShock({ config: "dualshock4", index: 1 }), ds3 = dualShock({ config: "dualshock3", index: 0 });
Removed use of global config module in favor of `Config` objects that can be encapsulated by each `Controller` instance, allowing distinct instantiations of the latter and avoiding race conditions should instantiation take place within async events. Introduced optional `index` option that specifies which of the discovered HID devices (matched vendor and product ID) to use for the given controller config. Note that discovered controllers are sorted by device path before assignment to ensure consistency in selection. Exposed `Controller` as part of the core module to make multiple instantiation seem more clear. However, the original `dualShock` entry-point function was left for backwards compatibility. Example: var ds = require('dualshock-controller'); var ds1 = new ds.Controller({ config: "dualshock4", index: 0 }), ds2 = new ds.Controller({ config: "dualshock4", index: 1 }), ds3 = new ds.Controller({ config: "dualshock3", index: 0 });
I'm trying to connect multiple dual-shock controllers but can't find where the HID is being implemented. I want to search for HID devices, and create new controllers based on path.
The text was updated successfully, but these errors were encountered: