Ŀ                             Ŀ
 Emulate Mouse Driver for OS/2 Ĵ XSMOUSE10.ZIP 
                             

 Provides a device driver to send absolute mouse events into the OS/2 system.
 It has been specifically designed to ease the development and integration of
 touch screen solutions into the OS/2 system. Made in Holland by Wim Brul.

 Consists of XSMOUSE.TXT (this text file) and XSMOUSE.SYS (the device driver),
 GETEVENT.CMD (a read event example) and PUTEVENT.CMD (a write event example).

Open Source product with its ISC license contained in the LICENSE file.
Source Code at http://home.hccnet.nl/w.m.brul/emumouse/xsmouse10s.zip

Ŀ
 Description 


 This driver enables you to send mouse events into the system. It provides an
 application programming interface that conforms to the standard DosRead and
 DosWrite functions and as such may be easily used from rexx procedures using
 the charin and charout functions. It has been specifically designed to ease
 the development and integration of touch screen solutions into the system.

Ŀ
 Installation 


 Move the XSMOUSE10.ZIP file into a directory of your choice and unzip it.
 Copy the XSMOUSE.SYS device driver to your C:\OS2\BOOT directory. Look into
 your CONFIG.SYS file to determine which mouse device driver has been installed
 on your system. You may find AMOUSE.SYS or MOUSE.SYS and you need to add the
 STYPE=XSMOUSE$ parameter to that device driver statement and to insert the
 DEVICE=C:\OS2\BOOT\XSMOUSE.SYS device driver statement just above it. Restart
 your system. After that XSMOUSE$ will be the device driver name to be used.

Ŀ
 Common Event Buffer 


 The common event buffer is used to send absolute mouse events to mouse.sys
 like this is usually done for touch screens.

 Ŀ
  field  size  description        
 Ĵ
  Event  word  mouse event flags  
  yPos   word  current y position 
  xPos   word  current x position 
  yMax   word  maximum y position 
  xMax   word  maximum x position 
 

 Positions are measured in absolute coordinates.
 The coordinate position 0,0 represent the top left corner of the screen and
 the coordinate position yMax,xMax represent the bottom right corner of the
 screen and these are mapped by mouse.sys into the current display mode.

Ŀ
 Absolute Mouse Events 


 To report button states when the mouse stays at the old coordinate position
 use the mouse event flags listed under Old Position.

        Old Position               New Position
 Ŀ Ŀ
  button state    flag    button state    flag  
 Ĵ Ĵ
  all buttons up  0000h   all buttons up  0001h 
  button 1 down   0004h   button 1 down   0002h 
  button 2 down   0010h   button 2 down   0008h 
  button 3 down   0040h   button 3 down   0020h 
  

 To report button states when the mouse moves to the new coordinate position
 use the mouse event flags listed under New Position.

Ŀ
 GETEVENT.CMD 


 This rexx example file reads the last pointing device event from the common
 event buffer and displays it in hexadecimal format.

Ŀ
 PUTEVENT.CMD 


 This rexx example file writes the absolute pointing device event which moves
 the pointer to the center of the screen into the common event buffer and
 displays it in hexadecimal format.

Ŀ
 Prototyping Interface 


 The prototyping interface uses OS/2 Procedures language 2/REXX functions.
 To emulate the mouse the following functions are described:

  Acquire Driver
  Read Mouse Event
  Write Mouse Event
  Release Driver

Ŀ
 Acquire Driver 


 rc=stream(sName,'command','open');

 Opens the device driver for read/write access with this process.

 sName - Name of the device driver to be opened.

 rc - Return Code. See the OS/2 Procedures Language 2/REXX Reference
      for the standard strings returned.

Ŀ
 Read Mouse Event 


 Buffer=charin(sName,,10);

 Reads the last pointing device event from the common event buffer.

 sName - Name of the device driver to be used. Must be XSMOUSE$

 sBuffer - Name of the buffer to receive the common event buffer content.

Ŀ
 Write Mouse Event 


 rc=charout(sName,sBuffer);

 Writes the absolute pointing device event into the common event buffer.

 sName - Name of the device driver to be used. Must be XSMOUSE$

 sBuffer - Name of the buffer containing the absolute pointing device event.

 rc - Return Code. See the OS/2 Procedures Language 2/REXX Reference
      for the standard strings returned.

Ŀ
 Release Driver 


 rc=stream(sName,'command','close');

 Closes the device driver for read/write access with this process.

 sName - Name of the device driver to be closed.

 rc - Return Code. See the OS/2 Procedures Language 2/REXX Reference
      for the standard strings returned.

Ŀ
 Application Programming Interface 


 The application program interface uses OS/2 Control Program functions.
 To emulate the mouse the following functions are described:

  DosOpen
  DosRead
  DosWrite
  DosClose

Ŀ
 DosOpen 


 ulrc=DosOpen(pszName,phDevice,pulAction,0,0,1,18,0);

 Opens the device driver for read/write access with this process.

 pszName - Address of the asciiz name of the device driver to be opened.

 phDevice - Address of the variable to receive the device handle.

 pulAction - Address of the variable to receive the action taken.

 ulrc - Return Code. See the Control Program Guide and Reference
        for the standard values returned.

Ŀ
 DosRead 


 ulrc=DosRead(hDevice,pBuffer,10,pcbDone);

 Reads the last pointing device event from the common event buffer.

 hDevice - The device handle obtained from a previous call to DosOpen.

 pBuffer - Address of the buffer to receive the common event buffer content.

 pcbDone - Address of the variable to receive the number of bytes (10).

 ulrc - Return Code. See the Control Program Guide and Reference
        for the standard values returned.

Ŀ
 DosWrite 


 ulrc=DosWrite(hDevice,pBuffer,10,pcbDone);

 Writes the absolute pointing device event into the common event buffer.

 hDevice - The device handle obtained from a previous call to DosOpen.

 pBuffer - Address of the buffer containing the absolute pointing device event.

 pcbDone - Address of the variable to receive the number of bytes (10).

 ulrc - Return Code. See the Control Program Guide and Reference
        for the standard values returned.

Ŀ
 DosClose 


 ulrc=DosClose(hDevice);

 Closes the device driver for read/write access with this process.

 hDevice - The device handle obtained from a previous call to DosOpen.

 ulrc - Return Code. See the Control Program Guide and Reference
        for the standard values returned.

