home *** CD-ROM | disk | FTP | other *** search
/ Peanuts NeXT Software Archives / Peanuts-Update.iso / NEXTSTEP / system / driver / joystick / joystick.0.0.README < prev   
Encoding:
Text File  |  1997-12-10  |  5.2 KB  |  128 lines

  1. Greetings,
  2.  
  3. Here's the source code for an Intel joystick driver I ported over from
  4. Linux.  This driver allows you to create /dev/js[01] devices and
  5. then open/read from the devices for Joystick input.  It only works
  6. on Intel hardware with a standard joystick.  This driver was written
  7. and tested on an Intel Nextstep 3.3 system.
  8.  
  9. I've had no formal training on writing device drivers, so use this
  10. code at your own risk.  Most packages people make available say this,
  11. but as this is a device driver, this is a lot more risky than
  12. most packages.  This driver runs at kernel level, and could easily
  13. destroy all data on any accessible IO device. It's possible (although
  14. unlikely) it could even damage your hardware.
  15.  
  16. In addition to that, I've done very little hardware/assembly-level
  17. programming for Intel systems, and that which I did was all based
  18. on 8088 chips several years ago.  What can I say?  I'm an Apple II
  19. hacker, and my primary purpose in creating this was to get joystick
  20. support into the Apple II emulator :)
  21.  
  22. I haven't had time to work on this project for awhile now, so I've
  23. decided to just make the source code available.  Please feel free to
  24. improve it and post newer versions.
  25.  
  26. I've tried to clean it up a bit today.  I've rewritten some
  27. of the Makefiles and performed minimal testing.  It still appears
  28. to work. I'm 99% certain the project should compile and work on
  29. other systems. 
  30.  
  31. The project actually consists of three areas:
  32.     - The original linux joystick driver project,
  33.     - An Intel generic-unix-like device driver (works),
  34.     - and the start of a DriverKit device driver.
  35.  
  36. I made almost no progress on writing a DriverKit driver, so there's
  37. probably little of value in that area.
  38.  
  39. I'm not completely certain the linux code is unmodified.
  40. I could only find a file-by-file web page from which to
  41. download it, and I don't appear to have backed up that
  42. source.   In fact, I'm pretty sure that I commented out the
  43. following line and added the other one.  I also don't
  44. appear to have recorded where I got the original code.
  45. Try searching for linux joystick.
  46.  
  47. // #define JOYSTICK_MAJOR        15
  48. #define JOYSTICK_MAJOR        113
  49.  
  50. This driver installs as major device 32.   This conflicts with the
  51. BPF (berkeley packet filter) device [distributed with ppp, but
  52. generally unused], but I was unsuccessful in my attempts to get
  53. any other device number to work.  I have no idea why this was the
  54. case.  It doesn't appear to be anything in the joystick driver code
  55. as the original code didn't even use 32.  I got 32 from BPF.  Since
  56. I do automatically load ppp when I boot, maybe something in ppp or
  57. bpf performs some missing initialization for using device 32.
  58.  
  59. Using this driver has occasionally caused my clock to jump forward
  60. several minutes.   I'm not familiar enough with Intel hardware to
  61. know why this happens.  Probably either due to wrong handling of
  62. interrupts or due to conflicts with the timer that the joystick
  63. uses.
  64.  
  65. Along those same lines, the code for CLI_STI (interrupts) is mostly
  66. guesswork.  Heck, most of the code was guesswork derived from
  67. various other driver source code.  However, I don't have a good
  68. feeling for the interrupt stuff.  It seems to work both with and
  69. without the cli/sti calls.  I can't remember, but I think I also
  70. tried spl calls at one point.
  71.  
  72. I have done no or almost-no testing on joystick ioctl options.
  73. They may not work at all.
  74.  
  75. I no longer remember what joystick_loadable does.  The project seems to work
  76. equally well without it.  By default, it's not installed.
  77. I've renamed the only copy of it I've found (from an old production
  78. directory to joystick_loadable.dist).
  79.  
  80. I have successfully used this driver with a couple of test programs
  81. (included) as well as with a modified version of the a2 apple
  82. emulator (not included) to play some old Apple games.
  83.  
  84. I'll try to find the time to upload the a2 emulator later.
  85. Joystick code is #ifdef'd with JOYSTICK_SUPPORT.
  86.  
  87. Please feel free to contact me if you have any questions/comments.
  88. I'd really like to see this project become more usable.
  89.  
  90. Things that really need done:
  91.     - convert to DriverKit
  92.     
  93.     or
  94.     
  95.     - clean up interrupt code
  96.     - chose (and get working) different major device number
  97.     - make this "non-hacker" useable.
  98.     - merge this into the windowserver so that joystick events
  99.         are created rather than reading the devices in loops.
  100.     - (try to keep it as compatible with linux driver as possible)
  101.     - make setting absolute path to LIBDIR in Makefile unnecessary
  102.     - make setting absolute major device in Makefile unnecessary
  103.  
  104. To build this driver,
  105.     cd joystick/joystick.next
  106.     edit Makefile to set absolute path for LIBDIR.  This points
  107.         to the "production copy" of the driver.  This copy is
  108.         never modified except during "make install." Make clean
  109.         won't delete this copy.  Eventually, you'd probably
  110.         want to put this production copy in /usr/local/etc
  111.         or somewhere similar.
  112.     edit Makefile and joystick_kernel.h to change major device number if
  113.         necessary.  See above caveats.
  114.     make
  115.  
  116. To install the driver (does not install/build test programs)
  117.     make install
  118.     
  119. To use the driver (this must be done as root)
  120.     make install_driver        # creates device files/loads driver
  121.     make deinstall_driver        # deletes device files/unloads driver
  122.  
  123. It's probably safe to leave the /dev/js* entries around if you want.
  124.  
  125. -Mike Kienenberger
  126.  mkienenb@alaska.net
  127.  November 3, 1997
  128.