[comp.sys.hp] Help wanted - Starbase under X11

pavi@rootbeer.eng.ohio-state.edu (Pavithran Thomas) (03/08/90)

Greetings!
	I'm just beginning to program on the HP and am running into a few
problems.  I'm using C with starbase under TWM.

	According to the manual "Starbase Programming With X11", the following 
should work:

    if ((display = gopen("/dev/screen/pavi", OUTDEV, "hp98550", INIT)) == -1)
	exit(1);

    if ((locator = gopen("/dev/screen/pavi FIRST_MOUSE", INDEV, 
			 "hp-hil", INIT)) == -1)
	exit(1);
    if ((keyboard = gopen("/dev/screen/pavi FIRST_KEYBOARD", INDEV, "keyboard",
 			INIT)) == -1)
	gclose(locator), gclose(display), exit(1);

Unfortunately, I get the following error message:

Starbase error 71: Requested resource is not available.
    Procedure name:      gopen
    File descriptor:     8
    Device file name:    /dev/screen/pavi FIRST_MOUSE
    Library location:    human interface loop (20)

Could anybody please set me on the right track?  All I want to do is to bring
up a window under X11 using starbase and use the mouse and keyboard in a 
shared mode.

Any help would be greatly appreciated!

-pavi-

pavi@rootbeer.eng.ohio-state.edu

-=-

~~~~~~~~~~~~~~~~
Pavithran Thomas            | DECNet:    rcgl1::pavi   ( 6177:pavi)     
Graphics Consultant         + InterNet:  pavi@eng.ohio-state.edu       

tomg@hpcvlx.cv.hp.com (Thomas J. Gilg) (03/09/90)

 
> 	According to the manual "Starbase Programming With X11", the following 
> should work:
> 
>     if ((display = gopen("/dev/screen/pavi", OUTDEV, "hp98550", INIT)) == -1)
> 	exit(1);
> 
>     if ((locator = gopen("/dev/screen/pavi FIRST_MOUSE", INDEV, 
> 			 "hp-hil", INIT)) == -1)
> 	exit(1);
>     if ((keyboard = gopen("/dev/screen/pavi FIRST_KEYBOARD", INDEV, "keyboard",
>  			INIT)) == -1)
> 	gclose(locator), gclose(display), exit(1);
> 
> Unfortunately, I get the following error message:
> 
> Starbase error 71: Requested resource is not available.
>     Procedure name:      gopen
>     File descriptor:     8
>     Device file name:    /dev/screen/pavi FIRST_MOUSE
>     Library location:    human interface loop (20)

Your second gopen() is using the wrong driver (I think).  Its seems wrong 
to do this, but instead of using the hp-hil driver which is geared to 
talking with physical hardware (eg, /dev/hil1), use the display driver.  In
your case, "hp98550" should be used.  Any input resources attached to the
X window are then passed on to Starbase via the hp98550 driver whenever
the window has the input focus.  I suspect your 3rd gopen() needs the 
same change.

Thomas Gilg
tomg@cv.hp.com

stroyan@hpfcso.HP.COM (Mike Stroyan) (03/09/90)

> Could anybody please set me on the right track?  All I want to do is to bring
> up a window under X11 using starbase and use the mouse and keyboard in a 
> shared mode.

The "/dev/screen/pavi FIRST_MOUSE" string would be used to open the
first mouse on the HP-HIL loop as an X extension input device.  However
that device is not available as an extension device because the X server
is already using it as a pointer device.  Instead, you can open the
window name itself as an input device.  That will use the X server
pointer device for locator input and choice input.  The X server
keyboard device for can be used by the sox11 driver for another choice
device.  To use the sox11 driver try the following.

	if ((display = gopen("/dev/screen/pavi", OUTDEV, "hp98550", INIT)) == -1)
		exit(1);
	if ((input = gopen("/dev/screen/pavi", INDEV, "sox11", INIT)) == -1)
		gclose(display), exit(1);

Now the mouse position will be locator ordinal 1 on "input".  The mouse
buttons are reported as button numbers on choice ordinal 1 and as a button
state bitmask on choice ordinal 2.  The keyboard will be choice ordinal 3.

You could just open the window once with output and input as below, but
the "hp98550" driver inputs from only the mouse and doesn't do input
from the keyboard.

	if ((window = gopen("/dev/screen/pavi", OUTINDEV, "hp98550", INIT)) == -1)
		exit(1);

Mike Stroyan, stroyan@hpfcla.hp.com

n188cu@tamunix (Joel Huddleston) (03/10/90)

> 	According to the manual "Starbase Programming With X11", the following 
> should work:
> 
>     if ((display = gopen("/dev/screen/pavi", OUTDEV, "hp98550", INIT)) == -1)
> 	exit(1);
>     if ((locator = gopen("/dev/screen/pavi FIRST_MOUSE", INDEV, 
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> 			 "hp-hil", INIT)) == -1)
> 	exit(1);
I think you should strongly suspect this syntax and double check it.
Perhaps this FIRST_MOUSE should be bitwise or'ed to the INIT parameter at the
end of the call.  Or, maybe it should be in the "hp-hil" string.  I don't
have the manuals in front of me now or I could be more sure of what I am
saying but it seems that the first parameter to gopen should ONLY contain
the device file used for I/O.

Joel Huddleston
n188cu@tamunix.tamu.edu