tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Sun keyboard on i386?

On Wed, 13 Jul 2011, Mouse wrote:

> I have a desk on which (for reasons not immediately relevant) the main
> head is an i386 machine (4.0.1).  But this has meant I'm stuck using a
> crappy peecee keyboard.
> Today, I put together the interface electronics to put one of my good
> (Sun type 3) keyboards on one of the serial ports.  It works, in that a
> program that talks to the serial port can speak the keyboard's protocol
> and get keystrokes and suchlike.
> I can, if I have to, bludgeon X into being such a program.  But I
> thought I would first try to use the existing kernel code for Sun
> keyboards (which would, I would expect, have the additional advantage
> of working in the text console).  Looking at the kernel configs, I see
> that on sparc64 (and on sparc, though the comments say it's just for
> test building) kbd can attach at com, which is convenient because it's
> exactly what I want to do.  So I appended a handful of lines to my i386
> machine's kernel config, mostly lifted from sparc64:
> define firm_events
> file dev/sun/event.c          firm_events needs-flag
> device kbd: firm_events, wskbddev
> file dev/sun/kbd.c            kbd needs-flag
> file dev/sun/kbd_tables.c     kbd
> file dev/sun/wskbdmap_sun.c   kbd & wskbd
> attach kbd at com with kbd_tty
> file dev/sun/sunkbd.c         kbd_tty
> file dev/sun/kbdsun.c         kbd_tty
> kbd0 at com0
> I had to change an #include and remove another to get the kernel to
> compile, and rip a little code out of kbd.c and sunkbd.c to get it to
> link, but surprisingly little.  Less than I was expecting.
> (Specifically: in sunkbd.c, <machine/kbd.h> -> <sys/dev/kbd_reg.h>,
> remove <machine/vuid_event.h>, and rip out both arms of the
> if (args->kmta_consdev) test in sunkbd_attach(); in kbd.c, remove
> sunkbd_wskbd_cn{getc,pollc,bell} and sunkbd_bell_off, remove
> sunkbd_wskbd_consops and the code in kbd_enable that conditionally uses
> it.  Exact diffs available if anyone wants.)
> But it doesn't work.  I added a printf to sunkbd_match, and it's never
> even getting called.  Is there some kind person here who has any idea
> why not and can point me in a useful direction?  I daresay it's
> something that will be blindingly obvious once I see it....

On sparc64 the console attach stuff is based on properties it gets from 
OBP.  On x86 that's done in a completely different manner.  You will have 
to do a lot of cnattach hacking.

I'd recommend getting a newer Type 4 or Type 5 USB keyboard instead of 
trying to kluge a serial keyboard.  Those work great on x86.


Home | Main Index | Thread Index | Old Index