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

setExtras timeout error #4

Open
martindb opened this issue Apr 28, 2018 · 2 comments
Open

setExtras timeout error #4

martindb opened this issue Apr 28, 2018 · 2 comments

Comments

@martindb
Copy link

I'm trying to use a clone dualshock 3 controller (Shanwan controller) in my fresh installed rapsbian / rpi 3.

First, I have problems with pairing/using the controller with BT, so, I'm finally using a patched bluez version to get it work (see https://raspberryblog.de/?p=1870).

With this issue solved, I have problems with cncjs-pendant-ps3, exactly in the setExtras invocation, some seconds after starting, I got this error (it sets the leds according to battery level right):

root@raspberrypi:/usr/lib/node_modules/cncjs-pendant-ps3# cncjs-pendant-ps3 -p /dev/ttyUSB0
[ { vendorId: 1356,
productId: 616,
path: '/dev/hidraw0',
serialNumber: '03:c7:98:6e:63:25',
manufacturer: '',
product: 'PLAYSTATION(R)3 Controller',
release: 0,
interface: -1 } ]
Waiting for Pendant to connect... please press the PS button on the DS3 controller.
Pendant Connected
connection:change:Not Charging
battery:change:80%
connection:change:Rumbling
Connected to ws://localhost:8000?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IiIsIm5hbWUiOiJjbmNqcy1wZW5kYW50IiwiaWF0IjoxNTI0OTI2NTUzLCJleHAiOjE1Mjc1MTg1NTN9.7yFZBvugUp3pnTBHP1bC5rcuDhRjev0_tNg1zF7JGrg
Connected to port "/dev/ttyUSB0" (Baud rate: 115200)
/usr/lib/node_modules/cncjs-pendant-ps3/node_modules/dualshock-controller/src/controller.js:131
device.write(buff);
^

Error: Cannot write to HID device
at Controller.setExtras (/usr/lib/node_modules/cncjs-pendant-ps3/node_modules/dualshock-controller/src/controller.js:131:16)
at Timeout.updateControllerExtras [as _onTimeout] (/usr/lib/node_modules/cncjs-pendant-ps3/index.js:803:16)
at ontimeout (timers.js:386:14)
at tryOnTimeout (timers.js:250:5)
at Timer.listOnTimeout (timers.js:214:5)

Then, if I just comment the setExtras invocation, I can get the pendant working great, but no battery leds or rumble feedback:

            // Send Extras Updates
            setInterval(updateControllerExtras, 500);
            function updateControllerExtras() {
            ///             controller.setExtras({
            ///             rumbleLeft:  ps3_rumble_left,   // 0-1 (Rumble left on/off)
            ///             rumbleRight: ps3_rumble_right,   // 0-255 (Rumble right intensity)
            ///             led: ps3_led // 2 | 4 | 8 | 16 (Leds 1-4 on/off, bitmasked)
            ///     });

                    //console.log("ps3_rumble_left: " + ps3_rumble_left);
                    //console.log("ps3_rumble_right: " + ps3_rumble_right);
            }

If I make a simple nodejs code calling the setExtras function, I can control the leds and rumbling without problems.

Any idea?

@AustinSaintAubin
Copy link
Collaborator

Attach the modified index.js (you might post as a gist ( https://gist.github.com ) )
This seems a bit odd. At first glance it should fail to run with how its posted.
This is a clone dualshock 3 controller, so things might operate very differently.

@martindb
Copy link
Author

martindb commented May 1, 2018

Here it is.
https://gist.github.com/martindb/aab2d7c4dc52112ca7c5f4e3e0d785b4
I known you have programmed this pendant using an original sony controller, but also I want to share with others with same problem, they can use the patched bluez suporting shamwan chip, and commenting the setExtras invocation.

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

2 participants