9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* Re: [9fans] usb keyboard and mouse?
@ 2006-06-29  5:31 Mike Haertel
  2006-06-29  8:23 ` Charles Forsyth
  2006-06-29 11:55 ` Dan Cross
  0 siblings, 2 replies; 12+ messages in thread
From: Mike Haertel @ 2006-06-29  5:31 UTC (permalink / raw)
  To: 9fans

Er, no.  Legacy keyboard emulation is intended to work with any OS,
even if the OS bypasses the BIOS and directly fiddles with the PS/2
hardware.  It uses chipset magic to translate "in" and "out"
operations to ports 0x60 and 0x64 (the PS/2 keyboard ports) into
USB operations.

The implementation is chipset dependent.  Often what happens is
that the chipset recognizes an I/O request to port 0x60 or 0x64 and
aborts the request with an SMI (system management interrupt).  This
is a *very* non-maskable interrupt (more non-maskable than NMI...)
that causes the processor to save pretty much all its register state
in a special memory area, and jump to a handler in the system BIOS.
The BIOS SMI handler examines the saved register state, figures out
what the OS was trying to do, runs a software model of the PS/2
keyboard controller's state, chats with the USB keyboard, formulates
an appropriate response, emulates the I/O instruction the OS was
trying to do, and resumes execution of the OS at the instruction
following the I/O instruction.

Some chipsets might do it directly in hardware rather than using
the SMI+BIOS strategy.

>From: "Artem Letko" <aletko@gmail.com>
>To: "Fans of the OS Plan 9 from Bell Labs" <9fans@cse.psu.edu>
>
>but that's only if your kernel uses BIOS calls, right?
>
>On 6/26/06, geoff@collyer.net <geoff@collyer.net> wrote:
>> Some BIOSes have an option with a name like "enable legacy USB" or
>> "enable USB keyboard" that, if set, will simulate PS2 input from a USB
>> keyboard or mouse.


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

* Re: [9fans] usb keyboard and mouse?
  2006-06-29  5:31 [9fans] usb keyboard and mouse? Mike Haertel
@ 2006-06-29  8:23 ` Charles Forsyth
  2006-06-29 11:55 ` Dan Cross
  1 sibling, 0 replies; 12+ messages in thread
From: Charles Forsyth @ 2006-06-29  8:23 UTC (permalink / raw)
  To: 9fans

> The BIOS SMI handler examines the saved register state, figures out
> what the OS was trying to do, runs a software model of the PS/2
> keyboard controller's state, chats with the USB keyboard, formulates
> an appropriate response, emulates the I/O instruction the OS was
> trying to do, and resumes execution of the OS at the instruction
> following the I/O instruction.

yes, it's good fun and worked fine on my plan 9 file server.
i assumed it was all done with interrupts disabled, so that, as
anciently, the console should not indeed be used for chit-chat.



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

* Re: [9fans] usb keyboard and mouse?
  2006-06-29  5:31 [9fans] usb keyboard and mouse? Mike Haertel
  2006-06-29  8:23 ` Charles Forsyth
@ 2006-06-29 11:55 ` Dan Cross
  2006-06-29 15:02   ` Ronald G Minnich
  2006-06-29 23:50   ` Charles Forsyth
  1 sibling, 2 replies; 12+ messages in thread
From: Dan Cross @ 2006-06-29 11:55 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

On Wed, Jun 28, 2006 at 10:31:26PM -0700, Mike Haertel wrote:
> The implementation is chipset dependent.  Often what happens is
> that the chipset recognizes an I/O request to port 0x60 or 0x64 and
> aborts the request with an SMI (system management interrupt).  This
> is a *very* non-maskable interrupt (more non-maskable than NMI...)
> that causes the processor to save pretty much all its register state
> in a special memory area, and jump to a handler in the system BIOS.
> The BIOS SMI handler examines the saved register state, figures out
> what the OS was trying to do, runs a software model of the PS/2
> keyboard controller's state, chats with the USB keyboard, formulates
> an appropriate response, emulates the I/O instruction the OS was
> trying to do, and resumes execution of the OS at the instruction
> following the I/O instruction.
> 
> Some chipsets might do it directly in hardware rather than using
> the SMI+BIOS strategy.

Dear Lord!  At what point is a chicken sacrificed in this process?

	- Dan C.



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

* Re: [9fans] usb keyboard and mouse?
  2006-06-29 11:55 ` Dan Cross
@ 2006-06-29 15:02   ` Ronald G Minnich
  2006-06-29 23:50   ` Charles Forsyth
  1 sibling, 0 replies; 12+ messages in thread
From: Ronald G Minnich @ 2006-06-29 15:02 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

Dan Cross wrote:
> On Wed, Jun 28, 2006 at 10:31:26PM -0700, Mike Haertel wrote:
> 
>>The implementation is chipset dependent.  Often what happens is
>>that the chipset recognizes an I/O request to port 0x60 or 0x64 and
>>aborts the request with an SMI (system management interrupt).  This
>>is a *very* non-maskable interrupt (more non-maskable than NMI...)
>>that causes the processor to save pretty much all its register state
>>in a special memory area, and jump to a handler in the system BIOS.
>>The BIOS SMI handler examines the saved register state, figures out
>>what the OS was trying to do, runs a software model of the PS/2
>>keyboard controller's state, chats with the USB keyboard, formulates
>>an appropriate response, emulates the I/O instruction the OS was
>>trying to do, and resumes execution of the OS at the instruction
>>following the I/O instruction.
>>
>>Some chipsets might do it directly in hardware rather than using
>>the SMI+BIOS strategy.
> 
> 
> Dear Lord!  At what point is a chicken sacrificed in this process?
> 
> 	- Dan C.
> 

well, it does get better. On the GX2, the BIOS is a message-passing 
microkernel that lives in SMI. I am not making this up.

ron


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

* Re: [9fans] usb keyboard and mouse?
  2006-06-29 11:55 ` Dan Cross
  2006-06-29 15:02   ` Ronald G Minnich
@ 2006-06-29 23:50   ` Charles Forsyth
  1 sibling, 0 replies; 12+ messages in thread
From: Charles Forsyth @ 2006-06-29 23:50 UTC (permalink / raw)
  To: 9fans

>Dear Lord!  At what point is a chicken sacrificed in this process?

as often as possible, as usual.
chickens are cheap; code is costly.


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

* Re: [9fans] usb keyboard and mouse?
  2006-06-28 23:02       ` C H Forsyth
@ 2006-06-28 23:21         ` Ronald G Minnich
  0 siblings, 0 replies; 12+ messages in thread
From: Ronald G Minnich @ 2006-06-28 23:21 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

C H Forsyth wrote:
>>>Some BIOSes have an option with a name like "enable legacy USB" or
>>>"enable USB keyboard" that, if set, will simulate PS2 input from a USB
>>>keyboard or mouse.
>>
>>but that's only if your kernel uses BIOS calls, right?
> 
> 
> no, it works without that; it's intercepted at a lower level.

You just gotta love system management mode.

Fun. There's giant USB stacks in the bios'en nowadays. Sometimes they 
work. Sometimes they don't. Well, often they don't, but ... that's 
another story.

I had one machine recently that would work fine with the keyboard -- 
until the OS came up. then it stopped. And another machine that could 
boot off USB key -- er, well, not THAT USB key, or that OTHER USB key, 
or ... well, it had booted off SOME usb key at some phase of the moon, 
in a timezone > 12 hours off ours. Woo hoo!

BIOS and USB -- what a combination! Sure to induce longing for the steppes.

ron


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

* Re: [9fans] usb keyboard and mouse?
  2006-06-28 17:01     ` Francisco J Ballesteros
@ 2006-06-28 23:02       ` C H Forsyth
  2006-06-28 23:21         ` Ronald G Minnich
  0 siblings, 1 reply; 12+ messages in thread
From: C H Forsyth @ 2006-06-28 23:02 UTC (permalink / raw)
  To: 9fans

> > Some BIOSes have an option with a name like "enable legacy USB" or
> > "enable USB keyboard" that, if set, will simulate PS2 input from a USB
> > keyboard or mouse.
> but that's only if your kernel uses BIOS calls, right?

no, it works without that; it's intercepted at a lower level.


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

* Re: [9fans] usb keyboard and mouse?
  2006-06-28 15:48   ` Artem Letko
@ 2006-06-28 17:01     ` Francisco J Ballesteros
  2006-06-28 23:02       ` C H Forsyth
  0 siblings, 1 reply; 12+ messages in thread
From: Francisco J Ballesteros @ 2006-06-28 17:01 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

Also, I found that in several cases, setting up usb suffices to get
the hid device out of boot protocol (i.e. back to hid).

On 6/28/06, Artem Letko <aletko@gmail.com> wrote:
> but that's only if your kernel uses BIOS calls, right?
>
> On 6/26/06, geoff@collyer.net <geoff@collyer.net> wrote:
> > Some BIOSes have an option with a name like "enable legacy USB" or
> > "enable USB keyboard" that, if set, will simulate PS2 input from a USB
> > keyboard or mouse.
> >
> >
>
>


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

* Re: [9fans] usb keyboard and mouse?
  2006-06-27  0:19 ` geoff
@ 2006-06-28 15:48   ` Artem Letko
  2006-06-28 17:01     ` Francisco J Ballesteros
  0 siblings, 1 reply; 12+ messages in thread
From: Artem Letko @ 2006-06-28 15:48 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

but that's only if your kernel uses BIOS calls, right?

On 6/26/06, geoff@collyer.net <geoff@collyer.net> wrote:
> Some BIOSes have an option with a name like "enable legacy USB" or
> "enable USB keyboard" that, if set, will simulate PS2 input from a USB
> keyboard or mouse.
>
>


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

* Re: [9fans] usb keyboard and mouse?
  2006-06-26 18:50 ISHWAR RATTAN
  2006-06-26 19:22 ` Francisco J Ballesteros
@ 2006-06-27  0:19 ` geoff
  2006-06-28 15:48   ` Artem Letko
  1 sibling, 1 reply; 12+ messages in thread
From: geoff @ 2006-06-27  0:19 UTC (permalink / raw)
  To: 9fans

Some BIOSes have an option with a name like "enable legacy USB" or
"enable USB keyboard" that, if set, will simulate PS2 input from a USB
keyboard or mouse.



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

* Re: [9fans] usb keyboard and mouse?
  2006-06-26 18:50 ISHWAR RATTAN
@ 2006-06-26 19:22 ` Francisco J Ballesteros
  2006-06-27  0:19 ` geoff
  1 sibling, 0 replies; 12+ messages in thread
From: Francisco J Ballesteros @ 2006-06-26 19:22 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

Time ago I implemented a usbhid, w/ keyboard/mouse combo drivers.
Things changed later here and we are not using it since a few months.
I think I have a copy in the dump somewhere, but it´s likely it will need
some adjustments for changes in usbd libusb.

BTW, using it requires changing boot to start usbd usbhid or you won´t be
able to type the password.

If you don´t find anything better, drop me a line and I´ll copy our most recent
version to sources.

On 6/26/06, ISHWAR RATTAN <rattan@cps.cmich.edu> wrote:
>
> Got a machine that has usb ports only. Plan 9 iso gets
> stuck (as no input can be provided form the kbd). Is there
> a solution to this problem?
>
> -ishwar
>
>
>

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

* [9fans] usb keyboard and mouse?
@ 2006-06-26 18:50 ISHWAR RATTAN
  2006-06-26 19:22 ` Francisco J Ballesteros
  2006-06-27  0:19 ` geoff
  0 siblings, 2 replies; 12+ messages in thread
From: ISHWAR RATTAN @ 2006-06-26 18:50 UTC (permalink / raw)
  To: 9fans


Got a machine that has usb ports only. Plan 9 iso gets
stuck (as no input can be provided form the kbd). Is there
a solution to this problem?

-ishwar



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

end of thread, other threads:[~2006-06-29 23:50 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-06-29  5:31 [9fans] usb keyboard and mouse? Mike Haertel
2006-06-29  8:23 ` Charles Forsyth
2006-06-29 11:55 ` Dan Cross
2006-06-29 15:02   ` Ronald G Minnich
2006-06-29 23:50   ` Charles Forsyth
  -- strict thread matches above, loose matches on Subject: below --
2006-06-26 18:50 ISHWAR RATTAN
2006-06-26 19:22 ` Francisco J Ballesteros
2006-06-27  0:19 ` geoff
2006-06-28 15:48   ` Artem Letko
2006-06-28 17:01     ` Francisco J Ballesteros
2006-06-28 23:02       ` C H Forsyth
2006-06-28 23:21         ` Ronald G Minnich

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