9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: erik quanstrom <quanstro@quanstro.net>
To: 9fans@9fans.net
Subject: Re: [9fans] Raw Input Driver
Date: Fri, 20 Mar 2009 05:12:57 -0400	[thread overview]
Message-ID: <a104dd0de7ac139f1036ce147b53ade6@quanstro.net> (raw)
In-Reply-To: <49C34C55.5070607@orcasystems.com>

On Fri Mar 20 03:58:26 EDT 2009, james@orcasystems.com wrote:
> I am also looking for advice on what people might like for the
> interface, right now I am using:
>
> struct InputEvent {
>    int            msec;
>    unsigned short type;
>    unsigned short code;
>    int            value;
> };

the old objections notwithstanding, i think this is a good idea.
one can easily emulate the old interface with a combined kbd/mouse
interface in libary with the added bonus that it's harder to get misordered
kbd/mouse events which can be a problem on lossy wireless networks
(don't you hate it when your acme clicks and types get out-of-wack?)
and the ability to see more of the kbd state.

if you want to do this, think it terms of a devce, say /dev/input.
most plan 9 devices of this type have a text interface.  see mouse(3).
this format could easily be extended so that mouse is as before
and keyboard events are presented as 'k ' char[11] ' '  scancode[11] ' '
msec[1 - 24].  one would imagine mod being a bit vector of
the normal mode keys encoding plus a bit for key press/release.
<mouse.h> already has a reasonable definition for mouse events.
by analogy,

	typedef struct Keyboard Keyboard;
	struct Keyboard {
		Rune	c;
		uint	sc;
		uvlong	msec;
	};

then

	typedef struct Input Input
	struct Input {
		int	type;	/* 'k' or 'm' */
		union{
			Keyboard
			Mouse
		};
	};

and finally

              typedef struct Inputctl Inputctl;
               struct Inputctl
               {
		Channel	*c;	/* chan(Input[20]) */

		char	*file;
		int	inputfd;	/* to input file */
		int	ctlfd;	/* to ctl file */
		int	pid;	/* of slave proc */
               };

i'm glossing over dealing with mouse vs keyboard control
events.

the work is building this into the kernel and rio.  i think
it would make sense for keyboard(2) and mouse(2) to
be emulated in terms of the new interface for syncronization
reasons.

once you've torn all that up, it will be a trivial undertaking to
get your shift release event. ☺

- erik



  reply	other threads:[~2009-03-20  9:12 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-20  7:00 James Tomaschke
2009-03-20  7:07 ` lucio
2009-03-20  7:57   ` James Tomaschke
2009-03-20  9:12     ` erik quanstrom [this message]
2009-03-20 11:05       ` Charles Forsyth
2009-03-20 10:54         ` Francisco J Ballesteros
2009-03-20 11:07         ` cinap_lenrek
2009-03-20 11:28         ` roger peppe
2009-03-20 11:39           ` Fco. J. Ballesteros
2009-03-20 12:04             ` erik quanstrom
2009-03-20 11:32         ` erik quanstrom
2009-03-20 12:23           ` Charles Forsyth
2009-03-20 12:16             ` erik quanstrom
2009-03-20 13:03             ` roger peppe
2009-03-20 13:37               ` tlaronde
2009-03-20 14:26                 ` roger peppe
2009-03-20 15:02                   ` tlaronde
2009-03-20 15:14                     ` tlaronde
2009-03-20 12:52           ` maht
2009-03-20 22:23         ` James Tomaschke
2009-03-20  9:13     ` lucio
2009-03-20 14:18 Francisco J Ballesteros
2009-03-20 14:29 ` roger peppe
2009-03-20 14:22 Francisco J Ballesteros
2009-03-20 14:32 ` roger peppe
2009-03-20 15:17 ` lucio
2009-03-20 14:35 Francisco J Ballesteros
2009-03-20 14:46 Francisco J Ballesteros

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a104dd0de7ac139f1036ce147b53ade6@quanstro.net \
    --to=quanstro@quanstro.net \
    --cc=9fans@9fans.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).