rdepena / node-dualshock-controller

Eventing API layer over HID for the Sony DualShock 3 and DualShock 4 controllers
208 stars 46 forks source link

Mac 10.8.5 - Error connecting to controller #3

Closed foldi closed 10 years ago

foldi commented 10 years ago

When running the example in the README, I get the error below.

node dualshock connecting node dualshock disconnecting

TypeError: Uncaught, unspecified "error" event. at TypeError () at EventEmitter.emit (events.js:74:15) at checkIfreceiving (/Users/vince/Dev/NodeBots/dualshock-test/node_modules/dualshock-controller/lib/controller.js:145:10) at Timer.listOnTimeout as ontimeout

It seems like the code exits immediately after trying to connect. When checking my HID devices, I can see the controller connected as:

vendorId: 1356, productId: 616, path: 'USB_054c_0268_14100000', serialNumber: '', manufacturer: 'Sony', product: 'PLAYSTATION(R)3 Controller', release: 256, interface: -1

rdepena commented 10 years ago

Hey @foldi, this is not a solution but will yield a bit more information on the issue: Subscribe to the 'error' event dualShock3.on('error', function (data) { console.log(data); });

I will add this to the read me. but once you set this up you will be able to see the exact error and send it my way =).

additionally (and adding this just in case) I have found that if you ctrl+c out of the script occasionally it will keep going in the background, you could ps -a to see its still running. killing that zombie process should allow you to re-connect to the device ect...

foldi commented 10 years ago

Thanks for your help. When I subscribe to the error event, this gets logged to the console repeatedly..

the device failed to read, retrying cannot open device with vendor id 0x54c and product id 0x268

Also, when I run ps -a off a fresh boot, I get this.

PID TTY TIME CMD 293 ttys000 0:00.03 login -pf vince 295 ttys000 0:00.11 -bash 419 ttys000 0:00.00 ps -a

Doesn't seem like the process is hanging around.

rdepena commented 10 years ago

This is a wierd one, I am sure you have the right node version but can you check the version you are running ? anything > 0.8 should be fine. by the vendor Id and the product code pasted I can tell its the right one so you are right in that the problem is connecting.

foldi commented 10 years ago

I'm running Node v0.10.15. I also tried on a MacBook Air running OS X 10.7.5 and had the same problem. I tried pushing the factory reset button on the controller as well. Do you know if there's anything about the controller that would lock it up?

rdepena commented 10 years ago

I think I was able to recreate the issue, this happened to me if I only connected the controller via usb instead of pairing with it via bluetooth, in the short term try that while I work on a fix. let me know if that worked.

foldi commented 10 years ago

Yes, it works when pairing via bluetooth. Thx! If it could work via USB only, that would be great. But Bluetooth will work fine in the meantime.

rdepena commented 10 years ago

great to hear that its finally working. I will leave this issue open until I figure out USB only.

stewart commented 10 years ago

Hey @rdepena, getting the same error when I try to connect via USB, wondering if there's any progress on a patch? Was planning to dig into node-hid myself when I saw this issue.

rdepena commented 10 years ago

so far no (it might be a hardware limitation on the dualshock), but if you connect via bluetooth it should work.

rdepena commented 10 years ago

actually, ignore what I said about hardware limitation, have been looking into this and I have been able to get some data back from the controller with bluetooth off.

rdepena commented 10 years ago

one more update: Got this to work 100% by pressing the playstation button once I have the controller connected via USB (bluetooth off), I will add this to the documentation and close this ticket. Thank you for bringing this up.

rdepena commented 10 years ago

Updated read me document to warn about this additional step if connecting via usb.