jdchrist@watcgl.waterloo.edu (Dan Christensen) (05/31/89)
Everything below was tried on an IRIS 4D/120GTX unless otherwise stated. I am working on connecting an input device to the Iris through a serial port. Conceptually, the device has several valuators and several buttons. I want to transparently let an application use this device just as it uses a device such as the mouse, or the dial and button box. There are several possible methods of doing this, each with problems. 1) Create new valuators and buttons for this device. This would be an optimal solution but would probably require that the graphics library be recompiled, so I doubt that it is possible. 2) Put events onto event queues directly. This would require knowledge of which process currently has the input focus and what its input channel number is. This could probably be done with the routines gl_inchanget and gl_anyqenter, but unfortunately these routines are undocumented. Can anyone explain what these routines do, what parameters they take, etc? The problem with this approach is that polling the device wouldn't work, but I would be willing to sacrifice this. 3) Put events onto the NeWS event queue. This is easy to do from PostScript but most likely the graphics library only filters out certain events from this queue to put onto GL clients' event queues. To change this would probably require that the graphics library be recompiled, so I doubt that it is possible. 4) Override existing valuators and buttons with setvaluator and gl_changedevice respectively. This does work but has a couple of problems. First of all, the message ERROR #23 in kernal: severity=2, sevaluator: <some number> appears in the console window once every couple of seconds, especially when the MOUSEX and MOUSEY valuators are being overridden and the tracker crosses a window boundary. This only started to happen since we switched from an IRIS 4D/70G to our IRIS 4D/120GTX. The second problem is that we are limited in the number of devices we can use concurrently since this uses up valuators and buttons from a limited supply. Also, gl_changedevice is an undocumented routine, although it is used in /usr/people/4Dgifts/examples/devices/tabletd.c. 5) I found this section difficult to explain because I don't really understand how valuators work internally. Maybe someone who does understand how they work will understand what I am saying. Override existing valuators and buttons using only gl_changedevice. Using gl_changedevice for both the valuators and the buttons eliminates the error message produced by setvaluator. There are a couple of problems with this method also. The correlation between the value sent to gl_changedevice for a valuator and the value that the valuator gets set to is difficult to understand. Unless there is a routine like gl_readdevice, it is difficult to reuse an existing valuator. For example, if a valuator can take on values between 0 and 100 and the gl_changedevice values that make it do this are between 1000 and 1100 (call this its 'device range') then when I try to set the valuator to 50 with gl_changedevice it gets set to 0 and its device range changes to 50 to 150. I need to find out the difference between the gl_changedevice values and the setvaluator values and I don't know how to do this. If more that one process is trying to control a valuator then using gl_changedevice seems out of the question. If the device ranges they use are not identical, then the valuator will not be set correctly. How should I do this? If 1) could be done that would be great, but I doubt it is possible. 2) looks feasable if I can find out how those gl_* routines work. 3) doesn't look possible. 4) looks possible if that error message could be removed. I reported this to the SGI Hotline and the person I spoke to couldn't explain why this was happening. 5) looks tough. 4) and 5) aren't as good as the other because they reuse existing valuators. In the future will it be easier to create new valuators? Thanks in advance for any help. I've been working on this for months. ---- Dan Christensen, Computer Graphics Lab, jdchrist@watcgl.uwaterloo.ca University of Waterloo, Waterloo, Ont. jdchrist@watcgl.waterloo.edu