9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] kbdputc() in devcons.c in 9front?
@ 2014-07-17  1:59 kokamoto
  2014-07-17  7:39 ` cinap_lenrek
                   ` (5 more replies)
  0 siblings, 6 replies; 13+ messages in thread
From: kokamoto @ 2014-07-17  1:59 UTC (permalink / raw)
  To: 9fans

I'm checking how I should build my Plan9 system
in my home environment.   As I said before, we
have to save power as possible as we can (no
nuclear power energy here).   If I choose one
file/auth/cpu server machine, Plan9front may be
fastest.   However, I have here one serious problem.
Ktrans does not work on it.

You, 9front developpers, created kbdfs, and
lost kbdputc() in port/devcdons.c.   Most of
pc/kbd.c stuffs are driven out to user space, kbdfs.

In lab's or 9atom's distribution, I can have
/rc/bin/Kanji, like:
	#!/bin/rc

	pipefile -r ktrans /dev/cons
	rio -i $home/lib/windows </dev/cons

This assumes that the keyboard input from
stdin, and produces kanji translated character to
/dev/cons.

What is the merrit to create kbdfs?
I cann't see it, but only demerit like above.

Kenji




^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [9fans] kbdputc() in devcons.c in 9front?
  2014-07-17  1:59 [9fans] kbdputc() in devcons.c in 9front? kokamoto
@ 2014-07-17  7:39 ` cinap_lenrek
  2014-07-17 16:44   ` erik quanstrom
  2014-07-17  8:02 ` cinap_lenrek
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 13+ messages in thread
From: cinap_lenrek @ 2014-07-17  7:39 UTC (permalink / raw)
  To: 9fans

the problem is that rio reads /dev/kbd instead of
/dev/cons which in addition provides key press
and release events. so translating /dev/cons has
no effect on rio. (rio reads and multiplexes
/dev/kbd file)

/dev/kbd is used by:

games/doom, games/nes, games/snes, games/md
and vnc.

changing ktrans to translate /dev/kbd format
instead of /dev/cons should not be hard. i can
do that when i get back from my day job.

kbdfs removes some code duplication like the
latin1 composing. vncs in 9front just runs another
instance of kbdfs to provide cons and kbd files
instead of reimplementing the kernels console code.

kbdfs also lets you interrupt programs on the
plan9 console.

--
cinap



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [9fans] kbdputc() in devcons.c in 9front?
  2014-07-17  1:59 [9fans] kbdputc() in devcons.c in 9front? kokamoto
  2014-07-17  7:39 ` cinap_lenrek
@ 2014-07-17  8:02 ` cinap_lenrek
  2014-07-17 16:15   ` erik quanstrom
  2014-07-17 10:45 ` Steve Simon
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 13+ messages in thread
From: cinap_lenrek @ 2014-07-17  8:02 UTC (permalink / raw)
  To: 9fans

i havnt tried this, but as a quick work arround for rio,
you can make the /dev/kbd file unaccessible to rio with
aux/stub so rio will revert to reading /dev/cons:

aux/stub /dev/kbd
pipefile -r ktrans /dev/cons
rio -i $home/lib/windows </dev/cons

--
cinap



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [9fans] kbdputc() in devcons.c in 9front?
  2014-07-17  1:59 [9fans] kbdputc() in devcons.c in 9front? kokamoto
  2014-07-17  7:39 ` cinap_lenrek
  2014-07-17  8:02 ` cinap_lenrek
@ 2014-07-17 10:45 ` Steve Simon
  2014-07-17 10:58 ` Steffen Nurpmeso
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 13+ messages in thread
From: Steve Simon @ 2014-07-17 10:45 UTC (permalink / raw)
  To: 9fans

> As I said before, we
> have to save power as possible as we can

I have a dual atom motherboard, a Supermicro X7SLA-H
which is rather old now, but it still works fine.
This is my cpu, auth, file, dns soa, and smtp/imap
server.

It has two mirrored enterprise grade 500Gb drives
from different manufacturers (the idea is one will
fail before the other). I plan to add an SSD to the
mirror to hopefully speed venti.

This draws about 23 watts.

I run fossil+venti from the labs at present.

I use an raspberry PI terminal (2 watts).

The worsed offender is my DELL HD resolution display
which draws 70 watts. currently the raspberry pi kernel
does not send the CEC sequence to shut down the display
when its idle (screen saver), but its on my list
of things to fix.

I use HDMI but believe if you attach the display via XVGA
the syncs disappear on idle and shutdown the display correctly
but I have not tried this.

I also have a "green" router/wifi basestation/ADSL modem which
draws 5 watts.

-Steve



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [9fans] kbdputc() in devcons.c in 9front?
  2014-07-17  1:59 [9fans] kbdputc() in devcons.c in 9front? kokamoto
                   ` (2 preceding siblings ...)
  2014-07-17 10:45 ` Steve Simon
@ 2014-07-17 10:58 ` Steffen Nurpmeso
  2014-07-17 12:17 ` cinap_lenrek
  2014-07-19 12:56 ` kokamoto
  5 siblings, 0 replies; 13+ messages in thread
From: Steffen Nurpmeso @ 2014-07-17 10:58 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

kokamoto@hera.eonet.ne.jp wrote:
 |have to save power as possible as we can (no
 |nuclear power energy here).

No!!  That surely can be helped, enough willingness provided.

--steffen



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [9fans] kbdputc() in devcons.c in 9front?
  2014-07-17  1:59 [9fans] kbdputc() in devcons.c in 9front? kokamoto
                   ` (3 preceding siblings ...)
  2014-07-17 10:58 ` Steffen Nurpmeso
@ 2014-07-17 12:17 ` cinap_lenrek
  2014-07-18  0:13   ` kokamoto
  2014-07-19 12:56 ` kokamoto
  5 siblings, 1 reply; 13+ messages in thread
From: cinap_lenrek @ 2014-07-17 12:17 UTC (permalink / raw)
  To: 9fans

wheres the source code of the ktrans that you are
using?

i looked at /n/sources/extra/ktrans-2e.tgz but this
one would require the -t flag to work like you intended
in your mail:

	if (argc>1 && strcmp(argv[1], "-t")==0) {
		tflag = 1;
		in = 0;
		out = 1;
	} else {
		if ((in = open("/dev/kbd", OREAD)) < 0)
			exits("open /dev/kbd read");
		if ((out = open("/dev/kbd", OWRITE)) < 0)
			exits("open /dev/kbd/write");
		if (rfork(RFPROC))
			exits(0);
		atnotify(noter, 1);
	}

are you using a different ktrans than this? and if yes,
could you point me to the source?

--
cinap



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [9fans] kbdputc() in devcons.c in 9front?
  2014-07-17  8:02 ` cinap_lenrek
@ 2014-07-17 16:15   ` erik quanstrom
  2014-07-17 17:54     ` sl
  2014-07-17 18:41     ` cinap_lenrek
  0 siblings, 2 replies; 13+ messages in thread
From: erik quanstrom @ 2014-07-17 16:15 UTC (permalink / raw)
  To: 9fans

On Thu Jul 17 04:03:49 EDT 2014, cinap_lenrek@felloff.net wrote:
> i havnt tried this, but as a quick work arround for rio,
> you can make the /dev/kbd file unaccessible to rio with
> aux/stub so rio will revert to reading /dev/cons:
>
> aux/stub /dev/kbd
> pipefile -r ktrans /dev/cons
> rio -i $home/lib/windows </dev/cons

silly idea.  fix the incompatability?  ;-)

- erik



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [9fans] kbdputc() in devcons.c in 9front?
  2014-07-17  7:39 ` cinap_lenrek
@ 2014-07-17 16:44   ` erik quanstrom
  0 siblings, 0 replies; 13+ messages in thread
From: erik quanstrom @ 2014-07-17 16:44 UTC (permalink / raw)
  To: 9fans

> kbdfs removes some code duplication like the
> latin1 composing. vncs in 9front just runs another
> instance of kbdfs to provide cons and kbd files
> instead of reimplementing the kernels console code.

i found the major source of duplication was the n copies
of (different!) scan code tables in the various /sys/src/9/*/kbd.c
these differences appear to all be accidental.

consolidating them into port/devpckb.c which provides both /dev/kbin
and /dev/kbmap, and removing or reducing $arch/kbd.c to $arch/i8042.c
got a lot of the cleanup done without breaking interfaces.

it would be nice to get away from the annoying pc scan code interface,
but the cost is going to be compatability, and that cost seems too much
to me at this point.  the only way to do something like this imo would be
to agree and coordinate changes.

/dev/kbd seems reasonable if you've got that kind of problem. but
i don't see the benefit to using it where not formerly required,
but i do see a compatibility downside.

i also prefer having the keyboard in the kernel, since i do have kernels
with no user space.  norio(8) was written to deal with console interrupt
for a particular project.  think of it as rio with no graphics, and one
pre-defined window.   but i don't think it's a very good idea.  there are
better options.  (like rio.)

and yes, that's like, ya know, my opinion, man.  so like, whatever. :-)

- erik



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [9fans] kbdputc() in devcons.c in 9front?
  2014-07-17 16:15   ` erik quanstrom
@ 2014-07-17 17:54     ` sl
  2014-07-17 18:41     ` cinap_lenrek
  1 sibling, 0 replies; 13+ messages in thread
From: sl @ 2014-07-17 17:54 UTC (permalink / raw)
  To: 9fans

http://9front.org/img/9kbdfs01.png



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [9fans] kbdputc() in devcons.c in 9front?
  2014-07-17 16:15   ` erik quanstrom
  2014-07-17 17:54     ` sl
@ 2014-07-17 18:41     ` cinap_lenrek
  1 sibling, 0 replies; 13+ messages in thread
From: cinap_lenrek @ 2014-07-17 18:41 UTC (permalink / raw)
  To: 9fans

rio multiplexes /dev/kbd, so it opens it and derives the windows kbd
and cons files from it. it obviously has to read /dev/kbd to multiplex
it. now, the incompatibility is that opening /dev/kbd disables /dev/cons
input.

the reason is that /dev/cons is buffered but pressing keys on the keyboard
will result in characters being queued to /dev/cons. /dev/kbd reading programs
should *not* require a dummy reader proc to flush duplicated console input in
addition to reading /dev/kbd. you open /dev/kbd and the keyboard is yours.

it is also harder to filter or translate multiple asynchronously read
file stremas instead of just one. and filtering /dev/kbd is not much
differnet from filtering /dev/cons. in addition, you have keyboard
chords.

--
cinap



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [9fans] kbdputc() in devcons.c in 9front?
  2014-07-17 12:17 ` cinap_lenrek
@ 2014-07-18  0:13   ` kokamoto
  2014-07-18  0:16     ` cinap_lenrek
  0 siblings, 1 reply; 13+ messages in thread
From: kokamoto @ 2014-07-18  0:13 UTC (permalink / raw)
  To: 9fans

> wheres the source code of the ktrans that you are
> using?

It's not the one you checked.
I'll send it to you by private mail.  If I could have a
time I'll change it to be able to open everyone.
It was worked using my business time at office.
I'm now not a enpryee of that organization.

Kenji




^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [9fans] kbdputc() in devcons.c in 9front?
  2014-07-18  0:13   ` kokamoto
@ 2014-07-18  0:16     ` cinap_lenrek
  0 siblings, 0 replies; 13+ messages in thread
From: cinap_lenrek @ 2014-07-18  0:16 UTC (permalink / raw)
  To: 9fans

thanks!

--
cinap



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [9fans] kbdputc() in devcons.c in 9front?
  2014-07-17  1:59 [9fans] kbdputc() in devcons.c in 9front? kokamoto
                   ` (4 preceding siblings ...)
  2014-07-17 12:17 ` cinap_lenrek
@ 2014-07-19 12:56 ` kokamoto
  5 siblings, 0 replies; 13+ messages in thread
From: kokamoto @ 2014-07-19 12:56 UTC (permalink / raw)
  To: 9fans

> You, 9front developpers, created kbdfs, and
> lost kbdputc() in port/devcdons.c.   Most of
> pc/kbd.c stuffs are driven out to user space, kbdfs.
>
> In lab's or 9atom's distribution, I can have
> /rc/bin/Kanji, like:
> 	#!/bin/rc
>
> 	pipefile -r ktrans /dev/cons
> 	rio -i $home/lib/windows </dev/cons
>
> This assumes that the keyboard input from
> stdin, and produces kanji translated character to
> /dev/cons.

This is solved by cinap to write a new program, pipekbd
which works like pipefile for 9front's kbdfs.

Now I can use Japanese on Plan9fron, too.
Thanks cinap!

Kenji




^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2014-07-19 12:56 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-17  1:59 [9fans] kbdputc() in devcons.c in 9front? kokamoto
2014-07-17  7:39 ` cinap_lenrek
2014-07-17 16:44   ` erik quanstrom
2014-07-17  8:02 ` cinap_lenrek
2014-07-17 16:15   ` erik quanstrom
2014-07-17 17:54     ` sl
2014-07-17 18:41     ` cinap_lenrek
2014-07-17 10:45 ` Steve Simon
2014-07-17 10:58 ` Steffen Nurpmeso
2014-07-17 12:17 ` cinap_lenrek
2014-07-18  0:13   ` kokamoto
2014-07-18  0:16     ` cinap_lenrek
2014-07-19 12:56 ` kokamoto

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).