Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!sdd.hp.com!hp-pcd!hpcvlx.cv.hp.com!gms From: gms@hpcvlx.cv.hp.com. (George Sachs) Newsgroups: comp.windows.x Subject: Re: HELP needed in writing EXTENSION for PEN input device Message-ID: <100920328@hpcvlx.cv.hp.com.> Date: 21 Jun 91 23:58:56 GMT References: <3349@sparko.gwu.edu> Organization: Hewlett-Packard Co., Corvallis, OR, USA Lines: 48 > / hpcvlx.cv.hp.com:comp.windows.x / hakura@seas.gwu.edu (Ziyad Sami Hakura) / 10:37 am Jun 21, 1991 / > > I have a tablet and pen that connect via an RS232 serial connection to my > workstation. The pen is both pressure and tilt sensitive. > > I wish to write a device driver that will receive data from the pen and > will convert this data into events that are outside the normal range defined > by the X Protocol. My program should then receive these events at a procedure > which is set using the Xview SERVER_EXTENSION_PROC attribute. > > My problem is that I have no idea on how to write an extension that > produces custom events. I would like my device driver to be called around > 25 times per second to test the status of the pen and to produce events when > required. Is it possible to write such an extension? > > If anyone has written an extension that receives input from an alternative > input device, it would be very helpful if you could send me a copy of your > extension. The only documentation I have is the X Protocol Reference Manual and > the Xlib Programming Manual by O'Reilly & Associates, Inc. Their documentation > of extensions is very poor. If you have any advice on more helpful text or > implementation ideas, please write. > > Thanks for any help and advice. > Ziyad. > > P.S. I am using Xview, OpenWindows 2.0, and SunOS 4.1. The pressure sensing > pen is by GTCO Corporation (Digi-Pad 5 Family) which includes the 4D Digi-Pad > option X,Y,Z & Tilt. > ---------- You don't need to write the extension, just the device-dependent code to initialize the input device and format events received from it. The X Input Extension, available on the R5 distribution tape, provides the rest of what you need. It defines the events and a means for clients to select them, and routes those events to the appropriate clients. As far as polling is concerned, your OS serial device driver will take care of that. The X server does a select() on the file descriptor you've opened for the device, as a result of your device initialization, and will read input from the device whenever it's available. There is a porting guide in the R5 doc/extensions/xinput subdirectory that will help in writing your device-dependent code. George Sachs Hewlett-Packard gms@cv.hp.com