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

Crash on gamepad input #5

Closed
Maxattax97 opened this issue Nov 24, 2016 · 1 comment
Closed

Crash on gamepad input #5

Maxattax97 opened this issue Nov 24, 2016 · 1 comment

Comments

@Maxattax97
Copy link

I am able to get my iPhone to successfully connect to the server, but as soon as I press a button or use the joystick, I receive this error. I should note that I am using Ubuntu as a test before using this on RetroPie.

Running "clean:dist" (clean) task
\>> 1 path cleaned.

Running "copy:public" (copy) task
Created 1 directory, copied 3 files

Running "copy:client" (copy) task
Created 3 directories, copied 10 files

Running "express:dev" (express) task
Starting background Express server
Express server listening on port 8888

Running "watch" task
Waiting...
gamepad connected
connect gamepad
hello input -> 1
fs.js:658
    return binding.writeBuffer(fd, buffer, offset, length, position);
                   ^

Error: EINVAL: invalid argument, write
    at Error (native)
    at Object.fs.writeSync (fs.js:658:20)
    at null.<anonymous> (/home/max/Programs/mobile-gamepad/server/src/gamepad.js:139:20)
    at null.<anonymous> (/home/max/Programs/mobile-gamepad/server/src/gamehub.js:36:30)
    at Socket.<anonymous> (/home/max/Programs/mobile-gamepad/server/server.js:43:15)
    at emitOne (events.js:77:13)
    at Socket.emit (events.js:169:7)
    at /home/max/Programs/mobile-gamepad/node_modules/socket.io/lib/socket.js:501:12
    at nextTickCallbackWith0Args (node.js:420:9)
    at process._tickCallback (node.js:349:13)
Stopping Express server
@sbidolach
Copy link
Owner

This project is prepared only for RaspberryPi OS but you can do some changes in the code and then it will be working on Ubuntu as well. There is different in buffer frame between devices.

To run a gamepad on Ubuntu you have modify file ...\server\src\gamepad.js and method sendEvent.
There are to places where you have to uncomment code for Ubuntu and comment for RaspberryPi.

var input_event = Struct()
	.struct('time', Struct()
		// Raspberry Pi
		.word32Sle('tv_sec')
		.word32Sle('tv_usec')
		// Ubuntu
		//.word64Sle('tv_sec')
		//.word64Sle('tv_usec')
	)
	.word16Ule('type')
	.word16Ule('code')
	.word32Sle('value');

and

var input_event_end = Struct()
	.struct('time', Struct()
		// Raspberry Pi
		.word32Sle('tv_sec')
		.word32Sle('tv_usec')
		// Ubuntu
		//.word64Sle('tv_sec')
		//.word64Sle('tv_usec')
	)
	.word16Ule('type')
	.word16Ule('code')
	.word32Sle('value');

In next version I'll add command parameter and describe in README how run gamepade on Ubuntu without code changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants