From 52266913bd634abafcdc3e02aad9903da9139697 Mon Sep 17 00:00:00 2001 From: Jay Sorg Date: Tue, 16 Jul 2013 00:46:07 -0700 Subject: [PATCH] xorg driver, mouse, keybaord working in 1.7.0 and newer xorg --- xorg/server/readme.txt | 26 +++++++- xorg/server/xrdpkeyb/rdpKeyboard.c | 100 ++++++++++++++++++----------- xorg/server/xrdpmouse/rdpMouse.c | 87 ++++++++++++------------- 3 files changed, 127 insertions(+), 86 deletions(-) diff --git a/xorg/server/readme.txt b/xorg/server/readme.txt index 11e81e1e..1207efda 100644 --- a/xorg/server/readme.txt +++ b/xorg/server/readme.txt @@ -13,14 +13,34 @@ copy libxorgxrdp.so to /usr/lib/xorg/modules copy xrdpmouse_drv.so to /usr/lib/xorg/modules/input copy xrdpkeyb_drv.so to /usr/lib/xorg/modules/input -strat xserver like this +start xserver like this Xorg -modulepath /usr/lib/xorg/modules -config xrdp/xorg.conf -logfile /tmp/Xjay.log -novtswitch -sharevts -noreset -nohwaccess -ac :10 +or this on older Xorg but need /dev/vc/ thing below +Xorg -modulepath /home/jay/xorg-modules -config xrdp/xorg.conf -logfile /tmp/Xjay.log -novtswitch -sharevts -noreset -ac vt7 :10 older Xorg don't have -nohwaccess so you need to run Xorg as root or do something like this. sudo rm /dev/tty0 -sudo mknod -m 666 /dev/vc/7 c 7 7 +sudo mknod -m 666 /dev/tty0 c 4 0 sudo mkdir /dev/vc/ -sudo mknod -m 666 /dev/tty0 c 4 0 \ No newline at end of file +sudo mknod -m 666 /dev/vc/7 c 7 7 + +--modules + libfb.so + libint10.so + libvbe.so + libxorgxrdp.so +----drivers + xrdpdev_drv.so +----extensions + libdbe.so + libdri.so + libdri2.so + libextmod.so + libglx.so + librecord.so +----input + xrdpkeyb_drv.so + xrdpmouse_drv.so diff --git a/xorg/server/xrdpkeyb/rdpKeyboard.c b/xorg/server/xrdpkeyb/rdpKeyboard.c index 33c89ee9..ac7d284d 100644 --- a/xorg/server/xrdpkeyb/rdpKeyboard.c +++ b/xorg/server/xrdpkeyb/rdpKeyboard.c @@ -205,23 +205,17 @@ static KeySym g_kbdMap[] = static void rdpEnqueueKey(int type, int scancode) { - int i; - int n; - EventListPtr rdp_events; - xEvent *pev; - - i = GetEventList(&rdp_events); - LLOGLN(0, ("rdpEnqueueKey: i %d g_keyboard %p %p", i, g_keyboard, rdp_events)); - n = GetKeyboardEvents(rdp_events, g_keyboard, type, scancode); - LLOGLN(0, ("rdpEnqueueKey: n %d", n)); - for (i = 0; i < n; i++) + if (type == KeyPress) + { + xf86PostKeyboardEvent(g_keyboard, scancode, 1); + } + else { - pev = (rdp_events + i)->event; - mieqEnqueue(g_keyboard, (InternalEvent *)pev); + xf86PostKeyboardEvent(g_keyboard, scancode, 0); } } -#if 0 +#if 1 /******************************************************************************/ static CARD32 rdpDeferredUpdateCallback(OsTimerPtr timer, CARD32 now, pointer arg) @@ -231,8 +225,8 @@ rdpDeferredUpdateCallback(OsTimerPtr timer, CARD32 now, pointer arg) rdpEnqueueKey(KeyPress, 115); rdpEnqueueKey(KeyRelease, 115); - //xf86PostKeyboardEvent(g_keyboard, 9, 1); - //xf86PostKeyboardEvent(g_keyboard, 9, 0); + //xf86PostKeyboardEvent(g_keyboard, 115, 1); + //xf86PostKeyboardEvent(g_keyboard, 115, 0); g_timer = TimerSet(g_timer, 0, 1000, rdpDeferredUpdateCallback, 0); return 0; @@ -241,13 +235,13 @@ rdpDeferredUpdateCallback(OsTimerPtr timer, CARD32 now, pointer arg) /******************************************************************************/ void -rdpKeybDeviceInit(DeviceIntPtr pDevice, KeySymsPtr pKeySyms, CARD8 *pModMap) +rdpkeybDeviceInit(DeviceIntPtr pDevice, KeySymsPtr pKeySyms, CARD8 *pModMap) { int i; - LLOGLN(0, ("rdpKeybDeviceInit:")); + LLOGLN(0, ("rdpkeybDeviceInit:")); LLOGLN(10, (" MAP_LENGTH %d GLYPHS_PER_KEY %d N_PREDEFINED_KEYS %d", - MAP_LENGTH, GLYPHS_PER_KEY, N_PREDEFINED_KEYS)); + MAP_LENGTH, GLYPHS_PER_KEY, (int) N_PREDEFINED_KEYS)); for (i = 0; i < MAP_LENGTH; i++) { @@ -271,7 +265,7 @@ rdpKeybDeviceInit(DeviceIntPtr pDevice, KeySymsPtr pKeySyms, CARD8 *pModMap) pKeySyms->map = (KeySym *)malloc(i); if (pKeySyms->map == 0) { - LLOGLN(0, ("rdpKeybDeviceInit: malloc failed")); + LLOGLN(0, ("rdpkeybDeviceInit: malloc failed")); exit(1); } else @@ -292,89 +286,121 @@ rdpKeybDeviceInit(DeviceIntPtr pDevice, KeySymsPtr pKeySyms, CARD8 *pModMap) /******************************************************************************/ static void -rdpKeybDeviceOn(void) +rdpkeybDeviceOn(void) { - LLOGLN(0, ("rdpKeybDeviceOn:")); + LLOGLN(0, ("rdpkeybDeviceOn:")); } /******************************************************************************/ static void -rdpKeybDeviceOff(void) +rdpkeybDeviceOff(void) { - LLOGLN(0, ("rdpKeybDeviceOff:")); + LLOGLN(0, ("rdpkeybDeviceOff:")); } /******************************************************************************/ static void -rdpKeybBell(int volume, DeviceIntPtr pDev, pointer ctrl, int cls) +rdpkeybBell(int volume, DeviceIntPtr pDev, pointer ctrl, int cls) { - LLOGLN(0, ("rdpKeybBell:")); + LLOGLN(0, ("rdpkeybBell:")); } /******************************************************************************/ static void -rdpKeybChangeKeyboardControl(DeviceIntPtr pDev, KeybdCtrl *ctrl) +rdpkeybChangeKeyboardControl(DeviceIntPtr pDev, KeybdCtrl *ctrl) { - LLOGLN(0, ("rdpKeybChangeKeyboardControl:")); + LLOGLN(0, ("rdpkeybChangeKeyboardControl:")); } /******************************************************************************/ static int -rdpKeybControl(DeviceIntPtr device, int what) +rdpkeybControl(DeviceIntPtr device, int what) { KeySymsRec keySyms; CARD8 modMap[MAP_LENGTH]; DevicePtr pDev; XkbRMLVOSet set; - LLOGLN(0, ("rdpKeybControl: what %d", what)); + LLOGLN(0, ("rdpkeybControl: what %d", what)); pDev = (DevicePtr)device; switch (what) { case DEVICE_INIT: - rdpKeybDeviceInit(device, &keySyms, modMap); + rdpkeybDeviceInit(device, &keySyms, modMap); memset(&set, 0, sizeof(set)); set.rules = "base"; set.model = "pc104"; set.layout = "us"; set.variant = ""; set.options = ""; - InitKeyboardDeviceStruct(device, &set, rdpKeybBell, - rdpKeybChangeKeyboardControl); + InitKeyboardDeviceStruct(device, &set, rdpkeybBell, + rdpkeybChangeKeyboardControl); g_keyboard = device; - //g_timer = TimerSet(g_timer, 0, 1000, rdpDeferredUpdateCallback, 0); + g_timer = TimerSet(g_timer, 0, 1000, rdpDeferredUpdateCallback, 0); break; case DEVICE_ON: pDev->on = 1; - rdpKeybDeviceOn(); + rdpkeybDeviceOn(); break; case DEVICE_OFF: pDev->on = 0; - rdpKeybDeviceOff(); + rdpkeybDeviceOff(); break; case DEVICE_CLOSE: if (pDev->on) { - rdpKeybDeviceOff(); + rdpkeybDeviceOff(); } break; } return Success; } +#if XORG_VERSION_CURRENT < (((1) * 10000000) + ((9) * 100000) + ((0) * 1000) + 1) + +/* debian 6 + ubuntu 10.04 */ + +/******************************************************************************/ +static InputInfoPtr +rdpkeybPreInit(InputDriverPtr drv, IDevPtr dev, int flags) +{ + InputInfoPtr info; + + LLOGLN(0, ("rdpkeybPreInit: drv %p dev %p, flags 0x%x", + drv, dev, flags)); + info = xf86AllocateInput(drv, 0); + info->name = dev->identifier; + info->device_control = rdpkeybControl; + info->flags = XI86_CONFIGURED | XI86_ALWAYS_CORE | XI86_SEND_DRAG_EVENTS | + XI86_CORE_KEYBOARD | XI86_KEYBOARD_CAPABLE; + info->type_name = "Keyboard"; + info->fd = -1; + info->conf_idev = dev; + + return info; +} + +#else + +/* debian 7 + ubuntu 12.04 */ + /******************************************************************************/ static int rdpkeybPreInit(InputDriverPtr drv, InputInfoPtr info, int flags) { LLOGLN(0, ("rdpkeybPreInit: drv %p info %p, flags 0x%x", drv, info, flags)); - info->device_control = rdpKeybControl; + info->device_control = rdpkeybControl; info->type_name = "Keyboard"; return 0; } +#endif + /******************************************************************************/ static void rdpkeybUnInit(InputDriverPtr drv, InputInfoPtr info, int flags) diff --git a/xorg/server/xrdpmouse/rdpMouse.c b/xorg/server/xrdpmouse/rdpMouse.c index b5fdd0e7..7142a4ee 100644 --- a/xorg/server/xrdpmouse/rdpMouse.c +++ b/xorg/server/xrdpmouse/rdpMouse.c @@ -58,48 +58,48 @@ xrdp mouse module /******************************************************************************/ static void -rdpMouseDeviceInit(void) +rdpmouseDeviceInit(void) { - LLOGLN(0, ("rdpMouseDeviceInit:")); + LLOGLN(0, ("rdpmouseDeviceInit:")); } /******************************************************************************/ static void -rdpMouseDeviceOn(DeviceIntPtr pDev) +rdpmouseDeviceOn(DeviceIntPtr pDev) { - LLOGLN(0, ("rdpMouseDeviceOn:")); + LLOGLN(0, ("rdpmouseDeviceOn:")); } /******************************************************************************/ static void -rdpMouseDeviceOff(void) +rdpmouseDeviceOff(void) { - LLOGLN(0, ("rdpMouseDeviceOff:")); + LLOGLN(0, ("rdpmouseDeviceOff:")); } /******************************************************************************/ static void -rdpMouseCtrl(DeviceIntPtr pDevice, PtrCtrl *pCtrl) +rdpmouseCtrl(DeviceIntPtr pDevice, PtrCtrl *pCtrl) { - LLOGLN(0, ("rdpMouseCtrl:")); + LLOGLN(0, ("rdpmouseCtrl:")); } /******************************************************************************/ static int -rdpMouseControl(DeviceIntPtr device, int what) +rdpmouseControl(DeviceIntPtr device, int what) { BYTE map[6]; DevicePtr pDev; Atom btn_labels[6]; Atom axes_labels[2]; - LLOGLN(0, ("rdpMouseControl: what %d", what)); + LLOGLN(0, ("rdpmouseControl: what %d", what)); pDev = (DevicePtr)device; switch (what) { case DEVICE_INIT: - rdpMouseDeviceInit(); + rdpmouseDeviceInit(); map[0] = 0; map[1] = 1; map[2] = 2; @@ -116,23 +116,23 @@ rdpMouseControl(DeviceIntPtr device, int what) axes_labels[0] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_X); axes_labels[1] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_Y); - InitPointerDeviceStruct(pDev, map, 5, btn_labels, rdpMouseCtrl, + InitPointerDeviceStruct(pDev, map, 5, btn_labels, rdpmouseCtrl, GetMotionHistorySize(), 2, axes_labels); break; case DEVICE_ON: pDev->on = 1; - rdpMouseDeviceOn(device); + rdpmouseDeviceOn(device); break; case DEVICE_OFF: pDev->on = 0; - rdpMouseDeviceOff(); + rdpmouseDeviceOff(); break; case DEVICE_CLOSE: if (pDev->on) { - rdpMouseDeviceOff(); + rdpmouseDeviceOff(); } break; @@ -141,54 +141,49 @@ rdpMouseControl(DeviceIntPtr device, int what) return Success; } -/******************************************************************************/ -static void -rdpMouseReadInput(struct _InputInfoRec *local) -{ - LLOGLN(0, ("rdpMouseReadInput:")); -} +#if XORG_VERSION_CURRENT < (((1) * 10000000) + ((9) * 100000) + ((0) * 1000) + 1) -/******************************************************************************/ -static int -rdpMouseControlProc(struct _InputInfoRec *local, xDeviceCtl *control) -{ - LLOGLN(0, ("rdpMouseControlProc:")); - return 0; -} +/* debian 6 + ubuntu 10.04 */ /******************************************************************************/ -static int -rdpMouseSwitchMode(ClientPtr client, DeviceIntPtr dev, int mode) +static InputInfoPtr +rdpmousePreInit(InputDriverPtr drv, IDevPtr dev, int flags) { - LLOGLN(0, ("rdpMouseSwitchMode:")); - return 0; -} + InputInfoPtr info; -/******************************************************************************/ -static int -rdpMouseSetDeviceValuators(struct _InputInfoRec *local, - int *valuators, int first_valuator, - int num_valuators) -{ - LLOGLN(0, ("rdpMouseSetDeviceValuators:")); - return 0; + LLOGLN(0, ("rdpmousePreInit: drv %p dev %p, flags 0x%x", + drv, dev, flags)); + info = xf86AllocateInput(drv, 0); + info->name = dev->identifier; + info->device_control = rdpmouseControl; + info->flags = XI86_CONFIGURED | XI86_ALWAYS_CORE | XI86_SEND_DRAG_EVENTS | + XI86_CORE_POINTER | XI86_POINTER_CAPABLE; + info->type_name = "Mouse"; + info->fd = -1; + info->conf_idev = dev; + + return info; } +#else + +/* debian 7 + ubuntu 12.04 */ + /******************************************************************************/ static int rdpmousePreInit(InputDriverPtr drv, InputInfoPtr info, int flags) { LLOGLN(0, ("rdpmousePreInit: drv %p info %p, flags 0x%x", drv, info, flags)); - info->device_control = rdpMouseControl; - info->read_input = rdpMouseReadInput; - info->control_proc = rdpMouseControlProc; - info->switch_mode = rdpMouseSwitchMode; - info->set_device_valuators = rdpMouseSetDeviceValuators; + info->device_control = rdpmouseControl; info->type_name = "Mouse"; return 0; } +#endif + /******************************************************************************/ static void rdpmouseUnInit(InputDriverPtr drv, InputInfoPtr info, int flags)