home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / sys / mac / hardware / 24475 < prev    next >
Encoding:
Text File  |  1992-12-20  |  2.9 KB  |  58 lines

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