Paravirt framebuffer userspace tools [2/6]
PATCH 1/1 Paravirt framebuffer userspace tools [2/6]
Adds the basic userspace support for the VNC and SDL framebuffer pieces that run in dom0. Slightly modified by me to add some option parsing
tools/Makefile +1 -0
@@ -18,6 +18,7 @@ SUBDIRS-y += xenstat SUBDIRS-y += xenstat SUBDIRS-y += libaio SUBDIRS-y += blktap +SUBDIRS-y += xenfb # These don't cross-compile ifeq ($(XEN_COMPILE_ARCH),$(XEN_TARGET_ARCH))
tools/xenfb/Makefile new file +36 -0
@@ -0,0 +1,36 @@ +XEN_ROOT=../.. +include $(XEN_ROOT)/tools/Rules.mk + +CFLAGS += -g -Wall +CFLAGS += -I$(XEN_LIBXC) -I$(XEN_ROOT)/linux-2.6-xen-sparse/include +LDFLAGS += -L$(XEN_LIBXC) -L$(XEN_XENSTORE) + +INSTALL = install +INSTALL_PROG = $(INSTALL) -m0755 +INSTALL_DIR = $(INSTALL) -d -m0755 + +.PHONY: all +all: build + +.PHONY: build +build: mk-symlinks + $(MAKE) vncfb sdlfb + +install: all + $(INSTALL_DIR) -p $(DESTDIR)/usr/lib/xen/bin + $(INSTALL_PROG) vncfb $(DESTDIR)/usr/lib/xen/bin/xen-vncfb + $(INSTALL_PROG) sdlfb $(DESTDIR)/usr/lib/xen/bin/xen-sdlfb + +sdlfb: sdlfb.o xenfb.o + +sdlfb.o: CFLAGS += $(shell sdl-config --cflags) +sdlfb: LDLIBS += $(shell sdl-config --libs) -lxenctrl -lxenstore + +clean: + $(RM) *.o *~ vncfb sdlfb + +keymapping.o: CFLAGS += $(shell pkg-config --cflags gtk+-2.0) + +vncfb: vncfb.o xenfb.o keymapping.o +vncfb.o: CFLAGS += $(shell libvncserver-config --cflags) +vncfb: LDLIBS += $(shell libvncserver-config --libs) -lxenctrl -lxenstore
tools/xenfb/keymapping.c new file +141 -0
141 lines not on this page · raw message
tools/xenfb/sdlfb.c new file +191 -0
191 lines not on this page · raw message
tools/xenfb/vncfb.c new file +154 -0
154 lines not on this page · raw message
tools/xenfb/xenfb.c new file +457 -0
457 lines not on this page · raw message
tools/xenfb/xenfb.h new file +33 -0
@@ -0,0 +1,33 @@ +#ifndef _XENFB_H_ +#define _XENFB_H_ + +#include <stdbool.h> +#include <stdint.h> + +struct xenfb +{ +uint8_t *pixels; + +int row_stride; +int depth; +int width; +int height; + +void *user_data; + +void (*update)(struct xenfb *xenfb,int x,int y,int width,int height); +}; + +struct xenfb *xenfb_new (void ); +void xenfb_delete (struct xenfb *xenfb); + +bool xenfb_set_domid (struct xenfb *xenfb,int domid); + +int xenfb_get_fileno (struct xenfb *xenfb); +int xenfb_on_incoming (struct xenfb *xenfb); + +int xenfb_send_key (struct xenfb *xenfb,bool down,int keycode); +int xenfb_send_motion (struct xenfb *xenfb,int rel_x,int rel_y); +int xenfb_send_button (struct xenfb *xenfb,bool down,int button); + +#endif
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Quoted 2 lines · Jeremy Katz
Adds the basic userspace support for the VNC and SDL framebuffer pieces that run in dom0. Slightly modified by me to add some option parsing
[...]
Quoted 125 lines
tools/xenfb/keymapping.c new file +125
-0+uint32_t gdk_linux_mapping[0x10000 ] = { + [GDK_a] =KEY_A , + [GDK_b] =KEY_B , + [GDK_c] =KEY_C , + [GDK_d] =KEY_D , + [GDK_e] =KEY_E , + [GDK_f] =KEY_F , + [GDK_g] =KEY_G , + [GDK_h] =KEY_H , + [GDK_i] =KEY_I , + [GDK_j] =KEY_J , + [GDK_k] =KEY_K , + [GDK_l] =KEY_L , + [GDK_m] =KEY_M , + [GDK_n] =KEY_N , + [GDK_o] =KEY_O , + [GDK_p] =KEY_P , + [GDK_q] =KEY_Q , + [GDK_r] =KEY_R , + [GDK_s] =KEY_S , + [GDK_t] =KEY_T , + [GDK_u] =KEY_U , + [GDK_v] =KEY_V , + [GDK_w] =KEY_W , + [GDK_x] =KEY_X , + [GDK_y] =KEY_Y , + [GDK_z] =KEY_Z , + [GDK_A ] =KEY_A , + [GDK_B ] =KEY_B , + [GDK_C ] =KEY_C , + [GDK_D ] =KEY_D , + [GDK_E ] =KEY_E , + [GDK_F ] =KEY_F , + [GDK_G ] =KEY_G , + [GDK_H ] =KEY_H , + [GDK_I ] =KEY_I , + [GDK_J ] =KEY_J , + [GDK_K ] =KEY_K , + [GDK_L ] =KEY_L , + [GDK_M ] =KEY_M , + [GDK_N ] =KEY_N , + [GDK_O ] =KEY_O , + [GDK_P ] =KEY_P , + [GDK_Q ] =KEY_Q , + [GDK_R ] =KEY_R , + [GDK_S ] =KEY_S , + [GDK_T ] =KEY_T , + [GDK_U ] =KEY_U , + [GDK_V ] =KEY_V , + [GDK_W ] =KEY_W , + [GDK_X ] =KEY_X , + [GDK_Y ] =KEY_Y , + [GDK_Z ] =KEY_Z , + [GDK_0 ] =KEY_0 , + [GDK_1 ] =KEY_1 , + [GDK_2 ] =KEY_2 , + [GDK_3 ] =KEY_3 , + [GDK_4 ] =KEY_4 , + [GDK_5 ] =KEY_5 , + [GDK_6 ] =KEY_6 , + [GDK_7 ] =KEY_7 , + [GDK_8 ] =KEY_8 , + [GDK_9 ] =KEY_9 , + [GDK_Return] =KEY_ENTER , + [GDK_BackSpace] =KEY_BACKSPACE , + [GDK_Tab] =KEY_TAB , + [GDK_Pause] =KEY_PAUSE , + [GDK_Delete] =KEY_DELETE , + [GDK_slash] =KEY_SLASH , + [GDK_minus] =KEY_MINUS , + [GDK_equal] =KEY_EQUAL , + [GDK_Escape] =KEY_ESC , + [GDK_braceleft] =KEY_LEFTBRACE , + [GDK_braceright] =KEY_RIGHTBRACE , + [GDK_bracketleft] =KEY_LEFTMETA , + [GDK_bracketright] =KEY_RIGHTMETA , + [GDK_Control_L] =KEY_LEFTCTRL , + [GDK_Control_R] =KEY_RIGHTCTRL , + [GDK_Shift_L] =KEY_LEFTSHIFT , + [GDK_Shift_R] =KEY_RIGHTSHIFT , + [GDK_Alt_L] =KEY_LEFTALT , + [GDK_Alt_R] =KEY_RIGHTALT , + [GDK_semicolon] =KEY_SEMICOLON , + [GDK_apostrophe] =KEY_APOSTROPHE , + [GDK_grave] =KEY_GRAVE , + [GDK_backslash] =KEY_BACKSLASH , + [GDK_comma] =KEY_COMMA , + [GDK_period] =KEY_DOT , + [GDK_space] =KEY_SPACE , + [GDK_Caps_Lock] =KEY_CAPSLOCK , + [GDK_Num_Lock] =KEY_NUMLOCK , + [GDK_Scroll_Lock] =KEY_SCROLLLOCK , + [GDK_Sys_Req] =KEY_SYSRQ , + [GDK_Linefeed] =KEY_LINEFEED , + [GDK_Home] =KEY_HOME , + [GDK_Pause] =KEY_PAUSE , + [GDK_F1 ] =KEY_F1 , + [GDK_F2 ] =KEY_F2 , + [GDK_F3 ] =KEY_F3 , + [GDK_F4 ] =KEY_F4 , + [GDK_F5 ] =KEY_F5 , + [GDK_F6 ] =KEY_F6 , + [GDK_F7 ] =KEY_F7 , + [GDK_F8 ] =KEY_F8 , + [GDK_F9 ] =KEY_F9 , + [GDK_F10 ] =KEY_F10 , + [GDK_F11 ] =KEY_F11 , + [GDK_F12 ] =KEY_F12 , + [GDK_Up] =KEY_UP , + [GDK_Page_Up] =KEY_PAGEUP , + [GDK_Left] =KEY_LEFT , + [GDK_Right] =KEY_RIGHT , + [GDK_End] =KEY_END , + [GDK_Down] =KEY_DOWN , + [GDK_Page_Down] =KEY_PAGEDOWN , + [GDK_Insert] =KEY_INSERT , + [GDK_colon] =KEY_SEMICOLON , + [GDK_quotedbl] =KEY_APOSTROPHE , + [GDK_less] =KEY_COMMA , + [GDK_greater] =KEY_DOT , + [GDK_question] =KEY_SLASH , + [GDK_bar] =KEY_BACKSLASH , + [GDK_asciitilde] =KEY_GRAVE , + [GDK_exclam] =KEY_1 , + [GDK_at] =KEY_2 ,
tools/xenfb/keymapping.c line 139
Quoted 10 lines
tools/xenfb/keymapping.c new file +10
-0+ [GDK_numbersign] = KEY_3, + [GDK_dollar] = KEY_4, + [GDK_percent] = KEY_5, + [GDK_asciicircum] = KEY_6, + [GDK_ampersand] = KEY_7, + [GDK_asterisk] = KEY_8, + [GDK_parenleft] = KEY_9, + [GDK_parenright] = KEY_0, + [GDK_underscore] = KEY_MINUS, + [GDK_plus] = KEY_EQUAL,
[...]
As I propose in a previous mail, we should use scancode instead of symbol id.
Why ?
Let me explain:
I use a french keyboard (sorry ;-) ) with a lot of symbols like "é", "è", "ç", "à", "ù", and these symbols don't appear in your list.
Moreover some symbols are on the same key: "<" and ">" are on the same key on french keyboard, whereas on an US keyboard they are on two different keys: how to manage the shift key in this cases ?
The first keys on a french keyboard are: "AZ" whereas on an US keyboard it's "QZ", so you translate the SDL symbol "A" to the kernel scancode "A" which is in fact "Q"...
for the kernel, KEY_Q is the second key of the the second row, but on my keyboard, the second key of the second row is "A", so if when I press "Q" (GDK_Q), you send KEY_Q, (the 2nd key of the 2nd row) whereas I press the 2nd key of the 3rd row (KEY_A).
So I think we should provide the scancode to the virtualized kernel (because kernel manage scancode and not symbol) and let it to manage scancode/symbol id translation using the standard mechanism (loadkeys at the console level, xkbd at the X11 level, for instance).
Regards,
Laurent
Signature · 6 lines
------------------ Laurent Vivier ------------------- mailto:[email protected] BULL/FREC:B1-226 phone: (+33) 476 29 7213 Bullcom: 229-7213 ------------------[ DT/OSwR&D/AIX ]------------------ "Any sufficiently advanced technology is indistinguishable from magic." -- Arthur C. Clarke
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel