[comp.windows.x] HELP needed in writing EXTENSION for PEN input device

hakura@seas.gwu.edu (Ziyad Sami Hakura) (06/22/91)

     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.

gms@hpcvlx.cv.hp.com. (George Sachs) (06/22/91)

> / 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

adrian@spike.ora.COM (adrian) (06/25/91)

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

Our documentation of the Xlib interface for writing extensions is 
just a reformatting of the MIT X consortium documentation.  We
realize this is inadequate, and are planning to improve it as soon
as possible.  Only recently has interest in extension writing
reached the point where significant numbers of people would read 
such documentation.

We have also commissioned articles about extension
writing for our journal the X Resource.

> If you have any advice on more helpful text or 
> implementation ideas, please write.

If anyone responds, can you copy adrian@ora.com?  We would like
to reflect in our documentation the techniques, experiences and 
tricks discovered by the X community.