Francois Michoux (fmichoux++at++paris.sgi.com)
Mon, 27 Sep 1999 09:25:31 +0200
The Buttons and Dials Interface is handled by the X Input Extension of
the X server (see attached example code).
As you've two graphics pipes, you're able to address the two dial and
buttons with your two different DISPLAY environment variables.
Hope this helps, Francois.
Francis Govers III wrote:
>
> 1. How do I get the Onyx to recognize having two dial and button set up
> attached to it? I have
> two graphics pipes and want a dial and button set up on each one. Also then
> how do I address
> the two dial and buttons so that I know that the first one always is used by
> pipe0 and the second one is always used by pipe1? I think I understand that
> they will be plugged into different ttyd ports on the Onyx, but how can I
> address them so that my program will know which one to send data to?
>
> Where is the Buttons and Dials Interface documented?
>
> Francis X. Govers III, Systems Engineer
> Silicon Graphics Inc.
> 11490 Westheimer, Ste. 100 Houston TX 77077
> Phone: 281-493-8366 Pager: 1-888-983-0380
> Email: fxgovers++at++houst.sgi.com Pager Email:fxgovers_p++at++pager.sgi.com
>
> -----------------------------------------------------------------------
> List Archives, FAQ, FTP: http://www.sgi.com/software/performer/
> Submissions: info-performer++at++sgi.com
> Admin. requests: info-performer-request++at++sgi.com
-- ________________________________________________________ Francois Michoux http://reality.sgi.com/fmichoux_paris Graphic/Multimedia Support mailto:fmichoux++at++paris.sgi.com SGI, 21 rue Albert Calmette, 78350 Jouy en Josas, FRANCE Mail Stop : IFR-3400 Voice Mail : 521-8231 Phone : +33 (1) 34 88 80 88 Fax : +33 (1) 34 88 82 82
// CC -o main main.C -lXi -lXext -lX11
#include <stdio.h> #include <stdlib.h> #include <X11/Xlib.h> #include <X11/extensions/XInput.h>
Display* dpy; Window root; int screen; Window window;
typedef struct { XID classe; int length; XID id; int led_mask; int led_values; } myXLedFeedbackControl;
void main(int argc, char* argv[]) { dpy = XOpenDisplay(NULL); if(dpy == NULL) { fprintf(stderr, "cannot open display\n"); exit(1); }
XExtensionVersion* version;
version = XGetExtensionVersion(dpy, "XInputExtension"); if(version == NULL || ((int) version) == NoSuchExtension) { fprintf(stderr, "XInputExtension not supported by X server\n"); exit(1); }
XDeviceInfo *device_info; int num_dev;
device_info = XListInputDevices(dpy, &num_dev);
int i; Bool device_exists = False; XID device_id;
for(i = 0; i < num_dev; i++) { /* * XXX search for SGI's device which is named "dial+buttons"; not * very general */ if(!strcmp(device_info[i].name, "dial+buttons")) { device_exists = True; device_id = device_info[i].id; break; } }
XFreeDeviceList(device_info);
if(!device_exists) { fprintf(stderr, "no dial and button box found\n"); exit(1); }
XDevice *db;
db = XOpenDevice(dpy, device_id);
screen = DefaultScreen(dpy); root = DefaultRootWindow(dpy);
XEventClass event_list[3]; int num_events; int DeviceButtonPressType; int DeviceButtonReleaseType; int DeviceMotionNotifyType;
num_events = 0; DeviceButtonPress(db, DeviceButtonPressType, event_list[0]); num_events++; DeviceButtonRelease(db, DeviceButtonReleaseType, event_list[1]); num_events++; DeviceMotionNotify(db, DeviceMotionNotifyType, event_list[2]); num_events++; XSelectExtensionEvent(dpy, DefaultRootWindow(dpy), event_list, num_events);
XEvent xevent;
while(1) { XNextEvent(dpy, &xevent); if( (xevent.type == DeviceButtonPressType) || (xevent.type == DeviceButtonReleaseType) ) { XDeviceButtonEvent* devbut_event = (XDeviceButtonEvent*)&xevent;
printf("button %d = %d\n", devbut_event->button, xevent.type); } else if(xevent.type == DeviceMotionNotifyType) { XDeviceMotionEvent* devmot_event = (XDeviceMotionEvent*)&xevent; int i, v;
v = devmot_event->first_axis; for(i = 0; i < devmot_event->axes_count; i++, v++) { printf("val %d = %d\n", v, devmot_event->axis_data[i]); } }
static int n = 0; Mask mask; myXLedFeedbackControl xLedFeedbackControl; XFeedbackControl* control = (XFeedbackControl*)&xLedFeedbackControl;
mask = DvLed; xLedFeedbackControl.classe = LedFeedbackClass; xLedFeedbackControl.length = sizeof(XLedFeedbackControl); xLedFeedbackControl.led_mask = 0xffffffff; n++; if(n == 32) n=0; xLedFeedbackControl.led_values = 1 << n; XChangeFeedbackControl(dpy, db, mask, control); } XCloseDevice(dpy, db); XCloseDisplay(dpy); }
begin:vcard n:Michoux;Francois tel;fax:33-1 34 88 82 82 tel;work:33-1 34 88 80 88 x-mozilla-html:FALSE url:http://reality.sgi.com/fmichoux_paris org:SGI <http://www.sgi.com> adr:;;21, rue Albert Calmette;Jouy-en-Josas;;78350;France version:2.1 email;internet:fmichoux++at++paris.sgi.com title:Support Engineer x-mozilla-cpt:;24928 fn:Francois Michoux end:vcard
This archive was generated by hypermail 2.0b2 on Mon Sep 27 1999 - 00:23:34 PDT