home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.mac.hardware
- Path: sparky!uunet!stanford.edu!CSD-NewsHost.Stanford.EDU!Xenon.Stanford.EDU!tecot
- From: tecot@Xenon.Stanford.EDU (Edward M. Tecot)
- Subject: Re: How does KeyCaps know which keyboard was used? [also: Dvorak]
- Message-ID: <tecot.724644837@Xenon.Stanford.EDU>
- Keywords: KeyCaps keyboard ADB Dvorak
- Sender: news@CSD-NewsHost.Stanford.EDU
- Organization: CS Department, Stanford University, California, USA
- References: <tuc.724409248@cs.wisc.edu>
- Date: 18 Dec 92 02:13:57 GMT
- Lines: 45
-
- tuc@calico.cs.wisc.edu (Brian A. Cole) writes:
- >Try this: Attach two different models of ADB keyboard to an ADB mac (or
- >attach an external ADB keyboard to a PowerBook, like I did) and go into
- >KeyCaps. Press a key. Now press a key on the _other_ keyboard.
- >Presto-Zamboni, the key layout displayed changes to that of the new
- >keyboard. Pretty neat, huh?
-
- >Now, I'm not complaining. In fact, I think that this is just how I'd
- >like it to work. My question is _how_ does it work? How did it know
- >that I'd attached an "Apple Keyboard II" and not an "Apple Extended
- >Keyboard II" (or, for that matter, some relatively unknown third-party
- >gizmo)?
-
- >I'd always thought that all a keyboard did was broadcast an ASCII (or
- >otherwise) code whenever a key is hit, but it seems to me that it must
- >also be sending some self-identification of some sort. Or I guess that
- >the few applications that care (like KeyCaps) could ask the keyboard to
- >identify itself after every keystroke or something.
-
- Sort of. Each device on the desktop bus has its own address, sort of like
- SCSI. When a keyboard event is posted, the address of the keyboard that
- generated it is posted as well. When KeyCaps receives an event from a
- different address, it looks up it's identification number (using the ADB
- Manager). These IDs are managed by DTS so that they remain unique.
-
- >Either way, it seems like the System must have some list of possible
- >keyboards somewhere. If this is the case, how the heck do third-party
- >manufacturers make Mac keyboards -- do they require a system extension
- >or something before the keyboard can be recognized? Will someone in
- >the know _please_ fill me in?
-
- Sort of - the keyboard driver requires a KMAP resource in order to understand
- how to map physical key codes into virtual key codes. The resource ID of
- the KMAP resource is the same as the ID of they keyboard. If the KMAP resource
- is not found, KMAP 0 is used, which works fine for most keyboards anyway.
- However, KeyCaps needs to know the physical layout of they keys in order to
- present a proper display. That's what the KCAP resource is for. Once again,
- the ID of the KCAP resource is the same as the ID of the keyboard. If the
- correct resource cannot be found, KeyCaps will put up an alert to complain.
- So, if you were to build your own keyboard, you would need to:
- 1) obtain an ID from DTS
- 2) Make a KCAP resource
- 3) Make a KMAP resource if for some reason KMAP 0 was insufficient.
-
- _emt
-