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

mouse support #69

Open
piranna opened this issue Sep 17, 2014 · 7 comments
Open

mouse support #69

piranna opened this issue Sep 17, 2014 · 7 comments
Labels
Milestone

Comments

@piranna
Copy link
Member

piranna commented Sep 17, 2014

Seems to be fairly easy to read the mouse data and a funny project implement the protocol... :-)

https://github.com/telmich/gpm/blob/master/src/gpm2/mice/ps2.c
http://www.computer-engineering.org/ps2mouse/

Also seems now with USB there will be no more protocols, so this is mostly a one-shoot task. Only point is, should this generate ansi-codes on a terminal, w3c mouse events, or this ones should be generated by a higher library (and by the way, keyboard events, too)?

@piranna
Copy link
Member Author

piranna commented Sep 18, 2014

Ok, this gist is fairly more interesting... ;-)

@piranna
Copy link
Member Author

piranna commented Sep 19, 2014

I have been banging my head and seems I start to understand how it works.

According to http://linux.die.net/man/4/console_codes, linux console is capable to emit mouse reports on the stdin stream, so applications like slap could work, so there's no problems here. Point is, linux console doesn't know about the mouse device or its protocol, so needs something that generate the console terminal ioctls (what? :-/) so the console can emit the reports. But how could this be done? This is the first time I've heard about this... :-(

Also, all mouse devices can only be read by root. This is not so bad, since the mouse could be used only on the local consoles, so it makes sense to have a global service... Only point, do it in Node.js as it should be, or take a shortcut and use the real gpm and forget of problems about create a clone?

@piranna piranna mentioned this issue Nov 10, 2014
@piranna piranna added the ready label Dec 29, 2014
@piranna
Copy link
Member Author

piranna commented Feb 5, 2015

Posible solution: since process.stdin is a Stream object, it has a 'data' event, so a process would be able to emit event to it. If so, it would be only to it's child process or to anybody listening to the same stdin stream, so that ANSI codes would be exchanged from one background gpm-like process to the other ones, and would also allow to listen to a particular mouse device for each user.

@piranna
Copy link
Member Author

piranna commented Feb 6, 2015

Ok, process.stdin is a Readable stream and can't be able to write to it, so we can't be able to inject mouse ANSI codes to everybody listening to the same stdin stream. Another alternative is to work as a "filter", piping process.stdin to process.stdout, but also writting there the mouse ANSI codes. In this case, being the first process where all the other ones start on an interactive session, candidates to inject this data are

  1. bin-getty
  2. logon
  3. nsh

bin-getty manage the console as an all, but don't know anything about users preferences, and would only allow to access to a "global" mouse. nsh is run as a user and would allow to change device online, but would make it only available to process started to them.

On the other hand, logon can access to the user preferences (it's already done to know what shell to start) so user would set what mouse to use and will be available for all process and shell interpreters. Problem are that mouse couldn't be possible to be changed online (users don't have access to the logon instance) could be problems when using it as access authenticator for online services like web or wss (we would need to detect that to don't enable the mouse functionality).

@piranna piranna added this to the 0.2.0 milestone Feb 8, 2015
@mitsukaki
Copy link
Contributor

It must get boring talking to yourself. Good thing I'm on summer break now! Status update?

@piranna
Copy link
Member Author

piranna commented Jul 1, 2016

Untested, but definitely feasable since we have access to the /dev filesystem, it only keeps to read the interface and parse the mouse events. It would be a funny project :-) Later it keeps to inject the ANSI codes in the terminal input stream as I put in my last post.

@mitsukaki
Copy link
Contributor

Ah okay excellent! I'll get to playing with it in my normal set up and see what I get

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

No branches or pull requests

2 participants