Re: [PATCH keyboard 3/3] Remove support for X input ABI < 12
On Wed, Nov 25, 2015 at 07:19:48AM +1000, Peter Hutterer wrote: > On Tue, Nov 24, 2015 at 12:46:44PM +0500, Alexandr Shadchin wrote: > > Signed-off-by: Alexandr Shadchin <alexandr.shadc...@gmail.com> > > do you have follow-up patches that require these changes? I'm ok merging > this set if it makes follow-ups easier, but a patchset just to remove > functionality seems a bit superfluous. > > Cheers, >Peter > Not yet. I found these changes in my repository. I considered that it makes sense, xorg-server 1.10 was released in 2011. evdev and synaptics: xorg-server >= 1.12 > > --- > > configure.ac | 2 +- > > src/kbd.c| 83 > > ++-- > > 2 files changed, 14 insertions(+), 71 deletions(-) > > > > diff --git a/configure.ac b/configure.ac > > index 6fd6576..993d5a8 100644 > > --- a/configure.ac > > +++ b/configure.ac > > @@ -44,7 +44,7 @@ XORG_MACROS_VERSION(1.8) > > XORG_DEFAULT_OPTIONS > > > > # Obtain compiler/linker options from server and required extensions > > -PKG_CHECK_MODULES(XORG, [xorg-server >= 1.4] xproto inputproto) > > +PKG_CHECK_MODULES(XORG, [xorg-server >= 1.10] xproto inputproto) > > > > # Define a configure option for an alternate input module directory > > AC_ARG_WITH(xorg-module-dir, > > diff --git a/src/kbd.c b/src/kbd.c > > index 1ce4ee6..e378dcc 100644 > > --- a/src/kbd.c > > +++ b/src/kbd.c > > @@ -53,11 +53,7 @@ > > /* Used to know when the first DEVICE_ON after a DEVICE_INIT is called */ > > #define INITFLAG (1U << 31) > > > > -#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) < 12 > > -static InputInfoPtr KbdPreInit(InputDriverPtr drv, IDevPtr dev, int flags); > > -#else > > static int KbdPreInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags); > > -#endif > > static int KbdProc(DeviceIntPtr device, int what); > > static void KbdCtrl(DeviceIntPtr device, KeybdCtrl *ctrl); > > static void KbdBell(int percent, DeviceIntPtr dev, pointer ctrl, int > > unused); > > @@ -132,43 +128,8 @@ _X_EXPORT XF86ModuleData kbdModuleData = { > > NULL > > }; > > > > -#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) < 12 > > -static int > > -NewKbdPreInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags); > > - > > -static InputInfoPtr > > -KbdPreInit(InputDriverPtr drv, IDevPtr dev, int flags) > > -{ > > -InputInfoPtr pInfo; > > - > > -if (!(pInfo = xf86AllocateInput(drv, 0))) > > - return NULL; > > - > > -pInfo->name = dev->identifier; > > -pInfo->flags = XI86_KEYBOARD_CAPABLE; > > -pInfo->conversion_proc = NULL; > > -pInfo->reverse_conversion_proc = NULL; > > -pInfo->private_flags = 0; > > -pInfo->always_core_feedback = NULL; > > -pInfo->conf_idev = dev; > > -pInfo->close_proc = NULL; > > - > > -if (NewKbdPreInit(drv, pInfo, flags) == Success) > > -{ > > -pInfo->flags |= XI86_CONFIGURED; > > -return pInfo; > > -} > > - > > -xf86DeleteInput(pInfo, 0); > > -return NULL; > > -} > > - > > -static int > > -NewKbdPreInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags) > > -#else > > static int > > KbdPreInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags) > > -#endif > > { > > KbdDevPtr pKbd; > > char *s; > > @@ -189,11 +150,7 @@ KbdPreInit(InputDriverPtr drv, InputInfoPtr pInfo, int > > flags) > > pInfo->dev = NULL; > > > > defaults = kbdDefaults; > > -xf86CollectInputOptions(pInfo, defaults > > -#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) < 12 > > -, NULL > > -#endif > > -); > > +xf86CollectInputOptions(pInfo, defaults); > > xf86ProcessCommonOptions(pInfo, pInfo->options); > > > > if (!(pKbd = calloc(sizeof(KbdDevRec), 1))) { > > @@ -335,6 +292,7 @@ KbdProc(DeviceIntPtr device, int what) > > > >InputInfoPtr pInfo = device->public.devicePrivate; > >KbdDevPtr pKbd = (KbdDevPtr) pInfo->private; > > + XkbRMLVOSet rmlvo; > >KeySymsRec keySyms; > >CARD8modMap[MAP_LENGTH]; > >int ret; > > @@ -348,23 +306,19 @@ KbdProc(DeviceIntPtr device, int what) > > pKbd->KbdGetMapping(pInfo, , modMap); > > > > device->public.on = FALSE; > > -#if GET_ABI_MAJOR(ABI_XINPUT_VERSI
[PATCH keyboard 1/3] Remove empty function xf86KbdUnplug
Signed-off-by: Alexandr Shadchin <alexandr.shadc...@gmail.com> --- src/kbd.c | 7 +-- 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/kbd.c b/src/kbd.c index 189adca..4db2e0a 100644 --- a/src/kbd.c +++ b/src/kbd.c @@ -452,11 +452,6 @@ PostKbdEvent(InputInfoPtr pInfo, unsigned int scanCode, Bool down) xf86PostKeyboardEvent(device, scanCode + MIN_KEYCODE, down); } -static void -xf86KbdUnplug(pointer p) -{ -} - static pointer xf86KbdPlug(pointermodule, pointer options, @@ -486,5 +481,5 @@ static XF86ModuleVersionInfo xf86KbdVersionRec = _X_EXPORT XF86ModuleData kbdModuleData = { , xf86KbdPlug, -xf86KbdUnplug +NULL }; -- 2.6.3 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
Re: [PATCH vesa 2/2] Fix check function in VESASaveRestore
On Mon, Aug 20, 2012 at 6:00 AM, Peter Hutterer peter.hutte...@who-t.net wrote: On Sat, Aug 18, 2012 at 08:53:34PM +0600, Alexandr Shadchin wrote: Signed-off-by: Alexandr Shadchin alexandr.shadc...@gmail.com --- src/vesa.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/src/vesa.c b/src/vesa.c index 8ac77da..11cd26c 100644 --- a/src/vesa.c +++ b/src/vesa.c @@ -1626,7 +1626,7 @@ VESASaveRestore(ScrnInfoPtr pScrn, vbeSaveRestoreFunction function) { VESAPtr pVesa; -if (MODE_QUERY 0 || function MODE_RESTORE) +if (function MODE_QUERY || function MODE_RESTORE) return (FALSE); pVesa = VESAGetRec(pScrn); -- 1.7.6 certainly looks less broken than the previous one though I notice that the previous one has been in since the original import in 2003. what was the effect of this bug? a small blurb in the commit message would be appreciated. Reviewed-by: Peter Hutterer peter.hutte...@who-t.net Cheers, Peter No effect, just corrected strange condition :) VESASaveRestore() call only with MODE_SAVE and MODE_RESTORE. Need send pull request or someone push? -- Alexandr Shadchin ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
[PATCH vesa 1/2] Remove unneeded AM_CONDITIONAL
Signed-off-by: Alexandr Shadchin alexandr.shadc...@gmail.com --- configure.ac |9 + 1 files changed, 5 insertions(+), 4 deletions(-) diff --git a/configure.ac b/configure.ac index 6317acd..08e0571 100644 --- a/configure.ac +++ b/configure.ac @@ -60,9 +60,11 @@ XORG_DRIVER_CHECK_EXT(DPMSExtension, xextproto) # Obtain compiler/linker options for the driver dependencies PKG_CHECK_MODULES(XORG, xorg-server = 1.0.99.901 xproto fontsproto $REQUIRED_MODULES) PKG_CHECK_MODULES(XEXT, [xextproto = 7.0.99.1], - HAVE_XEXTPROTO_71=yes; AC_DEFINE(HAVE_XEXTPROTO_71, 1, [xextproto 7.1 available]), - HAVE_XEXTPROTO_71=no) -AM_CONDITIONAL(HAVE_XEXTPROTO_71, [ test $HAVE_XEXTPROTO_71 = yes ]) + HAVE_XEXTPROTO_71=yes, HAVE_XEXTPROTO_71=no) + +if test x$HAVE_XEXTPROTO_71 = xyes; then +AC_DEFINE(HAVE_XEXTPROTO_71, 1, [xextproto 7.1 available]) +fi save_CFLAGS=$CFLAGS CFLAGS=$XORG_CFLAGS @@ -90,7 +92,6 @@ CFLAGS=$save_CFLAGS if test x$XSERVER_LIBPCIACCESS = xyes; then PKG_CHECK_MODULES([PCIACCESS], [pciaccess = 0.12.901]) fi -AM_CONDITIONAL(XSERVER_LIBPCIACCESS, test x$XSERVER_LIBPCIACCESS = xyes) # Checks for libraries. -- 1.7.6 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
[PATCH vesa 2/2] Fix check function in VESASaveRestore
Signed-off-by: Alexandr Shadchin alexandr.shadc...@gmail.com --- src/vesa.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/src/vesa.c b/src/vesa.c index 8ac77da..11cd26c 100644 --- a/src/vesa.c +++ b/src/vesa.c @@ -1626,7 +1626,7 @@ VESASaveRestore(ScrnInfoPtr pScrn, vbeSaveRestoreFunction function) { VESAPtr pVesa; -if (MODE_QUERY 0 || function MODE_RESTORE) +if (function MODE_QUERY || function MODE_RESTORE) return (FALSE); pVesa = VESAGetRec(pScrn); -- 1.7.6 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
Re: [PATCH:xf86-input-keyboard] Set XI_PROP_DEVICE_NODE property to string from Device option
Reviewed-by: Alexandr Shadchin alexandr.shadc...@gmail.com small comment see below On Fri, Apr 27, 2012 at 05:53:09PM -0700, Alan Coopersmith wrote: Signed-off-by: Alan Coopersmith alan.coopersm...@oracle.com --- man/kbd.man |2 +- src/kbd.c | 19 +++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/man/kbd.man b/man/kbd.man index c8d70cc..b1bd082 100644 --- a/man/kbd.man +++ b/man/kbd.man @@ -40,7 +40,7 @@ are supported: .TP 7 .BI Option \*qDevice\*q \*q string \*q Specify the keyboard device. Default: the OS's default console keyboard -input source. +input source. Property: Device Node (read-only). .TP 7 .BI Option \*qProtocol\*q \*q string \*q Specify the keyboard protocol. Valid protocol types include: diff --git a/src/kbd.c b/src/kbd.c index e04c340..f77bc95 100644 --- a/src/kbd.c +++ b/src/kbd.c @@ -38,6 +38,10 @@ #include xf86OSKbd.h #include compiler.h +#include exevents.h +#include X11/Xatom.h +#include xserver-properties.h + #include xkbstr.h #include xkbsrv.h @@ -328,6 +332,21 @@ KbdProc(DeviceIntPtr device, int what) return BadValue; } } +# ifdef XI_PROP_DEVICE_NODE + { replace tabulation on spaces + const char *device_node = + xf86CheckStrOption(pInfo-options, Device, NULL); + + if (device_node) + { + Atom prop_device = MakeAtom(XI_PROP_DEVICE_NODE, + strlen(XI_PROP_DEVICE_NODE), TRUE); + XIChangeDeviceProperty(device, prop_device, XA_STRING, 8, +PropModeReplace, strlen(device_node), +device_node, FALSE); + } + } +# endif /* XI_PROP_DEVICE_NODE */ #else { XkbComponentNamesRec xkbnames; -- 1.7.9.2 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel -- Alexandr Shadchin ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
Re: [PATCH:xf86-input-mouse 1/4] sun_mouse.c: Remove redundant option checks
On Fri, Apr 27, 2012 at 05:43:49PM -0700, Alan Coopersmith wrote: Previously they checked pInfo-options, then fell back to pInfo-conf_idev-commonOptions - but then 7bf22a368c752fe76dc replaced the latter with the former, resulting in some redunancy. Signed-off-by: Alan Coopersmith alan.coopersm...@oracle.com --- src/sun_mouse.c |6 -- 1 file changed, 6 deletions(-) diff --git a/src/sun_mouse.c b/src/sun_mouse.c index ad38ba4..9a594cd 100644 --- a/src/sun_mouse.c +++ b/src/sun_mouse.c @@ -611,16 +611,10 @@ solarisMouseAutoProbe(InputInfoPtr pInfo, const char **protocol, if (*device == NULL) { /* Check to see if xorg.conf or HAL specified a device to use */ *device = xf86CheckStrOption(pInfo-options, Device, NULL); - if (*device == NULL) { - *device = xf86CheckStrOption(pInfo-options, Device, NULL); - } } if (*device != NULL) { strmod = xf86CheckStrOption(pInfo-options, StreamsModule, NULL); - if (strmod == NULL) { - strmod = xf86CheckStrOption(pInfo-options, StreamsModule, NULL); - } if (strmod) { /* if a device name is already known, and a StreamsModule is specified to convert events to VUID, then we don't need to -- 1.7.9.2 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel Reviewed-by: Alexandr Shadchin alexandr.shadc...@gmail.com -- Alexandr Shadchin ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
Re: [PATCH:xf86-input-mouse 2/4] Set XI_PROP_DEVICE_NODE property to string from Device option
On Fri, Apr 27, 2012 at 05:43:50PM -0700, Alan Coopersmith wrote: Signed-off-by: Alan Coopersmith alan.coopersm...@oracle.com --- man/mousedrv.man |3 ++- src/mouse.c | 23 +++ 2 files changed, 25 insertions(+), 1 deletion(-) Reviewed-by: Alexandr Shadchin alexandr.shadc...@gmail.com -- Alexandr Shadchin ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
Re: [PATCH:xf86-input-mouse 3/4] Set button axis labels
On Fri, Apr 27, 2012 at 05:43:51PM -0700, Alan Coopersmith wrote: Signed-off-by: Alan Coopersmith alan.coopersm...@oracle.com --- src/mouse.c | 42 +- 1 file changed, 41 insertions(+), 1 deletion(-) Reviewed-by: Alexandr Shadchin alexandr.shadc...@gmail.com small comment see below diff --git a/src/mouse.c b/src/mouse.c index 7613403..308d356 100644 --- a/src/mouse.c +++ b/src/mouse.c @@ -1023,9 +1023,28 @@ out: return rc; } +static void MouseInitButtonLabels(Atom *btn_labels) +{ +int i; +Atom unknown_btn = XIGetKnownProperty(BTN_LABEL_PROP_BTN_UNKNOWN); + +btn_labels[0] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_LEFT); +btn_labels[1] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_MIDDLE); +btn_labels[2] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_RIGHT); +btn_labels[3] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_WHEEL_UP); +btn_labels[4] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_WHEEL_DOWN); +btn_labels[5] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_HWHEEL_LEFT); +btn_labels[6] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_HWHEEL_RIGHT); + +unknown_btn = XIGetKnownProperty(BTN_LABEL_PROP_BTN_UNKNOWN); unneeded, unknown_btn defined above +for (i = 7; i MSE_MAXBUTTONS; i++) +btn_labels[i] = unknown_btn; +} + static void MouseInitProperties(DeviceIntPtr device) { InputInfoPtr pInfo = device-public.devicePrivate; +MouseDevPtr pMse = pInfo-private; #ifdef XI_PROP_DEVICE_NODE const char *device_node = @@ -1040,6 +1059,23 @@ static void MouseInitProperties(DeviceIntPtr device) strlen(device_node), device_node, FALSE); } #endif /* XI_PROP_DEVICE_NODE */ + +/* Button labels */ +if (pMse-buttons 0) +{ +Atom prop_btn_label = XIGetKnownProperty(BTN_LABEL_PROP); + +if (prop_btn_label) +{ +Atom btn_labels[MSE_MAXBUTTONS]; +MouseInitButtonLabels(btn_labels); + +XIChangeDeviceProperty(device, prop_btn_label, XA_ATOM, 32, + PropModeReplace, pMse-buttons, + btn_labels, FALSE); +XISetDevicePropertyDeletable(device, prop_btn_label, FALSE); +} +} } static void @@ -1597,7 +1633,11 @@ MouseProc(DeviceIntPtr device, int what) for (i = 0; i MSE_MAXBUTTONS; i++) map[i + 1] = i + 1; -/* FIXME: we should probably set the labels here */ +#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) = 7 +MouseInitButtonLabels(btn_labels); +axes_labels[0] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_X); +axes_labels[1] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_Y); +#endif InitPointerDeviceStruct((DevicePtr)device, map, min(pMse-buttons, MSE_MAXBUTTONS), -- 1.7.9.2 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel -- Alexandr Shadchin ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
Re: [PATCH:xf86-input-mouse] Avoid NULL pointer dereference in autoprobe if proto == PROT_UNSUP
On Wed, Nov 30, 2011 at 07:32:47PM -0800, Alan Coopersmith wrote: Error: Null pointer dereference (CWE 476) Read from null pointer 'GetProtocol(proto)' at line 3477 of driver/xf86-input-mouse/src/mouse.c in function 'autoProbeMouse'. Function 'GetProtocol' may return constant 'NULL' at line 736, called at line 3477. Null pointer introduced at line 736 in function 'GetProtocol'. We already handle one of the two cases that make GetProtocol return NULL, proto == PROTO_UNKNOWN, but not PROT_UNSUP. [ This bug was found by the Parfait 0.4.2 bug checking tool. For more information see http://labs.oracle.com/projects/parfait/ ] Signed-off-by: Alan Coopersmith alan.coopersm...@oracle.com Reviewed-by: Alexandr Shadchin alexandr.shadc...@gmail.com -- Alexandr Shadchin ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
[PATCH xserver 1/8] xfree86: Remove 386BSD
Signed-off-by: Alexandr Shadchin alexandr.shadc...@gmail.com --- hw/xfree86/os-support/xf86_OSlib.h |7 +-- 1 files changed, 1 insertions(+), 6 deletions(-) diff --git a/hw/xfree86/os-support/xf86_OSlib.h b/hw/xfree86/os-support/xf86_OSlib.h index 0a5861f..a754f23 100644 --- a/hw/xfree86/os-support/xf86_OSlib.h +++ b/hw/xfree86/os-support/xf86_OSlib.h @@ -209,13 +209,8 @@ #endif /* __linux__ || __GLIBC__ */ /**/ -/* 386BSD and derivatives, BSD/386 */ +/* System is BSD-like */ /**/ - -#if defined(__386BSD__) (defined(__FreeBSD__) || defined(__NetBSD__)) -# undef __386BSD__ -#endif - #ifdef CSRG_BASED # include sys/ioctl.h # include signal.h -- 1.7.6 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
[PATCH xserver 2/8] bsd: Remove LINKKIT
Signed-off-by: Alexandr Shadchin alexandr.shadc...@gmail.com --- hw/xfree86/os-support/xf86_OSlib.h |3 --- 1 files changed, 0 insertions(+), 3 deletions(-) diff --git a/hw/xfree86/os-support/xf86_OSlib.h b/hw/xfree86/os-support/xf86_OSlib.h index a754f23..557a287 100644 --- a/hw/xfree86/os-support/xf86_OSlib.h +++ b/hw/xfree86/os-support/xf86_OSlib.h @@ -238,8 +238,6 @@ # define __FreeBSD_kernel_version __FreeBSD_version # endif -# if !defined(LINKKIT) - /* Don't need this stuff for the Link Kit */ # ifdef SYSCONS_SUPPORT #define COMPAT_SYSCONS #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) @@ -310,7 +308,6 @@ #ifndef CONSOLE_GET_MEM_INFO #define CONSOLE_GET_MEM_INFO_IOR('t',159,struct map_info) #endif -# endif /* !LINKKIT */ #if defined(USE_I386_IOPL) || defined(USE_AMD64_IOPL) #include machine/sysarch.h -- 1.7.6 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
[PATCH xserver 3/8] bsd: Fix indentation in xf86_OSlib.h
Also add check definition PCCONS_SUPPORT for CONSOLE_X_* Signed-off-by: Alexandr Shadchin alexandr.shadc...@gmail.com --- hw/xfree86/os-support/xf86_OSlib.h | 147 +++- 1 files changed, 77 insertions(+), 70 deletions(-) diff --git a/hw/xfree86/os-support/xf86_OSlib.h b/hw/xfree86/os-support/xf86_OSlib.h index 557a287..06fea03 100644 --- a/hw/xfree86/os-support/xf86_OSlib.h +++ b/hw/xfree86/os-support/xf86_OSlib.h @@ -238,80 +238,87 @@ # define __FreeBSD_kernel_version __FreeBSD_version # endif -# ifdef SYSCONS_SUPPORT -#define COMPAT_SYSCONS -#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) -# if defined(__DragonFly__) || (__FreeBSD_kernel_version = 41) -# include sys/consio.h -# include sys/kbio.h -# else -# include machine/console.h -# endif /* FreeBSD 4.1 RELEASE or lator */ -#else -# include sys/console.h -#endif -# endif /* SYSCONS_SUPPORT */ -# if defined(PCVT_SUPPORT) !defined(__NetBSD__) !defined(__OpenBSD__) -#if !defined(SYSCONS_SUPPORT) - /* no syscons, so include pcvt specific header file */ -# if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) -# include machine/pcvt_ioctl.h -# else -# include sys/pcvt_ioctl.h -# endif /* __FreeBSD_kernel__ */ -#else /* pcvt and syscons: hard-code the ID magic */ -# define VGAPCVTID _IOWR('V',113, struct pcvtid) +# ifdef SYSCONS_SUPPORT +# define COMPAT_SYSCONS +# if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) +# if defined(__DragonFly__) || (__FreeBSD_kernel_version = 41) +#include sys/consio.h +#include sys/kbio.h +# else +#include machine/console.h +# endif /* FreeBSD 4.1 RELEASE or lator */ +# else +# include sys/console.h +# endif +# endif /* SYSCONS_SUPPORT */ + +# if defined(PCVT_SUPPORT) !defined(__NetBSD__) !defined(__OpenBSD__) +# if !defined(SYSCONS_SUPPORT) +/* no syscons, so include pcvt specific header file */ +# if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) +#include machine/pcvt_ioctl.h +# else +#include sys/pcvt_ioctl.h +# endif /* __FreeBSD_kernel__ */ +# else /* pcvt and syscons: hard-code the ID magic */ +# define VGAPCVTID _IOWR('V',113, struct pcvtid) struct pcvtid { char name[16]; int rmajor, rminor; }; -#endif /* PCVT_SUPPORT SYSCONS_SUPPORT */ -# endif /* PCVT_SUPPORT */ -# ifdef WSCONS_SUPPORT -#include dev/wscons/wsconsio.h -#include dev/wscons/wsdisplay_usl_io.h -# endif /* WSCONS_SUPPORT */ -# if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) -#if defined(__FreeBSD_kernel_version) (__FreeBSD_kernel_version = 500013) -# include sys/mouse.h -#else -# undef MOUSE_GETINFO -# include machine/mouse.h -#endif -# endif -/* Include these definitions in case ioctl_pc.h didn't get included */ -# ifndef CONSOLE_X_MODE_ON -#define CONSOLE_X_MODE_ON _IO('t',121) -# endif -# ifndef CONSOLE_X_MODE_OFF -#define CONSOLE_X_MODE_OFF _IO('t',122) -# endif -# ifndef CONSOLE_X_BELL -#define CONSOLE_X_BELL _IOW('t',123,int[2]) -# endif -# ifndef CONSOLE_X_TV_ON -#define CONSOLE_X_TV_ON _IOW('t',155,int) -#define XMODE_RGB 0 -#define XMODE_NTSC 1 -#define XMODE_PAL 2 -#define XMODE_SECAM 3 -# endif -# ifndef CONSOLE_X_TV_OFF -#define CONSOLE_X_TV_OFF _IO('t',156) -# endif -#ifndef CONSOLE_GET_LINEAR_INFO -#define CONSOLE_GET_LINEAR_INFO _IOR('t',157,struct map_info) -#endif -#ifndef CONSOLE_GET_IO_INFO -#define CONSOLE_GET_IO_INFO _IOR('t',158,struct map_info) -#endif -#ifndef CONSOLE_GET_MEM_INFO -#define CONSOLE_GET_MEM_INFO_IOR('t',159,struct map_info) -#endif +# endif /* PCVT_SUPPORT SYSCONS_SUPPORT */ +# endif /* PCVT_SUPPORT */ + +# ifdef WSCONS_SUPPORT +# include dev/wscons/wsconsio.h +# include dev/wscons/wsdisplay_usl_io.h +# endif /* WSCONS_SUPPORT */ + +# if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) +# if defined(__FreeBSD_kernel_version) (__FreeBSD_kernel_version = 500013) +# include sys/mouse.h +# else +# undef MOUSE_GETINFO +# include machine/mouse.h +# endif +# endif -#if defined(USE_I386_IOPL) || defined(USE_AMD64_IOPL) -#include machine/sysarch.h -#endif +/* Include these definitions in case ioctl_pc.h didn't get included */ +# ifdef PCCONS_SUPPORT +# ifndef CONSOLE_X_MODE_ON +# define CONSOLE_X_MODE_ON _IO('t',121) +# endif +# ifndef CONSOLE_X_MODE_OFF +# define CONSOLE_X_MODE_OFF _IO('t',122) +# endif +# ifndef CONSOLE_X_BELL +# define CONSOLE_X_BELL _IOW('t',123,int[2]) +# endif +# ifndef CONSOLE_X_TV_ON +# define CONSOLE_X_TV_ON _IOW('t',155,int) +# define XMODE_RGB 0 +# define XMODE_NTSC 1 +# define XMODE_PAL 2 +# define XMODE_SECAM 3 +# endif
[PATCH xserver 4/8] bsd: Remove old code for FreeBSD 5.0
I think that no sense have this code, because no one engaged building (porting) new xserver on FreeBSD 5.0 Signed-off-by: Alexandr Shadchin alexandr.shadc...@gmail.com --- hw/xfree86/os-support/bsd/bsd_init.c | 64 +- hw/xfree86/os-support/xf86_OSlib.h | 15 ++-- 2 files changed, 12 insertions(+), 67 deletions(-) diff --git a/hw/xfree86/os-support/bsd/bsd_init.c b/hw/xfree86/os-support/bsd/bsd_init.c index 7079d62..fa7e2c2 100644 --- a/hw/xfree86/os-support/bsd/bsd_init.c +++ b/hw/xfree86/os-support/bsd/bsd_init.c @@ -35,7 +35,6 @@ #include xf86Priv.h #include xf86_OSlib.h -#include sys/utsname.h #include sys/ioctl.h #include stdlib.h #include errno.h @@ -158,9 +157,6 @@ xf86OpenConsole() xf86ConsOpen_t *driver; #if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT) int result; -#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) -struct utsname uts; -#endif vtmode_t vtmode; #endif @@ -235,17 +231,6 @@ xf86OpenConsole() break; #endif #if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT) - case SYSCONS: - /* as of FreeBSD 2.2.8, syscons driver does not need the #1 vt -* switching anymore. Here we check for FreeBSD 3.1 and up. -* Add cases for other *BSD that behave the same. - */ -#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) - uname (uts); - i = atof(uts.release) * 100; - if (i = 310) goto acquire_vt; -#endif - /* otherwise fall through */ case PCVT: #if !(defined(__NetBSD__) (__NetBSD_Version__ = 2)) /* @@ -263,7 +248,8 @@ xf86OpenConsole() sleep(1); } #endif -acquire_vt: +/* FALLTHROUGH */ + case SYSCONS: if (!xf86Info.ShareVTs) { /* * now get the VT @@ -396,26 +382,11 @@ xf86OpenSyscons() if (xf86Info.vtno == -1) { - /* -* For old syscons versions (0x100), VT_OPENQRY returns -* the current VT rather than the next free VT. In this -* case, the server gets started on the current VT instead -* of the next free VT. -*/ - -#if 0 - /* check for the fixed VT_OPENQRY */ - if (syscons_version = 0x100) + if (ioctl(fd, VT_OPENQRY, xf86Info.vtno) 0) { -#endif - if (ioctl(fd, VT_OPENQRY, xf86Info.vtno) 0) - { - /* No free VTs */ - xf86Info.vtno = -1; - } -#if 0 + /* No free VTs */ + xf86Info.vtno = -1; } -#endif if (xf86Info.vtno == -1) { @@ -428,18 +399,8 @@ xf86OpenSyscons() } else { - if (syscons_version = 0x100) - { - FatalError(%s: Cannot find a free VT, - xf86OpenSyscons); - } - /* Should no longer reach here */ - FatalError(%s: %s %s\n\t%s %s, - xf86OpenSyscons, - syscons versions prior to 1.0 require, - either the, - server's stdin be a VT, - or the use of the vtxx server option); + FatalError(%s: Cannot find a free VT, + xf86OpenSyscons); } } from = X_PROBED; @@ -458,15 +419,8 @@ xf86OpenSyscons() } xf86Info.consType = SYSCONS; xf86Msg(X_PROBED, Using syscons driver with X support); - if (syscons_version = 0x100) - { - xf86ErrorF( (version %ld.%ld)\n, syscons_version 8, - syscons_version 0xFF); - } - else - { - xf86ErrorF( (version 0.x)\n); - } + xf86ErrorF( (version %ld.%ld)\n, syscons_version 8, + syscons_version 0xFF); xf86Msg(from, using VT number %d\n\n, xf86Info.vtno); } else diff --git a/hw/xfree86/os-support/xf86_OSlib.h b/hw/xfree86/os-support/xf86_OSlib.h index 06fea03..57d057d 100644 --- a/hw/xfree86/os-support/xf86_OSlib.h +++ b/hw/xfree86/os-support/xf86_OSlib.h @@ -241,12 +241,8 @@ # ifdef SYSCONS_SUPPORT # define COMPAT_SYSCONS # if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) -# if defined(__DragonFly__) || (__FreeBSD_kernel_version = 41) -#include sys/consio.h -#include sys/kbio.h -# else -#include machine/console.h -# endif /* FreeBSD 4.1 RELEASE
[PATCH xserver 5/8] bsd: Remove definition XF86PM for OpenBSD (not uses)
Signed-off-by: Alexandr Shadchin alexandr.shadc...@gmail.com --- configure.ac | 12 +--- 1 files changed, 1 insertions(+), 11 deletions(-) diff --git a/configure.ac b/configure.ac index e4fcba4..18259f6 100644 --- a/configure.ac +++ b/configure.ac @@ -1632,17 +1632,7 @@ if test x$XORG = xyes; then ;; esac ;; - freebsd* | kfreebsd*-gnu | dragonfly*) - XORG_OS_SUBDIR=bsd - ;; - netbsd*) - XORG_OS_SUBDIR=bsd - ;; - openbsd*) - if test x$ac_cv_BSD_APM = xyes \ - -o x$ac_cv_BSD_KQUEUE_APM = xyes; then - XORG_CFLAGS=$XORG_CFLAGS -DXF86PM - fi + freebsd* | kfreebsd*-gnu | dragonfly* | netbsd* | openbsd*) XORG_OS_SUBDIR=bsd ;; solaris*) -- 1.7.6 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
[PATCH xserver 6/8] bsd: Remove xf86OSPMOpen and etc for *BSD (not uses)
Now do not for one *BSD is not defined X86PM. Signed-off-by: Alexandr Shadchin alexandr.shadc...@gmail.com --- configure.ac |9 -- hw/xfree86/os-support/bsd/Makefile.am | 12 +-- hw/xfree86/os-support/bsd/bsd_apm.c| 139 --- hw/xfree86/os-support/bsd/bsd_kqueue_apm.c | 201 4 files changed, 1 insertions(+), 360 deletions(-) delete mode 100644 hw/xfree86/os-support/bsd/bsd_apm.c delete mode 100644 hw/xfree86/os-support/bsd/bsd_kqueue_apm.c diff --git a/configure.ac b/configure.ac index 18259f6..6419bb2 100644 --- a/configure.ac +++ b/configure.ac @@ -310,15 +310,6 @@ if test -c /dev/xf86 ; then AC_DEFINE(HAS_APERTURE_DRV, 1, [System has /dev/xf86 aperture driver]) fi -dnl BSD APM support -AC_CHECK_HEADER([machine/apmvar.h],[ - AC_CHECK_HEADER([sys/event.h], - ac_cv_BSD_KQUEUE_APM=yes, - ac_cv_BSD_APM=yes)]) - -AM_CONDITIONAL(BSD_APM, [test x$ac_cv_BSD_APM = xyes]) -AM_CONDITIONAL(BSD_KQUEUE_APM, [test x$ac_cv_BSD_KQUEUE_APM = xyes]) - dnl glibc backtrace support check (hw/xfree86/common/xf86Events.c) AC_CHECK_HEADER([execinfo.h],[ AC_CHECK_LIB(c, backtrace, [ diff --git a/hw/xfree86/os-support/bsd/Makefile.am b/hw/xfree86/os-support/bsd/Makefile.am index b6ecdf1..68aa8c9 100644 --- a/hw/xfree86/os-support/bsd/Makefile.am +++ b/hw/xfree86/os-support/bsd/Makefile.am @@ -1,16 +1,5 @@ noinst_LTLIBRARIES = libbsd.la -# APM support. -if BSD_KQUEUE_APM -APM_SOURCES = $(srcdir)/bsd_kqueue_apm.c -else -if BSD_APM -APM_SOURCES = $(srcdir)/bsd_apm.c -else -APM_SOURCES = $(srcdir)/../shared/pm_noop.c -endif -endif - if FREEBSD_KLDLOAD KMOD_SOURCES = bsd_kmod.c else @@ -57,6 +46,7 @@ AM_CFLAGS = -DUSESTDRES $(XORG_CFLAGS) $(DIX_CFLAGS) INCLUDES = $(XORG_INCS) libbsd_la_SOURCES = \ + $(srcdir)/../shared/pm_noop.c \ $(srcdir)/../shared/posix_tty.c \ $(srcdir)/../shared/sigio.c \ $(srcdir)/../shared/vidmem.c \ diff --git a/hw/xfree86/os-support/bsd/bsd_apm.c b/hw/xfree86/os-support/bsd/bsd_apm.c deleted file mode 100644 index 73c88dc..000 --- a/hw/xfree86/os-support/bsd/bsd_apm.c +++ /dev/null @@ -1,139 +0,0 @@ -#ifdef HAVE_XORG_CONFIG_H -#include xorg-config.h -#endif - -#include X11/X.h -#include os.h -#include xf86.h -#include xf86Priv.h -#define XF86_OS_PRIVS -#include xf86_OSproc.h -#include xf86_OSlib.h - -#include machine/apmvar.h - -#define APM_DEVICE /dev/apm - -static pointer APMihPtr = NULL; -static void bsdCloseAPM(void); - -static struct { -u_int apmBsd; -pmEvent xf86; -} bsdToXF86Array [] = { -{ APM_STANDBY_REQ, XF86_APM_SYS_STANDBY }, -{ APM_SUSPEND_REQ, XF86_APM_SYS_SUSPEND }, -{ APM_NORMAL_RESUME, XF86_APM_NORMAL_RESUME }, -{ APM_CRIT_RESUME, XF86_APM_CRITICAL_RESUME }, -{ APM_BATTERY_LOW, XF86_APM_LOW_BATTERY }, -{ APM_POWER_CHANGE, XF86_APM_POWER_STATUS_CHANGE }, -{ APM_UPDATE_TIME, XF86_APM_UPDATE_TIME }, -{ APM_CRIT_SUSPEND_REQ, XF86_APM_CRITICAL_SUSPEND }, -{ APM_USER_STANDBY_REQ, XF86_APM_USER_STANDBY }, -{ APM_USER_SUSPEND_REQ, XF86_APM_USER_SUSPEND }, -{ APM_SYS_STANDBY_RESUME, XF86_APM_STANDBY_RESUME }, -#ifdef APM_CAPABILITY_CHANGE -{ APM_CAPABILITY_CHANGE, XF86_APM_CAPABILITY_CHANGED }, -#endif -}; - -#define numApmEvents (sizeof(bsdToXF86Array) / sizeof(bsdToXF86Array[0])) - -static pmEvent -bsdToXF86(int type) -{ -int i; - -for (i = 0; i numApmEvents; i++) { - if (type == bsdToXF86Array[i].apmBsd) { - return bsdToXF86Array[i].xf86; - } -} -return XF86_APM_UNKNOWN; -} - -/* - * APM events can be requested direclty from /dev/apm - */ -static int -bsdPMGetEventFromOS(int fd, pmEvent *events, int num) -{ -struct apm_event_info bsdEvent; -int i; - -for (i = 0; i num; i++) { - - if (ioctl(fd, APM_IOC_NEXTEVENT, bsdEvent) 0) { - if (errno != EAGAIN) { - xf86Msg(X_WARNING, bsdPMGetEventFromOS: APM_IOC_NEXTEVENT -%s\n, strerror(errno)); - } - break; - } - events[i] = bsdToXF86(bsdEvent.type); -} -return i; -} - -/* - * XXX This won't work on /dev/apm ! - * We should either use /dev/apm_ctl (and kill apmd(8)) - * or talk to apmd (but its protocol is not publically available)... - */ -static pmWait -bsdPMConfirmEventToOs(int fd, pmEvent event) -{ -switch (event) { - case XF86_APM_SYS_STANDBY: - case XF86_APM_USER_STANDBY: -if (ioctl( fd, APM_IOC_STANDBY, NULL ) == 0) -return PM_WAIT; /* should we stop the Xserver in standby, too? */ -else -return PM_NONE; - case XF86_APM_SYS_SUSPEND: - case XF86_APM_CRITICAL_SUSPEND: - case XF86_APM_USER_SUSPEND: -if (ioctl( fd, APM_IOC_SUSPEND, NULL ) == 0) -return PM_WAIT; -else -return PM_NONE; - case XF86_APM_STANDBY_RESUME
[PATCH xserver 7/8] bsd: Remove memrange.h (not need)
NetBSD work with own code MTRR (define HAS_MTRR_BUILTIN) Signed-off-by: Alexandr Shadchin alexandr.shadc...@gmail.com --- hw/xfree86/os-support/bsd/Makefile.am |4 -- hw/xfree86/os-support/bsd/i386_video.c |4 -- hw/xfree86/os-support/bsd/memrange.h | 69 3 files changed, 0 insertions(+), 77 deletions(-) delete mode 100644 hw/xfree86/os-support/bsd/memrange.h diff --git a/hw/xfree86/os-support/bsd/Makefile.am b/hw/xfree86/os-support/bsd/Makefile.am index 68aa8c9..ba9e1e8 100644 --- a/hw/xfree86/os-support/bsd/Makefile.am +++ b/hw/xfree86/os-support/bsd/Makefile.am @@ -60,7 +60,3 @@ libbsd_la_SOURCES = \ $(DRI_SOURCES) \ $(KMOD_SOURCES) \ $(RES_SOURCES) - -# FIXME: Add these files to the build as needed -EXTRA_DIST = \ - memrange.h diff --git a/hw/xfree86/os-support/bsd/i386_video.c b/hw/xfree86/os-support/bsd/i386_video.c index 35e00fc..abfabfe 100644 --- a/hw/xfree86/os-support/bsd/i386_video.c +++ b/hw/xfree86/os-support/bsd/i386_video.c @@ -35,12 +35,8 @@ #include sys/mman.h #ifdef HAS_MTRR_SUPPORT -#ifndef __NetBSD__ #include sys/types.h #include sys/memrange.h -#else -#include memrange.h -#endif #define X_MTRR_ID XFree86 #endif diff --git a/hw/xfree86/os-support/bsd/memrange.h b/hw/xfree86/os-support/bsd/memrange.h deleted file mode 100644 index 03c4791..000 --- a/hw/xfree86/os-support/bsd/memrange.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Memory range attribute operations, peformed on /dev/mem - */ - -#ifdef HAVE_XORG_CONFIG_H -#include xorg-config.h -#endif - -#ifndef _MEMRANGE_H -#define _MEMRANGE_H - -/* Memory range attributes */ -#define MDF_UNCACHEABLE(10) /* region not cached */ -#define MDF_WRITECOMBINE (11) /* region supports write combine -* action */ -#define MDF_WRITETHROUGH (12) /* write-through cached */ -#define MDF_WRITEBACK (13) /* write-back cached */ -#define MDF_WRITEPROTECT (14) /* read-only region */ -#define MDF_ATTRMASK (0x00ff) - -#define MDF_FIXBASE(124) /* fixed base */ -#define MDF_FIXLEN (125) /* fixed length */ -#define MDF_FIRMWARE (126) /* set by firmware (XXX not useful?) */ -#define MDF_ACTIVE (127) /* currently active */ -#define MDF_BOGUS (128) /* we don't like it */ -#define MDF_FIXACTIVE (129) /* can't be turned off */ -#define MDF_BUSY (130) /* range is in use */ - -struct mem_range_desc { - u_int64_t mr_base; - u_int64_t mr_len; - int mr_flags; - charmr_owner[8]; -}; - -struct mem_range_op { - struct mem_range_desc *mo_desc; - int mo_arg[2]; -#define MEMRANGE_SET_UPDATE0 -#define MEMRANGE_SET_REMOVE1 - /* XXX want a flag that says set and undo when I exit */ -}; -#define MEMRANGE_GET _IOWR('m', 50, struct mem_range_op) -#define MEMRANGE_SET _IOW('m', 51, struct mem_range_op) - -#ifdef _KERNEL - -struct mem_range_softc; -struct mem_range_ops { - void(*init) __P((struct mem_range_softc * sc)); - int (*set) __P((struct mem_range_softc * sc, struct mem_range_desc * mrd, int *arg)); - void(*initAP) __P((struct mem_range_softc * sc)); -}; - -struct mem_range_softc { - struct mem_range_ops *mr_op; - int mr_cap; - int mr_ndesc; - struct mem_range_desc *mr_desc; -}; - -extern struct mem_range_softc mem_range_softc; - -extern int mem_range_attr_get __P((struct mem_range_desc * mrd, int *arg)); -extern int mem_range_attr_set __P((struct mem_range_desc * mrd, int *arg)); -extern void mem_range_AP_init __P((void)); -#endif - -#endif -- 1.7.6 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
[PATCH xserver 8/8] xfree86: Don't export variable VTSwitchEnabled
Use function xf86EnableVTSwitch() instead direct access to VTSwitchEnabled. Keyboard driver no longer uses this variable. Signed-off-by: Alexandr Shadchin alexandr.shadc...@gmail.com --- hw/xfree86/common/xf86.h |2 -- hw/xfree86/common/xf86Events.c |2 +- 2 files changed, 1 insertions(+), 3 deletions(-) diff --git a/hw/xfree86/common/xf86.h b/hw/xfree86/common/xf86.h index f216d5e..9a2fa09 100644 --- a/hw/xfree86/common/xf86.h +++ b/hw/xfree86/common/xf86.h @@ -71,8 +71,6 @@ extern _X_EXPORT Bool sbusSlotClaimed; extern _X_EXPORT confDRIRec xf86ConfigDRI; extern _X_EXPORT Bool xf86DRI2Enabled(void); -extern _X_EXPORT Bool VTSwitchEnabled; /* kbd driver */ - #define XF86SCRNINFO(p) ((ScrnInfoPtr)dixLookupPrivate((p)-devPrivates, \ xf86ScreenKey)) #define XF86FLIP_PIXELS() \ diff --git a/hw/xfree86/common/xf86Events.c b/hw/xfree86/common/xf86Events.c index 41ffabd..1436a2a 100644 --- a/hw/xfree86/common/xf86Events.c +++ b/hw/xfree86/common/xf86Events.c @@ -93,7 +93,7 @@ * This has been generalised to work with Linux and *BSD+syscons (DHD) */ -Bool VTSwitchEnabled = TRUE; /* Allows run-time disabling for +static Bool VTSwitchEnabled = TRUE;/* Allows run-time disabling for *BSD and for avoiding VT switches when using the DRI automatic full screen mode.*/ -- 1.7.6 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
[PATCH xserver 1/4] bsd: Remove bsd_pci.c
bsd_pci.c have only one function osPciInit(). osPciInit() is equivalent call xf86InitVidMem(). xf86InitVidMem() is needed only for OpenBSD (see commit 06c0372c3a1b45005eb6d50406f77f4e93f1de1e) For OpenBSD is defined osPciInit() = xf86InitVidMem() Signed-off-by: Alexandr Shadchin alexandr.shadc...@gmail.com --- configure.ac |7 hw/xfree86/os-support/bus/Makefile.am |4 -- hw/xfree86/os-support/bus/Pci.h | 10 +++--- hw/xfree86/os-support/bus/bsd_pci.c | 55 - 4 files changed, 5 insertions(+), 71 deletions(-) delete mode 100644 hw/xfree86/os-support/bus/bsd_pci.c diff --git a/configure.ac b/configure.ac index 63d59f9..de957de 100644 --- a/configure.ac +++ b/configure.ac @@ -1582,7 +1582,6 @@ if test x$XORG = xyes; then dnl === dnl = beginning of PCI configuration == dnl === - xorg_bus_bsdpci=no xorg_bus_sparc=no AC_MSG_CHECKING([whether to build Xorg PCI functions]) @@ -1595,11 +1594,6 @@ if test x$XORG = xyes; then AC_DEFINE(XSERVER_LIBPCIACCESS, 1, [Use libpciaccess for all pci manipulation]) AC_DEFINE_DIR(PCI_TXT_IDS_PATH, PCI_TXT_IDS_DIR, [Default PCI text file ID path]) - case $host_os in - gnu* | freebsd* | kfreebsd*-gnu | netbsd* | openbsd* | solaris* | dragonfly*) - xorg_bus_bsdpci=yes - ;; - esac case $host_cpu in sparc*) xorg_bus_sparc=yes @@ -1788,7 +1782,6 @@ if test x$XORG = xyes; then fi AM_CONDITIONAL([XORG], [test x$XORG = xyes]) AM_CONDITIONAL([XORG_BUS_PCI], [test x$PCI = xyes]) -AM_CONDITIONAL([XORG_BUS_BSDPCI], [test x$xorg_bus_bsdpci = xyes]) AM_CONDITIONAL([XORG_BUS_SPARC], [test x$xorg_bus_sparc = xyes]) AM_CONDITIONAL([LINUX_ALPHA], [test x$linux_alpha = xyes]) AM_CONDITIONAL([LNXACPI], [test x$linux_acpi = xyes]) diff --git a/hw/xfree86/os-support/bus/Makefile.am b/hw/xfree86/os-support/bus/Makefile.am index e09d4d2..d63cd89 100644 --- a/hw/xfree86/os-support/bus/Makefile.am +++ b/hw/xfree86/os-support/bus/Makefile.am @@ -6,10 +6,6 @@ if XORG_BUS_PCI PCI_SOURCES += Pci.c Pci.h endif -if XORG_BUS_BSDPCI -PCI_SOURCES += bsd_pci.c -endif - if XORG_BUS_SPARC PLATFORM_SOURCES = Sbus.c sdk_HEADERS += xf86Sbus.h diff --git a/hw/xfree86/os-support/bus/Pci.h b/hw/xfree86/os-support/bus/Pci.h index 88560ec..821de0d 100644 --- a/hw/xfree86/os-support/bus/Pci.h +++ b/hw/xfree86/os-support/bus/Pci.h @@ -137,12 +137,12 @@ #define PCI_BUS_NO_DOMAIN(bus) ((bus) 0xffu) #define PCI_TAG_NO_DOMAIN(tag) ((tag) 0x0000u) -#if defined(linux) +#if defined(linux) || defined(__sun) || defined(__GNU__) || \ + defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || \ + defined(__NetBSD__) || defined(__DragonFly__) #define osPciInit(x) do {} while (0) -#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || \ - defined(__OpenBSD__) || defined(__NetBSD__) || \ - defined(__DragonFly__) || defined(__sun) || defined(__GNU__) -extern void osPciInit(void); +#elif defined(__OpenBSD__) +#define osPciInit(x) do { xf86InitVidMem(); } while (0) #else #error No PCI support available for this architecture/OS combination #endif diff --git a/hw/xfree86/os-support/bus/bsd_pci.c b/hw/xfree86/os-support/bus/bsd_pci.c deleted file mode 100644 index 7a5dbbb..000 --- a/hw/xfree86/os-support/bus/bsd_pci.c +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright © 2007 Intel Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the Software), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. - * - * Authors: - *Eric Anholt e...@anholt.net - * - */ - -/** - * @file bsd_pci.c - * - * This is a trivial implementation of the remaining PCI support hooks in the - * X Server that is unaware
[PATCH xserver 2/4] xfree86: Remove Pci.h
In commit 3e5281af17841cf50d0e52a728b12c6ab56e61df says that xf86scanpci is unexport, although it still has _X_EXPORT. I think that simply forgot to remove _X_EXPORT and xf86scanpci not used anywhere else except for xserver. xf86scanpci is simple and is called only once, so make its functionality into a separate function makes no sense. Signed-off-by: Alexandr Shadchin alexandr.shadc...@gmail.com --- hw/xfree86/common/xf86pciBus.c|8 +- hw/xfree86/os-support/bus/Makefile.am |7 +-- hw/xfree86/os-support/bus/Pci.c | 140 - hw/xfree86/os-support/bus/xf86Pci.h |4 - 4 files changed, 5 insertions(+), 154 deletions(-) delete mode 100644 hw/xfree86/os-support/bus/Pci.c diff --git a/hw/xfree86/common/xf86pciBus.c b/hw/xfree86/common/xf86pciBus.c index eb5323c..b90af24 100644 --- a/hw/xfree86/common/xf86pciBus.c +++ b/hw/xfree86/common/xf86pciBus.c @@ -104,11 +104,11 @@ xf86PciProbe(void) struct pci_device_iterator *iter; struct pci_device ** xf86PciVideoInfo = NULL; - -if (!xf86scanpci()) { - xf86PciVideoInfo = NULL; +if (pci_system_init()) return; -} + +/* choose correct platform/OS specific PCI init routine */ +osPciInit(); iter = pci_slot_match_iterator_create( xf86IsolateDevice); while ((info = pci_device_next(iter)) != NULL) { diff --git a/hw/xfree86/os-support/bus/Makefile.am b/hw/xfree86/os-support/bus/Makefile.am index d63cd89..d3e4823 100644 --- a/hw/xfree86/os-support/bus/Makefile.am +++ b/hw/xfree86/os-support/bus/Makefile.am @@ -1,17 +1,12 @@ noinst_LTLIBRARIES = libbus.la sdk_HEADERS = xf86Pci.h -PCI_SOURCES = -if XORG_BUS_PCI -PCI_SOURCES += Pci.c Pci.h -endif - if XORG_BUS_SPARC PLATFORM_SOURCES = Sbus.c sdk_HEADERS += xf86Sbus.h endif -libbus_la_SOURCES = $(PCI_SOURCES) $(PLATFORM_SOURCES) nobus.c +libbus_la_SOURCES = $(PLATFORM_SOURCES) nobus.c INCLUDES = $(XORG_INCS) diff --git a/hw/xfree86/os-support/bus/Pci.c b/hw/xfree86/os-support/bus/Pci.c deleted file mode 100644 index 0362a00..000 --- a/hw/xfree86/os-support/bus/Pci.c +++ /dev/null @@ -1,140 +0,0 @@ -/* - * Copyright 1998 by Concurrent Computer Corporation - * - * Permission to use, copy, modify, distribute, and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and that - * both that copyright notice and this permission notice appear in - * supporting documentation, and that the name of Concurrent Computer - * Corporation not be used in advertising or publicity pertaining to - * distribution of the software without specific, written prior - * permission. Concurrent Computer Corporation makes no representations - * about the suitability of this software for any purpose. It is - * provided as is without express or implied warranty. - * - * CONCURRENT COMPUTER CORPORATION DISCLAIMS ALL WARRANTIES WITH REGARD - * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS, IN NO EVENT SHALL CONCURRENT COMPUTER CORPORATION BE - * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY - * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, - * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS - * SOFTWARE. - * - * Copyright 1998 by Metro Link Incorporated - * - * Permission to use, copy, modify, distribute, and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and that - * both that copyright notice and this permission notice appear in - * supporting documentation, and that the name of Metro Link - * Incorporated not be used in advertising or publicity pertaining to - * distribution of the software without specific, written prior - * permission. Metro Link Incorporated makes no representations - * about the suitability of this software for any purpose. It is - * provided as is without express or implied warranty. - * - * METRO LINK INCORPORATED DISCLAIMS ALL WARRANTIES WITH REGARD - * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS, IN NO EVENT SHALL METRO LINK INCORPORATED BE - * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY - * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, - * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS - * SOFTWARE. - * - * This software is derived from the original XFree86 PCI code - * which includes the following copyright notices as well: - * - * Copyright 1995 by Robin Cutshaw ro...@xfree86.org - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided
[PATCH xserver 4/4] xfree86: Remove odd check definition PCI_DOM_MASK
PCI_DOM_MASK is already defined (see above). Signed-off-by: Alexandr Shadchin alexandr.shadc...@gmail.com --- hw/xfree86/os-support/bus/Pci.h |3 --- 1 files changed, 0 insertions(+), 3 deletions(-) diff --git a/hw/xfree86/os-support/bus/Pci.h b/hw/xfree86/os-support/bus/Pci.h index 90713bc..ff057e7 100644 --- a/hw/xfree86/os-support/bus/Pci.h +++ b/hw/xfree86/os-support/bus/Pci.h @@ -119,9 +119,6 @@ #define PCI_DOM_MASK 0x0ffu #endif -#ifndef PCI_DOM_MASK -# define PCI_DOM_MASK 0x0ffu -#endif #define PCI_DOMBUS_MASK (((PCI_DOM_MASK) 8) | 0x0ffu) #define PCI_MAKE_BUS(d,b)d) (PCI_DOM_MASK)) 8) | ((b) 0xffu)) -- 1.7.6 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
[PULL] xfree86 cleanup
The following changes since commit 91131037a2d2e07079de5d222d8a8c95300750cc: Fix position _X_EXPORT (2011-10-28 13:10:07 -0700) are available in the git repository at: git://g...@github.com:Koba/xserver.git reviewed Alexandr Shadchin (7): Remove unused VT_SYSREQ_DEFAULT Remove BSDi support Remove odd definition DEV_MEM Move check definition MAP_FAILED in xf86_OSlib.h bsd: alpha_video: Function sethae() need only for FreeBSD bsd: alpha_video: Simplify #include bsd: alpha_video: Remove unused variables hw/xfree86/os-support/bsd/alpha_video.c | 69 - hw/xfree86/os-support/bsd/arm_video.c |7 --- hw/xfree86/os-support/bsd/i386_video.c|5 -- hw/xfree86/os-support/bsd/ppc_video.c |9 +--- hw/xfree86/os-support/bsd/sparc64_video.c |4 -- hw/xfree86/os-support/linux/lnx_video.c |4 -- hw/xfree86/os-support/shared/bios_mmap.c |4 -- hw/xfree86/os-support/xf86_OSlib.h| 23 ++ 8 files changed, 23 insertions(+), 102 deletions(-) -- Alexandr Shadchin ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
Re: [PATCH xserver 2/4] xfree86: Remove Pci.h
On Sat, Oct 29, 2011 at 10:17:05AM -0700, Alan Coopersmith wrote: There seems to be a mismatch here - the subject says remove Pci.h, but the patch removes Pci.c and the only thing it does to Pci.h is to remove it from PCI_SOURCES in bus/Makefile.am. You are right. Correct xfree86: Remove Pci.c. Thanks. -- -Alan Coopersmith-alan.coopersm...@oracle.com Oracle Solaris Platform Engineering: X Window System -- Alexandr Shadchin ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
Re: [PATCH xserver 1/4] bsd: Remove bsd_pci.c
On Sat, Oct 29, 2011 at 10:13:48AM -0700, Alan Coopersmith wrote: On 10/29/11 08:54, Alexandr Shadchin wrote: bsd_pci.c have only one function osPciInit(). osPciInit() is equivalent call xf86InitVidMem(). xf86InitVidMem() is needed only for OpenBSD (see commit 06c0372c3a1b45005eb6d50406f77f4e93f1de1e) Pretty sure Solaris needs xf86InitVidMem too, though I'm not in a position to test today. Any reason not to just set it to xf86InitVidMem for all the platforms that used to call it in bsd_pci.c ? Yes, it can be done, but main idea of adding xf86InitVidMem, that it was necessary to share aperture_fd between xserver and libpciaccess (call pci_system_init_dev_mem()). This is need (and implemented) only for OpenBSD. As far as I can see, this is not necessary for Solaris, but I'll be happy if you do test. diff --git a/hw/xfree86/os-support/bus/Pci.h b/hw/xfree86/os-support/bus/Pci.h index 88560ec..821de0d 100644 --- a/hw/xfree86/os-support/bus/Pci.h +++ b/hw/xfree86/os-support/bus/Pci.h @@ -137,12 +137,12 @@ #define PCI_BUS_NO_DOMAIN(bus) ((bus) 0xffu) #define PCI_TAG_NO_DOMAIN(tag) ((tag) 0x0000u) -#if defined(linux) +#if defined(linux) || defined(__sun) || defined(__GNU__) || \ +defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || \ +defined(__NetBSD__) || defined(__DragonFly__) #define osPciInit(x) do {} while (0) -#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || \ -defined(__OpenBSD__) || defined(__NetBSD__) || \ -defined(__DragonFly__) || defined(__sun) || defined(__GNU__) -extern void osPciInit(void); +#elif defined(__OpenBSD__) +#define osPciInit(x) do { xf86InitVidMem(); } while (0) #else #error No PCI support available for this architecture/OS combination #endif -- -Alan Coopersmith-alan.coopersm...@oracle.com Oracle Solaris Platform Engineering: X Window System -- Alexandr Shadchin ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
[PATCH xserver 2/2] Fix position _X_EXPORT
Signed-off-by: Alexandr Shadchin alexandr.shadc...@gmail.com --- include/dix.h |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/dix.h b/include/dix.h index b1bf9ed..34661f3 100644 --- a/include/dix.h +++ b/include/dix.h @@ -571,8 +571,8 @@ typedef struct { extern int XItoCoreType(int xi_type); extern Bool DevHasCursor(DeviceIntPtr pDev); -extern Bool _X_EXPORT IsPointerDevice( DeviceIntPtr dev); -extern Bool _X_EXPORT IsKeyboardDevice(DeviceIntPtr dev); +extern _X_EXPORT Bool IsPointerDevice(DeviceIntPtr dev); +extern _X_EXPORT Bool IsKeyboardDevice(DeviceIntPtr dev); extern Bool IsPointerEvent(InternalEvent *event); extern _X_EXPORT Bool IsMaster(DeviceIntPtr dev); extern _X_EXPORT Bool IsFloating(DeviceIntPtr dev); -- 1.7.6 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
[PATCH xserver 1/7] Remove unused VT_SYSREQ_DEFAULT
Signed-off-by: Alexandr Shadchin alexandr.shadc...@gmail.com --- hw/xfree86/os-support/xf86_OSlib.h |4 1 files changed, 0 insertions(+), 4 deletions(-) diff --git a/hw/xfree86/os-support/xf86_OSlib.h b/hw/xfree86/os-support/xf86_OSlib.h index 1d59060..2a4d079 100644 --- a/hw/xfree86/os-support/xf86_OSlib.h +++ b/hw/xfree86/os-support/xf86_OSlib.h @@ -378,10 +378,6 @@ #define DEV_MEM /dev/mem #endif -#ifndef VT_SYSREQ_DEFAULT -#define VT_SYSREQ_DEFAULT FALSE -#endif - #define SYSCALL(call) while(((call) == -1) (errno == EINTR)) #define XF86_OS_PRIVS -- 1.7.6 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
[PATCH xserver 2/7] Remove BSDi support
Signed-off-by: Alexandr Shadchin alexandr.shadc...@gmail.com --- hw/xfree86/os-support/xf86_OSlib.h | 19 ++- 1 files changed, 2 insertions(+), 17 deletions(-) diff --git a/hw/xfree86/os-support/xf86_OSlib.h b/hw/xfree86/os-support/xf86_OSlib.h index 2a4d079..34b8669 100644 --- a/hw/xfree86/os-support/xf86_OSlib.h +++ b/hw/xfree86/os-support/xf86_OSlib.h @@ -230,20 +230,13 @@ # include sys/mman.h # include sys/stat.h -# if defined(__bsdi__) -# include sys/param.h -# if (_BSDI_VERSION 199510) -# include i386/isa/vgaioctl.h -# endif -# endif /* __bsdi__ */ - #endif /* CSRG_BASED */ /**/ /* Kernel of *BSD */ /**/ #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || \ - defined(__NetBSD__) || defined(__OpenBSD__) || defined(__bsdi__) || defined(__DragonFly__) + defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) # include sys/param.h # if defined(__FreeBSD_version) !defined(__FreeBSD_kernel_version) @@ -252,12 +245,6 @@ # if !defined(LINKKIT) /* Don't need this stuff for the Link Kit */ -# if defined(__bsdi__) -# include i386/isa/pcconsioctl.h -# define CONSOLE_X_MODE_ON PCCONIOCRAW -# define CONSOLE_X_MODE_OFF PCCONIOCCOOK -# define CONSOLE_X_BELL PCCONIOCBEEP -# else /* __bsdi__ */ # ifdef SYSCONS_SUPPORT #define COMPAT_SYSCONS #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) @@ -328,7 +315,6 @@ #ifndef CONSOLE_GET_MEM_INFO #define CONSOLE_GET_MEM_INFO_IOR('t',159,struct map_info) #endif -# endif /* __bsdi__ */ # endif /* !LINKKIT */ #if defined(USE_I386_IOPL) || defined(USE_AMD64_IOPL) @@ -337,8 +323,7 @@ # define CLEARDTR_SUPPORT -#endif -/* __FreeBSD_kernel__ || __NetBSD__ || __OpenBSD__ || __bsdi__ */ +#endif /* __FreeBSD__ || __NetBSD__ || __OpenBSD__ || __DragonFly__ */ /**/ /* IRIX */ -- 1.7.6 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
[PATCH xserver 3/7] Remove odd definition DEV_MEM
DEV_MEM defined in xf86_OSlib.h Signed-off-by: Alexandr Shadchin alexandr.shadc...@gmail.com --- hw/xfree86/os-support/bsd/alpha_video.c|1 - hw/xfree86/os-support/bsd/arm_video.c |2 -- hw/xfree86/os-support/bsd/i386_video.c |1 - hw/xfree86/os-support/bsd/ppc_video.c |4 +--- hw/xfree86/os-support/shared/bios_devmem.c |5 - 5 files changed, 1 insertions(+), 12 deletions(-) diff --git a/hw/xfree86/os-support/bsd/alpha_video.c b/hw/xfree86/os-support/bsd/alpha_video.c index 15eb2a4..ee5c86a 100644 --- a/hw/xfree86/os-support/bsd/alpha_video.c +++ b/hw/xfree86/os-support/bsd/alpha_video.c @@ -197,7 +197,6 @@ static int devMemFd = -1; #ifdef HAS_APERTURE_DRV #define DEV_APERTURE /dev/xf86 #endif -#define DEV_MEM /dev/mem static pointer mapVidMem(int, unsigned long, unsigned long, int); static void unmapVidMem(int, pointer, unsigned long); diff --git a/hw/xfree86/os-support/bsd/arm_video.c b/hw/xfree86/os-support/bsd/arm_video.c index eb631a7..ffc42a8 100644 --- a/hw/xfree86/os-support/bsd/arm_video.c +++ b/hw/xfree86/os-support/bsd/arm_video.c @@ -113,8 +113,6 @@ struct memAccess ioMemInfo = { CONSOLE_GET_IO_INFO, NULL, NULL, static Bool useDevMem = FALSE; static int devMemFd = -1; -#define DEV_MEM /dev/mem - static pointer mapVidMem(int, unsigned long, unsigned long, int); static void unmapVidMem(int, pointer, unsigned long); diff --git a/hw/xfree86/os-support/bsd/i386_video.c b/hw/xfree86/os-support/bsd/i386_video.c index 525bfb6..2edad18 100644 --- a/hw/xfree86/os-support/bsd/i386_video.c +++ b/hw/xfree86/os-support/bsd/i386_video.c @@ -88,7 +88,6 @@ static int devMemFd = -1; #ifdef HAS_APERTURE_DRV #define DEV_APERTURE /dev/xf86 #endif -#define DEV_MEM /dev/mem static pointer mapVidMem(int, unsigned long, unsigned long, int); static void unmapVidMem(int, pointer, unsigned long); diff --git a/hw/xfree86/os-support/bsd/ppc_video.c b/hw/xfree86/os-support/bsd/ppc_video.c index aeaf183..920a002 100644 --- a/hw/xfree86/os-support/bsd/ppc_video.c +++ b/hw/xfree86/os-support/bsd/ppc_video.c @@ -45,9 +45,7 @@ /* Video Memory Mapping section*/ /***/ -#ifndef __OpenBSD__ -#define DEV_MEM /dev/mem -#else +#ifdef __OpenBSD__ #define DEV_MEM /dev/xf86 #endif diff --git a/hw/xfree86/os-support/shared/bios_devmem.c b/hw/xfree86/os-support/shared/bios_devmem.c index b9dfb7d..38b9a8c 100644 --- a/hw/xfree86/os-support/shared/bios_devmem.c +++ b/hw/xfree86/os-support/shared/bios_devmem.c @@ -34,11 +34,6 @@ /* * Read BIOS via /dev/mem. */ - -#ifndef DEV_MEM -# define DEV_MEM /dev/mem -#endif - int xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf, int Len) -- 1.7.6 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
[PATCH xserver 4/7] Move check definition MAP_FAILED in xf86_OSlib.h
Also remove odd definition MAP_FAILED. Signed-off-by: Alexandr Shadchin alexandr.shadc...@gmail.com --- hw/xfree86/os-support/bsd/alpha_video.c |4 hw/xfree86/os-support/bsd/arm_video.c |5 - hw/xfree86/os-support/bsd/i386_video.c|4 hw/xfree86/os-support/bsd/ppc_video.c |5 - hw/xfree86/os-support/bsd/sparc64_video.c |4 hw/xfree86/os-support/linux/lnx_video.c |4 hw/xfree86/os-support/shared/bios_mmap.c |4 hw/xfree86/os-support/xf86_OSlib.h|4 8 files changed, 4 insertions(+), 30 deletions(-) diff --git a/hw/xfree86/os-support/bsd/alpha_video.c b/hw/xfree86/os-support/bsd/alpha_video.c index ee5c86a..c47f7bf 100644 --- a/hw/xfree86/os-support/bsd/alpha_video.c +++ b/hw/xfree86/os-support/bsd/alpha_video.c @@ -52,10 +52,6 @@ #define MAP_FLAGS (MAP_FILE | MAP_SHARED) #endif -#ifndef MAP_FAILED -#define MAP_FAILED ((caddr_t)-1) -#endif - axpDevice bsdGetAXP(void); #ifndef __NetBSD__ diff --git a/hw/xfree86/os-support/bsd/arm_video.c b/hw/xfree86/os-support/bsd/arm_video.c index ffc42a8..1de6c87 100644 --- a/hw/xfree86/os-support/bsd/arm_video.c +++ b/hw/xfree86/os-support/bsd/arm_video.c @@ -97,11 +97,6 @@ struct memAccess ioMemInfo = { CONSOLE_GET_IO_INFO, NULL, NULL, #define MAP_FLAGS (MAP_FILE | MAP_SHARED) #endif -#ifndef MAP_FAILED -#define MAP_FAILED ((caddr_t)-1) -#endif - - #define BUS_BASE 0L #define BUS_BASE_BWX 0L diff --git a/hw/xfree86/os-support/bsd/i386_video.c b/hw/xfree86/os-support/bsd/i386_video.c index 2edad18..389841c 100644 --- a/hw/xfree86/os-support/bsd/i386_video.c +++ b/hw/xfree86/os-support/bsd/i386_video.c @@ -64,10 +64,6 @@ #define MAP_FLAGS (MAP_FILE | MAP_SHARED) #endif -#ifndef MAP_FAILED -#define MAP_FAILED ((caddr_t)-1) -#endif - #ifdef __OpenBSD__ #define SYSCTL_MSG \tCheck that you have set 'machdep.allowaperture=1'\n\ \tin /etc/sysctl.conf and reboot your machine\n \ diff --git a/hw/xfree86/os-support/bsd/ppc_video.c b/hw/xfree86/os-support/bsd/ppc_video.c index 920a002..e5d832e 100644 --- a/hw/xfree86/os-support/bsd/ppc_video.c +++ b/hw/xfree86/os-support/bsd/ppc_video.c @@ -36,11 +36,6 @@ #include bus/Pci.h -#ifndef MAP_FAILED -#define MAP_FAILED ((caddr_t)-1) -#endif - - /***/ /* Video Memory Mapping section*/ /***/ diff --git a/hw/xfree86/os-support/bsd/sparc64_video.c b/hw/xfree86/os-support/bsd/sparc64_video.c index a2a30c9..960c850 100644 --- a/hw/xfree86/os-support/bsd/sparc64_video.c +++ b/hw/xfree86/os-support/bsd/sparc64_video.c @@ -34,10 +34,6 @@ #include xf86_OSlib.h #include xf86OSpriv.h -#ifndef MAP_FAILED -#define MAP_FAILED ((caddr_t)-1) -#endif - /***/ /* Video Memory Mapping section*/ /***/ diff --git a/hw/xfree86/os-support/linux/lnx_video.c b/hw/xfree86/os-support/linux/lnx_video.c index 3d45511..e711784 100644 --- a/hw/xfree86/os-support/linux/lnx_video.c +++ b/hw/xfree86/os-support/linux/lnx_video.c @@ -46,10 +46,6 @@ #include asm/mtrr.h #endif -#ifndef MAP_FAILED -#define MAP_FAILED ((void *)-1) -#endif - static Bool ExtendedEnabled = FALSE; #ifdef __ia64__ diff --git a/hw/xfree86/os-support/shared/bios_mmap.c b/hw/xfree86/os-support/shared/bios_mmap.c index 33a8df0..b7b35d9 100644 --- a/hw/xfree86/os-support/shared/bios_mmap.c +++ b/hw/xfree86/os-support/shared/bios_mmap.c @@ -31,10 +31,6 @@ #include xf86Priv.h #include xf86_OSlib.h -#ifndef MAP_FAILED -#define MAP_FAILED ((void *)-1) -#endif - /* * Read BIOS via mmap()ing DEV_MEM */ diff --git a/hw/xfree86/os-support/xf86_OSlib.h b/hw/xfree86/os-support/xf86_OSlib.h index 34b8669..0a5861f 100644 --- a/hw/xfree86/os-support/xf86_OSlib.h +++ b/hw/xfree86/os-support/xf86_OSlib.h @@ -363,6 +363,10 @@ #define DEV_MEM /dev/mem #endif +#ifndef MAP_FAILED +#define MAP_FAILED ((void *)-1) +#endif + #define SYSCALL(call) while(((call) == -1) (errno == EINTR)) #define XF86_OS_PRIVS -- 1.7.6 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
[PATCH xserver 5/7] bsd: alpha_video: Function sethae() need only for FreeBSD
Signed-off-by: Alexandr Shadchin alexandr.shadc...@gmail.com --- hw/xfree86/os-support/bsd/alpha_video.c | 51 -- 1 files changed, 14 insertions(+), 37 deletions(-) diff --git a/hw/xfree86/os-support/bsd/alpha_video.c b/hw/xfree86/os-support/bsd/alpha_video.c index c47f7bf..1a3736b 100644 --- a/hw/xfree86/os-support/bsd/alpha_video.c +++ b/hw/xfree86/os-support/bsd/alpha_video.c @@ -435,7 +435,6 @@ xf86DisableIO() #define vuipvolatile unsigned int * -static unsigned long msb_set = 0; static pointer memSBase = 0; static pointer memBase = 0; @@ -473,29 +472,25 @@ writeSparse32(int Value, pointer Base, register unsigned long Offset); #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) extern int sysarch(int, void *); -#endif struct parms { u_int64_t hae; }; -#ifndef __NetBSD__ -static int +static void sethae(u_int64_t hae) { -#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) #ifndef ALPHA_SETHAE #define ALPHA_SETHAE 0 #endif - struct parms p; - p.hae = hae; - return (sysarch(ALPHA_SETHAE, (char *)p)); -#endif -#ifdef __OpenBSD__ - return -1; -#endif + static struct parms p; + + if (p.hae != hae) { + p.hae = hae; + sysarch(ALPHA_SETHAE, (char *)p); + } } -#endif /* __NetBSD__ */ +#endif static pointer mapVidMemSparse(int ScreenNum, unsigned long Base, unsigned long Size, int flags) @@ -550,12 +545,9 @@ readSparse8(pointer Base, register unsigned long Offset) if (Offset = (hae_thresh)) { msb = Offset hae_mask; Offset -= msb; - if (msb_set != msb) { -#ifndef __NetBSD__ +#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) sethae(msb); #endif - msb_set = msb; - } } result = *(vuip) ((unsigned long)memSBase + (Offset 5)); result = shift; @@ -574,12 +566,9 @@ readSparse16(pointer Base, register unsigned long Offset) if (Offset = (hae_thresh)) { msb = Offset hae_mask; Offset -= msb; - if (msb_set != msb) { -#ifndef __NetBSD__ +#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) sethae(msb); #endif - msb_set = msb; - } } result = *(vuip)((unsigned long)memSBase+(Offset5)+(1(5-2))); result = shift; @@ -604,12 +593,9 @@ writeSparse8(int Value, pointer Base, register unsigned long Offset) if (Offset = (hae_thresh)) { msb = Offset hae_mask; Offset -= msb; - if (msb_set != msb) { -#ifndef __NetBSD__ +#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) sethae(msb); #endif - msb_set = msb; - } } *(vuip) ((unsigned long)memSBase + (Offset 5)) = b * 0x01010101; } @@ -625,12 +611,9 @@ writeSparse16(int Value, pointer Base, register unsigned long Offset) if (Offset = (hae_thresh)) { msb = Offset hae_mask; Offset -= msb; - if (msb_set != msb) { -#ifndef __NetBSD__ +#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) sethae(msb); #endif - msb_set = msb; - } } *(vuip)((unsigned long)memSBase+(Offset5)+(1(5-2))) = w * 0x00010001; @@ -655,12 +638,9 @@ writeSparseNB8(int Value, pointer Base, register unsigned long Offset) if (Offset = (hae_thresh)) { msb = Offset hae_mask; Offset -= msb; - if (msb_set != msb) { -#ifndef __NetBSD__ +#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) sethae(msb); #endif - msb_set = msb; - } } *(vuip) ((unsigned long)memSBase + (Offset 5)) = b * 0x01010101; } @@ -675,12 +655,9 @@ writeSparseNB16(int Value, pointer Base, register unsigned long Offset) if (Offset = (hae_thresh)) { msb = Offset hae_mask ; Offset -= msb; - if (msb_set != msb) { -#ifndef __NetBSD__ +#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) sethae(msb); #endif - msb_set = msb; - } } *(vuip)((unsigned long)memSBase+(Offset5)+(1(5-2))) = w * 0x00010001; -- 1.7.6 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
[PATCH xserver 6/7] bsd: alpha_video: Simplify #include
Signed-off-by: Alexandr Shadchin alexandr.shadc...@gmail.com --- hw/xfree86/os-support/bsd/alpha_video.c | 10 -- 1 files changed, 4 insertions(+), 6 deletions(-) diff --git a/hw/xfree86/os-support/bsd/alpha_video.c b/hw/xfree86/os-support/bsd/alpha_video.c index 1a3736b..ed1adca 100644 --- a/hw/xfree86/os-support/bsd/alpha_video.c +++ b/hw/xfree86/os-support/bsd/alpha_video.c @@ -33,12 +33,10 @@ #include sys/param.h #ifndef __NetBSD__ -# include sys/sysctl.h -# if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) -# include machine/sysarch.h -# endif -# else -# include machine/sysarch.h +#include sys/sysctl.h +#endif +#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__) +#include machine/sysarch.h #endif #include xf86Axp.h -- 1.7.6 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
[PATCH xserver 7/7] bsd: alpha_video: Remove unused variables
Signed-off-by: Alexandr Shadchin alexandr.shadc...@gmail.com --- hw/xfree86/os-support/bsd/alpha_video.c |3 --- 1 files changed, 0 insertions(+), 3 deletions(-) diff --git a/hw/xfree86/os-support/bsd/alpha_video.c b/hw/xfree86/os-support/bsd/alpha_video.c index ed1adca..882fb3b 100644 --- a/hw/xfree86/os-support/bsd/alpha_video.c +++ b/hw/xfree86/os-support/bsd/alpha_video.c @@ -58,8 +58,6 @@ extern unsigned long dense_base(void); static int axpSystem = -1; static unsigned long hae_thresh; static unsigned long hae_mask; -static unsigned long bus_base; -static unsigned long sparse_size; static unsigned long memory_base(void) @@ -290,7 +288,6 @@ xf86OSInitVidMem(VidMemInfoPtr pVidMem) axpSystem = bsdGetAXP(); hae_thresh = xf86AXPParams[axpSystem].hae_thresh; hae_mask = xf86AXPParams[axpSystem].hae_mask; -sparse_size = xf86AXPParams[axpSystem].size; #endif /* __NetBSD__ */ } pVidMem-initialised = TRUE; -- 1.7.6 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
[PULL] some cleanups
The following changes since commit afb1fe695d197187a301c19863a128a65389b15c: Merge remote-tracking branch 'whot/next' (2011-09-26 20:24:15 -0700) are available in the git repository at: g...@github.com:Koba/xserver.git reviewed Alexandr Shadchin (8): bsd: Remove unused macros KBD_FD bsd: Replacement screenFd on consoleFd because they are equivalent bsd: Variable devConsoleFd need only if defined PCCONS_SUPPORT bsd: Remove dead code bsd: Some clean up bsd: OpenBSD and NetBSD not need extra headers in PCVT_SUPPORT bsd: ioctl KDENABIO/KDDISABIO do not matter for OpenBSD Remove unused vtSysreq hw/xfree86/common/xf86Config.c| 13 --- hw/xfree86/common/xf86Globals.c |2 - hw/xfree86/common/xf86Privstr.h |3 -- hw/xfree86/man/xorg.conf.man | 12 --- hw/xfree86/os-support/bsd/alpha_video.c |2 +- hw/xfree86/os-support/bsd/arm_video.c |6 ++-- hw/xfree86/os-support/bsd/bsd_bell.c |4 -- hw/xfree86/os-support/bsd/bsd_init.c | 51 +--- hw/xfree86/os-support/bsd/i386_video.c|2 +- hw/xfree86/os-support/bsd/ppc_video.c |4 +- hw/xfree86/os-support/bsd/sparc64_video.c |2 +- hw/xfree86/os-support/xf86_OSlib.h| 42 ++- hw/xfree86/parser/xf86tokens.h|2 - 13 files changed, 28 insertions(+), 117 deletions(-) -- Alexandr Shadchin ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
Re: [PATCH] Add a 'wscons' autoconf mechanism to configure input devices on BSD.
Three small notes: * Remove part USE_XKEYBOARD_CONFIG (Now this not used). * Is it correct to use priv_open_device() ? This is our local change. * Style, see below. Reviewed-by: Alexandr Shadchin alexandr.shadc...@gmail.com On Sun, Sep 18, 2011 at 12:49:51PM +0200, Matthieu Herrb wrote: This does not really handle hotplug (it's handled inside the kernel, by the 'mux' devices), but uses the wscons console driver configuration to figure out the keyboard layout and the list of pointing devices found by the kernel. Signed-off-by: Matthieu Herrb matthieu.he...@laas.fr --- config/Makefile.am |6 + config/config-backends.h|5 + config/config.c |5 + config/wscons.c | 282 +++ configure.ac| 16 +++ hw/xfree86/common/xf86Config.c |6 +- hw/xfree86/common/xf86Globals.c |2 +- hw/xfree86/common/xf86Xinput.c |3 +- 8 files changed, 321 insertions(+), 4 deletions(-) create mode 100644 config/wscons.c diff --git a/config/Makefile.am b/config/Makefile.am index 4a2e873..69bdcf7 100644 --- a/config/Makefile.am +++ b/config/Makefile.am @@ -34,6 +34,12 @@ libconfig_la_SOURCES += hal.c libconfig_la_LIBADD += $(HAL_LIBS) endif +else + +if CONFIG_WSCONS +libconfig_la_SOURCES += wscons.c +endif # CONFIG_WSCONS + endif # CONFIG_NEED_DBUS endif # !CONFIG_UDEV diff --git a/config/config-backends.h b/config/config-backends.h index 0a2a22a..945cc1f 100644 --- a/config/config-backends.h +++ b/config/config-backends.h @@ -68,3 +68,8 @@ int config_hal_init(void); void config_hal_fini(void); # endif #endif + +#ifdef CONFIG_WSCONS +int config_wscons_init(void); +void config_wscons_fini(void); +#endif diff --git a/config/config.c b/config/config.c index d86f7c6..69bd6a1 100644 --- a/config/config.c +++ b/config/config.c @@ -52,6 +52,9 @@ config_init(void) else { ErrorF([config] failed to initialise D-Bus core\n); } +#elif defined(CONFIG_WSCONS) +if (!config_wscons_init()) + ErrorF([config] failed to initialise wscons\n); #endif } @@ -68,6 +71,8 @@ config_fini(void) config_dbus_fini(); # endif config_dbus_core_fini(); +#elif defined(CONFIG_WSCONS) +config_wscons_fini(); #endif } diff --git a/config/wscons.c b/config/wscons.c new file mode 100644 index 000..17bece4 --- /dev/null +++ b/config/wscons.c @@ -0,0 +1,282 @@ +/* + * Copyright (c) 2011 Matthieu Herrb + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the Software), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#ifdef HAVE_DIX_CONFIG_H +#include dix-config.h +#endif + +#include dev/wscons/wsconsio.h +#include dev/wscons/wsksymdef.h + +#include sys/ioctl.h +#include errno.h +#include string.h +#include unistd.h + +#include input.h +#include inputstr.h +#include os.h +#include config-backends.h + +#define WSCONS_KBD_DEVICE /dev/wskbd +#define WSCONS_MOUSE_PREFIX /dev/wsmouse + +#define KB_OVRENC \ + { KB_UK,gb }, \ + { KB_SV,se }, \ + { KB_SG,ch }, \ + { KB_SF,ch }, \ + { KB_LA,latam }, \ + { KB_CF,ca } + +struct nameint { + int val; + char *name; +} kbdenc[] = { KB_OVRENC, KB_ENCTAB, { 0 } }; + +struct nameint kbdvar[] = { + { KB_NODEAD | KB_SG,de_nodeadkeys }, + { KB_NODEAD | KB_SF,fr_nodeadkeys }, + { KB_SF,fr }, + { KB_DVORAK | KB_CF,fr-dvorak }, + { KB_DVORAK | KB_FR,bepo }, + { KB_DVORAK,dvorak }, + { KB_CF,fr-legacy }, + { KB_NODEAD,nodeadkeys }, + { 0 } +}; + +struct nameint kbdopt[] = { +#ifndef USE_XKEYBOARD_CONFIG + { KB_SWAPCTRLCAPS, ctrl:swapcaps }, +#else + { KB_SWAPCTRLCAPS, ctrl:swapcaps,terminate:ctrl_alt_bksp }, +#endif
Re: [PATCH xserver 8/8] Remove unused vtSysreq
On Fri, Sep 16, 2011 at 04:03:44PM -0500, Jamey Sharp wrote: On Thu, Sep 15, 2011 at 09:13:09PM -0700, Alan Coopersmith wrote: On 09/15/11 20:51, Jamey Sharp wrote: On Thu, Sep 15, 2011 at 06:42:59PM -0700, Alan Coopersmith wrote: On 09/15/11 13:07, Jamey Sharp wrote: It looks to me like you should also delete VTSYSRQ from hw/xfree86/parser/xf86tokens.h. Please ensure that any changes result in the X server simply ignoring the VTSysReq option in existing xorg.conf and not erroring out refusing to start on a file that happens to have a no-longer-useful option in. If I understand the parser correctly (and I probably don't), it's already too late for that: while there's a VTSYSRQ entry in the enum in xf86tokens.h, nothing generates that token type. Instead, there's a VTSysReq ServerFlag. So deleting the token from the enum is not a regression, I think. I can't figure out at a quick glance whether unknown ServerFlags are treated as an error, though. Does the patch need to somehow make this flag be explicitly ignored if present? Honestly, I don't remember - probably easiest to just test starting the server (when built with this series) using an xorg.conf with the entry added. I just tested 1.11 with ServerFlags 'Option NoSuchOption blag' and didn't get any messages about it in the log. The server started up fine. I just remember prior issues here (see commits e0a451eb7cc d2cf562bbad from prior obsoletion - though those seem to be keywords, not options) I saw commits along those lines, but I guess they aren't relevant here. Alexandr, my comment stands: if you delete VTSYSRQ from xf86tokens.h you can add my Reviewed-by tag to this patch. Jamey I agree, delete VTSYSREQ from xf86tokens.h is correct. Option VTSysReq read only in configServerFlags() and this place will be removed. Unknown options will be ignored, as correctly noted Jamey. Also I tested on 1.11, started up fine. -- Alexandr Shadchin ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
[PATCH xserver 2/8] bsd: Replacement screenFd on consoleFd because they are equivalent
Signed-off-by: Alexandr Shadchin alexandr.shadc...@gmail.com --- hw/xfree86/common/xf86Globals.c |1 - hw/xfree86/common/xf86Privstr.h |2 -- hw/xfree86/os-support/bsd/alpha_video.c |2 +- hw/xfree86/os-support/bsd/arm_video.c |6 +++--- hw/xfree86/os-support/bsd/bsd_init.c | 13 + hw/xfree86/os-support/bsd/i386_video.c|2 +- hw/xfree86/os-support/bsd/ppc_video.c |4 ++-- hw/xfree86/os-support/bsd/sparc64_video.c |2 +- 8 files changed, 9 insertions(+), 23 deletions(-) diff --git a/hw/xfree86/common/xf86Globals.c b/hw/xfree86/common/xf86Globals.c index 16d5557..5e56438 100644 --- a/hw/xfree86/common/xf86Globals.c +++ b/hw/xfree86/common/xf86Globals.c @@ -109,7 +109,6 @@ xf86InfoRec xf86Info = { .caughtSignal = FALSE, .currentScreen = NULL, #ifdef CSRG_BASED -.screenFd = -1, .consType = -1, #endif .allowMouseOpenFail = FALSE, diff --git a/hw/xfree86/common/xf86Privstr.h b/hw/xfree86/common/xf86Privstr.h index 608f9bd..added3c 100644 --- a/hw/xfree86/common/xf86Privstr.h +++ b/hw/xfree86/common/xf86Privstr.h @@ -74,8 +74,6 @@ typedef struct { /* graphics part */ ScreenPtr currentScreen; #if defined(CSRG_BASED) || defined(__FreeBSD_kernel__) -intscreenFd; /* fd for memory mapped access to -* vga card */ intconsType; /* Which console driver? */ #endif diff --git a/hw/xfree86/os-support/bsd/alpha_video.c b/hw/xfree86/os-support/bsd/alpha_video.c index bb3a5cb..15eb2a4 100644 --- a/hw/xfree86/os-support/bsd/alpha_video.c +++ b/hw/xfree86/os-support/bsd/alpha_video.c @@ -340,7 +340,7 @@ mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags) base = mmap(0, Size, (flags VIDMEM_READONLY) ? PROT_READ : (PROT_READ | PROT_WRITE), - MAP_FLAGS, xf86Info.screenFd, + MAP_FLAGS, xf86Info.consoleFd, (unsigned long)Base + BUS_BASE); if (base == MAP_FAILED) { diff --git a/hw/xfree86/os-support/bsd/arm_video.c b/hw/xfree86/os-support/bsd/arm_video.c index 482d53f..eb631a7 100644 --- a/hw/xfree86/os-support/bsd/arm_video.c +++ b/hw/xfree86/os-support/bsd/arm_video.c @@ -213,7 +213,7 @@ mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags) base = mmap(0, Size, (flags VIDMEM_READONLY) ? PROT_READ : (PROT_READ | PROT_WRITE), - MAP_FLAGS, xf86Info.screenFd, + MAP_FLAGS, xf86Info.consoleFd, (unsigned long)Base - 0xA); if (base == MAP_FAILED) { @@ -306,7 +306,7 @@ checkMapInfo(Bool warn, int Region) if(!memAccP-Checked) { - if(ioctl(xf86Info.screenFd, memAccP-ioctl, (memAccP-memInfo)) == -1) + if(ioctl(xf86Info.consoleFd, memAccP-ioctl, (memAccP-memInfo)) == -1) { if(warn) { @@ -360,7 +360,7 @@ xf86MapInfoMap(struct memAccess *memInfoP, pointer Base, unsigned long Size) Size, PROT_READ | PROT_WRITE, MAP_SHARED, -xf86Info.screenFd, +xf86Info.consoleFd, (unsigned long)mapInfoP-u.map_info_mmap.map_offset)) == (pointer)-1) { diff --git a/hw/xfree86/os-support/bsd/bsd_init.c b/hw/xfree86/os-support/bsd/bsd_init.c index 123eb17..e5c8495 100644 --- a/hw/xfree86/os-support/bsd/bsd_init.c +++ b/hw/xfree86/os-support/bsd/bsd_init.c @@ -212,7 +212,6 @@ xf86OpenConsole() fclose(stdin); #endif xf86Info.consoleFd = fd; - xf86Info.screenFd = fd; switch (xf86Info.consType) { @@ -688,22 +687,12 @@ xf86CloseConsole() case WSCONS: { int mode = WSDISPLAYIO_MODE_EMUL; - ioctl(xf86Info.screenFd, WSDISPLAYIO_SMODE, mode); + ioctl(xf86Info.consoleFd, WSDISPLAYIO_SMODE, mode); break; } #endif } -if (xf86Info.screenFd != xf86Info.consoleFd) -{ - close(xf86Info.screenFd); - close(xf86Info.consoleFd); - if ((xf86Info.consoleFd = open(/dev/console,O_RDONLY,0)) 0) - { - xf86FatalError(xf86CloseConsole: Cannot open /dev/console (%s), - strerror(errno)); - } -} close(xf86Info.consoleFd); if (devConsoleFd = 0) close(devConsoleFd); diff --git a/hw/xfree86/os-support/bsd/i386_video.c b/hw/xfree86/os-support/bsd/i386_video.c index 7aef079..525bfb6 100644 --- a/hw/xfree86/os-support/bsd/i386_video.c +++ b/hw/xfree86/os-support/bsd/i386_video.c @@ -258,7 +258,7 @@ mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags
[PATCH xserver 3/8] bsd: Variable devConsoleFd need only if defined PCCONS_SUPPORT
Signed-off-by: Alexandr Shadchin alexandr.shadc...@gmail.com --- hw/xfree86/os-support/bsd/bsd_init.c |5 + 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/hw/xfree86/os-support/bsd/bsd_init.c b/hw/xfree86/os-support/bsd/bsd_init.c index e5c8495..84c6b3d 100644 --- a/hw/xfree86/os-support/bsd/bsd_init.c +++ b/hw/xfree86/os-support/bsd/bsd_init.c @@ -41,7 +41,10 @@ #include errno.h static Bool KeepTty = FALSE; + +#ifdef PCCONS_SUPPORT static int devConsoleFd = -1; +#endif #if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT) static int VTnum = -1; static int initialVT = -1; @@ -694,8 +697,10 @@ xf86CloseConsole() } close(xf86Info.consoleFd); +#ifdef PCCONS_SUPPORT if (devConsoleFd = 0) close(devConsoleFd); +#endif return; } -- 1.7.6 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
[PATCH xserver 4/8] bsd: Remove dead code
Signed-off-by: Alexandr Shadchin alexandr.shadc...@gmail.com --- hw/xfree86/os-support/bsd/bsd_init.c | 23 --- 1 files changed, 0 insertions(+), 23 deletions(-) diff --git a/hw/xfree86/os-support/bsd/bsd_init.c b/hw/xfree86/os-support/bsd/bsd_init.c index 84c6b3d..1825672 100644 --- a/hw/xfree86/os-support/bsd/bsd_init.c +++ b/hw/xfree86/os-support/bsd/bsd_init.c @@ -211,9 +211,6 @@ xf86OpenConsole() %s: No console driver found\n\tSupported drivers: %s\n\t%s, xf86OpenConsole, cons_drivers, CHECK_DRIVER_MSG); } -#if 0 /* stdin is already closed in OsInit() */ - fclose(stdin); -#endif xf86Info.consoleFd = fd; switch (xf86Info.consType) @@ -372,7 +369,6 @@ xf86OpenSyscons() int fd = -1; vtmode_t vtmode; char vtname[12]; -struct stat status; long syscons_version; MessageType from; @@ -425,20 +421,11 @@ xf86OpenSyscons() { /* * All VTs are in use. If initialVT was found, use it. -* Otherwise, if stdin is a VT, use that one. -* XXX stdin is already closed, so this won't work. */ if (initialVT != -1) { xf86Info.vtno = initialVT; } - else if ((fstat(0, status) = 0) - S_ISCHR(status.st_mode) - (ioctl(0, VT_GETMODE, vtmode) = 0)) - { - /* stdin is a VT */ - xf86Info.vtno = minor(status.st_rdev) + 1; - } else { if (syscons_version = 0x100) @@ -508,7 +495,6 @@ xf86OpenPcvt() int fd = -1; vtmode_t vtmode; char vtname[12], *vtprefix; -struct stat status; struct pcvtid pcvt_version; #ifndef __OpenBSD__ @@ -554,20 +540,11 @@ xf86OpenPcvt() { /* * All VTs are in use. If initialVT was found, use it. -* Otherwise, if stdin is a VT, use that one. -* XXX stdin is already closed, so this won't work. */ if (initialVT != -1) { xf86Info.vtno = initialVT; } - else if ((fstat(0, status) = 0) - S_ISCHR(status.st_mode) - (ioctl(0, VT_GETMODE, vtmode) = 0)) - { - /* stdin is a VT */ - xf86Info.vtno = minor(status.st_rdev) + 1; - } else { FatalError(%s: Cannot find a free VT, -- 1.7.6 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
[PATCH xserver 5/8] bsd: Some clean up
OpenBSD and NetBSD does not support syscons Signed-off-by: Alexandr Shadchin alexandr.shadc...@gmail.com --- hw/xfree86/os-support/bsd/bsd_init.c |4 hw/xfree86/os-support/xf86_OSlib.h | 20 2 files changed, 8 insertions(+), 16 deletions(-) diff --git a/hw/xfree86/os-support/bsd/bsd_init.c b/hw/xfree86/os-support/bsd/bsd_init.c index 1825672..a0caee3 100644 --- a/hw/xfree86/os-support/bsd/bsd_init.c +++ b/hw/xfree86/os-support/bsd/bsd_init.c @@ -446,11 +446,7 @@ xf86OpenSyscons() } close(fd); -#ifndef __OpenBSD__ sprintf(vtname, /dev/ttyv%01x, xf86Info.vtno - 1); -#else - sprintf(vtname, /dev/ttyC%01x, xf86Info.vtno - 1); -#endif if ((fd = open(vtname, SYSCONS_CONSOLE_MODE, 0)) 0) { FatalError(xf86OpenSyscons: Cannot open %s (%s), diff --git a/hw/xfree86/os-support/xf86_OSlib.h b/hw/xfree86/os-support/xf86_OSlib.h index 24c92fb..cf92821 100644 --- a/hw/xfree86/os-support/xf86_OSlib.h +++ b/hw/xfree86/os-support/xf86_OSlib.h @@ -266,19 +266,15 @@ # else /* __bsdi__ */ # ifdef SYSCONS_SUPPORT #define COMPAT_SYSCONS -#if defined(__NetBSD__) || defined(__OpenBSD__) -# include machine/console.h +#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) +# if defined(__DragonFly__) || (__FreeBSD_kernel_version = 41) +# include sys/consio.h +# include sys/kbio.h +# else +# include machine/console.h +# endif /* FreeBSD 4.1 RELEASE or lator */ #else -# if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) -#if defined(__DragonFly__) || (__FreeBSD_kernel_version = 41) -# include sys/consio.h -# include sys/kbio.h -#else -# include machine/console.h -#endif /* FreeBSD 4.1 RELEASE or lator */ -# else -# include sys/console.h -# endif +# include sys/console.h #endif # endif /* SYSCONS_SUPPORT */ # if defined(PCVT_SUPPORT) -- 1.7.6 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
[PATCH xserver 6/8] bsd: OpenBSD and NetBSD not need extra headers in PCVT_SUPPORT
Signed-off-by: Alexandr Shadchin alexandr.shadc...@gmail.com --- hw/xfree86/os-support/xf86_OSlib.h | 12 +++- 1 files changed, 3 insertions(+), 9 deletions(-) diff --git a/hw/xfree86/os-support/xf86_OSlib.h b/hw/xfree86/os-support/xf86_OSlib.h index cf92821..fddde8a 100644 --- a/hw/xfree86/os-support/xf86_OSlib.h +++ b/hw/xfree86/os-support/xf86_OSlib.h @@ -277,20 +277,14 @@ # include sys/console.h #endif # endif /* SYSCONS_SUPPORT */ -# if defined(PCVT_SUPPORT) +# if defined(PCVT_SUPPORT) !defined(__NetBSD__) !defined(__OpenBSD__) #if !defined(SYSCONS_SUPPORT) /* no syscons, so include pcvt specific header file */ # if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) # include machine/pcvt_ioctl.h # else -# if defined(__NetBSD__) || defined(__OpenBSD__) -# if !defined(WSCONS_SUPPORT) -#include machine/pcvt_ioctl.h -# endif /* WSCONS_SUPPORT */ -# else -# include sys/pcvt_ioctl.h -# endif /* __NetBSD__ */ -# endif /* __FreeBSD_kernel__ || __OpenBSD__ */ +# include sys/pcvt_ioctl.h +# endif /* __FreeBSD_kernel__ */ #else /* pcvt and syscons: hard-code the ID magic */ # define VGAPCVTID _IOWR('V',113, struct pcvtid) struct pcvtid { -- 1.7.6 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
[PATCH xserver 7/8] bsd: ioctl KDENABIO/KDDISABIO do not matter for OpenBSD
Signed-off-by: Alexandr Shadchin alexandr.shadc...@gmail.com --- hw/xfree86/os-support/bsd/bsd_init.c |6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/xfree86/os-support/bsd/bsd_init.c b/hw/xfree86/os-support/bsd/bsd_init.c index a0caee3..c8a4e05 100644 --- a/hw/xfree86/os-support/bsd/bsd_init.c +++ b/hw/xfree86/os-support/bsd/bsd_init.c @@ -292,13 +292,13 @@ acquire_vt: { FatalError(xf86OpenConsole: VT_SETMODE VT_PROCESS failed); } - #if !defined(USE_DEV_IO) !defined(USE_I386_IOPL) +#if !defined(__OpenBSD__) !defined(USE_DEV_IO) !defined(USE_I386_IOPL) if (ioctl(xf86Info.consoleFd, KDENABIO, 0) 0) { FatalError(xf86OpenConsole: KDENABIO failed (%s), strerror(errno)); } - #endif +#endif if (ioctl(xf86Info.consoleFd, KDSETMODE, KD_GRAPHICS) 0) { FatalError(xf86OpenConsole: KDSETMODE KD_GRAPHICS failed); @@ -648,7 +648,7 @@ xf86CloseConsole() VT.mode = VT_AUTO; ioctl(xf86Info.consoleFd, VT_SETMODE, VT); /* dflt vt handling */ } -#if !defined(OpenBSD) !defined(USE_DEV_IO) !defined(USE_I386_IOPL) +#if !defined(__OpenBSD__) !defined(USE_DEV_IO) !defined(USE_I386_IOPL) if (ioctl(xf86Info.consoleFd, KDDISABIO, 0) 0) { xf86FatalError(xf86CloseConsole: KDDISABIO failed (%s), -- 1.7.6 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
[PATCH xserver 8/8] Remove unused vtSysreq
Signed-off-by: Alexandr Shadchin alexandr.shadc...@gmail.com --- hw/xfree86/common/xf86Config.c | 13 - hw/xfree86/common/xf86Globals.c|1 - hw/xfree86/common/xf86Privstr.h|1 - hw/xfree86/man/xorg.conf.man | 12 hw/xfree86/os-support/xf86_OSlib.h | 10 -- 5 files changed, 0 insertions(+), 37 deletions(-) diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c index 58b30dd..5b8c2cd 100644 --- a/hw/xfree86/common/xf86Config.c +++ b/hw/xfree86/common/xf86Config.c @@ -670,7 +670,6 @@ typedef enum { FLAG_DISABLEVIDMODE, FLAG_ALLOWNONLOCAL, FLAG_ALLOWMOUSEOPENFAIL, -FLAG_VTSYSREQ, FLAG_SAVER_BLANKTIME, FLAG_DPMS_STANDBYTIME, FLAG_DPMS_SUSPENDTIME, @@ -712,8 +711,6 @@ static OptionInfoRec FlagOptions[] = { {0}, FALSE }, { FLAG_ALLOWMOUSEOPENFAIL, AllowMouseOpenFail, OPTV_BOOLEAN, {0}, FALSE }, - { FLAG_VTSYSREQ, VTSysReq, OPTV_BOOLEAN, - {0}, FALSE }, { FLAG_SAVER_BLANKTIME, BlankTime , OPTV_INTEGER, {0}, FALSE }, { FLAG_DPMS_STANDBYTIME, StandbyTime, OPTV_INTEGER, @@ -868,16 +865,6 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts) if (xf86GetOptValBool(FlagOptions, FLAG_ALLOWMOUSEOPENFAIL, value)) xf86Info.allowMouseOpenFail = value; -if (xf86GetOptValBool(FlagOptions, FLAG_VTSYSREQ, value)) { -#ifdef USE_VT_SYSREQ - xf86Info.vtSysreq = value; - xf86Msg(X_CONFIG, VTSysReq %s\n, value ? enabled : disabled); -#else - if (value) - xf86Msg(X_WARNING, VTSysReq is not supported on this OS\n); -#endif -} - xf86Info.pmFlag = TRUE; if (xf86GetOptValBool(FlagOptions, FLAG_NOPM, value)) xf86Info.pmFlag = !value; diff --git a/hw/xfree86/common/xf86Globals.c b/hw/xfree86/common/xf86Globals.c index 5e56438..182b0cc 100644 --- a/hw/xfree86/common/xf86Globals.c +++ b/hw/xfree86/common/xf86Globals.c @@ -96,7 +96,6 @@ InputInfoPtr xf86InputDevs = NULL; xf86InfoRec xf86Info = { .consoleFd = -1, .vtno = -1, -.vtSysreq = FALSE, .lastEventTime = -1, .vtRequestsPending = FALSE, #ifdef sun diff --git a/hw/xfree86/common/xf86Privstr.h b/hw/xfree86/common/xf86Privstr.h index added3c..0a08a7b 100644 --- a/hw/xfree86/common/xf86Privstr.h +++ b/hw/xfree86/common/xf86Privstr.h @@ -57,7 +57,6 @@ typedef enum { typedef struct { intconsoleFd; intvtno; -Bool vtSysreq; /* event handler part */ intlastEventTime; diff --git a/hw/xfree86/man/xorg.conf.man b/hw/xfree86/man/xorg.conf.man index f406f82..17579ee 100644 --- a/hw/xfree86/man/xorg.conf.man +++ b/hw/xfree86/man/xorg.conf.man @@ -560,18 +560,6 @@ drivers to not report failure if the mouse device can't be opened/initialised. It has no effect on the evdev(__drivermansuffix__) or other drivers. Default: false. .TP 7 -.BI Option \*qVTSysReq\*q \*q boolean \*q -enables the SYSV\-style VT switch sequence for non\-SYSV systems -which support VT switching. -This sequence is -.B Alt\-SysRq -followed by a function key -.RB ( Fn ). -This prevents the __xservername__ server trapping the -keys used for the default VT switch sequence, which means that clients can -access them. -Default: off. -.TP 7 .BI Option \*qBlankTime\*q \*q time \*q sets the inactivity timeout for the .B blank diff --git a/hw/xfree86/os-support/xf86_OSlib.h b/hw/xfree86/os-support/xf86_OSlib.h index fddde8a..1d59060 100644 --- a/hw/xfree86/os-support/xf86_OSlib.h +++ b/hw/xfree86/os-support/xf86_OSlib.h @@ -168,11 +168,6 @@ # define POSIX_TTY # endif /* SVR4 */ - -# if defined(sun) defined(HAS_USL_VTS) -# define USE_VT_SYSREQ -# endif - #endif /* (SYSV || SVR4) */ /**/ @@ -207,7 +202,6 @@ # define LDSMAP PIO_SCRNMAP # define LDNMAP LDSMAP # define CLEARDTR_SUPPORT -# define USE_VT_SYSREQ # endif # define POSIX_TTY @@ -343,10 +337,6 @@ # define CLEARDTR_SUPPORT -# if defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT) || defined(WSCONS_SUPPORT) -# define USE_VT_SYSREQ -# endif - #endif /* __FreeBSD_kernel__ || __NetBSD__ || __OpenBSD__ || __bsdi__ */ -- 1.7.6 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
Re: [PATCH 1/4] xfree86: move -novtswitch -sharevts argument handling up to common layer
; - } if ((argv[i][0] == 'v') (argv[i][1] == 't')) { if (sscanf(argv[i], vt%2d, VTnum) == 0 || diff --git a/hw/xfree86/os-support/linux/lnx_init.c b/hw/xfree86/os-support/linux/lnx_init.c index 77dfb2f..9c91740 100644 --- a/hw/xfree86/os-support/linux/lnx_init.c +++ b/hw/xfree86/os-support/linux/lnx_init.c @@ -39,8 +39,6 @@ #include sys/stat.h static Bool KeepTty = FALSE; -static Bool VTSwitch = TRUE; -static Bool ShareVTs = FALSE; static int activeVT = -1; static char vtname[11]; @@ -109,7 +107,7 @@ xf86OpenConsole(void) xf86OpenConsole: Cannot open /dev/tty0 (%s)\n, strerror(errno)); -if (ShareVTs) +if (xf86Info.ShareVTs) { SYSCALL(ret = ioctl(fd, VT_GETSTATE, vts)); if (ret 0) @@ -184,7 +182,7 @@ xf86OpenConsole(void) } #endif -if (!ShareVTs) +if (!xf86Info.ShareVTs) { struct termios nTty; @@ -240,7 +238,7 @@ xf86OpenConsole(void) * of Init?$#*Device(). So I just place it here */ } } else { /* serverGeneration != 1 */ -if (!ShareVTs VTSwitch) +if (!xf86Info.ShareVTs xf86Info.autoVTSwitch) { /* now get the VT */ switch_to(xf86Info.vtno, xf86OpenConsole); @@ -254,7 +252,7 @@ xf86CloseConsole(void) struct vt_mode VT; int ret; -if (ShareVTs) { +if (xf86Info.ShareVTs) { close(xf86Info.consoleFd); return; } @@ -286,7 +284,7 @@ xf86CloseConsole(void) strerror(errno)); } -if (VTSwitch) +if (xf86Info.autoVTSwitch) { /* * Perform a switch back to the active VT when we were started @@ -311,16 +309,7 @@ xf86ProcessArgument(int argc, char *argv[], int i) KeepTty = TRUE; return 1; } -if (!strcmp(argv[i], -novtswitch)) -{ -VTSwitch = FALSE; -return 1; -} -if (!strcmp(argv[i], -sharevts)) -{ -ShareVTs = TRUE; -return 1; -} + if ((argv[i][0] == 'v') (argv[i][1] == 't')) { if (sscanf(argv[i], vt%2d, xf86Info.vtno) == 0) @@ -340,6 +329,4 @@ xf86UseMsg(void) ErrorF(vtXX use the specified VT number\n); ErrorF(-keeptty ); ErrorF(don't detach controlling tty (for debugging only)\n); - ErrorF(-novtswitchdon't immediately switch to new VT\n); - ErrorF(-sharevts share VTs with another X server\n); } -- 1.7.3.2 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel a small comment above Reviewed-by: Alexandr Shadchin alexandr.shadc...@gmail.com -- Alexandr Shadchin ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
[PATCH synaptics v2 1/2] On/Off hooks to return boolean so we can bail out of the caller
Signed-off-by: Alexandr Shadchin alexandr.shadc...@gmail.com --- s/RetValue/rc/ src/eventcomm.c |5 - src/ps2comm.c |4 +++- src/synaptics.c | 13 - src/synproto.h |4 ++-- 4 files changed, 17 insertions(+), 9 deletions(-) diff --git a/src/eventcomm.c b/src/eventcomm.c index d70e735..e0a6965 100644 --- a/src/eventcomm.c +++ b/src/eventcomm.c @@ -61,7 +61,7 @@ struct eventcomm_proto_data BOOL need_grab; }; -static void +static Bool EventDeviceOnHook(InputInfoPtr pInfo, SynapticsParameters *para) { SynapticsPrivate *priv = (SynapticsPrivate *)pInfo-private; @@ -79,10 +79,13 @@ EventDeviceOnHook(InputInfoPtr pInfo, SynapticsParameters *para) if (ret 0) { xf86IDrvMsg(pInfo, X_WARNING, can't grab event device, errno=%d\n, errno); + return FALSE; } } proto_data-need_grab = FALSE; + +return TRUE; } /** diff --git a/src/ps2comm.c b/src/ps2comm.c index 3178175..b7995ee 100644 --- a/src/ps2comm.c +++ b/src/ps2comm.c @@ -369,11 +369,13 @@ ps2_print_ident(InputInfoPtr pInfo, const struct PS2SynapticsHwInfo *synhw) } } -static void +static Bool PS2DeviceOffHook(InputInfoPtr pInfo) { ps2_synaptics_reset(pInfo-fd); ps2_synaptics_enable_device(pInfo-fd); + +return TRUE; } static Bool diff --git a/src/synaptics.c b/src/synaptics.c index 2f60322..c043b5d 100644 --- a/src/synaptics.c +++ b/src/synaptics.c @@ -845,8 +845,9 @@ DeviceOn(DeviceIntPtr dev) return !Success; } -if (priv-proto_ops-DeviceOnHook) -priv-proto_ops-DeviceOnHook(pInfo, priv-synpara); +if (priv-proto_ops-DeviceOnHook +!priv-proto_ops-DeviceOnHook(pInfo, priv-synpara)) +return !Success; priv-comm.buffer = XisbNew(pInfo-fd, INPUT_BUFFER_SIZE); if (!priv-comm.buffer) { @@ -878,14 +879,16 @@ DeviceOff(DeviceIntPtr dev) { InputInfoPtr pInfo = dev-public.devicePrivate; SynapticsPrivate *priv = (SynapticsPrivate *) (pInfo-private); +Bool rc = Success; DBG(3, Synaptics DeviceOff called\n); if (pInfo-fd != -1) { TimerCancel(priv-timer); xf86RemoveEnabledDevice(pInfo); -if (priv-proto_ops-DeviceOffHook) -priv-proto_ops-DeviceOffHook(pInfo); +if (priv-proto_ops-DeviceOffHook +!priv-proto_ops-DeviceOffHook(pInfo)) +rc = !Success; if (priv-comm.buffer) { XisbFree(priv-comm.buffer); priv-comm.buffer = NULL; @@ -894,7 +897,7 @@ DeviceOff(DeviceIntPtr dev) pInfo-fd = -1; } dev-public.on = FALSE; -return Success; +return rc; } static Bool diff --git a/src/synproto.h b/src/synproto.h index f9af37c..6962bbf 100644 --- a/src/synproto.h +++ b/src/synproto.h @@ -70,8 +70,8 @@ struct CommData { struct _SynapticsParameters; struct SynapticsProtocolOperations { -void (*DeviceOnHook)(InputInfoPtr pInfo, struct _SynapticsParameters *para); -void (*DeviceOffHook)(InputInfoPtr pInfo); +Bool (*DeviceOnHook)(InputInfoPtr pInfo, struct _SynapticsParameters *para); +Bool (*DeviceOffHook)(InputInfoPtr pInfo); Bool (*QueryHardware)(InputInfoPtr pInfo); Bool (*ReadHwState)(InputInfoPtr pInfo, struct CommData *comm, struct SynapticsHwState *hwRet); -- 1.7.6 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
[PATCH synaptics v2 2/2] The correct maximum values for pressure and finger width
Signed-off-by: Alexandr Shadchin alexandr.shadc...@gmail.com --- Fix evaluation range in set_default_parameters() (suggestion Chris Bagwell) src/synaptics.c |8 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/synaptics.c b/src/synaptics.c index c043b5d..cbdd74d 100644 --- a/src/synaptics.c +++ b/src/synaptics.c @@ -246,7 +246,7 @@ SanitizeDimensions(InputInfoPtr pInfo) if (priv-minp = priv-maxp) { priv-minp = 0; - priv-maxp = 256; + priv-maxp = 255; xf86IDrvMsg(pInfo, X_PROBED, invalid pressure range. defaulting to %d - %d\n, @@ -256,7 +256,7 @@ SanitizeDimensions(InputInfoPtr pInfo) if (priv-minw = priv-maxw) { priv-minw = 0; - priv-maxw = 16; + priv-maxw = 15; xf86IDrvMsg(pInfo, X_PROBED, invalid finger width range. defaulting to %d - %d\n, @@ -459,7 +459,7 @@ static void set_default_parameters(InputInfoPtr pInfo) horizHyst = pars-hyst_x = 0 ? pars-hyst_x : diag * 0.005; vertHyst = pars-hyst_y = 0 ? pars-hyst_y : diag * 0.005; -range = priv-maxp - priv-minp; +range = priv-maxp - priv-minp + 1; /* scaling based on defaults and a pressure of 256 */ fingerLow = priv-minp + range * (25.0/256); @@ -472,7 +472,7 @@ static void set_default_parameters(InputInfoPtr pInfo) pressureMotionMaxZ = priv-minp + range * (160.0/256); palmMinZ = priv-minp + range * (200.0/256); -range = priv-maxw - priv-minw; +range = priv-maxw - priv-minw + 1; /* scaling based on defaults below and a tool width of 16 */ palmMinWidth = priv-minw + range * (10.0/16); -- 1.7.6 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
Re: [PATCH synaptics v2 2/2] The correct maximum values for pressure and finger width
On Fri, Aug 26, 2011 at 03:02:46PM +0200, walter harms wrote: Am 26.08.2011 14:42, schrieb Alexandr Shadchin: Signed-off-by: Alexandr Shadchin alexandr.shadc...@gmail.com --- Fix evaluation range in set_default_parameters() (suggestion Chris Bagwell) src/synaptics.c |8 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/synaptics.c b/src/synaptics.c index c043b5d..cbdd74d 100644 --- a/src/synaptics.c +++ b/src/synaptics.c @@ -246,7 +246,7 @@ SanitizeDimensions(InputInfoPtr pInfo) if (priv-minp = priv-maxp) { priv-minp = 0; - priv-maxp = 256; + priv-maxp = 255; xf86IDrvMsg(pInfo, X_PROBED, invalid pressure range. defaulting to %d - %d\n, @@ -256,7 +256,7 @@ SanitizeDimensions(InputInfoPtr pInfo) if (priv-minw = priv-maxw) { priv-minw = 0; - priv-maxw = 16; + priv-maxw = 15; xf86IDrvMsg(pInfo, X_PROBED, invalid finger width range. defaulting to %d - %d\n, @@ -459,7 +459,7 @@ static void set_default_parameters(InputInfoPtr pInfo) horizHyst = pars-hyst_x = 0 ? pars-hyst_x : diag * 0.005; vertHyst = pars-hyst_y = 0 ? pars-hyst_y : diag * 0.005; -range = priv-maxp - priv-minp; +range = priv-maxp - priv-minp + 1; /* scaling based on defaults and a pressure of 256 */ fingerLow = priv-minp + range * (25.0/256); @@ -472,7 +472,7 @@ static void set_default_parameters(InputInfoPtr pInfo) pressureMotionMaxZ = priv-minp + range * (160.0/256); palmMinZ = priv-minp + range * (200.0/256); -range = priv-maxw - priv-minw; +range = priv-maxw - priv-minw + 1; /* scaling based on defaults below and a tool width of 16 */ palmMinWidth = priv-minw + range * (10.0/16); Could you give a comment why the limit is 15 (or 255) ? (i assume 8bit/ 4bit bit i do not know) re, wh In principle, you think right. more precisely pages 25-26 in Synaptics PS/2 TouchPad Interfacing Guide (http://www.synaptics.com/developers/manuals) -- Alexandr Shadchin ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
[PATCH synaptics 1/2] On/Off hooks to return boolean so we can bail out of the caller
Signed-off-by: Alexandr Shadchin alexandr.shadc...@gmail.com --- src/eventcomm.c |5 - src/ps2comm.c |4 +++- src/synaptics.c | 13 - src/synproto.h |4 ++-- 4 files changed, 17 insertions(+), 9 deletions(-) diff --git a/src/eventcomm.c b/src/eventcomm.c index d70e735..e0a6965 100644 --- a/src/eventcomm.c +++ b/src/eventcomm.c @@ -61,7 +61,7 @@ struct eventcomm_proto_data BOOL need_grab; }; -static void +static Bool EventDeviceOnHook(InputInfoPtr pInfo, SynapticsParameters *para) { SynapticsPrivate *priv = (SynapticsPrivate *)pInfo-private; @@ -79,10 +79,13 @@ EventDeviceOnHook(InputInfoPtr pInfo, SynapticsParameters *para) if (ret 0) { xf86IDrvMsg(pInfo, X_WARNING, can't grab event device, errno=%d\n, errno); + return FALSE; } } proto_data-need_grab = FALSE; + +return TRUE; } /** diff --git a/src/ps2comm.c b/src/ps2comm.c index 3178175..b7995ee 100644 --- a/src/ps2comm.c +++ b/src/ps2comm.c @@ -369,11 +369,13 @@ ps2_print_ident(InputInfoPtr pInfo, const struct PS2SynapticsHwInfo *synhw) } } -static void +static Bool PS2DeviceOffHook(InputInfoPtr pInfo) { ps2_synaptics_reset(pInfo-fd); ps2_synaptics_enable_device(pInfo-fd); + +return TRUE; } static Bool diff --git a/src/synaptics.c b/src/synaptics.c index 2f60322..3c08b18 100644 --- a/src/synaptics.c +++ b/src/synaptics.c @@ -845,8 +845,9 @@ DeviceOn(DeviceIntPtr dev) return !Success; } -if (priv-proto_ops-DeviceOnHook) -priv-proto_ops-DeviceOnHook(pInfo, priv-synpara); +if (priv-proto_ops-DeviceOnHook +!priv-proto_ops-DeviceOnHook(pInfo, priv-synpara)) +return !Success; priv-comm.buffer = XisbNew(pInfo-fd, INPUT_BUFFER_SIZE); if (!priv-comm.buffer) { @@ -878,14 +879,16 @@ DeviceOff(DeviceIntPtr dev) { InputInfoPtr pInfo = dev-public.devicePrivate; SynapticsPrivate *priv = (SynapticsPrivate *) (pInfo-private); +Bool RetValue = Success; DBG(3, Synaptics DeviceOff called\n); if (pInfo-fd != -1) { TimerCancel(priv-timer); xf86RemoveEnabledDevice(pInfo); -if (priv-proto_ops-DeviceOffHook) -priv-proto_ops-DeviceOffHook(pInfo); +if (priv-proto_ops-DeviceOffHook +!priv-proto_ops-DeviceOffHook(pInfo)) +RetValue = !Success; if (priv-comm.buffer) { XisbFree(priv-comm.buffer); priv-comm.buffer = NULL; @@ -894,7 +897,7 @@ DeviceOff(DeviceIntPtr dev) pInfo-fd = -1; } dev-public.on = FALSE; -return Success; +return RetValue; } static Bool diff --git a/src/synproto.h b/src/synproto.h index f9af37c..6962bbf 100644 --- a/src/synproto.h +++ b/src/synproto.h @@ -70,8 +70,8 @@ struct CommData { struct _SynapticsParameters; struct SynapticsProtocolOperations { -void (*DeviceOnHook)(InputInfoPtr pInfo, struct _SynapticsParameters *para); -void (*DeviceOffHook)(InputInfoPtr pInfo); +Bool (*DeviceOnHook)(InputInfoPtr pInfo, struct _SynapticsParameters *para); +Bool (*DeviceOffHook)(InputInfoPtr pInfo); Bool (*QueryHardware)(InputInfoPtr pInfo); Bool (*ReadHwState)(InputInfoPtr pInfo, struct CommData *comm, struct SynapticsHwState *hwRet); -- 1.7.6 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
[PATCH synaptics 2/2] The correct maximum values for pressure and finger width
Signed-off-by: Alexandr Shadchin alexandr.shadc...@gmail.com --- src/synaptics.c |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/synaptics.c b/src/synaptics.c index 3c08b18..6918330 100644 --- a/src/synaptics.c +++ b/src/synaptics.c @@ -246,7 +246,7 @@ SanitizeDimensions(InputInfoPtr pInfo) if (priv-minp = priv-maxp) { priv-minp = 0; - priv-maxp = 256; + priv-maxp = 255; xf86IDrvMsg(pInfo, X_PROBED, invalid pressure range. defaulting to %d - %d\n, @@ -256,7 +256,7 @@ SanitizeDimensions(InputInfoPtr pInfo) if (priv-minw = priv-maxw) { priv-minw = 0; - priv-maxw = 16; + priv-maxw = 15; xf86IDrvMsg(pInfo, X_PROBED, invalid finger width range. defaulting to %d - %d\n, -- 1.7.6 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
Re: [PATCH synaptics] Adding support for OpenBSD
On Tue, Aug 23, 2011 at 01:20:10PM +1000, Peter Hutterer wrote: On Fri, Aug 19, 2011 at 09:13:33PM +0600, Alexandr Shadchin wrote: Signed-off-by: Alexandr Shadchin alexandr.shadc...@gmail.com --- configure.ac |8 ++ src/Makefile.am |5 + src/synaptics.c |3 + src/synproto.h |3 + src/wsconscomm.c | 278 ++ 5 files changed, 297 insertions(+), 0 deletions(-) create mode 100644 src/wsconscomm.c diff --git a/configure.ac b/configure.ac index 09306ec..c3807e8 100644 --- a/configure.ac +++ b/configure.ac @@ -110,6 +110,10 @@ case ${host} in BUILD_PS2COMM=yes BUILD_PSMCOMM=yes ;; +*openbsd*) + AC_MSG_RESULT([wsconscomm]) + BUILD_WSCONSCOMM=yes + ;; *) AC_MSG_RESULT([none]) ;; @@ -123,9 +127,13 @@ fi if test x$BUILD_PS2COMM = xyes; then AC_DEFINE(BUILD_PS2COMM, 1, [Optional backend ps2comm and alpscomm enabled]) fi +if test x$BUILD_WSCONSCOMM = xyes; then +AC_DEFINE(BUILD_WSCONSCOMM, 1, [Optional backend wsconscomm enabled]) +fi AM_CONDITIONAL([BUILD_EVENTCOMM], [test x${BUILD_EVENTCOMM} = xyes]) AM_CONDITIONAL([BUILD_PSMCOMM], [test x${BUILD_PSMCOMM} = xyes]) AM_CONDITIONAL([BUILD_PS2COMM], [test x${BUILD_PS2COMM} = xyes]) +AM_CONDITIONAL([BUILD_WSCONSCOMM], [test x${BUILD_WSCONSCOMM} = xyes]) # - # Dependencies for synclient and syndaemon diff --git a/src/Makefile.am b/src/Makefile.am index 5e04670..ef297c8 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -50,3 +50,8 @@ if BUILD_PSMCOMM @DRIVER_NAME@_drv_la_SOURCES += \ psmcomm.c endif + +if BUILD_WSCONSCOMM +@DRIVER_NAME@_drv_la_SOURCES += \ + wsconscomm.c +endif diff --git a/src/synaptics.c b/src/synaptics.c index cf91b9f..dd0142c 100644 --- a/src/synaptics.c +++ b/src/synaptics.c @@ -150,6 +150,9 @@ const static struct { {psaux, psaux_proto_operations}, {alps, alps_proto_operations}, #endif +#ifdef BUILD_WSCONSCOMM +{wscons, wscons_proto_operations}, +#endif {NULL, NULL} }; diff --git a/src/synproto.h b/src/synproto.h index 75f90e4..260c248 100644 --- a/src/synproto.h +++ b/src/synproto.h @@ -89,5 +89,8 @@ extern struct SynapticsProtocolOperations event_proto_operations; #ifdef BUILD_PSMCOMM extern struct SynapticsProtocolOperations psm_proto_operations; #endif /* BUILD_PSMCOMM */ +#ifdef BUILD_WSCONSCOMM +extern struct SynapticsProtocolOperations wscons_proto_operations; +#endif /* BUILD_WSCONSCOMM */ #endif /* _SYNPROTO_H_ */ diff --git a/src/wsconscomm.c b/src/wsconscomm.c new file mode 100644 index 000..2b5b2d8 --- /dev/null +++ b/src/wsconscomm.c @@ -0,0 +1,278 @@ +/* + * Copyright ? 2011 Alexandr Shadchin shadc...@openbsd.org + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED AS IS AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifdef HAVE_CONFIG_H +#include config.h +#endif + +#include xorg-server.h +#include unistd.h +#include sys/ioctl.h +#include errno.h +#include string.h +#include synproto.h +#include synaptics.h +#include synapticsstr.h +#include xf86.h + +#include dev/wscons/wsconsio.h + +extern int priv_open_device(const char *); is this a BSD-specific function? can't seem to find the definition for it anywhere Err, this is a OpenBSD-specific function. I'll replace it for a standard open() in next patch. + +#define DEFAULT_WSMOUSE0_DEV /dev/wsmouse0 DEFAULT_WSMOUSE_DEV, if it's default, the 0 in the define is unnecessary. I agree. +#define NEVENTS64 + +static const char *synaptics_devs[] = { +DEFAULT_WSMOUSE0_DEV, +NULL +}; + +static Bool +WSConsIsSynaptics(InputInfoPtr pInfo, const char *device) +{ +int wsmouse_type, fd = -1; +Bool res = FALSE; + +fd = priv_open_device(device); + +if (fd 0) +return FALSE; + +if (ioctl(fd, WSMOUSEIO_GTYPE, wsmouse_type) == -1) { +xf86IDrvMsg(pInfo, X_ERROR, cannot get mouse type\n); +goto out
Re: [PATCH synaptics] Adding support for OpenBSD
On Wed, Aug 24, 2011 at 5:57 AM, Peter Hutterer peter.hutte...@who-t.net wrote: On Tue, Aug 23, 2011 at 09:34:58PM +0600, Alexandr Shadchin wrote: On Tue, Aug 23, 2011 at 01:20:10PM +1000, Peter Hutterer wrote: +static void +WSConsDeviceOnHook(InputInfoPtr pInfo, SynapticsParameters *para) +{ + int wsmouse_mode = WSMOUSE_NATIVE; + + if (ioctl(pInfo-fd, WSMOUSEIO_SETMODE, wsmouse_mode) == -1) + xf86IDrvMsg(pInfo, X_ERROR, cannot set native mode\n); +} + +static void +WSConsDeviceOffHook(InputInfoPtr pInfo) +{ + int wsmouse_mode = WSMOUSE_COMPAT; + + if (ioctl(pInfo-fd, WSMOUSEIO_SETMODE, wsmouse_mode) == -1) + xf86IDrvMsg(pInfo, X_ERROR, cannot set compat mode\n); +} if these two are an error, we should change the On/Off hooks to return boolean so we can bail out of the caller. that'd be a separate patch, at least eventcomm.c needs it too. Hmm, in http://cgit.freedesktop.org/xorg/driver/xf86-input-synaptics/ On/Off hooks is 'static void'. Maybe it's in your local repository? Could not you show this patch? sorry, I meant this is an unrelated patch that should be done too. Quietly failing in the device backends is not a good thing imo. Cheers, Peter Now I understand you. I'll do it. -- Alexandr Shadchin ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
[PATCH mouse v3] Fix wrong read Protocol and Device from xorg.conf
Add call xf86CollectInputOptions() before using pInfo-options. The bug is seeing by ABI 12. Signed-off-by: Alexandr Shadchin alexandr.shadc...@gmail.com --- Sorry for the late answer, entirely lost sight of this bug. Change: * move COLLECT_INPUT_OPTIONS() in old PreInit (make sense only for ABI 12) * little expanded commit message src/mouse.c |2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/src/mouse.c b/src/mouse.c index d981f6f..6304149 100644 --- a/src/mouse.c +++ b/src/mouse.c @@ -872,6 +872,8 @@ MousePreInit(InputDriverPtr drv, IDevPtr dev, int flags) pInfo-private_flags = 0; pInfo-always_core_feedback = NULL; +COLLECT_INPUT_OPTIONS(pInfo, NULL); + if (NewMousePreInit(drv, pInfo, flags) == Success) { /* Check if SendDragEvents has been disabled. */ -- 1.7.6 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
[PATCH synaptics] Adding support for OpenBSD
Signed-off-by: Alexandr Shadchin alexandr.shadc...@gmail.com --- configure.ac |8 ++ src/Makefile.am |5 + src/synaptics.c |3 + src/synproto.h |3 + src/wsconscomm.c | 278 ++ 5 files changed, 297 insertions(+), 0 deletions(-) create mode 100644 src/wsconscomm.c diff --git a/configure.ac b/configure.ac index 09306ec..c3807e8 100644 --- a/configure.ac +++ b/configure.ac @@ -110,6 +110,10 @@ case ${host} in BUILD_PS2COMM=yes BUILD_PSMCOMM=yes ;; +*openbsd*) + AC_MSG_RESULT([wsconscomm]) + BUILD_WSCONSCOMM=yes + ;; *) AC_MSG_RESULT([none]) ;; @@ -123,9 +127,13 @@ fi if test x$BUILD_PS2COMM = xyes; then AC_DEFINE(BUILD_PS2COMM, 1, [Optional backend ps2comm and alpscomm enabled]) fi +if test x$BUILD_WSCONSCOMM = xyes; then +AC_DEFINE(BUILD_WSCONSCOMM, 1, [Optional backend wsconscomm enabled]) +fi AM_CONDITIONAL([BUILD_EVENTCOMM], [test x${BUILD_EVENTCOMM} = xyes]) AM_CONDITIONAL([BUILD_PSMCOMM], [test x${BUILD_PSMCOMM} = xyes]) AM_CONDITIONAL([BUILD_PS2COMM], [test x${BUILD_PS2COMM} = xyes]) +AM_CONDITIONAL([BUILD_WSCONSCOMM], [test x${BUILD_WSCONSCOMM} = xyes]) # - # Dependencies for synclient and syndaemon diff --git a/src/Makefile.am b/src/Makefile.am index 5e04670..ef297c8 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -50,3 +50,8 @@ if BUILD_PSMCOMM @DRIVER_NAME@_drv_la_SOURCES += \ psmcomm.c endif + +if BUILD_WSCONSCOMM +@DRIVER_NAME@_drv_la_SOURCES += \ + wsconscomm.c +endif diff --git a/src/synaptics.c b/src/synaptics.c index cf91b9f..dd0142c 100644 --- a/src/synaptics.c +++ b/src/synaptics.c @@ -150,6 +150,9 @@ const static struct { {psaux, psaux_proto_operations}, {alps, alps_proto_operations}, #endif +#ifdef BUILD_WSCONSCOMM +{wscons, wscons_proto_operations}, +#endif {NULL, NULL} }; diff --git a/src/synproto.h b/src/synproto.h index 75f90e4..260c248 100644 --- a/src/synproto.h +++ b/src/synproto.h @@ -89,5 +89,8 @@ extern struct SynapticsProtocolOperations event_proto_operations; #ifdef BUILD_PSMCOMM extern struct SynapticsProtocolOperations psm_proto_operations; #endif /* BUILD_PSMCOMM */ +#ifdef BUILD_WSCONSCOMM +extern struct SynapticsProtocolOperations wscons_proto_operations; +#endif /* BUILD_WSCONSCOMM */ #endif /* _SYNPROTO_H_ */ diff --git a/src/wsconscomm.c b/src/wsconscomm.c new file mode 100644 index 000..2b5b2d8 --- /dev/null +++ b/src/wsconscomm.c @@ -0,0 +1,278 @@ +/* + * Copyright © 2011 Alexandr Shadchin shadc...@openbsd.org + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED AS IS AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifdef HAVE_CONFIG_H +#include config.h +#endif + +#include xorg-server.h +#include unistd.h +#include sys/ioctl.h +#include errno.h +#include string.h +#include synproto.h +#include synaptics.h +#include synapticsstr.h +#include xf86.h + +#include dev/wscons/wsconsio.h + +extern int priv_open_device(const char *); + +#define DEFAULT_WSMOUSE0_DEV /dev/wsmouse0 +#define NEVENTS64 + +static const char *synaptics_devs[] = { +DEFAULT_WSMOUSE0_DEV, +NULL +}; + +static Bool +WSConsIsSynaptics(InputInfoPtr pInfo, const char *device) +{ +int wsmouse_type, fd = -1; +Bool res = FALSE; + +fd = priv_open_device(device); + +if (fd 0) +return FALSE; + +if (ioctl(fd, WSMOUSEIO_GTYPE, wsmouse_type) == -1) { +xf86IDrvMsg(pInfo, X_ERROR, cannot get mouse type\n); +goto out; +} + +if (wsmouse_type == WSMOUSE_TYPE_SYNAPTICS) +res = TRUE; + +out: +close(fd); +return res; +} + +static void +WSConsDeviceOnHook(InputInfoPtr pInfo, SynapticsParameters *para) +{ +int wsmouse_mode = WSMOUSE_NATIVE; + +if (ioctl(pInfo-fd, WSMOUSEIO_SETMODE, wsmouse_mode) == -1) +xf86IDrvMsg(pInfo, X_ERROR, cannot set native mode\n); +} + +static void +WSConsDeviceOffHook(InputInfoPtr pInfo) +{ +int wsmouse_mode = WSMOUSE_COMPAT; + +if (ioctl(pInfo-fd, WSMOUSEIO_SETMODE, wsmouse_mode) == -1) +xf86IDrvMsg(pInfo, X_ERROR, cannot set compat mode\n); +} + +static Bool +WSConsQueryHardware(InputInfoPtr pInfo
[PATCH mouse v2] Fix wrong read Protocol and Device from xorg.conf
Add call xf86CollectInputOptions() before using pInfo-options. Signed-off-by: Alexandr Shadchin alexandr.shadc...@gmail.com --- src/mouse.c |2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/src/mouse.c b/src/mouse.c index c3498ea..e3d3d9f 100644 --- a/src/mouse.c +++ b/src/mouse.c @@ -927,6 +927,8 @@ MousePreInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags) pMse-PostEvent = MousePostEvent; pMse-CommonOptions = MouseCommonOptions; +COLLECT_INPUT_OPTIONS(pInfo, NULL); + /* Find the protocol type. */ protocol = xf86SetStrOption(pInfo-options, Protocol, NULL); if (protocol) { -- 1.7.5 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
[PATCH mouse] Fix wrong read Protocol and Device from xorg.conf
Before call xf86CollectInputOptions(): pInfo-options - empty Need use pInfo-conf_idev-commonOptions instead pInfo-options Signed-off-by: Alexandr Shadchin alexandr.shadc...@gmail.com --- src/mouse.c |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mouse.c b/src/mouse.c index c3498ea..19251ad 100644 --- a/src/mouse.c +++ b/src/mouse.c @@ -928,7 +928,7 @@ MousePreInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags) pMse-CommonOptions = MouseCommonOptions; /* Find the protocol type. */ -protocol = xf86SetStrOption(pInfo-options, Protocol, NULL); +protocol = xf86SetStrOption(pInfo-conf_idev-commonOptions, Protocol, NULL); if (protocol) { protocolFrom = X_CONFIG; } else if (osInfo-DefaultProtocol) { @@ -941,7 +941,7 @@ MousePreInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags) goto out; } -device = xf86SetStrOption(pInfo-options, Device, NULL); +device = xf86SetStrOption(pInfo-conf_idev-commonOptions, Device, NULL); /* Default Mapping: 1 2 3 8 9 10 11 ... */ for (i = 0; i MSE_MAXBUTTONS; i++) -- 1.7.5 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
[PATCH xserver] Simplify auto-detect mouse for WSCONS_SUPPORT
Signed-off-by: Alexandr Shadchin alexandr.shadc...@gmail.com --- hw/xfree86/common/xf86Configure.c | 13 +++-- 1 files changed, 3 insertions(+), 10 deletions(-) diff --git a/hw/xfree86/common/xf86Configure.c b/hw/xfree86/common/xf86Configure.c index c712df7..9752669 100644 --- a/hw/xfree86/common/xf86Configure.c +++ b/hw/xfree86/common/xf86Configure.c @@ -63,6 +63,9 @@ static char *DFLT_MOUSE_PROTO = auto; #elif defined(linux) static char DFLT_MOUSE_DEV[] = /dev/input/mice; static char DFLT_MOUSE_PROTO[] = auto; +#elif defined(WSCONS_SUPPORT) +static char *DFLT_MOUSE_DEV = /dev/wsmouse; +static char *DFLT_MOUSE_PROTO = wsmouse; #else static char *DFLT_MOUSE_DEV = /dev/mouse; static char *DFLT_MOUSE_PROTO = auto; @@ -154,16 +157,6 @@ configureInputSection (void) /* Crude mechanism to auto-detect mouse (os dependent) */ { int fd; -#ifdef WSCONS_SUPPORT - fd = open(/dev/wsmouse, 0); - if (fd = 0) { - DFLT_MOUSE_DEV = /dev/wsmouse; - DFLT_MOUSE_PROTO = wsmouse; - close(fd); - } else { - ErrorF(cannot open /dev/wsmouse\n); - } -#endif fd = open(DFLT_MOUSE_DEV, 0); if (fd != -1) { -- 1.7.3.5 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
[PATCH v2 synaptics 01/11] Fix typo (resx - resy)
Signed-off-by: Alexandr Shadchin alexandr.shadc...@gmail.com --- Changes to v2: patch [PATCH synaptics 1/8] United functions of SynapticsDefaultDimensions() and ReadDevDimensions() split into three patch 1-3 src/synaptics.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/src/synaptics.c b/src/synaptics.c index 56ce725..a7dd566 100644 --- a/src/synaptics.c +++ b/src/synaptics.c @@ -203,7 +203,7 @@ SynapticsDefaultDimensions(InputInfoPtr pInfo) { priv-miny = 1729; priv-maxy = 4171; - priv-resx = 0; + priv-resy = 0; xf86Msg(X_PROBED, %s: invalid y-axis range. defaulting to %d - %d\n, -- 1.7.3.5 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
[PATCH v2 synaptics 09/11] Remove extra definition CommData
Signed-off-by: Alexandr Shadchin alexandr.shadc...@gmail.com Reviewed-by: Peter Hutterer peter.hutte...@who-t.net --- src/synproto.h |1 - 1 files changed, 0 insertions(+), 1 deletions(-) diff --git a/src/synproto.h b/src/synproto.h index 3fe70b9..4b37df0 100644 --- a/src/synproto.h +++ b/src/synproto.h @@ -79,7 +79,6 @@ enum SynapticsProtocol { }; struct _SynapticsParameters; -struct CommData; struct SynapticsProtocolOperations { void (*DeviceOnHook)(InputInfoPtr pInfo, struct _SynapticsParameters *para); -- 1.7.3.5 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
[PATCH v2 synaptics 03/11] Renamed SynapticsDefaultDimensions in SanitizeDimensions
Signed-off-by: Alexandr Shadchin alexandr.shadc...@gmail.com --- src/synaptics.c |6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/synaptics.c b/src/synaptics.c index 1f5b68c..ab7a463 100644 --- a/src/synaptics.c +++ b/src/synaptics.c @@ -130,7 +130,7 @@ static Bool QueryHardware(InputInfoPtr); static void ReadDevDimensions(InputInfoPtr); static void ScaleCoordinates(SynapticsPrivate *priv, struct SynapticsHwState *hw); static void CalculateScalingCoeffs(SynapticsPrivate *priv); -static void SynapticsDefaultDimensions(InputInfoPtr pInfo); +static void SanitizeDimensions(InputInfoPtr pInfo); void InitDeviceProperties(InputInfoPtr pInfo); int SetProperty(DeviceIntPtr dev, Atom property, XIPropertyValuePtr prop, @@ -185,7 +185,7 @@ _X_EXPORT XF86ModuleData synapticsModuleData = { * men, or possibly apes. */ static void -SynapticsDefaultDimensions(InputInfoPtr pInfo) +SanitizeDimensions(InputInfoPtr pInfo) { SynapticsPrivate *priv = (SynapticsPrivate *)pInfo-private; @@ -2614,7 +2614,7 @@ ReadDevDimensions(InputInfoPtr pInfo) if (priv-proto_ops-ReadDevDimensions) priv-proto_ops-ReadDevDimensions(pInfo); -SynapticsDefaultDimensions(pInfo); +SanitizeDimensions(pInfo); } static Bool -- 1.7.3.5 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
[PATCH v2 synaptics 02/11] Simplified mechanism for determining default size
Now SynapticsDefaultDimensions() called only once Signed-off-by: Alexandr Shadchin alexandr.shadc...@gmail.com --- src/alpscomm.c |2 +- src/ps2comm.c |2 +- src/psmcomm.c |2 +- src/synaptics.c|6 -- src/synapticsstr.h |3 --- 5 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/alpscomm.c b/src/alpscomm.c index 84d2136..c5af681 100644 --- a/src/alpscomm.c +++ b/src/alpscomm.c @@ -233,5 +233,5 @@ struct SynapticsProtocolOperations alps_proto_operations = { ALPSQueryHardware, ALPSReadHwState, ALPSAutoDevProbe, -SynapticsDefaultDimensions +NULL }; diff --git a/src/ps2comm.c b/src/ps2comm.c index 4e372b3..a34613e 100644 --- a/src/ps2comm.c +++ b/src/ps2comm.c @@ -672,5 +672,5 @@ struct SynapticsProtocolOperations psaux_proto_operations = { PS2QueryHardware, PS2ReadHwState, PS2AutoDevProbe, -SynapticsDefaultDimensions +NULL }; diff --git a/src/psmcomm.c b/src/psmcomm.c index 741cd1d..903e6dd 100644 --- a/src/psmcomm.c +++ b/src/psmcomm.c @@ -181,5 +181,5 @@ struct SynapticsProtocolOperations psm_proto_operations = { PSMQueryHardware, PSMReadHwState, PSMAutoDevProbe, -SynapticsDefaultDimensions +NULL }; diff --git a/src/synaptics.c b/src/synaptics.c index a7dd566..1f5b68c 100644 --- a/src/synaptics.c +++ b/src/synaptics.c @@ -130,6 +130,7 @@ static Bool QueryHardware(InputInfoPtr); static void ReadDevDimensions(InputInfoPtr); static void ScaleCoordinates(SynapticsPrivate *priv, struct SynapticsHwState *hw); static void CalculateScalingCoeffs(SynapticsPrivate *priv); +static void SynapticsDefaultDimensions(InputInfoPtr pInfo); void InitDeviceProperties(InputInfoPtr pInfo); int SetProperty(DeviceIntPtr dev, Atom property, XIPropertyValuePtr prop, @@ -183,7 +184,7 @@ _X_EXPORT XF86ModuleData synapticsModuleData = { * The default values 1900, etc. come from the dawn of time, when men where * men, or possibly apes. */ -void +static void SynapticsDefaultDimensions(InputInfoPtr pInfo) { SynapticsPrivate *priv = (SynapticsPrivate *)pInfo-private; @@ -444,7 +445,6 @@ static void set_default_parameters(InputInfoPtr pInfo) * If the range was autodetected, apply these edge widths to all four * sides. */ -SynapticsDefaultDimensions(pInfo); width = abs(priv-maxx - priv-minx); height = abs(priv-maxy - priv-miny); @@ -2613,6 +2613,8 @@ ReadDevDimensions(InputInfoPtr pInfo) if (priv-proto_ops-ReadDevDimensions) priv-proto_ops-ReadDevDimensions(pInfo); + +SynapticsDefaultDimensions(pInfo); } static Bool diff --git a/src/synapticsstr.h b/src/synapticsstr.h index 066b3f3..8f6593e 100644 --- a/src/synapticsstr.h +++ b/src/synapticsstr.h @@ -243,7 +243,4 @@ typedef struct _SynapticsPrivateRec enum TouchpadModel model; /* The detected model */ } SynapticsPrivate; - -extern void SynapticsDefaultDimensions(InputInfoPtr pInfo); - #endif /* _SYNAPTICSSTR_H_ */ -- 1.7.3.5 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
[PATCH v2 synaptics 04/11] Removing extra call SetDeviceAndProtocol()
SetDeviceAndProtocol() calling in SynapticsPreInit(), extra calling in DeviceOn() unnecessary. Signed-off-by: Alexandr Shadchin alexandr.shadc...@gmail.com Reviewed-by: Peter Hutterer peter.hutte...@who-t.net --- src/synaptics.c |1 - 1 files changed, 0 insertions(+), 1 deletions(-) diff --git a/src/synaptics.c b/src/synaptics.c index ab7a463..0b1681a 100644 --- a/src/synaptics.c +++ b/src/synaptics.c @@ -844,7 +844,6 @@ DeviceOn(DeviceIntPtr dev) DBG(3, Synaptics DeviceOn called\n); -SetDeviceAndProtocol(pInfo); pInfo-fd = xf86OpenSerial(pInfo-options); if (pInfo-fd == -1) { xf86Msg(X_WARNING, %s: cannot open input device\n, pInfo-name); -- 1.7.3.5 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
[PATCH v2 synaptics 06/11] Move definition struct SynapticsHwInfo in ps2comm.h
Signed-off-by: Alexandr Shadchin alexandr.shadc...@gmail.com --- Changes to v2: add next patch (Rename SynapticsHwInfo) src/ps2comm.c |7 --- src/ps2comm.h |8 ++-- src/psmcomm.c |7 --- src/synproto.h |1 - 4 files changed, 6 insertions(+), 17 deletions(-) diff --git a/src/ps2comm.c b/src/ps2comm.c index a34613e..1ea09c9 100644 --- a/src/ps2comm.c +++ b/src/ps2comm.c @@ -82,13 +82,6 @@ #define PS2DBG(x) #endif -struct SynapticsHwInfo { -unsigned int model_id; /* Model-ID */ -unsigned int capabilities; /* Capabilities */ -unsigned int ext_cap; /* Extended Capabilities */ -unsigned int identity; /* Identification */ -}; - /* * PS/2 Utility functions. * Many parts adapted from tpconfig.c by C. Scott Ananian diff --git a/src/ps2comm.h b/src/ps2comm.h index fec5634..99ff3ec 100644 --- a/src/ps2comm.h +++ b/src/ps2comm.h @@ -94,10 +94,14 @@ typedef unsigned char byte; +struct SynapticsHwInfo { +unsigned int model_id; /* Model-ID */ +unsigned int capabilities; /* Capabilities */ +unsigned int ext_cap; /* Extended Capabilities */ +unsigned int identity; /* Identification */ +}; Bool ps2_putbyte(int fd, byte b); - -struct SynapticsHwInfo; void ps2_print_ident(const struct SynapticsHwInfo *synhw); #endif /* _PS2COMM_H_ */ diff --git a/src/psmcomm.c b/src/psmcomm.c index 903e6dd..88263ae 100644 --- a/src/psmcomm.c +++ b/src/psmcomm.c @@ -52,13 +52,6 @@ #define SYSCALL(call) while (((call) == -1) (errno == EINTR)) -struct SynapticsHwInfo { -unsigned int model_id; /* Model-ID */ -unsigned int capabilities; /* Capabilities */ -unsigned int ext_cap; /* Extended Capabilities */ -unsigned int identity; /* Identification */ -}; - /* * Identify Touchpad * See also the SYN_ID_* macros diff --git a/src/synproto.h b/src/synproto.h index 96ddf3e..a899a73 100644 --- a/src/synproto.h +++ b/src/synproto.h @@ -79,7 +79,6 @@ enum SynapticsProtocol { }; struct _SynapticsParameters; -struct SynapticsHwInfo; struct CommData; struct SynapticsProtocolOperations { -- 1.7.3.5 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
[PATCH v2 synaptics 07/11] Renamed SynapticsHwInfo in PS2SynapticsHwInfo
Signed-off-by: Alexandr Shadchin alexandr.shadc...@gmail.com --- src/ps2comm.c | 24 src/ps2comm.h |4 ++-- src/psmcomm.c |8 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/ps2comm.c b/src/ps2comm.c index 1ea09c9..6991d22 100644 --- a/src/ps2comm.c +++ b/src/ps2comm.c @@ -214,7 +214,7 @@ ps2_synaptics_reset(int fd) * see also SYN_MODEL_* macros */ static Bool -ps2_synaptics_model_id(int fd, struct SynapticsHwInfo *synhw) +ps2_synaptics_model_id(int fd, struct PS2SynapticsHwInfo *synhw) { byte mi[3]; @@ -239,7 +239,7 @@ ps2_synaptics_model_id(int fd, struct SynapticsHwInfo *synhw) * see also the SYN_CAP_* macros */ static Bool -ps2_synaptics_capability(int fd, struct SynapticsHwInfo *synhw) +ps2_synaptics_capability(int fd, struct PS2SynapticsHwInfo *synhw) { byte cap[3]; @@ -279,7 +279,7 @@ ps2_synaptics_capability(int fd, struct SynapticsHwInfo *synhw) * See also the SYN_ID_* macros */ static Bool -ps2_synaptics_identify(int fd, struct SynapticsHwInfo *synhw) +ps2_synaptics_identify(int fd, struct PS2SynapticsHwInfo *synhw) { byte id[3]; @@ -315,7 +315,7 @@ ps2_synaptics_disable_device(int fd) } static Bool -ps2_query_is_synaptics(int fd, struct SynapticsHwInfo* synhw) +ps2_query_is_synaptics(int fd, struct PS2SynapticsHwInfo* synhw) { int i; @@ -335,7 +335,7 @@ ps2_query_is_synaptics(int fd, struct SynapticsHwInfo* synhw) } void -ps2_print_ident(const struct SynapticsHwInfo *synhw) +ps2_print_ident(const struct PS2SynapticsHwInfo *synhw) { xf86Msg(X_PROBED, Synaptics Touchpad, model: %d\n, SYN_ID_MODEL(synhw)); xf86Msg(X_PROBED, Firmware: %d.%d\n, SYN_ID_MAJOR(synhw), @@ -381,11 +381,11 @@ PS2QueryHardware(InputInfoPtr pInfo) { int mode; SynapticsPrivate *priv = (SynapticsPrivate *)pInfo-private; -struct SynapticsHwInfo *synhw; +struct PS2SynapticsHwInfo *synhw; if (!priv-proto_data) -priv-proto_data = calloc(1, sizeof(struct SynapticsHwInfo)); -synhw = (struct SynapticsHwInfo*)priv-proto_data; +priv-proto_data = calloc(1, sizeof(struct PS2SynapticsHwInfo)); +synhw = (struct PS2SynapticsHwInfo*)priv-proto_data; /* is the synaptics touchpad active? */ if (!ps2_query_is_synaptics(pInfo-fd, synhw)) @@ -424,7 +424,7 @@ PS2QueryHardware(InputInfoPtr pInfo) * Decide if the current packet stored in priv-protoBuf is valid. */ static Bool -ps2_packet_ok(struct SynapticsHwInfo *synhw, struct CommData *comm) +ps2_packet_ok(struct PS2SynapticsHwInfo *synhw, struct CommData *comm) { unsigned char *buf = comm-protoBuf; int newabs = SYN_MODEL_NEWABS(synhw); @@ -453,7 +453,7 @@ ps2_packet_ok(struct SynapticsHwInfo *synhw, struct CommData *comm) } static Bool -ps2_synaptics_get_packet(InputInfoPtr pInfo, struct SynapticsHwInfo *synhw, +ps2_synaptics_get_packet(InputInfoPtr pInfo, struct PS2SynapticsHwInfo *synhw, struct SynapticsProtocolOperations *proto_ops, struct CommData *comm) { @@ -522,11 +522,11 @@ PS2ReadHwState(InputInfoPtr pInfo, struct SynapticsHwState *hw = (comm-hwState); SynapticsPrivate *priv = (SynapticsPrivate *)pInfo-private; SynapticsParameters *para = priv-synpara; -struct SynapticsHwInfo *synhw; +struct PS2SynapticsHwInfo *synhw; int newabs; int w, i; -synhw = (struct SynapticsHwInfo*)priv-proto_data; +synhw = (struct PS2SynapticsHwInfo*)priv-proto_data; if (!synhw) { xf86Msg(X_ERROR, diff --git a/src/ps2comm.h b/src/ps2comm.h index 99ff3ec..2cf6a23 100644 --- a/src/ps2comm.h +++ b/src/ps2comm.h @@ -94,7 +94,7 @@ typedef unsigned char byte; -struct SynapticsHwInfo { +struct PS2SynapticsHwInfo { unsigned int model_id; /* Model-ID */ unsigned int capabilities; /* Capabilities */ unsigned int ext_cap; /* Extended Capabilities */ @@ -102,6 +102,6 @@ struct SynapticsHwInfo { }; Bool ps2_putbyte(int fd, byte b); -void ps2_print_ident(const struct SynapticsHwInfo *synhw); +void ps2_print_ident(const struct PS2SynapticsHwInfo *synhw); #endif /* _PS2COMM_H_ */ diff --git a/src/psmcomm.c b/src/psmcomm.c index 88263ae..596db48 100644 --- a/src/psmcomm.c +++ b/src/psmcomm.c @@ -103,7 +103,7 @@ PSMQueryIsSynaptics(InputInfoPtr pInfo) } static void -convert_hw_info(const synapticshw_t *psm_ident, struct SynapticsHwInfo *synhw) +convert_hw_info(const synapticshw_t *psm_ident, struct PS2SynapticsHwInfo *synhw) { memset(synhw, 0, sizeof(*synhw)); synhw-model_id = ((psm_ident-infoRot180 23) | @@ -130,14 +130,14 @@ static Bool PSMQueryHardware(InputInfoPtr pInfo) { synapticshw_t psm_ident; -struct SynapticsHwInfo *synhw; +struct PS2SynapticsHwInfo *synhw; SynapticsPrivate *priv; priv = (SynapticsPrivate *)pInfo-private; if(!priv-proto_data) -priv-proto_data = calloc(1
[PATCH v2 synaptics 10/11] Rewrite mechanisn to detect Protocol and Device
Made SetDeviceAndProtocol() does not depend on the protocols, it will make it easier to add new backend. New behavior SetDeviceAndProtocol: 1) If not set Device or Protocol, then try AutoDevProbe 2) Otherwise, look for the appropriate protocol (Device and Protocol must be set) Signed-off-by: Alexandr Shadchin alexandr.shadc...@gmail.com --- Changes to v2: - reorder protocol - remove unneeded typedef (SynapticsProtocolRec) - correct SetDeviceAndProtocol (more clearer) - correct commit message (most difficult :) src/alpscomm.c |8 + src/ps2comm.c |8 + src/psmcomm.c |7 + src/synaptics.c | 84 +- src/synproto.h | 11 --- 5 files changed, 36 insertions(+), 82 deletions(-) diff --git a/src/alpscomm.c b/src/alpscomm.c index 3872f5c..dc76655 100644 --- a/src/alpscomm.c +++ b/src/alpscomm.c @@ -220,17 +220,11 @@ ALPSReadHwState(InputInfoPtr pInfo, return TRUE; } -static Bool -ALPSAutoDevProbe(InputInfoPtr pInfo) -{ -return FALSE; -} - struct SynapticsProtocolOperations alps_proto_operations = { NULL, NULL, ALPSQueryHardware, ALPSReadHwState, -ALPSAutoDevProbe, +NULL, NULL }; diff --git a/src/ps2comm.c b/src/ps2comm.c index a6e052c..0e9b861 100644 --- a/src/ps2comm.c +++ b/src/ps2comm.c @@ -660,17 +660,11 @@ PS2ReadHwState(InputInfoPtr pInfo, return PS2ReadHwStateProto(pInfo, psaux_proto_operations, comm, hwRet); } -static Bool -PS2AutoDevProbe(InputInfoPtr pInfo) -{ -return FALSE; -} - struct SynapticsProtocolOperations psaux_proto_operations = { NULL, PS2DeviceOffHook, PS2QueryHardware, PS2ReadHwState, -PS2AutoDevProbe, +NULL, NULL }; diff --git a/src/psmcomm.c b/src/psmcomm.c index eec240c..73ad079 100644 --- a/src/psmcomm.c +++ b/src/psmcomm.c @@ -162,16 +162,11 @@ PSMReadHwState(InputInfoPtr pInfo, return PS2ReadHwStateProto(pInfo, psm_proto_operations, comm, hwRet); } -static Bool PSMAutoDevProbe(InputInfoPtr pInfo) -{ -return FALSE; -} - struct SynapticsProtocolOperations psm_proto_operations = { NULL, NULL, PSMQueryHardware, PSMReadHwState, -PSMAutoDevProbe, +NULL, NULL }; diff --git a/src/synaptics.c b/src/synaptics.c index 9980dcc..cdb894b 100644 --- a/src/synaptics.c +++ b/src/synaptics.c @@ -136,6 +136,21 @@ void InitDeviceProperties(InputInfoPtr pInfo); int SetProperty(DeviceIntPtr dev, Atom property, XIPropertyValuePtr prop, BOOL checkonly); +const static struct { +const char *name; +struct SynapticsProtocolOperations *proto_ops; +} protocols[] = { +#ifdef BUILD_EVENTCOMM +{event, event_proto_operations}, +#endif +#ifdef BUILD_PSMCOMM +{psm, psm_proto_operations}, +#endif +{psaux, psaux_proto_operations}, +{alps, alps_proto_operations}, +{NULL, NULL} +}; + InputDriverRec SYNAPTICS = { 1, synaptics, @@ -235,61 +250,24 @@ SanitizeDimensions(InputInfoPtr pInfo) static void SetDeviceAndProtocol(InputInfoPtr pInfo) { -char *str_par, *device; SynapticsPrivate *priv = pInfo-private; -enum SynapticsProtocol proto = SYN_PROTO_PSAUX; +char *proto, *device; +int i; +proto = xf86SetStrOption(pInfo-options, Protocol, NULL); device = xf86SetStrOption(pInfo-options, Device, NULL); -if (!device) { - device = xf86SetStrOption(pInfo-options, Path, NULL); - if (device) { - pInfo-options = - xf86ReplaceStrOption(pInfo-options, Device, device); - } -} -if (device strstr(device, /dev/input/event)) { -#ifdef BUILD_EVENTCOMM - proto = SYN_PROTO_EVENT; -#endif -} else { - str_par = xf86FindOptionValue(pInfo-options, Protocol); - if (str_par !strcmp(str_par, psaux)) { - /* Already set up */ -#ifdef BUILD_EVENTCOMM - } else if (str_par !strcmp(str_par, event)) { - proto = SYN_PROTO_EVENT; -#endif /* BUILD_EVENTCOMM */ -#ifdef BUILD_PSMCOMM - } else if (str_par !strcmp(str_par, psm)) { - proto = SYN_PROTO_PSM; -#endif /* BUILD_PSMCOMM */ - } else if (str_par !strcmp(str_par, alps)) { - proto = SYN_PROTO_ALPS; - } else { /* default to auto-dev */ -#ifdef BUILD_EVENTCOMM - if (!device event_proto_operations.AutoDevProbe(pInfo)) - proto = SYN_PROTO_EVENT; -#endif - } -} -switch (proto) { -case SYN_PROTO_PSAUX: - priv-proto_ops = psaux_proto_operations; - break; -#ifdef BUILD_EVENTCOMM -case SYN_PROTO_EVENT: - priv-proto_ops = event_proto_operations; - break; -#endif /* BUILD_EVENTCOMM */ -#ifdef BUILD_PSMCOMM -case SYN_PROTO_PSM: - priv-proto_ops = psm_proto_operations; - break; -#endif /* BUILD_PSMCOMM */ -case SYN_PROTO_ALPS: - priv-proto_ops = alps_proto_operations; - break; +for (i = 0; protocols[i].name; i++) { +if ((!device || !proto
[PATCH v2 synaptics 11/11] Now ps2comm and alpscomm backend optional
Signed-off-by: Alexandr Shadchin alexandr.shadc...@gmail.com Reviewed-by: Peter Hutterer peter.hutte...@who-t.net --- configure.ac| 20 +++- src/Makefile.am |8 ++-- src/synaptics.c |2 ++ src/synproto.h |5 +++-- 4 files changed, 26 insertions(+), 9 deletions(-) diff --git a/configure.ac b/configure.ac index ea66935..edfc4e4 100644 --- a/configure.ac +++ b/configure.ac @@ -98,21 +98,31 @@ AM_CONDITIONAL(DEBUG, [test x$DEBUGGING = xyes]) AC_MSG_CHECKING([which optional backends will be build]) case ${host} in *linux*) - AC_MSG_RESULT([eventcomm]) + AC_MSG_RESULT([ps2comm alpscomm eventcomm]) + BUILD_PS2COMM=yes BUILD_EVENTCOMM=yes - AC_DEFINE(BUILD_EVENTCOMM, 1, [Optional backend eventcomm enabled]) ;; -*freebsd* | *openbsd* | *netbsd* | *dragonfly*) - AC_MSG_RESULT([psmcomm]) +*freebsd* | *netbsd* | *dragonfly*) + AC_MSG_RESULT([ps2comm alpscomm psmcomm]) + BUILD_PS2COMM=yes BUILD_PSMCOMM=yes - AC_DEFINE(BUILD_PSMCOMM, 1, [Optional backend psmcomm enabled]) ;; *) AC_MSG_RESULT([none]) ;; esac +if test x$BUILD_EVENTCOMM = xyes; then +AC_DEFINE(BUILD_EVENTCOMM, 1, [Optional backend eventcomm enabled]) +fi +if test x$BUILD_PSMCOMM = xyes; then +AC_DEFINE(BUILD_PSMCOMM, 1, [Optional backend psmcomm enabled]) +fi +if test x$BUILD_PS2COMM = xyes; then +AC_DEFINE(BUILD_PS2COMM, 1, [Optional backend ps2comm and alpscomm enabled]) +fi AM_CONDITIONAL([BUILD_EVENTCOMM], [test x${BUILD_EVENTCOMM} = xyes]) AM_CONDITIONAL([BUILD_PSMCOMM], [test x${BUILD_PSMCOMM} = xyes]) +AM_CONDITIONAL([BUILD_PS2COMM], [test x${BUILD_PS2COMM} = xyes]) # - # Dependencies for synclient and syndaemon diff --git a/src/Makefile.am b/src/Makefile.am index 0637445..ff513f1 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -32,11 +32,15 @@ AM_CPPFLAGS = -I$(top_srcdir)/include AM_CFLAGS = $(XORG_CFLAGS) @DRIVER_NAME@_drv_la_SOURCES = @DRIVER_NAME@.c synapticsstr.h \ - alpscomm.c \ - ps2comm.c ps2comm.h \ synproto.h \ properties.c +if BUILD_PS2COMM +@DRIVER_NAME@_drv_la_SOURCES += \ + alpscomm.c \ + ps2comm.c ps2comm.h +endif + if BUILD_EVENTCOMM @DRIVER_NAME@_drv_la_SOURCES += \ eventcomm.c eventcomm.h diff --git a/src/synaptics.c b/src/synaptics.c index cdb894b..1233917 100644 --- a/src/synaptics.c +++ b/src/synaptics.c @@ -146,8 +146,10 @@ const static struct { #ifdef BUILD_PSMCOMM {psm, psm_proto_operations}, #endif +#ifdef BUILD_PS2COMM {psaux, psaux_proto_operations}, {alps, alps_proto_operations}, +#endif {NULL, NULL} }; diff --git a/src/synproto.h b/src/synproto.h index 54a64eb..251dc84 100644 --- a/src/synproto.h +++ b/src/synproto.h @@ -79,14 +79,15 @@ struct SynapticsProtocolOperations { void (*ReadDevDimensions)(InputInfoPtr pInfo); }; +#ifdef BUILD_PS2COMM extern struct SynapticsProtocolOperations psaux_proto_operations; +extern struct SynapticsProtocolOperations alps_proto_operations; +#endif /* BUILD_PS2COMM */ #ifdef BUILD_EVENTCOMM extern struct SynapticsProtocolOperations event_proto_operations; #endif /* BUILD_EVENTCOMM */ #ifdef BUILD_PSMCOMM extern struct SynapticsProtocolOperations psm_proto_operations; #endif /* BUILD_PSMCOMM */ -extern struct SynapticsProtocolOperations alps_proto_operations; - #endif /* _SYNPROTO_H_ */ -- 1.7.3.5 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
[PATCH synaptics 1/8] United functions of SynapticsDefaultDimensions() and ReadDevDimensions()
There is no point doing the same thing in different places Signed-off-by: Alexandr Shadchin alexandr.shadc...@gmail.com --- src/alpscomm.c |2 +- src/ps2comm.c |2 +- src/psmcomm.c |2 +- src/synaptics.c| 96 --- src/synapticsstr.h |3 -- 5 files changed, 41 insertions(+), 64 deletions(-) diff --git a/src/alpscomm.c b/src/alpscomm.c index 84d2136..c5af681 100644 --- a/src/alpscomm.c +++ b/src/alpscomm.c @@ -233,5 +233,5 @@ struct SynapticsProtocolOperations alps_proto_operations = { ALPSQueryHardware, ALPSReadHwState, ALPSAutoDevProbe, -SynapticsDefaultDimensions +NULL }; diff --git a/src/ps2comm.c b/src/ps2comm.c index 4e372b3..a34613e 100644 --- a/src/ps2comm.c +++ b/src/ps2comm.c @@ -672,5 +672,5 @@ struct SynapticsProtocolOperations psaux_proto_operations = { PS2QueryHardware, PS2ReadHwState, PS2AutoDevProbe, -SynapticsDefaultDimensions +NULL }; diff --git a/src/psmcomm.c b/src/psmcomm.c index 741cd1d..903e6dd 100644 --- a/src/psmcomm.c +++ b/src/psmcomm.c @@ -181,5 +181,5 @@ struct SynapticsProtocolOperations psm_proto_operations = { PSMQueryHardware, PSMReadHwState, PSMAutoDevProbe, -SynapticsDefaultDimensions +NULL }; diff --git a/src/synaptics.c b/src/synaptics.c index 56ce725..daa0542 100644 --- a/src/synaptics.c +++ b/src/synaptics.c @@ -174,63 +174,6 @@ _X_EXPORT XF86ModuleData synapticsModuleData = { /* * Function Definitions / -/** - * Fill in default dimensions for backends that cannot query the hardware. - * Eventually, we want the edges to be 1900/5400 for x, 1900/4000 for y. - * These values are based so that calculate_edge_widths() will give us the - * right values. - * - * The default values 1900, etc. come from the dawn of time, when men where - * men, or possibly apes. - */ -void -SynapticsDefaultDimensions(InputInfoPtr pInfo) -{ -SynapticsPrivate *priv = (SynapticsPrivate *)pInfo-private; - -if (priv-minx = priv-maxx) -{ - priv-minx = 1615; - priv-maxx = 5685; - priv-resx = 0; - - xf86Msg(X_PROBED, - %s: invalid x-axis range. defaulting to %d - %d\n, - pInfo-name, priv-minx, priv-maxx); -} - -if (priv-miny = priv-maxy) -{ - priv-miny = 1729; - priv-maxy = 4171; - priv-resx = 0; - - xf86Msg(X_PROBED, - %s: invalid y-axis range. defaulting to %d - %d\n, - pInfo-name, priv-miny, priv-maxy); -} - -if (priv-minp = priv-maxp) -{ - priv-minp = 0; - priv-maxp = 256; - - xf86Msg(X_PROBED, - %s: invalid pressure range. defaulting to %d - %d\n, - pInfo-name, priv-minp, priv-maxp); -} - -if (priv-minw = priv-maxw) -{ - priv-minw = 0; - priv-maxw = 16; - - xf86Msg(X_PROBED, - %s: invalid finger width range. defaulting to %d - %d\n, - pInfo-name, priv-minw, priv-maxw); -} -} - static void SetDeviceAndProtocol(InputInfoPtr pInfo) { @@ -444,7 +387,6 @@ static void set_default_parameters(InputInfoPtr pInfo) * If the range was autodetected, apply these edge widths to all four * sides. */ -SynapticsDefaultDimensions(pInfo); width = abs(priv-maxx - priv-minx); height = abs(priv-maxy - priv-miny); @@ -2613,6 +2555,44 @@ ReadDevDimensions(InputInfoPtr pInfo) if (priv-proto_ops-ReadDevDimensions) priv-proto_ops-ReadDevDimensions(pInfo); + +if (priv-minx = priv-maxx) { +priv-minx = 1615; +priv-maxx = 5685; +priv-resx = 0; + +xf86Msg(X_PROBED, +%s: invalid x-axis range. defaulting to %d - %d\n, +pInfo-name, priv-minx, priv-maxx); +} + +if (priv-miny = priv-maxy) { +priv-miny = 1729; +priv-maxy = 4171; +priv-resy = 0; + +xf86Msg(X_PROBED, +%s: invalid y-axis range. defaulting to %d - %d\n, +pInfo-name, priv-miny, priv-maxy); +} + +if (priv-minp = priv-maxp) { +priv-minp = 0; +priv-maxp = 256; + +xf86Msg(X_PROBED, +%s: invalid pressure range. defaulting to %d - %d\n, +pInfo-name, priv-minp, priv-maxp); +} + +if (priv-minw = priv-maxw) { +priv-minw = 0; +priv-maxw = 16; + +xf86Msg(X_PROBED, +%s: invalid finger width range. defaulting to %d - %d\n, +pInfo-name, priv-minw, priv-maxw); +} } static Bool diff --git a/src/synapticsstr.h b/src/synapticsstr.h index 066b3f3..8f6593e 100644 --- a/src/synapticsstr.h +++ b/src/synapticsstr.h @@ -243,7 +243,4 @@ typedef struct _SynapticsPrivateRec enum TouchpadModel model
[PATCH synaptics 2/8] Removing extra call SetDeviceAndProtocol()
SetDeviceAndProtocol() calling in SynapticsPreInit(), extra calling in DeviceOn() unnecessary. Signed-off-by: Alexandr Shadchin alexandr.shadc...@gmail.com --- src/synaptics.c |1 - 1 files changed, 0 insertions(+), 1 deletions(-) diff --git a/src/synaptics.c b/src/synaptics.c index daa0542..b1d027f 100644 --- a/src/synaptics.c +++ b/src/synaptics.c @@ -786,7 +786,6 @@ DeviceOn(DeviceIntPtr dev) DBG(3, Synaptics DeviceOn called\n); -SetDeviceAndProtocol(pInfo); pInfo-fd = xf86OpenSerial(pInfo-options); if (pInfo-fd == -1) { xf86Msg(X_WARNING, %s: cannot open input device\n, pInfo-name); -- 1.7.3.5 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
[PATCH synaptics 4/8] Move definition struct SynapticsHwInfo in ps2comm.h
Signed-off-by: Alexandr Shadchin alexandr.shadc...@gmail.com --- src/ps2comm.c |7 --- src/ps2comm.h |8 ++-- src/psmcomm.c |7 --- src/synproto.h |1 - 4 files changed, 6 insertions(+), 17 deletions(-) diff --git a/src/ps2comm.c b/src/ps2comm.c index a34613e..1ea09c9 100644 --- a/src/ps2comm.c +++ b/src/ps2comm.c @@ -82,13 +82,6 @@ #define PS2DBG(x) #endif -struct SynapticsHwInfo { -unsigned int model_id; /* Model-ID */ -unsigned int capabilities; /* Capabilities */ -unsigned int ext_cap; /* Extended Capabilities */ -unsigned int identity; /* Identification */ -}; - /* * PS/2 Utility functions. * Many parts adapted from tpconfig.c by C. Scott Ananian diff --git a/src/ps2comm.h b/src/ps2comm.h index fec5634..99ff3ec 100644 --- a/src/ps2comm.h +++ b/src/ps2comm.h @@ -94,10 +94,14 @@ typedef unsigned char byte; +struct SynapticsHwInfo { +unsigned int model_id; /* Model-ID */ +unsigned int capabilities; /* Capabilities */ +unsigned int ext_cap; /* Extended Capabilities */ +unsigned int identity; /* Identification */ +}; Bool ps2_putbyte(int fd, byte b); - -struct SynapticsHwInfo; void ps2_print_ident(const struct SynapticsHwInfo *synhw); #endif /* _PS2COMM_H_ */ diff --git a/src/psmcomm.c b/src/psmcomm.c index 903e6dd..88263ae 100644 --- a/src/psmcomm.c +++ b/src/psmcomm.c @@ -52,13 +52,6 @@ #define SYSCALL(call) while (((call) == -1) (errno == EINTR)) -struct SynapticsHwInfo { -unsigned int model_id; /* Model-ID */ -unsigned int capabilities; /* Capabilities */ -unsigned int ext_cap; /* Extended Capabilities */ -unsigned int identity; /* Identification */ -}; - /* * Identify Touchpad * See also the SYN_ID_* macros diff --git a/src/synproto.h b/src/synproto.h index 96ddf3e..a899a73 100644 --- a/src/synproto.h +++ b/src/synproto.h @@ -79,7 +79,6 @@ enum SynapticsProtocol { }; struct _SynapticsParameters; -struct SynapticsHwInfo; struct CommData; struct SynapticsProtocolOperations { -- 1.7.3.5 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
[PATCH synaptics 6/8] Remove extra definition CommData
Signed-off-by: Alexandr Shadchin alexandr.shadc...@gmail.com --- src/synproto.h |1 - 1 files changed, 0 insertions(+), 1 deletions(-) diff --git a/src/synproto.h b/src/synproto.h index 3fe70b9..4b37df0 100644 --- a/src/synproto.h +++ b/src/synproto.h @@ -79,7 +79,6 @@ enum SynapticsProtocol { }; struct _SynapticsParameters; -struct CommData; struct SynapticsProtocolOperations { void (*DeviceOnHook)(InputInfoPtr pInfo, struct _SynapticsParameters *para); -- 1.7.3.5 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
[PATCH synaptics 7/8] Rewrite mechanisn detect Protocol and Device
It is now easier to add new backends Signed-off-by: Alexandr Shadchin alexandr.shadc...@gmail.com --- src/alpscomm.c |8 +- src/ps2comm.c |8 +- src/psmcomm.c |7 + src/synaptics.c | 80 --- src/synproto.h | 16 +++--- 5 files changed, 37 insertions(+), 82 deletions(-) diff --git a/src/alpscomm.c b/src/alpscomm.c index 3872f5c..dc76655 100644 --- a/src/alpscomm.c +++ b/src/alpscomm.c @@ -220,17 +220,11 @@ ALPSReadHwState(InputInfoPtr pInfo, return TRUE; } -static Bool -ALPSAutoDevProbe(InputInfoPtr pInfo) -{ -return FALSE; -} - struct SynapticsProtocolOperations alps_proto_operations = { NULL, NULL, ALPSQueryHardware, ALPSReadHwState, -ALPSAutoDevProbe, +NULL, NULL }; diff --git a/src/ps2comm.c b/src/ps2comm.c index b676ddc..92665c8 100644 --- a/src/ps2comm.c +++ b/src/ps2comm.c @@ -660,17 +660,11 @@ PS2ReadHwState(InputInfoPtr pInfo, return PS2ReadHwStatePriv(pInfo, psaux_proto_operations, comm, hwRet); } -static Bool -PS2AutoDevProbe(InputInfoPtr pInfo) -{ -return FALSE; -} - struct SynapticsProtocolOperations psaux_proto_operations = { NULL, PS2DeviceOffHook, PS2QueryHardware, PS2ReadHwState, -PS2AutoDevProbe, +NULL, NULL }; diff --git a/src/psmcomm.c b/src/psmcomm.c index ea8cf88..8d633bd 100644 --- a/src/psmcomm.c +++ b/src/psmcomm.c @@ -162,16 +162,11 @@ PSMReadHwState(InputInfoPtr pInfo, return PS2ReadHwStatePriv(pInfo, psm_proto_operations, comm, hwRet); } -static Bool PSMAutoDevProbe(InputInfoPtr pInfo) -{ -return FALSE; -} - struct SynapticsProtocolOperations psm_proto_operations = { NULL, NULL, PSMQueryHardware, PSMReadHwState, -PSMAutoDevProbe, +NULL, NULL }; diff --git a/src/synaptics.c b/src/synaptics.c index 1a559a2..8819798 100644 --- a/src/synaptics.c +++ b/src/synaptics.c @@ -135,6 +135,18 @@ void InitDeviceProperties(InputInfoPtr pInfo); int SetProperty(DeviceIntPtr dev, Atom property, XIPropertyValuePtr prop, BOOL checkonly); +const static SynapticsProtocolRec protocols[] = { +{psaux, psaux_proto_operations}, +{alps, alps_proto_operations}, +#ifdef BUILD_PSMCOMM +{psm, psm_proto_operations}, +#endif +#ifdef BUILD_EVENTCOMM +{event, event_proto_operations}, +#endif +{NULL, NULL} +}; + InputDriverRec SYNAPTICS = { 1, synaptics, @@ -177,61 +189,23 @@ _X_EXPORT XF86ModuleData synapticsModuleData = { static void SetDeviceAndProtocol(InputInfoPtr pInfo) { -char *str_par, *device; SynapticsPrivate *priv = pInfo-private; -enum SynapticsProtocol proto = SYN_PROTO_PSAUX; +char *proto, *device; +int i; +proto = xf86SetStrOption(pInfo-options, Protocol, NULL); device = xf86SetStrOption(pInfo-options, Device, NULL); -if (!device) { - device = xf86SetStrOption(pInfo-options, Path, NULL); - if (device) { - pInfo-options = - xf86ReplaceStrOption(pInfo-options, Device, device); - } -} -if (device strstr(device, /dev/input/event)) { -#ifdef BUILD_EVENTCOMM - proto = SYN_PROTO_EVENT; -#endif -} else { - str_par = xf86FindOptionValue(pInfo-options, Protocol); - if (str_par !strcmp(str_par, psaux)) { - /* Already set up */ -#ifdef BUILD_EVENTCOMM - } else if (str_par !strcmp(str_par, event)) { - proto = SYN_PROTO_EVENT; -#endif /* BUILD_EVENTCOMM */ -#ifdef BUILD_PSMCOMM - } else if (str_par !strcmp(str_par, psm)) { - proto = SYN_PROTO_PSM; -#endif /* BUILD_PSMCOMM */ - } else if (str_par !strcmp(str_par, alps)) { - proto = SYN_PROTO_ALPS; - } else { /* default to auto-dev */ -#ifdef BUILD_EVENTCOMM - if (!device event_proto_operations.AutoDevProbe(pInfo)) - proto = SYN_PROTO_EVENT; -#endif - } -} -switch (proto) { -case SYN_PROTO_PSAUX: - priv-proto_ops = psaux_proto_operations; - break; -#ifdef BUILD_EVENTCOMM -case SYN_PROTO_EVENT: - priv-proto_ops = event_proto_operations; - break; -#endif /* BUILD_EVENTCOMM */ -#ifdef BUILD_PSMCOMM -case SYN_PROTO_PSM: - priv-proto_ops = psm_proto_operations; - break; -#endif /* BUILD_PSMCOMM */ -case SYN_PROTO_ALPS: - priv-proto_ops = alps_proto_operations; - break; +for (i = 0; protocols[i].name; i++) { +if (proto device !strcmp(proto, protocols[i].name)) +break; +if (protocols[i].proto_ops-AutoDevProbe +protocols[i].proto_ops-AutoDevProbe(pInfo)) +break; } +free(proto); +free(device); + +priv-proto_ops = protocols[i].proto_ops; } /* @@ -656,6 +630,10 @@ SynapticsPreInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags) /* may change pInfo-options */ SetDeviceAndProtocol(pInfo); +if (priv-proto_ops == NULL
[PATCH synaptics 8/8] Now ps2comm and alpscomm backend optional
Signed-off-by: Alexandr Shadchin alexandr.shadc...@gmail.com --- OpenBSD don't support this backends. Backend for OpenBSD I'll add later. configure.ac| 20 +++- src/Makefile.am |8 ++-- src/synaptics.c |2 ++ src/synproto.h |5 +++-- 4 files changed, 26 insertions(+), 9 deletions(-) diff --git a/configure.ac b/configure.ac index ea66935..edfc4e4 100644 --- a/configure.ac +++ b/configure.ac @@ -98,21 +98,31 @@ AM_CONDITIONAL(DEBUG, [test x$DEBUGGING = xyes]) AC_MSG_CHECKING([which optional backends will be build]) case ${host} in *linux*) - AC_MSG_RESULT([eventcomm]) + AC_MSG_RESULT([ps2comm alpscomm eventcomm]) + BUILD_PS2COMM=yes BUILD_EVENTCOMM=yes - AC_DEFINE(BUILD_EVENTCOMM, 1, [Optional backend eventcomm enabled]) ;; -*freebsd* | *openbsd* | *netbsd* | *dragonfly*) - AC_MSG_RESULT([psmcomm]) +*freebsd* | *netbsd* | *dragonfly*) + AC_MSG_RESULT([ps2comm alpscomm psmcomm]) + BUILD_PS2COMM=yes BUILD_PSMCOMM=yes - AC_DEFINE(BUILD_PSMCOMM, 1, [Optional backend psmcomm enabled]) ;; *) AC_MSG_RESULT([none]) ;; esac +if test x$BUILD_EVENTCOMM = xyes; then +AC_DEFINE(BUILD_EVENTCOMM, 1, [Optional backend eventcomm enabled]) +fi +if test x$BUILD_PSMCOMM = xyes; then +AC_DEFINE(BUILD_PSMCOMM, 1, [Optional backend psmcomm enabled]) +fi +if test x$BUILD_PS2COMM = xyes; then +AC_DEFINE(BUILD_PS2COMM, 1, [Optional backend ps2comm and alpscomm enabled]) +fi AM_CONDITIONAL([BUILD_EVENTCOMM], [test x${BUILD_EVENTCOMM} = xyes]) AM_CONDITIONAL([BUILD_PSMCOMM], [test x${BUILD_PSMCOMM} = xyes]) +AM_CONDITIONAL([BUILD_PS2COMM], [test x${BUILD_PS2COMM} = xyes]) # - # Dependencies for synclient and syndaemon diff --git a/src/Makefile.am b/src/Makefile.am index 0637445..ff513f1 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -32,11 +32,15 @@ AM_CPPFLAGS = -I$(top_srcdir)/include AM_CFLAGS = $(XORG_CFLAGS) @DRIVER_NAME@_drv_la_SOURCES = @DRIVER_NAME@.c synapticsstr.h \ - alpscomm.c \ - ps2comm.c ps2comm.h \ synproto.h \ properties.c +if BUILD_PS2COMM +@DRIVER_NAME@_drv_la_SOURCES += \ + alpscomm.c \ + ps2comm.c ps2comm.h +endif + if BUILD_EVENTCOMM @DRIVER_NAME@_drv_la_SOURCES += \ eventcomm.c eventcomm.h diff --git a/src/synaptics.c b/src/synaptics.c index 8819798..3b6e63b 100644 --- a/src/synaptics.c +++ b/src/synaptics.c @@ -136,8 +136,10 @@ int SetProperty(DeviceIntPtr dev, Atom property, XIPropertyValuePtr prop, BOOL checkonly); const static SynapticsProtocolRec protocols[] = { +#ifdef BUILD_PS2COMM {psaux, psaux_proto_operations}, {alps, alps_proto_operations}, +#endif #ifdef BUILD_PSMCOMM {psm, psm_proto_operations}, #endif diff --git a/src/synproto.h b/src/synproto.h index 9c25428..700cf7a 100644 --- a/src/synproto.h +++ b/src/synproto.h @@ -84,14 +84,15 @@ typedef struct { struct SynapticsProtocolOperations *proto_ops; } SynapticsProtocolRec; +#ifdef BUILD_PS2COMM extern struct SynapticsProtocolOperations psaux_proto_operations; +extern struct SynapticsProtocolOperations alps_proto_operations; +#endif /* BUILD_PS2COMM */ #ifdef BUILD_EVENTCOMM extern struct SynapticsProtocolOperations event_proto_operations; #endif /* BUILD_EVENTCOMM */ #ifdef BUILD_PSMCOMM extern struct SynapticsProtocolOperations psm_proto_operations; #endif /* BUILD_PSMCOMM */ -extern struct SynapticsProtocolOperations alps_proto_operations; - #endif /* _SYNPROTO_H_ */ -- 1.7.3.5 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
Re: [PATCH xserver] Removing unused code
Push, please (yet not forgotten :-) On Wed, Dec 01, 2010 at 08:27:50AM +0100, Matthieu Herrb wrote: On Tue, Nov 30, 2010 at 09:17:19PM +0500, Alexandr Shadchin wrote: In OpenBSD removed support PCCONS in 2002 year http://marc.info/?l=openbsd-cvsm=102435816424294w=2 Signed-off-by: Alexandr Shadchin alexandr.shadc...@gmail.com Reviewed-by: Matthieu Herrb matthieu.he...@laas.fr --- hw/xfree86/os-support/bsd/bsd_init.c |6 +- hw/xfree86/os-support/xf86_OSlib.h |8 2 files changed, 1 insertions(+), 13 deletions(-) diff --git a/hw/xfree86/os-support/bsd/bsd_init.c b/hw/xfree86/os-support/bsd/bsd_init.c index 13c6ec3..123eb17 100644 --- a/hw/xfree86/os-support/bsd/bsd_init.c +++ b/hw/xfree86/os-support/bsd/bsd_init.c @@ -50,11 +50,7 @@ static Bool ShareVTs = FALSE; #ifdef PCCONS_SUPPORT /* Stock 0.1 386bsd pccons console driver interface */ -#ifndef __OpenBSD__ -# define PCCONS_CONSOLE_DEV1 /dev/ttyv0 -#else -# define PCCONS_CONSOLE_DEV1 /dev/ttyC0 -#endif +#define PCCONS_CONSOLE_DEV1 /dev/ttyv0 #define PCCONS_CONSOLE_DEV2 /dev/vga #define PCCONS_CONSOLE_MODE O_RDWR|O_NDELAY #endif diff --git a/hw/xfree86/os-support/xf86_OSlib.h b/hw/xfree86/os-support/xf86_OSlib.h index c53fc0d..76e29b3 100644 --- a/hw/xfree86/os-support/xf86_OSlib.h +++ b/hw/xfree86/os-support/xf86_OSlib.h @@ -291,14 +291,6 @@ # define CONSOLE_X_MODE_OFF PCCONIOCCOOK # define CONSOLE_X_BELL PCCONIOCBEEP # else /* __bsdi__ */ -# if defined(__OpenBSD__) -# ifdef PCCONS_SUPPORT -# include machine/pccons.h -# undef CONSOLE_X_MODE_ON -# undef CONSOLE_X_MODE_OFF -# undef CONSOLE_X_BELL -# endif -# endif # ifdef SYSCONS_SUPPORT #define COMPAT_SYSCONS #if defined(__NetBSD__) || defined(__OpenBSD__) -- 1.7.3.2 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel -- Matthieu Herrb -- Alexandr Shadchin ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
[PULL xserver] Removing unused code support PCCONS (OpenBSD)
The following changes since commit 93a73993708b1345c86ec3ec06b02ed236595673: test: write some event → XI1 conversion tests. (2011-02-22 08:08:55 +1000) are available in the git repository at: git://github.com/Koba/xserver.git master Alexandr Shadchin (1): Removing unused code support PCCONS (OpenBSD) hw/xfree86/os-support/bsd/bsd_init.c |6 +- hw/xfree86/os-support/xf86_OSlib.h |8 2 files changed, 1 insertions(+), 13 deletions(-) ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
[PATCH setxkbmap 1/2] Removed unused arg subdir in function findFileInPath()
Signed-off-by: Alexandr Shadchin alexandr.shadc...@gmail.com --- setxkbmap.c | 12 ++-- 1 files changed, 6 insertions(+), 6 deletions(-) diff --git a/setxkbmap.c b/setxkbmap.c index 0c43be5..1c9c89e 100644 --- a/setxkbmap.c +++ b/setxkbmap.c @@ -178,7 +178,7 @@ Bool setOptString(int *arg, int argc, char **argv, setting_t * setting, int src) int parseArgs(int argc, char **argv); Bool getDisplay(int argc, char **argv); Bool getServerValues(void); -FILE *findFileInPath(char *name, char *subdir); +FILE *findFileInPath(char *name); Bool addStringToOptions(char *opt_str, list_t * opts); char *stringFromOptions(char *orig, list_t * newOpts); Bool applyConfig(char *name); @@ -622,7 +622,7 @@ getServerValues(void) /******/ FILE * -findFileInPath(char *name, char *subdir) +findFileInPath(char *name) { register int i; char buf[PATH_MAX]; @@ -637,11 +637,11 @@ findFileInPath(char *name, char *subdir) } for (i = 0; (i inclPath.num); i++) { -if (snprintf(buf, PATH_MAX, %s/%s%s, inclPath.item[i], subdir, name) = +if (snprintf(buf, PATH_MAX, %s/%s, inclPath.item[i], name) = PATH_MAX) { -VMSG3(0, Path too long (%s/%s%s). Ignored.\n, inclPath.item[i], - subdir, name); +VMSG2(0, Path too long (%s/%s). Ignored.\n, inclPath.item[i], + name); continue; } fp = fopen(buf, r); @@ -739,7 +739,7 @@ applyConfig(char *name) FILE *fp; Bool ok; -if ((fp = findFileInPath(name, )) == NULL) +if ((fp = findFileInPath(name)) == NULL) return False; ok = XkbCFParse(fp, XkbCFDflts, NULL, cfgResult); fclose(fp); -- 1.7.3.5 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
[PATCH setxkbmap 2/2] Removed unneeded arg name in applyConfig()
Signed-off-by: Alexandr Shadchin alexandr.shadc...@gmail.com --- setxkbmap.c | 11 ++- 1 files changed, 6 insertions(+), 5 deletions(-) diff --git a/setxkbmap.c b/setxkbmap.c index 1c9c89e..6c678ff 100644 --- a/setxkbmap.c +++ b/setxkbmap.c @@ -181,7 +181,7 @@ Bool getServerValues(void); FILE *findFileInPath(char *name); Bool addStringToOptions(char *opt_str, list_t * opts); char *stringFromOptions(char *orig, list_t * newOpts); -Bool applyConfig(char *name); +Bool applyConfig(void); Bool applyRules(void); Bool applyComponentNames(void); void printKeymap(void); @@ -734,18 +734,19 @@ stringFromOptions(char *orig, list_t * newOpts) /******/ Bool -applyConfig(char *name) +applyConfig(void) { FILE *fp; Bool ok; -if ((fp = findFileInPath(name)) == NULL) +if ((fp = findFileInPath(settings.config.value)) == NULL) return False; ok = XkbCFParse(fp, XkbCFDflts, NULL, cfgResult); fclose(fp); if (!ok) { -ERR1(Couldn't find configuration file \%s\\n, name); +ERR1(Couldn't find configuration file \%s\\n, + settings.config.value); return False; } if (cfgResult.rules_file) @@ -1057,7 +1058,7 @@ main(int argc, char **argv) VMSG1(7, locale is %s\n, settings.locale.value); if (dpy) getServerValues(); -if (settings.config.value (!applyConfig(settings.config.value))) +if (settings.config.value (!applyConfig())) exit(-3); if (!applyRules()) exit(-4); -- 1.7.3.5 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
[PATCH v2 keyboard 2/3] Removed useless leds (member structure KbdDevRec)
Signed-off-by: Alexandr Shadchin alexandr.shadc...@gmail.com --- src/kbd.c |8 ++-- src/xf86OSKbd.h |1 - 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/src/kbd.c b/src/kbd.c index 86b5be5..e0d55e5 100644 --- a/src/kbd.c +++ b/src/kbd.c @@ -220,14 +220,12 @@ UpdateLeds(InputInfoPtr pInfo) pKbd-keyLeds MODEFLAG)leds |= XLED3; if (pKbd-keyLeds COMPOSEFLAG) leds |= XLED4; -pKbd-leds = leds; -pKbd-SetLeds(pInfo, pKbd-leds); +pKbd-SetLeds(pInfo, leds); } static void KbdCtrl( DeviceIntPtr device, KeybdCtrl *ctrl) { - unsigned long leds; InputInfoPtr pInfo = (InputInfoPtr) device-public.devicePrivate; KbdDevPtr pKbd = (KbdDevPtr) pInfo-private; @@ -251,9 +249,7 @@ KbdCtrl( DeviceIntPtr device, KeybdCtrl *ctrl) } else { pKbd-keyLeds = ~COMPOSEFLAG; } - leds = ctrl-leds ~(XCAPS | XNUM | XSCR); /* ??? */ - pKbd-leds = leds; - pKbd-SetLeds(pInfo, pKbd-leds); + pKbd-SetLeds(pInfo, ctrl-leds); } static void diff --git a/src/xf86OSKbd.h b/src/xf86OSKbd.h index f94f177..1c8d764 100644 --- a/src/xf86OSKbd.h +++ b/src/xf86OSKbd.h @@ -65,7 +65,6 @@ typedef struct { OpenKeyboardProc OpenKeyboard; PostEventProc PostEvent; -unsigned long leds; unsigned long keyLeds; intscanPrefix; Bool CustomKeycodes; -- 1.7.3.5 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
[PATCH v2 keyboard 3/3] Rewrote code to set initial state LEDS
Saved only initial state CapsLock and NumLock Signed-off-by: Alexandr Shadchin alexandr.shadc...@gmail.com --- src/kbd.c | 105 - 1 files changed, 27 insertions(+), 78 deletions(-) diff --git a/src/kbd.c b/src/kbd.c index e0d55e5..2a2a8a8 100644 --- a/src/kbd.c +++ b/src/kbd.c @@ -41,13 +41,8 @@ #include xkbstr.h #include xkbsrv.h -#define CAPSFLAG 1 -#define NUMFLAG2 -#define SCROLLFLAG 4 -#define MODEFLAG 8 -#define COMPOSEFLAG16 -/* Used to know when the first DEVICE_ON after a DEVICE_INIT is called */ -#define INITFLAG (1U 31) +/* Support only 4 LEDS */ +#define INITFLAG (~(XLED1 | XLED2 | XLED3 | XLED4)) #if GET_ABI_MAJOR(ABI_XINPUT_VERSION) 12 static InputInfoPtr KbdPreInit(InputDriverPtr drv, IDevPtr dev, int flags); @@ -59,9 +54,6 @@ static void KbdCtrl(DeviceIntPtr device, KeybdCtrl *ctrl); static void KbdBell(int percent, DeviceIntPtr dev, pointer ctrl, int unused); static void PostKbdEvent(InputInfoPtr pInfo, unsigned int key, Bool down); -static void InitKBD(InputInfoPtr pInfo, Bool init); -static void UpdateLeds(InputInfoPtr pInfo); - _X_EXPORT InputDriverRec KBD = { 1, kbd, @@ -209,76 +201,19 @@ KbdBell(int percent, DeviceIntPtr dev, pointer ctrl, int unused) } static void -UpdateLeds(InputInfoPtr pInfo) +KbdCtrl(DeviceIntPtr device, KeybdCtrl *ctrl) { +InputInfoPtr pInfo = (InputInfoPtr) device-public.devicePrivate; KbdDevPtr pKbd = (KbdDevPtr) pInfo-private; -unsigned long leds = 0; - -if (pKbd-keyLeds CAPSFLAG)leds |= XLED1; -if (pKbd-keyLeds NUMFLAG) leds |= XLED2; -if (pKbd-keyLeds SCROLLFLAG || -pKbd-keyLeds MODEFLAG)leds |= XLED3; -if (pKbd-keyLeds COMPOSEFLAG) leds |= XLED4; - -pKbd-SetLeds(pInfo, leds); -} - -static void -KbdCtrl( DeviceIntPtr device, KeybdCtrl *ctrl) -{ - InputInfoPtr pInfo = (InputInfoPtr) device-public.devicePrivate; - KbdDevPtr pKbd = (KbdDevPtr) pInfo-private; - - if ( ctrl-leds XLED1) { - pKbd-keyLeds |= CAPSFLAG; - } else { - pKbd-keyLeds = ~CAPSFLAG; - } - if ( ctrl-leds XLED2) { - pKbd-keyLeds |= NUMFLAG; - } else { - pKbd-keyLeds = ~NUMFLAG; - } - if ( ctrl-leds XLED3) { - pKbd-keyLeds |= SCROLLFLAG; - } else { - pKbd-keyLeds = ~SCROLLFLAG; - } - if ( ctrl-leds (XCOMP|XLED4) ) { - pKbd-keyLeds |= COMPOSEFLAG; - } else { - pKbd-keyLeds = ~COMPOSEFLAG; - } - pKbd-SetLeds(pInfo, ctrl-leds); -} -static void -InitKBD(InputInfoPtr pInfo, Bool init) -{ - KbdDevPtr pKbd = (KbdDevPtr) pInfo-private; - - pKbd-scanPrefix = 0; +if (pKbd-keyLeds INITFLAG) { +pKbd-keyLeds = (INITFLAG | XLED1 |XLED2); +pKbd-keyLeds |= ctrl-leds; +} else { +pKbd-keyLeds = ctrl-leds; +} - if (init) { - pKbd-keyLeds = pKbd-GetLeds(pInfo); - UpdateLeds(pInfo); - pKbd-keyLeds |= INITFLAG; - } else { - unsigned long leds = pKbd-keyLeds; - - pKbd-keyLeds = pKbd-GetLeds(pInfo); - UpdateLeds(pInfo); - if ((pKbd-keyLeds CAPSFLAG) != - ((leds INITFLAG) ? 0 : (leds CAPSFLAG))) { - pKbd-PostEvent(pInfo, KEY_CapsLock, TRUE); - pKbd-PostEvent(pInfo, KEY_CapsLock, FALSE); - } - if ((pKbd-keyLeds NUMFLAG) != - (leds INITFLAG ? 0 : leds NUMFLAG)) { - pKbd-PostEvent(pInfo, KEY_NumLock, TRUE); - pKbd-PostEvent(pInfo, KEY_NumLock, FALSE); - } - } +pKbd-SetLeds(pInfo, pKbd-keyLeds); } static int @@ -299,6 +234,9 @@ KbdProc(DeviceIntPtr device, int what) pKbd-KbdGetMapping(pInfo, keySyms, modMap); + pKbd-keyLeds = pKbd-GetLeds(pInfo); + pKbd-keyLeds |= INITFLAG; + device-public.on = FALSE; #if GET_ABI_MAJOR(ABI_XINPUT_VERSION) = 5 { @@ -329,7 +267,6 @@ KbdProc(DeviceIntPtr device, int what) (KbdCtrlProcPtr)KbdCtrl); } #endif /* XINPUT ABI 5*/ - InitKBD(pInfo, TRUE); break; case DEVICE_ON: if (device-public.on) @@ -350,7 +287,7 @@ KbdProc(DeviceIntPtr device, int what) } device-public.on = TRUE; -InitKBD(pInfo, FALSE); +pKbd-scanPrefix = 0; break; case DEVICE_CLOSE: @@ -412,6 +349,18 @@ PostKbdEvent(InputInfoPtr pInfo, unsigned int scanCode, Bool down) scanCode = KEY_Pause; } +if (pKbd-keyLeds INITFLAG) { +if (pKbd-keyLeds XLED1) { +xf86PostKeyboardEvent(device, KEY_CapsLock + MIN_KEYCODE, TRUE); +xf86PostKeyboardEvent(device, KEY_CapsLock + MIN_KEYCODE, FALSE); +} +if (pKbd-keyLeds XLED2) { +xf86PostKeyboardEvent(device, KEY_NumLock + MIN_KEYCODE, TRUE); +xf86PostKeyboardEvent(device, KEY_NumLock + MIN_KEYCODE, FALSE); +} +pKbd-keyLeds = ~INITFLAG; +} + xf86PostKeyboardEvent(device, scanCode
[PATCH v2 keyboard 1/3] Removed option XLeds
IMHO nobody needs because it works not correctly and still not fixed Signed-off-by: Alexandr Shadchin alexandr.shadc...@gmail.com --- man/kbd.man |7 --- src/kbd.c | 19 +-- src/xf86OSKbd.h |1 - 3 files changed, 1 insertions(+), 26 deletions(-) diff --git a/man/kbd.man b/man/kbd.man index 4fb2336..b7d57d5 100644 --- a/man/kbd.man +++ b/man/kbd.man @@ -53,13 +53,6 @@ Standard, Xqueue. Not all protocols are supported on all platforms. Default: Standard. .RE .TP 7 -.BI Option \*qXLeds\*q \*q ledlist \*q -makes the keyboard LEDs specified in -.I ledlist -available for client use instead of their traditional function -(Scroll Lock, Caps Lock and Num Lock). The numbers in the list are -in the range 1 to 3. Default: empty list. -.TP 7 .BI Option \*qXkbRules\*q \*q rules \*q specifies which XKB rules file to use for interpreting the .BR XkbModel , diff --git a/src/kbd.c b/src/kbd.c index d89d234..86b5be5 100644 --- a/src/kbd.c +++ b/src/kbd.c @@ -141,7 +141,6 @@ KbdPreInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags) #endif { KbdDevPtr pKbd; -char *s; const char **defaults; int rc = Success; @@ -187,22 +186,6 @@ KbdPreInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags) goto out; } -if ((s = xf86SetStrOption(pInfo-options, XLeds, NULL))) { -char *l, *end; -unsigned int i; -l = strtok(s, \t\n); -while (l) { - i = strtoul(l, end, 0); - if (*end == '\0') - pKbd-xledsMask |= 1L (i - 1); - else { - xf86Msg(X_ERROR, \%s\ is not a valid XLeds value, l); - } - l = strtok(NULL, \t\n); -} -free(s); -} - xkb_rules = xf86SetStrOption(pInfo-options, XkbRules, NULL); xkb_model = xf86SetStrOption(pInfo-options, XkbModel, NULL); xkb_layout = xf86SetStrOption(pInfo-options, XkbLayout, NULL); @@ -237,7 +220,7 @@ UpdateLeds(InputInfoPtr pInfo) pKbd-keyLeds MODEFLAG)leds |= XLED3; if (pKbd-keyLeds COMPOSEFLAG) leds |= XLED4; -pKbd-leds = (pKbd-leds pKbd-xledsMask) | (leds ~pKbd-xledsMask); +pKbd-leds = leds; pKbd-SetLeds(pInfo, pKbd-leds); } diff --git a/src/xf86OSKbd.h b/src/xf86OSKbd.h index cba049f..f94f177 100644 --- a/src/xf86OSKbd.h +++ b/src/xf86OSKbd.h @@ -66,7 +66,6 @@ typedef struct { PostEventProc PostEvent; unsigned long leds; -unsigned long xledsMask; unsigned long keyLeds; intscanPrefix; Bool CustomKeycodes; -- 1.7.3.5 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
Re: [PATCH keyboard 2/5] Removed function InitKBD
But it does not work :-) DEVICE_INIT ... call InitKeyboardDeviceStruct() ... call KbdCtrl() set LEDS in accordance with the ctrl-leds I have not found yet a way to startup X so ctrl-leds were not zero ... call InitKBD() (LEDS has already repaid) manipulation InitKBD do not matter But I really lost sight of that save state NumLock etc. be useful. I'll prepare a new series of patches, this series can be ignored. On Thu, Feb 17, 2011 at 04:20:10PM -0800, Alan Coopersmith wrote: Why have you decided to remove the functionality of initializing the state of things like NumLock based on the initial LED state? It was a bit of the hack to propogate things like NumLock on by default from the BIOS up through to the X server, but it worked.(At least it used to, I haven't checked in a while.) -alan- On 02/17/11 04:10 PM, Alexandr Shadchin wrote: Before calling InitKBD called KbdCtrl, which sets the LEDS in accordance with the ctrl-leds. Therefore, further manipulation InitKBD do not matter. Signed-off-by: Alexandr Shadchin alexandr.shadc...@gmail.com --- src/kbd.c | 53 + 1 files changed, 1 insertions(+), 52 deletions(-) diff --git a/src/kbd.c b/src/kbd.c index 86b5be5..bb1a177 100644 --- a/src/kbd.c +++ b/src/kbd.c @@ -46,8 +46,6 @@ #define SCROLLFLAG 4 #define MODEFLAG 8 #define COMPOSEFLAG16 -/* Used to know when the first DEVICE_ON after a DEVICE_INIT is called */ -#define INITFLAG (1U 31) #if GET_ABI_MAJOR(ABI_XINPUT_VERSION) 12 static InputInfoPtr KbdPreInit(InputDriverPtr drv, IDevPtr dev, int flags); @@ -59,9 +57,6 @@ static void KbdCtrl(DeviceIntPtr device, KeybdCtrl *ctrl); static void KbdBell(int percent, DeviceIntPtr dev, pointer ctrl, int unused); static void PostKbdEvent(InputInfoPtr pInfo, unsigned int key, Bool down); -static void InitKBD(InputInfoPtr pInfo, Bool init); -static void UpdateLeds(InputInfoPtr pInfo); - _X_EXPORT InputDriverRec KBD = { 1, kbd, @@ -209,22 +204,6 @@ KbdBell(int percent, DeviceIntPtr dev, pointer ctrl, int unused) } static void -UpdateLeds(InputInfoPtr pInfo) -{ -KbdDevPtr pKbd = (KbdDevPtr) pInfo-private; -unsigned long leds = 0; - -if (pKbd-keyLeds CAPSFLAG)leds |= XLED1; -if (pKbd-keyLeds NUMFLAG) leds |= XLED2; -if (pKbd-keyLeds SCROLLFLAG || -pKbd-keyLeds MODEFLAG)leds |= XLED3; -if (pKbd-keyLeds COMPOSEFLAG) leds |= XLED4; - -pKbd-leds = leds; -pKbd-SetLeds(pInfo, pKbd-leds); -} - -static void KbdCtrl( DeviceIntPtr device, KeybdCtrl *ctrl) { unsigned long leds; @@ -256,35 +235,6 @@ KbdCtrl( DeviceIntPtr device, KeybdCtrl *ctrl) pKbd-SetLeds(pInfo, pKbd-leds); } -static void -InitKBD(InputInfoPtr pInfo, Bool init) -{ - KbdDevPtr pKbd = (KbdDevPtr) pInfo-private; - - pKbd-scanPrefix = 0; - - if (init) { - pKbd-keyLeds = pKbd-GetLeds(pInfo); - UpdateLeds(pInfo); - pKbd-keyLeds |= INITFLAG; - } else { - unsigned long leds = pKbd-keyLeds; - - pKbd-keyLeds = pKbd-GetLeds(pInfo); - UpdateLeds(pInfo); - if ((pKbd-keyLeds CAPSFLAG) != - ((leds INITFLAG) ? 0 : (leds CAPSFLAG))) { - pKbd-PostEvent(pInfo, KEY_CapsLock, TRUE); - pKbd-PostEvent(pInfo, KEY_CapsLock, FALSE); - } - if ((pKbd-keyLeds NUMFLAG) != - (leds INITFLAG ? 0 : leds NUMFLAG)) { - pKbd-PostEvent(pInfo, KEY_NumLock, TRUE); - pKbd-PostEvent(pInfo, KEY_NumLock, FALSE); - } - } -} - static int KbdProc(DeviceIntPtr device, int what) { @@ -333,7 +283,6 @@ KbdProc(DeviceIntPtr device, int what) (KbdCtrlProcPtr)KbdCtrl); } #endif /* XINPUT ABI 5*/ - InitKBD(pInfo, TRUE); break; case DEVICE_ON: if (device-public.on) @@ -354,7 +303,7 @@ KbdProc(DeviceIntPtr device, int what) } device-public.on = TRUE; -InitKBD(pInfo, FALSE); +pKbd-scanPrefix = 0; break; case DEVICE_CLOSE: -- -Alan Coopersmith-alan.coopersm...@oracle.com Oracle Solaris Platform Engineering: X Window System ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel -- Alexandr Shadchin ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
[PATCH keyboard 2/2] Removed unnecessary code, since ABI_XINPUT_VERSION = 2
Signed-off-by: Alexandr Shadchin alexandr.shadc...@gmail.com --- src/kbd.c | 44 1 files changed, 0 insertions(+), 44 deletions(-) diff --git a/src/kbd.c b/src/kbd.c index e0f0d33..d89d234 100644 --- a/src/kbd.c +++ b/src/kbd.c @@ -276,51 +276,7 @@ KbdCtrl( DeviceIntPtr device, KeybdCtrl *ctrl) static void InitKBD(InputInfoPtr pInfo, Bool init) { - xEvent kevent; KbdDevPtr pKbd = (KbdDevPtr) pInfo-private; -#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) 1 - DeviceIntPtrpKeyboard = pInfo-dev; - KeyClassRec *keyc = pKeyboard-key; - KeySym *map = keyc-curKeySyms.map; - unsigned inti; -#endif - - kevent.u.keyButtonPointer.time = GetTimeInMillis(); - kevent.u.keyButtonPointer.rootX = 0; - kevent.u.keyButtonPointer.rootY = 0; - -/* The server does this for us with i-h. */ -#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) 1 - /* - * Hmm... here is the biggest hack of every time ! - * It may be possible that a switch-vt procedure has finished BEFORE - * you released all keys neccessary to do this. That peculiar behavior - * can fool the X-server pretty much, cause it assumes that some keys - * were not released. TWM may stuck alsmost completly - * OK, what we are doing here is after returning from the vt-switch - * exeplicitely unrelease all keyboard keys before the input-devices - * are reenabled. - */ - for (i = keyc-curKeySyms.minKeyCode, map = keyc-curKeySyms.map; - i keyc-curKeySyms.maxKeyCode; - i++, map += keyc-curKeySyms.mapWidth) - if (KeyPressed(i)) - { -switch (*map) { -/* Don't release the lock keys */ -case XK_Caps_Lock: -case XK_Shift_Lock: -case XK_Num_Lock: -case XK_Scroll_Lock: -case XK_Kana_Lock: - break; -default: - kevent.u.u.detail = i; - kevent.u.u.type = KeyRelease; - (* pKeyboard-public.processInputProc)(kevent, pKeyboard, 1); -} - } -#endif pKbd-scanPrefix = 0; -- 1.7.3.5 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
[PATCH keyboard 1/2] Require server 1.4 or later
Signed-off-by: Alexandr Shadchin alexandr.shadc...@gmail.com --- configure.ac |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/configure.ac b/configure.ac index f6ebb96..f6fdf26 100644 --- a/configure.ac +++ b/configure.ac @@ -45,7 +45,7 @@ XORG_MACROS_VERSION(1.8) XORG_DEFAULT_OPTIONS # Obtain compiler/linker options from server and required extensions -PKG_CHECK_MODULES(XORG, [xorg-server = 1.2.99.0] xproto inputproto) +PKG_CHECK_MODULES(XORG, [xorg-server = 1.4] xproto inputproto) # Define a configure option for an alternate input module directory AC_ARG_WITH(xorg-module-dir, -- 1.7.3.5 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
[PATCH keyboard 1/5] Removed option XLeds
IMHO nobody needs because it works not correctly and still not fixed Signed-off-by: Alexandr Shadchin alexandr.shadc...@gmail.com --- man/kbd.man |7 --- src/kbd.c | 19 +-- src/xf86OSKbd.h |1 - 3 files changed, 1 insertions(+), 26 deletions(-) diff --git a/man/kbd.man b/man/kbd.man index 4fb2336..b7d57d5 100644 --- a/man/kbd.man +++ b/man/kbd.man @@ -53,13 +53,6 @@ Standard, Xqueue. Not all protocols are supported on all platforms. Default: Standard. .RE .TP 7 -.BI Option \*qXLeds\*q \*q ledlist \*q -makes the keyboard LEDs specified in -.I ledlist -available for client use instead of their traditional function -(Scroll Lock, Caps Lock and Num Lock). The numbers in the list are -in the range 1 to 3. Default: empty list. -.TP 7 .BI Option \*qXkbRules\*q \*q rules \*q specifies which XKB rules file to use for interpreting the .BR XkbModel , diff --git a/src/kbd.c b/src/kbd.c index d89d234..86b5be5 100644 --- a/src/kbd.c +++ b/src/kbd.c @@ -141,7 +141,6 @@ KbdPreInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags) #endif { KbdDevPtr pKbd; -char *s; const char **defaults; int rc = Success; @@ -187,22 +186,6 @@ KbdPreInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags) goto out; } -if ((s = xf86SetStrOption(pInfo-options, XLeds, NULL))) { -char *l, *end; -unsigned int i; -l = strtok(s, \t\n); -while (l) { - i = strtoul(l, end, 0); - if (*end == '\0') - pKbd-xledsMask |= 1L (i - 1); - else { - xf86Msg(X_ERROR, \%s\ is not a valid XLeds value, l); - } - l = strtok(NULL, \t\n); -} -free(s); -} - xkb_rules = xf86SetStrOption(pInfo-options, XkbRules, NULL); xkb_model = xf86SetStrOption(pInfo-options, XkbModel, NULL); xkb_layout = xf86SetStrOption(pInfo-options, XkbLayout, NULL); @@ -237,7 +220,7 @@ UpdateLeds(InputInfoPtr pInfo) pKbd-keyLeds MODEFLAG)leds |= XLED3; if (pKbd-keyLeds COMPOSEFLAG) leds |= XLED4; -pKbd-leds = (pKbd-leds pKbd-xledsMask) | (leds ~pKbd-xledsMask); +pKbd-leds = leds; pKbd-SetLeds(pInfo, pKbd-leds); } diff --git a/src/xf86OSKbd.h b/src/xf86OSKbd.h index cba049f..f94f177 100644 --- a/src/xf86OSKbd.h +++ b/src/xf86OSKbd.h @@ -66,7 +66,6 @@ typedef struct { PostEventProc PostEvent; unsigned long leds; -unsigned long xledsMask; unsigned long keyLeds; intscanPrefix; Bool CustomKeycodes; -- 1.7.3.5 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
[PATCH keyboard 2/5] Removed function InitKBD
Before calling InitKBD called KbdCtrl, which sets the LEDS in accordance with the ctrl-leds. Therefore, further manipulation InitKBD do not matter. Signed-off-by: Alexandr Shadchin alexandr.shadc...@gmail.com --- src/kbd.c | 53 + 1 files changed, 1 insertions(+), 52 deletions(-) diff --git a/src/kbd.c b/src/kbd.c index 86b5be5..bb1a177 100644 --- a/src/kbd.c +++ b/src/kbd.c @@ -46,8 +46,6 @@ #define SCROLLFLAG 4 #define MODEFLAG 8 #define COMPOSEFLAG16 -/* Used to know when the first DEVICE_ON after a DEVICE_INIT is called */ -#define INITFLAG (1U 31) #if GET_ABI_MAJOR(ABI_XINPUT_VERSION) 12 static InputInfoPtr KbdPreInit(InputDriverPtr drv, IDevPtr dev, int flags); @@ -59,9 +57,6 @@ static void KbdCtrl(DeviceIntPtr device, KeybdCtrl *ctrl); static void KbdBell(int percent, DeviceIntPtr dev, pointer ctrl, int unused); static void PostKbdEvent(InputInfoPtr pInfo, unsigned int key, Bool down); -static void InitKBD(InputInfoPtr pInfo, Bool init); -static void UpdateLeds(InputInfoPtr pInfo); - _X_EXPORT InputDriverRec KBD = { 1, kbd, @@ -209,22 +204,6 @@ KbdBell(int percent, DeviceIntPtr dev, pointer ctrl, int unused) } static void -UpdateLeds(InputInfoPtr pInfo) -{ -KbdDevPtr pKbd = (KbdDevPtr) pInfo-private; -unsigned long leds = 0; - -if (pKbd-keyLeds CAPSFLAG)leds |= XLED1; -if (pKbd-keyLeds NUMFLAG) leds |= XLED2; -if (pKbd-keyLeds SCROLLFLAG || -pKbd-keyLeds MODEFLAG)leds |= XLED3; -if (pKbd-keyLeds COMPOSEFLAG) leds |= XLED4; - -pKbd-leds = leds; -pKbd-SetLeds(pInfo, pKbd-leds); -} - -static void KbdCtrl( DeviceIntPtr device, KeybdCtrl *ctrl) { unsigned long leds; @@ -256,35 +235,6 @@ KbdCtrl( DeviceIntPtr device, KeybdCtrl *ctrl) pKbd-SetLeds(pInfo, pKbd-leds); } -static void -InitKBD(InputInfoPtr pInfo, Bool init) -{ - KbdDevPtr pKbd = (KbdDevPtr) pInfo-private; - - pKbd-scanPrefix = 0; - - if (init) { - pKbd-keyLeds = pKbd-GetLeds(pInfo); - UpdateLeds(pInfo); - pKbd-keyLeds |= INITFLAG; - } else { - unsigned long leds = pKbd-keyLeds; - - pKbd-keyLeds = pKbd-GetLeds(pInfo); - UpdateLeds(pInfo); - if ((pKbd-keyLeds CAPSFLAG) != - ((leds INITFLAG) ? 0 : (leds CAPSFLAG))) { - pKbd-PostEvent(pInfo, KEY_CapsLock, TRUE); - pKbd-PostEvent(pInfo, KEY_CapsLock, FALSE); - } - if ((pKbd-keyLeds NUMFLAG) != - (leds INITFLAG ? 0 : leds NUMFLAG)) { - pKbd-PostEvent(pInfo, KEY_NumLock, TRUE); - pKbd-PostEvent(pInfo, KEY_NumLock, FALSE); - } - } -} - static int KbdProc(DeviceIntPtr device, int what) { @@ -333,7 +283,6 @@ KbdProc(DeviceIntPtr device, int what) (KbdCtrlProcPtr)KbdCtrl); } #endif /* XINPUT ABI 5*/ - InitKBD(pInfo, TRUE); break; case DEVICE_ON: if (device-public.on) @@ -354,7 +303,7 @@ KbdProc(DeviceIntPtr device, int what) } device-public.on = TRUE; -InitKBD(pInfo, FALSE); +pKbd-scanPrefix = 0; break; case DEVICE_CLOSE: -- 1.7.3.5 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
[PATCH keyboard 3/5] Removed useless leds and keyLeds (members structure KbdDevRec)
Signed-off-by: Alexandr Shadchin alexandr.shadc...@gmail.com --- src/kbd.c | 31 --- src/xf86OSKbd.h |2 -- 2 files changed, 4 insertions(+), 29 deletions(-) diff --git a/src/kbd.c b/src/kbd.c index bb1a177..283c0f1 100644 --- a/src/kbd.c +++ b/src/kbd.c @@ -204,35 +204,12 @@ KbdBell(int percent, DeviceIntPtr dev, pointer ctrl, int unused) } static void -KbdCtrl( DeviceIntPtr device, KeybdCtrl *ctrl) +KbdCtrl(DeviceIntPtr device, KeybdCtrl *ctrl) { - unsigned long leds; - InputInfoPtr pInfo = (InputInfoPtr) device-public.devicePrivate; - KbdDevPtr pKbd = (KbdDevPtr) pInfo-private; +InputInfoPtr pInfo = (InputInfoPtr) device-public.devicePrivate; +KbdDevPtr pKbd = (KbdDevPtr) pInfo-private; - if ( ctrl-leds XLED1) { - pKbd-keyLeds |= CAPSFLAG; - } else { - pKbd-keyLeds = ~CAPSFLAG; - } - if ( ctrl-leds XLED2) { - pKbd-keyLeds |= NUMFLAG; - } else { - pKbd-keyLeds = ~NUMFLAG; - } - if ( ctrl-leds XLED3) { - pKbd-keyLeds |= SCROLLFLAG; - } else { - pKbd-keyLeds = ~SCROLLFLAG; - } - if ( ctrl-leds (XCOMP|XLED4) ) { - pKbd-keyLeds |= COMPOSEFLAG; - } else { - pKbd-keyLeds = ~COMPOSEFLAG; - } - leds = ctrl-leds ~(XCAPS | XNUM | XSCR); /* ??? */ - pKbd-leds = leds; - pKbd-SetLeds(pInfo, pKbd-leds); +pKbd-SetLeds(pInfo, ctrl-leds); } static int diff --git a/src/xf86OSKbd.h b/src/xf86OSKbd.h index f94f177..f948cf3 100644 --- a/src/xf86OSKbd.h +++ b/src/xf86OSKbd.h @@ -65,8 +65,6 @@ typedef struct { OpenKeyboardProc OpenKeyboard; PostEventProc PostEvent; -unsigned long leds; -unsigned long keyLeds; intscanPrefix; Bool CustomKeycodes; Bool isConsole; -- 1.7.3.5 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
[PATCH keyboard 4/5] Removed useless defines (CAPSFLAG etc.)
Signed-off-by: Alexandr Shadchin alexandr.shadc...@gmail.com --- src/kbd.c |6 -- 1 files changed, 0 insertions(+), 6 deletions(-) diff --git a/src/kbd.c b/src/kbd.c index 283c0f1..5f2aa80 100644 --- a/src/kbd.c +++ b/src/kbd.c @@ -41,12 +41,6 @@ #include xkbstr.h #include xkbsrv.h -#define CAPSFLAG 1 -#define NUMFLAG2 -#define SCROLLFLAG 4 -#define MODEFLAG 8 -#define COMPOSEFLAG16 - #if GET_ABI_MAJOR(ABI_XINPUT_VERSION) 12 static InputInfoPtr KbdPreInit(InputDriverPtr drv, IDevPtr dev, int flags); #else -- 1.7.3.5 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
[PATCH keyboard 5/5] Removed no longer needed GetLeds
Signed-off-by: Alexandr Shadchin alexandr.shadc...@gmail.com --- src/bsd_kbd.c | 39 --- src/hurd_kbd.c |7 --- src/lnx_kbd.c | 16 src/sun_kbd.c | 15 --- src/xf86OSKbd.h |2 -- 5 files changed, 0 insertions(+), 79 deletions(-) diff --git a/src/bsd_kbd.c b/src/bsd_kbd.c index 710470a..64bba88 100644 --- a/src/bsd_kbd.c +++ b/src/bsd_kbd.c @@ -101,44 +101,6 @@ SetKbdLeds(InputInfoPtr pInfo, int leds) } static int -GetKbdLeds(InputInfoPtr pInfo) -{ -KbdDevPtr pKbd = (KbdDevPtr) pInfo-private; -int leds = 0, real_leds = 0; - -switch (pKbd-consType) { - -#ifdef PCCONS_SUPPORT - case PCCONS: -break; -#endif -#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT) - case SYSCONS: - case PCVT: -ioctl(pInfo-fd, KDGETLED, real_leds); -break; -#endif -#if defined(WSCONS_SUPPORT) -case WSCONS: - ioctl(pInfo-fd, WSKBDIO_GETLEDS, real_leds); - break; -#endif -} - -#ifdef LED_CAP -if (real_leds LED_CAP) leds |= XLED1; -#endif -#ifdef LED_NUM -if (real_leds LED_NUM) leds |= XLED2; -#endif -#ifdef LED_SCR -if (real_leds LED_SCR) leds |= XLED3; -#endif - -return(leds); -} - -static int KbdOn(InputInfoPtr pInfo, int what) { KbdDevPtr pKbd = (KbdDevPtr) pInfo-private; @@ -437,7 +399,6 @@ xf86OSKbdPreInit(InputInfoPtr pInfo) pKbd-KbdOff = KbdOff; pKbd-Bell = SoundBell; pKbd-SetLeds = SetKbdLeds; -pKbd-GetLeds = GetKbdLeds; pKbd-KbdGetMapping= KbdGetMapping; pKbd-RemapScanCode = NULL; diff --git a/src/hurd_kbd.c b/src/hurd_kbd.c index 8c0cd60..5470532 100644 --- a/src/hurd_kbd.c +++ b/src/hurd_kbd.c @@ -89,12 +89,6 @@ SetKbdLeds(InputInfoPtr pInfo, int leds) return; } -static int -GetKbdLeds(InputInfoPtr pInfo) -{ -return 0; -} - static void KbdGetMapping(InputInfoPtr pInfo, KeySymsPtr pKeySyms, CARD8 *pModMap) { @@ -154,7 +148,6 @@ xf86OSKbdPreInit(InputInfoPtr pInfo) pKbd-KbdOff= KbdOff; pKbd-Bell = SoundKbdBell; pKbd-SetLeds = SetKbdLeds; -pKbd-GetLeds = GetKbdLeds; pKbd-KbdGetMapping = KbdGetMapping; pKbd-RemapScanCode = ATScancode; pKbd-OpenKeyboard = OpenKeyboard; diff --git a/src/lnx_kbd.c b/src/lnx_kbd.c index e69e1b6..e46a90e 100644 --- a/src/lnx_kbd.c +++ b/src/lnx_kbd.c @@ -67,21 +67,6 @@ SetKbdLeds(InputInfoPtr pInfo, int leds) ioctl(pInfo-fd, KDSETLED, real_leds); } -static int -GetKbdLeds(InputInfoPtr pInfo) -{ -char real_leds; -int leds = 0; - -ioctl(pInfo-fd, KDGETLED, real_leds); - -if (real_leds LED_CAP) leds |= XLED1; -if (real_leds LED_NUM) leds |= XLED2; -if (real_leds LED_SCR) leds |= XLED3; - -return(leds); -} - typedef struct { int kbdtrans; struct termios kbdtty; @@ -213,7 +198,6 @@ xf86OSKbdPreInit(InputInfoPtr pInfo) pKbd-KbdOff= KbdOff; pKbd-Bell = SoundBell; pKbd-SetLeds = SetKbdLeds; -pKbd-GetLeds = GetKbdLeds; pKbd-KbdGetMapping = KbdGetMapping; pKbd-RemapScanCode = NULL; diff --git a/src/sun_kbd.c b/src/sun_kbd.c index a240087..c5bb4d4 100644 --- a/src/sun_kbd.c +++ b/src/sun_kbd.c @@ -395,20 +395,6 @@ SetKbdLeds(InputInfoPtr pInfo, int leds) sunKbdSetLeds(pInfo, real_leds); } -static int -GetKbdLeds(InputInfoPtr pInfo) -{ -int leds = 0; -int real_leds = sunKbdGetLeds(pInfo); - -if (real_leds LED_CAPS_LOCK) leds |= XLED1; -if (real_leds LED_NUM_LOCK) leds |= XLED2; -if (real_leds LED_SCROLL_LOCK) leds |= XLED3; -if (real_leds LED_COMPOSE) leds |= XLED4; - -return leds; -} - static void CloseKeyboard(InputInfoPtr pInfo) { @@ -511,7 +497,6 @@ xf86OSKbdPreInit(InputInfoPtr pInfo) pKbd-KbdOff= KbdOff; pKbd-Bell = SoundKbdBell; pKbd-SetLeds = SetKbdLeds; -pKbd-GetLeds = GetKbdLeds; pKbd-KbdGetMapping = KbdGetMapping; pKbd-RemapScanCode = NULL; diff --git a/src/xf86OSKbd.h b/src/xf86OSKbd.h index f948cf3..a9ed255 100644 --- a/src/xf86OSKbd.h +++ b/src/xf86OSKbd.h @@ -39,7 +39,6 @@ typedef int (*KbdOffProc)(InputInfoPtr pInfo, int what); typedefvoid(*BellProc)(InputInfoPtr pInfo, int loudness, int pitch, int duration); typedefvoid(*SetLedsProc)(InputInfoPtr pInfo, int leds); -typedefint (*GetLedsProc)(InputInfoPtr pInfo); typedefvoid(*KbdGetMappingProc)(InputInfoPtr pInfo, KeySymsPtr pKeySyms, CARD8* pModMap); typedefint (*RemapScanCodeProc)(InputInfoPtr pInfo, int *scanCode); @@ -58,7 +57,6 @@ typedef struct { KbdOffProc KbdOff; BellProc Bell; SetLedsProcSetLeds; -GetLedsProcGetLeds
[PATCH keyboard v2] Cleanup set the value of CustomKeycodes
Also, do not print values of variables CustomKeycodes twice. Signed-off-by: Alexandr Shadchin alexandr.shadc...@gmail.com --- src/bsd_kbd.c |1 - src/hurd_kbd.c |1 - src/kbd.c | 15 ++- src/sun_kbd.c |2 -- 4 files changed, 2 insertions(+), 17 deletions(-) diff --git a/src/bsd_kbd.c b/src/bsd_kbd.c index 127b6ab..1e432fd 100644 --- a/src/bsd_kbd.c +++ b/src/bsd_kbd.c @@ -444,7 +444,6 @@ xf86OSKbdPreInit(InputInfoPtr pInfo) pKbd-RemapScanCode = NULL; pKbd-OpenKeyboard = OpenKeyboard; -pKbd-CustomKeycodes = FALSE; pKbd-private = calloc(sizeof(BsdKbdPrivRec), 1); if (pKbd-private == NULL) { diff --git a/src/hurd_kbd.c b/src/hurd_kbd.c index dde5fbb..8c0cd60 100644 --- a/src/hurd_kbd.c +++ b/src/hurd_kbd.c @@ -158,7 +158,6 @@ xf86OSKbdPreInit(InputInfoPtr pInfo) pKbd-KbdGetMapping = KbdGetMapping; pKbd-RemapScanCode = ATScancode; pKbd-OpenKeyboard = OpenKeyboard; -pKbd-CustomKeycodes = FALSE; pKbd-private = NULL; pInfo-read_input = ReadInput; return TRUE; diff --git a/src/kbd.c b/src/kbd.c index f4b51ff..624545a 100644 --- a/src/kbd.c +++ b/src/kbd.c @@ -89,7 +89,6 @@ static const char *kbdDefaults[] = { XkbRules,base, XkbModel,pc105, XkbLayout, us, -CustomKeycodes, off, NULL }; @@ -102,7 +101,6 @@ static const char *kbd98Defaults[] = { XkbRules,xfree98, XkbModel,pc98, XkbLayout, jp, -CustomKeycodes, off, NULL }; @@ -151,7 +149,6 @@ KbdPreInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags) #endif { KbdDevPtr pKbd; -MessageType from = X_DEFAULT; char *s; const char **defaults; int rc = Success; @@ -220,16 +217,8 @@ KbdPreInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags) xkb_variant = xf86SetStrOption(pInfo-options, XkbVariant, NULL); xkb_options = xf86SetStrOption(pInfo-options, XkbOptions, NULL); - pKbd-CustomKeycodes = FALSE; - from = X_DEFAULT; - if (xf86FindOption(pInfo-options, CustomKeycodes)) { - pKbd-CustomKeycodes = xf86SetBoolOption(pInfo-options, CustomKeycodes, - pKbd-CustomKeycodes); - from = X_CONFIG; - } - - xf86Msg(from, %s: CustomKeycodes %s\n, - pInfo-name, pKbd-CustomKeycodes ? enabled : disabled); +pKbd-CustomKeycodes = xf86SetBoolOption(pInfo-options, CustomKeycodes, + FALSE); out: return rc; diff --git a/src/sun_kbd.c b/src/sun_kbd.c index 05d1bd9..a240087 100644 --- a/src/sun_kbd.c +++ b/src/sun_kbd.c @@ -518,8 +518,6 @@ xf86OSKbdPreInit(InputInfoPtr pInfo) pKbd-OpenKeyboard = OpenKeyboard; -pKbd-CustomKeycodes = FALSE; - pKbd-private = calloc(sizeof(sunKbdPrivRec), 1); if (pKbd-private == NULL) { xf86Msg(X_ERROR,can't allocate keyboard OS private data\n); -- 1.7.3.5 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
Re: [PATCH keyboard 2/4] Cleanup set the value of CustomKeycodes
On Thu, Feb 17, 2011 at 08:32:31AM +1000, Peter Hutterer wrote: On Mon, Feb 14, 2011 at 12:45:39PM +0500, Alexandr Shadchin wrote: On Mon, Feb 14, 2011 at 10:11:02AM +1000, Peter Hutterer wrote: On Fri, Feb 11, 2011 at 03:32:58PM +0500, Alexandr Shadchin wrote: Also, do not print values of variables CustomKeycodes twice. Signed-off-by: Alexandr Shadchin alexandr.shadc...@gmail.com --- src/bsd_kbd.c |1 - src/hurd_kbd.c |1 - src/kbd.c | 13 ++--- src/sun_kbd.c |2 -- 4 files changed, 2 insertions(+), 15 deletions(-) diff --git a/src/bsd_kbd.c b/src/bsd_kbd.c index 127b6ab..1e432fd 100644 --- a/src/bsd_kbd.c +++ b/src/bsd_kbd.c @@ -444,7 +444,6 @@ xf86OSKbdPreInit(InputInfoPtr pInfo) pKbd-RemapScanCode = NULL; pKbd-OpenKeyboard = OpenKeyboard; -pKbd-CustomKeycodes = FALSE; pKbd-private = calloc(sizeof(BsdKbdPrivRec), 1); if (pKbd-private == NULL) { diff --git a/src/hurd_kbd.c b/src/hurd_kbd.c index dde5fbb..8c0cd60 100644 --- a/src/hurd_kbd.c +++ b/src/hurd_kbd.c @@ -158,7 +158,6 @@ xf86OSKbdPreInit(InputInfoPtr pInfo) pKbd-KbdGetMapping = KbdGetMapping; pKbd-RemapScanCode = ATScancode; pKbd-OpenKeyboard = OpenKeyboard; -pKbd-CustomKeycodes = FALSE; pKbd-private = NULL; pInfo-read_input = ReadInput; return TRUE; diff --git a/src/kbd.c b/src/kbd.c index f4b51ff..f5cecbb 100644 --- a/src/kbd.c +++ b/src/kbd.c @@ -151,7 +151,6 @@ KbdPreInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags) #endif { KbdDevPtr pKbd; -MessageType from = X_DEFAULT; char *s; const char **defaults; int rc = Success; @@ -220,16 +219,8 @@ KbdPreInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags) xkb_variant = xf86SetStrOption(pInfo-options, XkbVariant, NULL); xkb_options = xf86SetStrOption(pInfo-options, XkbOptions, NULL); - pKbd-CustomKeycodes = FALSE; - from = X_DEFAULT; - if (xf86FindOption(pInfo-options, CustomKeycodes)) { - pKbd-CustomKeycodes = xf86SetBoolOption(pInfo-options, CustomKeycodes, - pKbd-CustomKeycodes); - from = X_CONFIG; - } - - xf86Msg(from, %s: CustomKeycodes %s\n, - pInfo-name, pKbd-CustomKeycodes ? enabled : disabled); +pKbd-CustomKeycodes = xf86SetBoolOption(pInfo-options, CustomKeycodes, + NULL); NULL is a rather unusual choice for a boolean. ACK otherwise though. Cheers, Peter Before calling xf86SetBoolOption(pInfo-options, CustomKeycodes, NULL) we've done xf86CollectInputOptions(pInfo, defaults). defaults = kbdDefaults or kbd98Defaults static const char *kbdDefaults[] = { Protocol, standard, XkbRules, base, XkbModel, pc105, XkbLayout,us, CustomKeycodes, off, set by default NULL }; static const char *kbd98Defaults[] = { Protocol, standard, XkbRules, xfree98, XkbModel, pc98, XkbLayout,jp, CustomKeycodes, off, set by default NULL }; Thus the value of CustomKeycodes when calling xf86SetBoolOption will already be set (by default or from the config) and xf86SetBoolOption can not return NULL. Indeed replacement of NULL will add clarity, but functionally not change anything. What is your opinion on this issue? sorry, swamped. my comment was merely stating that instead of NULL we should use FALSE. no functional change, but makes more sense when reading the code. Cheers, Peter I totally agree. I did not immediately realize :-) -- Alexandr Shadchin ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
Re: [PATCH setxkbmap] Eliminate limitations on path length.
/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel -- Alexandr Shadchin ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
Re: [PATCH setxkbmap] Eliminate limitations on path length.
Of course, I'm talking about it. The implementation is up to you. :-) On Wed, Feb 16, 2011 at 01:23:06AM +0300, Van de Bugger wrote: No. I believe that is wrong approach. I suppose fopen does not crash if path too long but returns appropriate error, so we just should check result of fopen carefuly, and issue appropriate error message (using errno and strerror). On Wed, 2011-02-16 at 02:56 +0500, Alexandr Shadchin wrote: Also fopen() can not open path greater than PATH_MAX. Path still need to verify that it was less than PATH_MAX. On Wed, Feb 16, 2011 at 12:15:52AM +0300, Van de Bugger wrote: From 0aaae5b3c0d6183e2791c30155bae40132a0c779 Mon Sep 17 00:00:00 2001 From: Van de Bugger van.de.bug...@gmail.com Date: Tue, 15 Feb 2011 23:55:28 +0300 Subject: [PATCH setxkbmap] Eliminate limitations on path length. ...by using dynamically allocated buffers. No need in PATH_MAX, MAXPATHLEN. No more Path too long errors. --- setxkbmap.c | 72 -- 1 files changed, 45 insertions(+), 27 deletions(-) diff --git a/setxkbmap.c b/setxkbmap.c index 3d3b7d8..6777b1b 100644 --- a/setxkbmap.c +++ b/setxkbmap.c @@ -24,6 +24,7 @@ / +#include stdarg.h #include stdio.h #include stdlib.h #include locale.h @@ -36,14 +37,6 @@ #include X11/extensions/XKBconfig.h #include X11/extensions/XKBrules.h -#ifndef PATH_MAX -#ifdef MAXPATHLEN -#define PATH_MAX MAXPATHLEN -#else -#define PATH_MAX 1024 -#endif -#endif - #ifndef DFLT_XKB_CONFIG_ROOT #define DFLT_XKB_CONFIG_ROOT /usr/share/X11/xkb #endif @@ -170,6 +163,7 @@ static int deviceSpec = XkbUseCoreKbd; /******/ +char * rprintf( char const * format, ... ); Bool addToList(list_t * list, char *newVal); void usage(int argc, char **argv); void dumpNames(Bool wantRules, Bool wantCNames); @@ -189,6 +183,42 @@ void printKeymap(void); /******/ /* +Like sprintf, but returns freshly allocated string instead writing it to +pre-allocated buffer. Do not forget to free returned strung. +*/ + +char * +rprintf(char const * format, ...) +{ +va_list args; +char * buffer = NULL; +int allocated = 0; +int required = 100; +do +{ +buffer = realloc(buffer, required + 1); +if (buffer == NULL) +{ +ERR(Out of memory.\n); +abort(); +} +allocated = required + 1; +va_start(args, format); +required = vsnprintf(buffer, allocated, format, args); +va_end(args); +if (required 0) +{ +ERR1(`vsnprintf' returned unexpected error (%d).\n, required); +abort(); +} +} +while (required = allocated); +return buffer; +} + +/******/ + +/* If newVal is NULL or empty string, the list is cleared. Otherwise newVal is added to the end of the list (if it is not present in the list yet). */ @@ -623,7 +653,6 @@ FILE * findFileInPath(char *name, char *subdir) { register int i; -char buf[PATH_MAX]; FILE *fp; if (name[0] == '/') @@ -635,16 +664,11 @@ findFileInPath(char *name, char *subdir) } for (i = 0; (i inclPath.num); i++) { -if (snprintf(buf, PATH_MAX, %s/%s%s, inclPath.item[i], subdir, name) = -PATH_MAX) -{ -VMSG3(0, Path too long (%s/%s%s). Ignored.\n, inclPath.item[i], - subdir, name); -continue; -} -fp = fopen(buf, r); +char * path = rprintf(%s/%s%s, inclPath.item[i], subdir, name); +fp = fopen(path, r); if ((verbose 7) || ((!fp) (verbose 5))) -MSG2(%s file %s\n, (fp ? Found : Didn't find), buf); +MSG2(%s file %s\n, (fp ? Found : Didn't find), path); +free(path); if (fp != NULL) return fp; } @@ -824,7 +848,6 @@ applyRules(void) if (settings.model.src || settings.layout.src || settings.variant.src || options.item) { -char buf[PATH_MAX]; XkbComponentNamesRec rnames; if (settings.variant.src settings.layout.src) @@ -852,14 +875,9 @@ applyRules(void) * we succeed with */ for (i = 0; (i inclPath.num) (!rules); i++) { -if (snprintf(buf, PATH_MAX, %s/rules/%s
Re: [PATCH keyboard 2/4] Cleanup set the value of CustomKeycodes
On Mon, Feb 14, 2011 at 10:11:02AM +1000, Peter Hutterer wrote: On Fri, Feb 11, 2011 at 03:32:58PM +0500, Alexandr Shadchin wrote: Also, do not print values of variables CustomKeycodes twice. Signed-off-by: Alexandr Shadchin alexandr.shadc...@gmail.com --- src/bsd_kbd.c |1 - src/hurd_kbd.c |1 - src/kbd.c | 13 ++--- src/sun_kbd.c |2 -- 4 files changed, 2 insertions(+), 15 deletions(-) diff --git a/src/bsd_kbd.c b/src/bsd_kbd.c index 127b6ab..1e432fd 100644 --- a/src/bsd_kbd.c +++ b/src/bsd_kbd.c @@ -444,7 +444,6 @@ xf86OSKbdPreInit(InputInfoPtr pInfo) pKbd-RemapScanCode = NULL; pKbd-OpenKeyboard = OpenKeyboard; -pKbd-CustomKeycodes = FALSE; pKbd-private = calloc(sizeof(BsdKbdPrivRec), 1); if (pKbd-private == NULL) { diff --git a/src/hurd_kbd.c b/src/hurd_kbd.c index dde5fbb..8c0cd60 100644 --- a/src/hurd_kbd.c +++ b/src/hurd_kbd.c @@ -158,7 +158,6 @@ xf86OSKbdPreInit(InputInfoPtr pInfo) pKbd-KbdGetMapping = KbdGetMapping; pKbd-RemapScanCode = ATScancode; pKbd-OpenKeyboard = OpenKeyboard; -pKbd-CustomKeycodes = FALSE; pKbd-private = NULL; pInfo-read_input = ReadInput; return TRUE; diff --git a/src/kbd.c b/src/kbd.c index f4b51ff..f5cecbb 100644 --- a/src/kbd.c +++ b/src/kbd.c @@ -151,7 +151,6 @@ KbdPreInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags) #endif { KbdDevPtr pKbd; -MessageType from = X_DEFAULT; char *s; const char **defaults; int rc = Success; @@ -220,16 +219,8 @@ KbdPreInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags) xkb_variant = xf86SetStrOption(pInfo-options, XkbVariant, NULL); xkb_options = xf86SetStrOption(pInfo-options, XkbOptions, NULL); - pKbd-CustomKeycodes = FALSE; - from = X_DEFAULT; - if (xf86FindOption(pInfo-options, CustomKeycodes)) { - pKbd-CustomKeycodes = xf86SetBoolOption(pInfo-options, CustomKeycodes, - pKbd-CustomKeycodes); - from = X_CONFIG; - } - - xf86Msg(from, %s: CustomKeycodes %s\n, - pInfo-name, pKbd-CustomKeycodes ? enabled : disabled); +pKbd-CustomKeycodes = xf86SetBoolOption(pInfo-options, CustomKeycodes, + NULL); NULL is a rather unusual choice for a boolean. ACK otherwise though. Cheers, Peter Before calling xf86SetBoolOption(pInfo-options, CustomKeycodes, NULL) we've done xf86CollectInputOptions(pInfo, defaults). defaults = kbdDefaults or kbd98Defaults static const char *kbdDefaults[] = { Protocol, standard, XkbRules, base, XkbModel, pc105, XkbLayout,us, CustomKeycodes, off, set by default NULL }; static const char *kbd98Defaults[] = { Protocol, standard, XkbRules, xfree98, XkbModel, pc98, XkbLayout,jp, CustomKeycodes, off, set by default NULL }; Thus the value of CustomKeycodes when calling xf86SetBoolOption will already be set (by default or from the config) and xf86SetBoolOption can not return NULL. Indeed replacement of NULL will add clarity, but functionally not change anything. What is your opinion on this issue? -- Alexandr Shadchin ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
[PATCH keyboard 1/4] lnx: Fix detect CustomKeycodes for __powerpc__
Signed-off-by: Alexandr Shadchin alexandr.shadc...@gmail.com --- src/lnx_kbd.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/src/lnx_kbd.c b/src/lnx_kbd.c index 63b51d9..5292f77 100644 --- a/src/lnx_kbd.c +++ b/src/lnx_kbd.c @@ -233,7 +233,7 @@ xf86OSKbdPreInit(InputInfoPtr pInfo) f = fopen(/proc/sys/dev/mac_hid/keyboard_sends_linux_keycodes,r); if (f) { if (fgetc(f) == '0') -pKbd-CustomKeycodes = TRUE; +xf86ReplaceBoolOption(pInfo-options, CustomKeycodes, TRUE); fclose(f); } } -- 1.7.3.5 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
[PATCH keyboard 2/4] Cleanup set the value of CustomKeycodes
Also, do not print values of variables CustomKeycodes twice. Signed-off-by: Alexandr Shadchin alexandr.shadc...@gmail.com --- src/bsd_kbd.c |1 - src/hurd_kbd.c |1 - src/kbd.c | 13 ++--- src/sun_kbd.c |2 -- 4 files changed, 2 insertions(+), 15 deletions(-) diff --git a/src/bsd_kbd.c b/src/bsd_kbd.c index 127b6ab..1e432fd 100644 --- a/src/bsd_kbd.c +++ b/src/bsd_kbd.c @@ -444,7 +444,6 @@ xf86OSKbdPreInit(InputInfoPtr pInfo) pKbd-RemapScanCode = NULL; pKbd-OpenKeyboard = OpenKeyboard; -pKbd-CustomKeycodes = FALSE; pKbd-private = calloc(sizeof(BsdKbdPrivRec), 1); if (pKbd-private == NULL) { diff --git a/src/hurd_kbd.c b/src/hurd_kbd.c index dde5fbb..8c0cd60 100644 --- a/src/hurd_kbd.c +++ b/src/hurd_kbd.c @@ -158,7 +158,6 @@ xf86OSKbdPreInit(InputInfoPtr pInfo) pKbd-KbdGetMapping = KbdGetMapping; pKbd-RemapScanCode = ATScancode; pKbd-OpenKeyboard = OpenKeyboard; -pKbd-CustomKeycodes = FALSE; pKbd-private = NULL; pInfo-read_input = ReadInput; return TRUE; diff --git a/src/kbd.c b/src/kbd.c index f4b51ff..f5cecbb 100644 --- a/src/kbd.c +++ b/src/kbd.c @@ -151,7 +151,6 @@ KbdPreInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags) #endif { KbdDevPtr pKbd; -MessageType from = X_DEFAULT; char *s; const char **defaults; int rc = Success; @@ -220,16 +219,8 @@ KbdPreInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags) xkb_variant = xf86SetStrOption(pInfo-options, XkbVariant, NULL); xkb_options = xf86SetStrOption(pInfo-options, XkbOptions, NULL); - pKbd-CustomKeycodes = FALSE; - from = X_DEFAULT; - if (xf86FindOption(pInfo-options, CustomKeycodes)) { - pKbd-CustomKeycodes = xf86SetBoolOption(pInfo-options, CustomKeycodes, - pKbd-CustomKeycodes); - from = X_CONFIG; - } - - xf86Msg(from, %s: CustomKeycodes %s\n, - pInfo-name, pKbd-CustomKeycodes ? enabled : disabled); +pKbd-CustomKeycodes = xf86SetBoolOption(pInfo-options, CustomKeycodes, + NULL); out: return rc; diff --git a/src/sun_kbd.c b/src/sun_kbd.c index 05d1bd9..a240087 100644 --- a/src/sun_kbd.c +++ b/src/sun_kbd.c @@ -518,8 +518,6 @@ xf86OSKbdPreInit(InputInfoPtr pInfo) pKbd-OpenKeyboard = OpenKeyboard; -pKbd-CustomKeycodes = FALSE; - pKbd-private = calloc(sizeof(sunKbdPrivRec), 1); if (pKbd-private == NULL) { xf86Msg(X_ERROR,can't allocate keyboard OS private data\n); -- 1.7.3.5 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
[PATCH keyboard 3/4] Remove unused XQUEUE
Signed-off-by: Alexandr Shadchin alexandr.shadc...@gmail.com --- src/kbd.c |8 1 files changed, 0 insertions(+), 8 deletions(-) diff --git a/src/kbd.c b/src/kbd.c index f5cecbb..26e8e5d 100644 --- a/src/kbd.c +++ b/src/kbd.c @@ -81,11 +81,7 @@ _X_EXPORT InputDriverRec KEYBOARD = { }; static const char *kbdDefaults[] = { -#ifdef XQUEUE -Protocol,Xqueue, -#else Protocol,standard, -#endif XkbRules,base, XkbModel,pc105, XkbLayout, us, @@ -94,11 +90,7 @@ static const char *kbdDefaults[] = { }; static const char *kbd98Defaults[] = { -#ifdef XQUEUE -Protocol,Xqueue, -#else Protocol,standard, -#endif XkbRules,xfree98, XkbModel,pc98, XkbLayout, jp, -- 1.7.3.5 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
[PATCH keyboard 4/4] Do not print values of Protocol twice
Signed-off-by: Alexandr Shadchin alexandr.shadc...@gmail.com --- src/bsd_kbd.c |1 - src/lnx_kbd.c |1 - 2 files changed, 0 insertions(+), 2 deletions(-) diff --git a/src/bsd_kbd.c b/src/bsd_kbd.c index 1e432fd..710470a 100644 --- a/src/bsd_kbd.c +++ b/src/bsd_kbd.c @@ -357,7 +357,6 @@ OpenKeyboard(InputInfoPtr pInfo) free(s); return FALSE; } -xf86Msg(X_CONFIG, %s: Protocol: %s\n, pInfo-name, s); free(s); s = xf86SetStrOption(pInfo-options, Device, NULL); diff --git a/src/lnx_kbd.c b/src/lnx_kbd.c index 5292f77..e69e1b6 100644 --- a/src/lnx_kbd.c +++ b/src/lnx_kbd.c @@ -183,7 +183,6 @@ OpenKeyboard(InputInfoPtr pInfo) return FALSE; } -xf86Msg(X_CONFIG, %s: Protocol: %s\n, pInfo-name, s); free(s); s = xf86SetStrOption(pInfo-options, Device, NULL); -- 1.7.3.5 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
Re: [PATCH xkbcomp 2/2] Fix incorrect processing of char(0xff) in comments
On Sun, Jan 16, 2011 at 4:27 PM, Dirk Wallenstein hals...@t-online.de wrote: On Sun, Jan 16, 2011 at 01:26:10AM +0500, Alexandr Shadchin wrote: If type readBuf is char, then scanchar() return -1 for char(0xFF) and EOF. If type readBuf is unsigned char, then scanchar() return 0xFF for char(0xFF) and -1 for EOF. NAK: I assume you want to correct the case when returning EOF stored inside of readBuf? This would now return EOF as 0x00ff but EOF is a negative value. All parts that access readBuf work with signed values. You are wrong. EOF(value -1) returned if readBufLen == 0. EOF not stored inside of readBuf (1 patch). Signed-off-by: Alexandr Shadchin alexandr.shadc...@gmail.com --- xkbscan.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/xkbscan.c b/xkbscan.c index 6d3678e..2620a07 100644 --- a/xkbscan.c +++ b/xkbscan.c @@ -49,7 +49,7 @@ char scanBuf[1024]; static int scanStrLine = 0; #define BUFSIZE 4096 -static char readBuf[BUFSIZE]; +static unsigned char readBuf[BUFSIZE]; static int readBufPos = 0; static int readBufLen = 0; -- 1.7.3.5 -- Greetings, Dirk -- Alexandr Shadchin ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
[PATCH xkbcomp 1/2] Removing unnecessary and unsafe code in scanchar()
If readBufLen == BUFSIZE and feof() != 0, then go outside the boundaries of buffer. Signed-off-by: Alexandr Shadchin alexandr.shadc...@gmail.com --- xkbscan.c |2 -- 1 files changed, 0 insertions(+), 2 deletions(-) diff --git a/xkbscan.c b/xkbscan.c index 03193e2..6d3678e 100644 --- a/xkbscan.c +++ b/xkbscan.c @@ -277,8 +277,6 @@ scanchar(void) readBufPos = 0; if (!readBufLen) return EOF; -if (feof(yyin)) -readBuf[readBufLen] = EOF; } return readBuf[readBufPos++]; -- 1.7.3.5 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
[PATCH xkbcomp 2/2] Fix incorrect processing of char(0xff) in comments
If type readBuf is char, then scanchar() return -1 for char(0xFF) and EOF. If type readBuf is unsigned char, then scanchar() return 0xFF for char(0xFF) and -1 for EOF. Signed-off-by: Alexandr Shadchin alexandr.shadc...@gmail.com --- xkbscan.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/xkbscan.c b/xkbscan.c index 6d3678e..2620a07 100644 --- a/xkbscan.c +++ b/xkbscan.c @@ -49,7 +49,7 @@ char scanBuf[1024]; static int scanStrLine = 0; #defineBUFSIZE 4096 -static char readBuf[BUFSIZE]; +static unsigned char readBuf[BUFSIZE]; static int readBufPos = 0; static int readBufLen = 0; -- 1.7.3.5 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
Re: [PATCH keyboard] Remove random History comment and OS_KBD_VERSION_CURRENT
On Mon, Jan 10, 2011 at 5:01 AM, Peter Hutterer peter.hutte...@who-t.net wrote: On Sat, Jan 08, 2011 at 05:08:41PM +0500, Alexandr Shadchin wrote: In xf86-input-mouse similar cleanup already done, can also make for keyboard? Signed-off-by: Alexandr Shadchin alexandr.shadc...@gmail.com --- src/xf86OSKbd.h | 18 -- 1 files changed, 0 insertions(+), 18 deletions(-) diff --git a/src/xf86OSKbd.h b/src/xf86OSKbd.h index 561bf89..dc8219a 100644 --- a/src/xf86OSKbd.h +++ b/src/xf86OSKbd.h @@ -97,21 +97,3 @@ typedef struct { } KbdProtocolRec; Bool xf86OSKbdPreInit(InputInfoPtr pInfo); - -/* Adjust this when the kbd interface changes. */ - -/* - * History: - * - * 1.0.0 - Initial version. - */ - -#define OS_KBD_VERSION_MAJOR 1 -#define OS_KBD_VERSION_MINOR 0 -#define OS_KBD_VERSION_PATCH 0 - -#define OS_KBD_VERSION_CURRENT \ - BUILTIN_INTERFACE_VERSION_NUMERIC(OS_KBD_VERSION_MAJOR, \ - OS_KBD_VERSION_MINOR, \ - OS_KBD_VERSION_PATCH) - -- 1.7.3.5 applied, thanks. a suggestion for the future - please send patchsets numbered, as one thread, it's a lot easier to go through the patches and apply them in-order or even to find a specific set of patches in an overcrowded inbox. Cheers, Peter Thanks for the tip, I will keep in mind. -- Alexandr Shadchin ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
Re: [PATCH keyboard] Fix detect CustomKeycodes = True for Linux ifdef __powerpc__
On Mon, Jan 10, 2011 at 4:59 AM, Peter Hutterer peter.hutte...@who-t.net wrote: On Sat, Jan 08, 2011 at 05:42:18PM +0500, Alexandr Shadchin wrote: either to remove the block ifdef __powerpc__ in lnx_kbd.c because it is meaningless. why not just replace the one instance where CustomKeycodes is set to TRUE with the call to xf86AddNewOption()? so pKbd-CustomKeycodes always comes from the option and we can remove pretty much all other instances. Cheers, Peter Great idea, thanks Signed-off-by: Alexandr Shadchin alexandr.shadc...@gmail.com --- src/kbd.c | 8 +--- src/lnx_kbd.c | 2 ++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/kbd.c b/src/kbd.c index f4b51ff..b261b2b 100644 --- a/src/kbd.c +++ b/src/kbd.c @@ -89,7 +89,6 @@ static const char *kbdDefaults[] = { XkbRules, base, XkbModel, pc105, XkbLayout, us, - CustomKeycodes, off, NULL }; @@ -102,7 +101,6 @@ static const char *kbd98Defaults[] = { XkbRules, xfree98, XkbModel, pc98, XkbLayout, jp, - CustomKeycodes, off, NULL }; @@ -193,6 +191,11 @@ KbdPreInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags) goto out; } + if (!xf86FindOption(pInfo-options, CustomKeycodes)) { + xf86AddNewOption(pInfo-options, CustomKeycodes, + pKbd-CustomKeycodes ? on : off); + } + if (!pKbd-OpenKeyboard(pInfo)) { rc = BadMatch; goto out; @@ -220,7 +223,6 @@ KbdPreInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags) xkb_variant = xf86SetStrOption(pInfo-options, XkbVariant, NULL); xkb_options = xf86SetStrOption(pInfo-options, XkbOptions, NULL); - pKbd-CustomKeycodes = FALSE; from = X_DEFAULT; if (xf86FindOption(pInfo-options, CustomKeycodes)) { pKbd-CustomKeycodes = xf86SetBoolOption(pInfo-options, CustomKeycodes, diff --git a/src/lnx_kbd.c b/src/lnx_kbd.c index 63b51d9..81e24ec 100644 --- a/src/lnx_kbd.c +++ b/src/lnx_kbd.c @@ -221,6 +221,8 @@ xf86OSKbdPreInit(InputInfoPtr pInfo) pKbd-OpenKeyboard = OpenKeyboard; + pKbd-CustomKeycodes = FALSE; + pKbd-private = calloc(sizeof(LnxKbdPrivRec), 1); if (pKbd-private == NULL) { xf86Msg(X_ERROR,can't allocate keyboard OS private data\n); -- 1.7.3.5 -- Alexandr Shadchin ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
[PATCH keyboard] Fix detect CustomKeycodes = True for Linux ifdef __powerpc__
either to remove the block ifdef __powerpc__ in lnx_kbd.c because it is meaningless. Signed-off-by: Alexandr Shadchin alexandr.shadc...@gmail.com --- src/kbd.c |8 +--- src/lnx_kbd.c |2 ++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/kbd.c b/src/kbd.c index f4b51ff..b261b2b 100644 --- a/src/kbd.c +++ b/src/kbd.c @@ -89,7 +89,6 @@ static const char *kbdDefaults[] = { XkbRules,base, XkbModel,pc105, XkbLayout, us, -CustomKeycodes, off, NULL }; @@ -102,7 +101,6 @@ static const char *kbd98Defaults[] = { XkbRules,xfree98, XkbModel,pc98, XkbLayout, jp, -CustomKeycodes, off, NULL }; @@ -193,6 +191,11 @@ KbdPreInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags) goto out; } +if (!xf86FindOption(pInfo-options, CustomKeycodes)) { +xf86AddNewOption(pInfo-options, CustomKeycodes, + pKbd-CustomKeycodes ? on : off); +} + if (!pKbd-OpenKeyboard(pInfo)) { rc = BadMatch; goto out; @@ -220,7 +223,6 @@ KbdPreInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags) xkb_variant = xf86SetStrOption(pInfo-options, XkbVariant, NULL); xkb_options = xf86SetStrOption(pInfo-options, XkbOptions, NULL); - pKbd-CustomKeycodes = FALSE; from = X_DEFAULT; if (xf86FindOption(pInfo-options, CustomKeycodes)) { pKbd-CustomKeycodes = xf86SetBoolOption(pInfo-options, CustomKeycodes, diff --git a/src/lnx_kbd.c b/src/lnx_kbd.c index 63b51d9..81e24ec 100644 --- a/src/lnx_kbd.c +++ b/src/lnx_kbd.c @@ -221,6 +221,8 @@ xf86OSKbdPreInit(InputInfoPtr pInfo) pKbd-OpenKeyboard = OpenKeyboard; +pKbd-CustomKeycodes = FALSE; + pKbd-private = calloc(sizeof(LnxKbdPrivRec), 1); if (pKbd-private == NULL) { xf86Msg(X_ERROR,can't allocate keyboard OS private data\n); -- 1.7.3.5 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel