(no subject)
aivils at latnet.lv
aivils at latnet.lv
Tue Jan 24 00:19:45 PST 2006
Entity extension for X windows.
http://www.ltn.lv/~aivils/files/xentity-0.01.tar.bz2
INSTALL
Please edit in the Rules.make line SERVER_SRC, insert here path to
Your server source.
# make
# make install
ENTITY
This extension, called ENTITY, add unified wired protocol to X
server. This protocol allow control X server internals without additional
wired API creation.
X server internal routine or device driver must register entity
control procedure. This registered control routine must be prepared
to receive client calls. entity algorithm is very similar UNIX ioctl().
X server internal routine use only two functions of entity extension:
int XentRegister(const char *name,
int (*func) (unsigned long, const int, char *, const int),
unsigned long data);
to register entity, where
name - entity name,
func - entity control procedure,
data - entity private data.
When entity is registered. X server clients can activate entity control
procedure via client xentity library. Entity control procedure is two
way communication. It can receive data from buffer and it can change
buffer content.
int XentUnregister(const char *name); - to unregister the entity.
Typical server side implementation:
#include "entity.h"
struct MyData *data;
int
ControlProc(unsigned long data, const int cmd, char *buffer, const int len)
{
switch (cmd) {
case A:
/* do some thing */
case B:
/* do another thing */
}
}
Init()
{
XentRegister("entity_name", ControlProc, (unsigned long) data);
}
Client side implementation of entity should use libxentity.a
Typical client side:
#include "xentityext.h"
int handle;
handle = XEntityOpen(dpy, "entity_name");
XEntitySetControl(dpy, handle, COMMAND-1, send_to_server_buffer, len);
XEntityGetControl(dpy, handle, COMMAND-2, receive_from_server_buffer, len2);
XEntityClose(dpy, handle);
As You can see client-server communication content have only buffer
size limits. Also set of commands and buffer content are not specified,
but is unique for each registered entity of server-side. Flash-forward
is design of proper server-side entity control procedure, without
hundreds of client-server communication structures like FooBarRec,
FooBarReplay.
First try is control.so X extension, which contains two entities
".extension.loader" ".extension.input". ".extension.loader" - provide
runtime module load/remove. ".extension.input" - provide runtime
input device create/delete. Current vesion of control.so is not
portable and use direct built-in function calls. To set up it add
in the xorg.conf some lines
Section "Module"
<skip>
Load "entity" # X ENTITY Extension
Load "control" # Support of xmodule and xdevice
<skip>
EndSection
XMODULE
xmodule application use entity ".extension.loader". Supported
options:
# xmodule -l name,option1,value1,option2,value2,...
-l - load the module of X server,
name - module name, current it may contain absolute path 8-(
option1 - option name,
value1 - value of option1
# xmodule -r name
-r - remove the module of X server.
# xmodule --list
receives list of some registered modules.
# xmodule --list-input
receives list of registered input modules and print it to stdout.
# xmodule --list-output
receives list of registered input modules and print it to stdout.
XDEVICE
xdevice application use entity ".extension.input".
# xdevice -c ident-name,driver-name,option1,value1,option2,value2...
-c - create input device,
ident-name - input device identifier,
driver-name - driver name,
option1 - option name,
value1 - value of option1.
Command equals config entry like this:
Section "InputDevice"
Identifier "ident-name"
Driver "driver-name"
Option "option1" "value1"
Option "option2" "value2"
EndSection
# xdevice -d ident-name
-d - deletes device with identifier "ident-name"
Probably You will create new device under Linux, which uses
driver evdev and device file /dev/input/event4. Commands:
# xmodule -l evdev
# xdevice -c e4,evdev,Device,/dev/input/event4,AlwaysCore,1
Check out input devices
# xsetpointer -l
Delete previously created input device
# xdevice -d e4
# xmodule -r evdev
Module removing is not certainly required.
Aivils Stoss
If You are ready to help, please help me to create nice
README.
More information about the xorg
mailing list