Re: synaptics: two-finger scrolling and coasting

2016-04-22 Thread Alexandr Shadchin
On Fri, Apr 22, 2016 at 05:24:29AM +0200, Sebastien Marie wrote:
> On Thu, Apr 21, 2016 at 09:36:33PM +0200, Ulf Brosziewski wrote:
> > Ping?
> > 
> > It isn't a severe bug and it doesn't concern a spectacular feature,
> > but shouldn't we fix it?
> > 
> 
> I run it too since 1 week I think, and I don't see any problem (I forgot
> it :) ).
> 
> I am OK with it, but as I am not really competent in this area you
> shouldn't take my OK as really authoritative :)
> 
> Thanks.
> -- 
> Sebastien Marie
> 

Also no regress, ok shadchin@

-- 
Alexandr Shadchin



Re: multitouch support again

2016-03-27 Thread Alexandr Shadchin
On Sat, Mar 26, 2016 at 10:37:08PM +0100, Martin Pieuchot wrote:
> On 25/03/16(Fri) 13:23, Ulf Brosziewski wrote:
> > Again, my mail client insisted on the "flowed" text format,
> > sorry. Here is a clean version of the diff.
> 
> Tested with:
> 
>   pms0: Synaptics clickpad, firmware 8.0
> 
> In think this should go in, then we can polish it in-tree and wait for
> regression before converting mice.
> 
> ok mpi@
> 

Also tested with:
 pms0: Synaptics touchpad, firmware 7.4

I support, ok shadchin@

-- 
Alexandr Shadchin



Re: Detect more keyboard cases when starting X

2015-12-26 Thread Alexandr Shadchin
On Fri, Dec 25, 2015 at 05:55:22PM -0700, Anthony J. Bentley wrote:
> Hi,
> 
> As X starts, it will attempt to detect features from the kbd(8)
> setting--for example, us.dvorak will enable dvorak in X, and
> fr.dvorak will enable French dvorak in X. However, it detects
> these features with equality checks, which will fail if multiple
> options are set, as in the case of us.dvorak.swapctrlcaps or
> fr.dvorak.swapctrlcaps.
> 
> Instead of checking for equality, this diff instead checks if the
> bits are set. Now us.dvorak.swapctrlcaps and fr.dvorak.swapctrlcaps
> work, us.swapctrlcaps.iopener swaps ctrl/caps, and the ones that
> already worked (de.nodead, etc) still do.
> 
> This was reported on misc@ by "Sevan / Venture37" back in June.
> 
> ok?
> 

ok shadchin@

> Index: config/wscons.c
> ===
> RCS file: /cvs/xenocara/xserver/config/wscons.c,v
> retrieving revision 1.14
> diff -u -p -r1.14 wscons.c
> --- config/wscons.c   15 Jan 2015 01:30:40 -  1.14
> +++ config/wscons.c   25 Dec 2015 21:37:21 -
> @@ -139,7 +139,7 @@ wscons_add_keyboard(void)
>  break;
>  }
>  for (i = 0; kbdvar[i].val; i++)
> -if (wsenc == kbdvar[i].val || KB_VARIANT(wsenc) == kbdvar[i].val) {
> +if ((wsenc & kbdvar[i].val) == kbdvar[i].val) {
>  LogMessageVerb(X_INFO, 3, "wskbd: using variant %s\n",
> kbdvar[i].name);
>  input_options = input_option_new(input_options,
> @@ -147,7 +147,7 @@ wscons_add_keyboard(void)
>  break;
>  }
>  for (i = 0; kbdopt[i].val; i++)
> -if (KB_VARIANT(wsenc) == kbdopt[i].val) {
> +if (KB_VARIANT(wsenc) & kbdopt[i].val) {
>  LogMessageVerb(X_INFO, 3, "wskbd: using option %s\n",
> kbdopt[i].name);
>  input_options = input_option_new(input_options,
> 

-- 
Alexandr Shadchin



Fix casin(3)

2015-11-27 Thread Alexandr Shadchin
Fix wrong answer if the imaginary part is zero.
NetBSD also turn off this piece of code.

See
http://en.cppreference.com/w/c/numeric/complex/casin
http://www.wolframalpha.com/input/?i=asin%28-2.0%29

-- 
Alexandr Shadchin

Index: s_casin.c
===
RCS file: /cvs/src/lib/libm/src/s_casin.c,v
retrieving revision 1.6
diff -u -p -r1.6 s_casin.c
--- s_casin.c   3 Jul 2013 04:46:36 -   1.6
+++ s_casin.c   27 Nov 2015 09:59:45 -
@@ -63,6 +63,7 @@ casin(double complex z)
x = creal (z);
y = cimag (z);
 
+#if 0
if (y == 0.0) {
if (fabs(x) > 1.0) {
w = M_PI_2 + 0.0 * I;
@@ -73,6 +74,7 @@ casin(double complex z)
}
return (w);
}
+#endif
 
/* Power series expansion */
/*
Index: s_casinf.c
===
RCS file: /cvs/src/lib/libm/src/s_casinf.c,v
retrieving revision 1.3
diff -u -p -r1.3 s_casinf.c
--- s_casinf.c  20 Jul 2011 19:28:33 -  1.3
+++ s_casinf.c  27 Nov 2015 09:59:45 -
@@ -65,6 +65,7 @@ casinf(float complex z)
x = crealf(z);
y = cimagf(z);
 
+#if 0
if(y == 0.0f) {
if(fabsf(x) > 1.0f) {
w = (float)M_PI_2 + 0.0f * I;
@@ -75,6 +76,7 @@ casinf(float complex z)
}
return (w);
}
+#endif
 
/* Power series expansion */
/*
Index: s_casinl.c
===
RCS file: /cvs/src/lib/libm/src/s_casinl.c,v
retrieving revision 1.3
diff -u -p -r1.3 s_casinl.c
--- s_casinl.c  20 Jul 2011 21:02:51 -  1.3
+++ s_casinl.c  27 Nov 2015 09:59:45 -
@@ -71,6 +71,7 @@ casinl(long double complex z)
x = creall(z);
y = cimagl(z);
 
+#if 0
if (y == 0.0L) {
if (fabsl(x) > 1.0L) {
w = PIO2L + 0.0L * I;
@@ -81,6 +82,7 @@ casinl(long double complex z)
}
return (w);
}
+#endif
 
/* Power series expansion */
b = cabsl(z);



Fix csqrt(3)

2015-11-26 Thread Alexandr Shadchin
>From http://en.cppreference.com/w/c/numeric/complex/csqrt :

csqrt(conj(z)) == conj(csqrt(z))

Before patch
 csqrt(-4.0 + -0.0i) = 0.0 + 2.0j
but should be
 csqrt(-4.0 + -0.0i) = 0.0 - 2.0j

-- 
Alexandr Shadchin

Index: lib/libm/src/s_csqrt.c
===
RCS file: /cvs/src/lib/libm/src/s_csqrt.c,v
retrieving revision 1.6
diff -u -p -r1.6 s_csqrt.c
--- lib/libm/src/s_csqrt.c  3 Jul 2013 04:46:36 -   1.6
+++ lib/libm/src/s_csqrt.c  24 Nov 2015 08:45:25 -
@@ -79,7 +79,7 @@ csqrt(double complex z)
r = fabs (x);
r = sqrt (r);
if (x < 0.0) {
-   w = 0.0 + r * I;
+   w = 0.0 + copysign(r, y) * I;
}
else {
w = r + y * I;
Index: lib/libm/src/s_csqrtf.c
===
RCS file: /cvs/src/lib/libm/src/s_csqrtf.c,v
retrieving revision 1.2
diff -u -p -r1.2 s_csqrtf.c
--- lib/libm/src/s_csqrtf.c 18 Jul 2010 18:42:26 -  1.2
+++ lib/libm/src/s_csqrtf.c 24 Nov 2015 08:45:25 -
@@ -72,7 +72,7 @@ csqrtf(float complex z)
 
if(y == 0.0f) {
if (x < 0.0f) {
-   w = 0.0f + sqrtf(-x) * I;
+   w = 0.0f + copysign(sqrtf(-x), y) * I;
return (w);
}
else if (x == 0.0f) {
Index: lib/libm/src/s_csqrtl.c
===
RCS file: /cvs/src/lib/libm/src/s_csqrtl.c,v
retrieving revision 1.2
diff -u -p -r1.2 s_csqrtl.c
--- lib/libm/src/s_csqrtl.c 20 Jul 2011 19:28:33 -  1.2
+++ lib/libm/src/s_csqrtl.c 24 Nov 2015 08:45:25 -
@@ -72,7 +72,7 @@ csqrtl(long double complex z)
 
if (y == 0.0L) {
if (x < 0.0L) {
-   w = 0.0L + sqrtl(-x) * I;
+   w = 0.0L + copysign(sqrtl(-x), y) * I;
return (w);
}
else {



UPDATE: xf86-input-synaptics 1.8.3

2015-11-24 Thread Alexandr Shadchin
Hi,

This diff updates xf86-input-synaptics to the latest release.
Tested on amd64.

Comments ? OK ?

-- 
Alexandr Shadchin

Index: ChangeLog
===
RCS file: /cvs/xenocara/driver/xf86-input-synaptics/ChangeLog,v
retrieving revision 1.10
diff -u -p -r1.10 ChangeLog
--- ChangeLog   11 Apr 2015 16:08:42 -  1.10
+++ ChangeLog   24 Nov 2015 08:28:47 -
@@ -1,3 +1,22 @@
+commit af7d8a15278a968d919bf539628281bf713f747b
+Author: Peter Hutterer 
+Date:   Thu Oct 29 12:10:09 2015 +1000
+
+synaptics 1.8.3
+
+Signed-off-by: Peter Hutterer 
+
+commit 3e7508ac087028f8f8e116f5279dad1ebcdc58e6
+Author: Gabriele Mazzotta 
+Date:   Thu Aug 14 20:03:42 2014 +0200
+
+Use cumulative relative touch movements while scrolling
+
+Signed-off-by: Gabriele Mazzotta 
+Reviewed-by: Peter Hutterer 
+Signed-off-by: Peter Hutterer 
+(cherry picked from commit ec0901e5f81d9cad6cc8bbdcb5ea075009c13de5)
+
 commit 6f8d4bac14ac8f3fd2714f0a8a9e37c5136a4013
 Author: Peter Hutterer 
 Date:   Fri Mar 27 11:26:55 2015 +1000
Index: configure
===
RCS file: /cvs/xenocara/driver/xf86-input-synaptics/configure,v
retrieving revision 1.11
diff -u -p -r1.11 configure
--- configure   11 Apr 2015 16:08:42 -  1.11
+++ configure   24 Nov 2015 08:28:48 -
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for xf86-input-synaptics 1.8.2.
+# Generated by GNU Autoconf 2.69 for xf86-input-synaptics 1.8.3.
 #
 # Report bugs to <https://bugs.freedesktop.org/enter_bug.cgi?product=xorg>.
 #
@@ -591,8 +591,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='xf86-input-synaptics'
 PACKAGE_TARNAME='xf86-input-synaptics'
-PACKAGE_VERSION='1.8.2'
-PACKAGE_STRING='xf86-input-synaptics 1.8.2'
+PACKAGE_VERSION='1.8.3'
+PACKAGE_STRING='xf86-input-synaptics 1.8.3'
 PACKAGE_BUGREPORT='https://bugs.freedesktop.org/enter_bug.cgi?product=xorg'
 PACKAGE_URL=''
 
@@ -1378,7 +1378,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures xf86-input-synaptics 1.8.2 to adapt to many kinds of 
systems.
+\`configure' configures xf86-input-synaptics 1.8.3 to adapt to many kinds of 
systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1449,7 +1449,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
- short | recursive ) echo "Configuration of xf86-input-synaptics 1.8.2:";;
+ short | recursive ) echo "Configuration of xf86-input-synaptics 1.8.3:";;
esac
   cat <<\_ACEOF
 
@@ -1586,7 +1586,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-xf86-input-synaptics configure 1.8.2
+xf86-input-synaptics configure 1.8.3
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -1910,7 +1910,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by xf86-input-synaptics $as_me 1.8.2, which was
+It was created by xf86-input-synaptics $as_me 1.8.3, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -2739,7 +2739,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE='xf86-input-synaptics'
- VERSION='1.8.2'
+ VERSION='1.8.3'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -18820,7 +18820,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_wri
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by xf86-input-synaptics $as_me 1.8.2, which was
+This file was extended by xf86-input-synaptics $as_me 1.8.3, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES= $CONFIG_FILES
@@ -18886,7 +18886,7 @@ _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; 
s/[\\""\`\$]/&/g'`"
 ac_cs_version="\\
-xf86-input-synaptics config.status 1.8.2
+xf86-input-synaptics config.status 1.8.3
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
Index: configure.ac
===
RCS file: /cvs/xenocara/driver/xf86-input-synaptics/configure.ac,v
retrieving revision 1.11
diff -u -p -r1.11 configure.ac
--- configure.ac11 Apr 2015 16:08:42 -  1.11
+++

UPDATE: xf86-input-keyboard 1.8.1

2015-11-24 Thread Alexandr Shadchin
Hi,

This diff updates xf86-input-keyboard to the latest release.
Tested on amd64.

Comments ? OK ?

-- 
Alexandr Shadchin



xf86-input-keyboard-1.8.1.tgz
Description: application/tar-gz


fix hypotf(3) for large and small values

2015-11-04 Thread Alexandr Shadchin
>From FreeBSD 23397: 
Fixed wrong magic numbers in scaling.  hypotf() was very broken for large
and small values:

hypotf(2.3819765e+38, 2.0416943e+38) was NaN instead of 3.1372484e+38
hypotf(-3.4028235e+38, 3.3886450e+38) was NaN instead of Inf
hypotf(-2.8025969e-45, -2.8025969e-45) was 0 instead of 4.2038954e-45

Found by:   ucbtest

Comment ? OK ?

-- 
Alexandr Shadchin

Index: e_hypotf.c
===
RCS file: /cvs/src/lib/libm/src/e_hypotf.c,v
retrieving revision 1.5
diff -u -p -r1.5 e_hypotf.c
--- e_hypotf.c  27 Oct 2009 23:59:29 -  1.5
+++ e_hypotf.c  4 Nov 2015 21:44:01 -
@@ -38,22 +38,22 @@ hypotf(float x, float y)
   if(hb == 0x7f80) w = b;
   return w;
   }
-  /* scale a and b by 2**-60 */
-  ha -= 0x5d80; hb -= 0x5d80;  k += 60;
+  /* scale a and b by 2**-68 */
+  ha -= 0x2200; hb -= 0x2200;  k += 68;
   SET_FLOAT_WORD(a,ha);
   SET_FLOAT_WORD(b,hb);
}
if(hb < 0x2680) {   /* b < 2**-50 */
if(hb <= 0x007f) {  /* subnormal b or 0 */  
if(hb==0) return a;
-   SET_FLOAT_WORD(t1,0x3f00);  /* t1=2^126 */
+   SET_FLOAT_WORD(t1,0x7e80);  /* t1=2^126 */
b *= t1;
a *= t1;
k -= 126;
-   } else {/* scale a and b by 2^60 */
-   ha += 0x5d80;   /* a *= 2^60 */
-   hb += 0x5d80;   /* b *= 2^60 */
-   k -= 60;
+   } else {/* scale a and b by 2^68 */
+   ha += 0x2200;   /* a *= 2^68 */
+   hb += 0x2200;   /* b *= 2^68 */
+   k -= 68;
SET_FLOAT_WORD(a,ha);
SET_FLOAT_WORD(b,hb);
}



Re: Drop register keyword from less(1)

2015-11-02 Thread Alexandr Shadchin
On Mon, Nov 2, 2015 at 2:16 PM, Nicholas Marriott <
nicholas.marri...@gmail.com> wrote:

> On Sun, Nov 01, 2015 at 06:22:53PM -0700, Todd C. Miller wrote:
> > If we are going to diverge from upstream less, a better starting
> > point would be https://github.com/gdamore/less-fork
> >
> > See also http://garrett.damore.org/2014_09_01_archive.html
> >
> > If you decide to tackle that you'll also want to diff our less
> > against the stock version to make sure we don't lose any local
> > changes, of which there were a few.
>
> I looked briefly at this and it wouldn't be that hard. However, while it
> would be fantastic to clean up all the crap from less, it isn't clear if
> Garrett D'Amore is going to be keeping his fork up to date - if he
> doesn't then we are then left with a much harder job to merge later
> changes from the original less. Unless we are happy to fork and maintain
> less ourselves without an upstream.
>
> IIRC our local changes are not huge and it is pretty easy to see them in
> the diff (strlcpy, SMALL, less_is_more, a few other bits).
>
>
Our patches https://github.com/shadchin/less/commits/openbsd for less-471
(man from -current, without merge changes less-471)

-- 
Alexandr Shadchin


Re: synaptics touchpads: w mode and resolution

2015-08-31 Thread Alexandr Shadchin
On Sat, Aug 29, 2015 at 6:10 PM, Ulf Brosziewski <
ulf.brosziew...@t-online.de> wrote:

> On 08/29/2015 01:13 PM, Alexandr Shadchin wrote:
>
>> On Fri, Aug 28, 2015 at 10:04:51PM +0200, Ulf Brosziewski wrote:
>>
>>>
>>> Some weeks ago a change was made in pms to support Synaptics touchpads
>>> that don't provide W mode. I assume that only fairly old models are
>>> concerned, and that the variant in the patch below is more accurate. It
>>> only fakes W values where necessary.
>>>
>>> The patch contains a second change, a check whether the resolution query
>>> was successful. According to the "Synaptics PS/2 Interfacing Guide", bit
>>> 7 of the second response byte will be set in case of success. It seems
>>> that if it isn't set, the other bytes are garbage or have an unknown
>>> meaning.
>>>
>>> Unfortunately I only have that old model - with firmware 4.1 - for
>>> testing. Could someone confirm that newer models aren't affected by
>>> these changes?
>>>
>>>
>>>
>> Tested on X201 (Synaptics touchpad, firmware 7.4), no regress.
>>
>> See comment below.
>>
>> Index: dev/pckbc/pms.c
>>> ===
>>> RCS file: /cvs/src/sys/dev/pckbc/pms.c,v
>>> retrieving revision 1.65
>>> diff -u -p -r1.65 pms.c
>>> --- dev/pckbc/pms.c 23 Aug 2015 04:45:23 -  1.65
>>> +++ dev/pckbc/pms.c 28 Aug 2015 18:04:45 -
>>> @@ -949,8 +949,10 @@ synaptics_get_hwinfo(struct pms_softc *s
>>> return (-1);
>>> }
>>>
>>> -   syn->res_x = SYNAPTICS_RESOLUTION_X(syn->resolution);
>>> -   syn->res_y = SYNAPTICS_RESOLUTION_Y(syn->resolution);
>>> +   if (syn->resolution&  0x8000) {
>>>
>>
>> I think it makes sense to define SYNAPTICS_RESOLUTION_VALID
>> instead of magic numbers.
>>
>> +   syn->res_x = SYNAPTICS_RESOLUTION_X(syn->resolution);
>>> +   syn->res_y = SYNAPTICS_RESOLUTION_Y(syn->resolution);
>>> +   }
>>> [...]
>>>
>>
>
> Thanks a lot. I have added the constant to pmsreg.h, this is the
> updated diff:
>
>
ok shadchin@


> Index: dev/pckbc/pms.c
> ===
> RCS file: /cvs/src/sys/dev/pckbc/pms.c,v
> retrieving revision 1.65
> diff -u -p -r1.65 pms.c
> --- dev/pckbc/pms.c 23 Aug 2015 04:45:23 -  1.65
> +++ dev/pckbc/pms.c 29 Aug 2015 12:33:57 -
> @@ -949,8 +949,10 @@ synaptics_get_hwinfo(struct pms_softc *s
> return (-1);
> }
>
> -   syn->res_x = SYNAPTICS_RESOLUTION_X(syn->resolution);
> -   syn->res_y = SYNAPTICS_RESOLUTION_Y(syn->resolution);
> +   if (syn->resolution & SYNAPTICS_RESOLUTION_VALID) {
>
> +   syn->res_x = SYNAPTICS_RESOLUTION_X(syn->resolution);
> +   syn->res_y = SYNAPTICS_RESOLUTION_Y(syn->resolution);
> +   }
> syn->min_x = SYNAPTICS_XMIN_BEZEL;
> syn->min_y = SYNAPTICS_YMIN_BEZEL;
> syn->max_x = (syn->dimension) ?
> @@ -1163,30 +1165,21 @@ pms_proc_synaptics(struct pms_softc *sc)
>
> w = ((sc->packet[0] & 0x30) >> 2) | ((sc->packet[0] & 0x04) >> 1) |
> ((sc->packet[3] & 0x04) >> 2);
> +   z = sc->packet[2];
>
> -   /*
> -* Conform to the encoding understood by
> -* /usr/xenocara/driver/xf86-input-synaptics/src/wsconscomm.c
> -*/
> -   switch (w) {
> -   case 0:
> -   /* fingerwidth 5, numfingers 2 */
> -   break;
> -   case 1:
> -   /* fingerwidth 5, numfingers 3 */
> -   break;
> -   case 5:
> -   /* fingerwidth 5, numfingers 1 */
> -   break;
> -   case 4:
> -   case 8:
> -   /* fingerwidth 4, numfingers 1 */
> -   w = 4;
> -   break;
> -   default:
> -   break;
> +   if ((syn->capabilities & SYNAPTICS_CAP_EXTENDED) == 0) {
> +   /*
> +* Emulate W mode for models that don't provide it. Bit 3
> +* of the w-input signals a touch ("finger"), Bit 2 and
> +* the "gesture" bits 1-0 can be ignored.
> +*/
> +   if (w & 8)
> +   w

Re: tap-and-drag on ALPS touchpads

2015-08-31 Thread Alexandr Shadchin
Y
> +   | WSMOUSE_INPUT_ABSOLUTE_Z
> +   | WSMOUSE_INPUT_ABSOLUTE_W);
> +   }
>
> -   wsmouse_input(sc->sc_wsmousedev, buttons, x, y, z, w,
> -   WSMOUSE_INPUT_ABSOLUTE_X | WSMOUSE_INPUT_ABSOLUTE_Y |
> -   WSMOUSE_INPUT_ABSOLUTE_Z | WSMOUSE_INPUT_ABSOLUTE_W);
> +   if (alps->gesture != ALPS_DRAG || gesture != ALPS_TAP)
> +   alps->gesture = gesture;
> +
> +   alps->old_x = x;
> +   alps->old_y = y;
>
> -   alps->old_fin = fin;
> } else {
> dx = dy = 0;
> if (z > ALPS_PRESSURE) {
> Index: dev/pckbc/pmsreg.h
> ===
> RCS file: /cvs/src/sys/dev/pckbc/pmsreg.h,v
> retrieving revision 1.11
> diff -u -p -r1.11 pmsreg.h
> --- dev/pckbc/pmsreg.h  26 Mar 2015 01:30:22 -  1.11
> +++ dev/pckbc/pmsreg.h  14 Aug 2015 18:27:57 -
> @@ -164,6 +164,10 @@
>
>  #define ALPS_Z_MAGIC   127
>
> +/* ALPS "gesture" and "finger" bits */
> +#define ALPS_TAP   0x01
> +#define ALPS_DRAG  0x03
> +
>  /* Elantech queries */
>  #define ELANTECH_QUE_FW_ID 0
>  #define ELANTECH_QUE_FW_VER1
>
>


-- 
Alexandr Shadchin


Re: synaptics touchpads: w mode and resolution

2015-08-29 Thread Alexandr Shadchin
On Fri, Aug 28, 2015 at 10:04:51PM +0200, Ulf Brosziewski wrote:
> 
> Some weeks ago a change was made in pms to support Synaptics touchpads
> that don't provide W mode. I assume that only fairly old models are
> concerned, and that the variant in the patch below is more accurate. It
> only fakes W values where necessary.
> 
> The patch contains a second change, a check whether the resolution query
> was successful. According to the "Synaptics PS/2 Interfacing Guide", bit
> 7 of the second response byte will be set in case of success. It seems
> that if it isn't set, the other bytes are garbage or have an unknown
> meaning.
> 
> Unfortunately I only have that old model - with firmware 4.1 - for
> testing. Could someone confirm that newer models aren't affected by
> these changes?
> 
> 

Tested on X201 (Synaptics touchpad, firmware 7.4), no regress.

See comment below.

> Index: dev/pckbc/pms.c
> ===
> RCS file: /cvs/src/sys/dev/pckbc/pms.c,v
> retrieving revision 1.65
> diff -u -p -r1.65 pms.c
> --- dev/pckbc/pms.c   23 Aug 2015 04:45:23 -  1.65
> +++ dev/pckbc/pms.c   28 Aug 2015 18:04:45 -
> @@ -949,8 +949,10 @@ synaptics_get_hwinfo(struct pms_softc *s
>   return (-1);
>   }
> 
> - syn->res_x = SYNAPTICS_RESOLUTION_X(syn->resolution);
> - syn->res_y = SYNAPTICS_RESOLUTION_Y(syn->resolution);
> + if (syn->resolution & 0x8000) {

I think it makes sense to define SYNAPTICS_RESOLUTION_VALID
instead of magic numbers.

> + syn->res_x = SYNAPTICS_RESOLUTION_X(syn->resolution);
> + syn->res_y = SYNAPTICS_RESOLUTION_Y(syn->resolution);
> + }
>   syn->min_x = SYNAPTICS_XMIN_BEZEL;
>   syn->min_y = SYNAPTICS_YMIN_BEZEL;
>   syn->max_x = (syn->dimension) ?
> @@ -1163,30 +1165,21 @@ pms_proc_synaptics(struct pms_softc *sc)
> 
>   w = ((sc->packet[0] & 0x30) >> 2) | ((sc->packet[0] & 0x04) >> 1) |
>   ((sc->packet[3] & 0x04) >> 2);
> + z = sc->packet[2];
> 
> - /*
> -  * Conform to the encoding understood by
> -  * /usr/xenocara/driver/xf86-input-synaptics/src/wsconscomm.c
> -  */
> - switch (w) {
> - case 0:
> - /* fingerwidth 5, numfingers 2 */
> - break;
> - case 1:
> - /* fingerwidth 5, numfingers 3 */
> - break;
> - case 5:
> - /* fingerwidth 5, numfingers 1 */
> - break;
> - case 4:
> - case 8:
> - /* fingerwidth 4, numfingers 1 */
> - w = 4;
> - break;
> - default:
> - break;
> + if ((syn->capabilities & SYNAPTICS_CAP_EXTENDED) == 0) {
> + /*
> +  * Emulate W mode for models that don't provide it. Bit 3
> +  * of the w-input signals a touch ("finger"), Bit 2 and
> +  * the "gesture" bits 1-0 can be ignored.
> +  */
> + if (w & 8)
> + w = 4;
> + else
> + z = w = 0;
>   }
> 
> +
>   if ((syn->capabilities & SYNAPTICS_CAP_PASSTHROUGH) && w == 3) {
>   synaptics_sec_proc(sc);
>   return;
> @@ -1203,7 +1196,6 @@ pms_proc_synaptics(struct pms_softc *sc)
>   sc->packet[4];
>   y = ((sc->packet[3] & 0x20) << 7) | ((sc->packet[1] & 0xf0) << 4) |
>   sc->packet[5];
> - z = sc->packet[2];
> 
>   buttons = ((sc->packet[0] & sc->packet[3]) & 0x01) ?
>   WSMOUSE_BUTTON(1) : 0;

-- 
Alexandr Shadchin



pckbc

2015-05-04 Thread Alexandr Shadchin
Less magic number

For PS/2 - status byte - bit 5:
The bit is '1' if the data on input port 60h came from the AUX port, or '0' if
the data came from the keyboard or from the keyboard controller itself.

KBS_TERR (kbd transmission error) was valid for AT-mode, but not for PS/2-mode.

Comment ? OK ?

-- 
Alexandr Shadchin

Index: i8042reg.h
===
RCS file: /cvs/src/sys/dev/ic/i8042reg.h,v
retrieving revision 1.8
diff -u -p -r1.8 i8042reg.h
--- i8042reg.h  25 Dec 2013 21:01:01 -  1.8
+++ i8042reg.h  4 May 2015 15:24:27 -
@@ -7,7 +7,7 @@
 #define KBS_WARM   0x04/* kbd input buffer low */
 #define KBS_OCMD   0x08/* kbd output buffer has command */
 #define KBS_NOSEC  0x10/* kbd security lock not engaged */
-#define KBS_TERR   0x20/* kbd transmission error */
+#define KBS_AUXDATA0x20/* kbd data in buffer from aux port */
 #define KBS_RERR   0x40/* kbd receive error */
 #define KBS_PERR   0x80/* kbd parity error */
 
Index: pckbc.c
===
RCS file: /cvs/src/sys/dev/ic/pckbc.c,v
retrieving revision 1.47
diff -u -p -r1.47 pckbc.c
--- pckbc.c 31 Mar 2015 02:27:30 -  1.47
+++ pckbc.c 4 May 2015 15:24:27 -
@@ -153,7 +153,7 @@ pckbc_poll_data1(bus_space_tag_t iot, bu
KBD_DELAY;
CPU_BUSY_CYCLE();
c = bus_space_read_1(iot, ioh_d, 0);
-   if (checkaux && (stat & 0x20)) { /* aux data */
+   if (checkaux && (stat & KBS_AUXDATA)) {
if (slot != PCKBC_AUX_SLOT) {
DPRINTF("lost aux 0x%x\n", c);
continue;
@@ -998,7 +998,7 @@ pckbcintr_internal(struct pckbc_internal
 
served = 1;
 
-   slot = (t->t_haveaux && (stat & 0x20)) ?
+   slot = (t->t_haveaux && (stat & KBS_AUXDATA)) ?
PCKBC_AUX_SLOT : PCKBC_KBD_SLOT;
q = t->t_slotdata[slot];
 



UPDATE: xf86-input-synaptics 1.8.2

2015-03-29 Thread Alexandr Shadchin
Hi,

This diff updates xf86-input-synaptics to the latest release.
Tested on amd64.

Comments ? OK ?

-- 
Alexandr Shadchin

Index: ChangeLog
===
RCS file: /cvs/xenocara/driver/xf86-input-synaptics/ChangeLog,v
retrieving revision 1.9
diff -u -p -r1.9 ChangeLog
--- ChangeLog   24 Jan 2015 17:43:59 -  1.9
+++ ChangeLog   29 Mar 2015 11:26:05 -
@@ -1,3 +1,70 @@
+commit 6f8d4bac14ac8f3fd2714f0a8a9e37c5136a4013
+Author: Peter Hutterer 
+Date:   Fri Mar 27 11:26:55 2015 +1000
+
+synaptics 1.8.2
+
+Signed-off-by: Peter Hutterer 
+
+commit 15caf2b53407379f8e677d48a022f4b46b97d83a
+Author: Peter Hutterer 
+Date:   Tue Mar 24 15:41:39 2015 +1000
+
+eventcomm: ignore fake and broken MT devices
+
+An MT device without X/Y is not a touchpad. And neither are fake MT 
devices.
+
+Signed-off-by: Peter Hutterer 
+Reviewed-by: Hans de Goede 
+(cherry picked from commit fc9f490a2c87e6f87b0f483cd6bf5f526dddbb8d)
+
+commit ef8daaf696584f7c1d3e9f192de18b5b9f923bdc
+Author: Peter Hutterer 
+Date:   Mon Mar 23 11:38:15 2015 +1000
+
+eventcomm: prevent possibly division by zero
+
+This came up as a kernel bug, but it's valid to create uinput devices with 
a
+min == max range for x/y. Technically valid, but effectively useless, so 
catch
+it, complain and hobble on along.
+
+Signed-off-by: Peter Hutterer 
+Reviewed-by: Hans de Goede 
+(cherry picked from commit 30866b97be6939b895327b930154ef758eed7ff8)
+
+commit 90c6d7fc60f3db1bd9db1c7702062fcaef3b3352
+Author: Gabriele Mazzotta 
+Date:   Thu Jan 15 22:04:17 2015 +0100
+
+Add a delay between the second button down-up event of double taps
+
+Some applications ignore the second tap of double taps because of the
+lack of a delay between the button down and button up events.
+
+Prevent this by replacing the transition from TS_2B to TS_START with a
+transition from TS_2B to TS_SINGLETAP that emits only a button down
+event. The button up event will be emitted when transitioning from
+TS_SINGLETAP to TS_START.
+
+In addition, decrease the default value of MaxDoubleTapTime from 180 ms
+to 100 ms in order to make double taps faster.
+
+Signed-off-by: Gabriele Mazzotta 
+Signed-off-by: Peter Hutterer 
+(cherry picked from commit 37d34f0356cc556dd8a49ec5d1ed64d49417a9b2)
+
+commit 649b77f0ce617fd1ec073b281636e304e80b56c0
+Author: Gabriele Mazzotta 
+Date:   Thu Jan 15 22:04:16 2015 +0100
+
+Update machine state diagram
+
+The diagram didn't entirely reflect the current state of the code.
+
+Signed-off-by: Gabriele Mazzotta 
+Signed-off-by: Peter Hutterer 
+(cherry picked from commit a357647d3fb918b94efbda98138fb0240a949ef2)
+
 commit d50c4bab8ae2836a0f38b29a5d22be2e950e4d08
 Author: Peter Hutterer 
 Date:   Thu Sep 18 07:40:13 2014 +1000
Index: Makefile.in
===
RCS file: /cvs/xenocara/driver/xf86-input-synaptics/Makefile.in,v
retrieving revision 1.10
diff -u -p -r1.10 Makefile.in
--- Makefile.in 15 Jan 2015 01:30:40 -  1.10
+++ Makefile.in 29 Mar 2015 11:26:05 -
@@ -74,8 +74,8 @@ subdir = .
 DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in $(srcdir)/config.h.in \
$(srcdir)/xorg-synaptics.pc.in $(top_srcdir)/configure COPYING \
-   ChangeLog INSTALL config.guess config.sub depcomp install-sh \
-   ltmain.sh missing
+   ChangeLog INSTALL compile config.guess config.sub depcomp \
+   install-sh ltmain.sh missing
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
Index: compile
===
RCS file: compile
diff -N compile
--- /dev/null   1 Jan 1970 00:00:00 -
+++ compile 29 Mar 2015 11:26:05 -
@@ -0,0 +1,347 @@
+#! /bin/sh
+# Wrapper for compilers which do not understand '-c -o'.
+
+scriptversion=2012-10-14.11; # UTC
+
+# Copyright (C) 1999-2014 Free Software Foundation, Inc.
+# Written by Tom Tromey .
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# As a special exception to the GNU General Public License, if you
+# distrib

Re: UPDATE: xkeyboard-config 2.14

2015-03-28 Thread Alexandr Shadchin
On Sun, Feb 08, 2015 at 03:10:45PM +0500, Alexandr Shadchin wrote:
> Hi,
> 
> This diff updates xkeyboard-config to the latest release.
> Tested on amd64.
> 
> Comments ? OK ?
> 
> -- 
> Alexandr Shadchin
> 

Ping.

-- 
Alexandr Shadchin



Re: elantech-v4 clickpad support

2015-01-25 Thread Alexandr Shadchin
elantech->mt[id].y =
> + ((sc->packet[4] & 0x0f) << 8) | sc->packet[5];
> + elantech->mt[id].z =
> + (sc->packet[1] & 0xf0)
> + | ((sc->packet[4] & 0xf0) >> 4);
> +
> + if (elantech->mt_filter & (1 << id)) {
> + elantech_send_mt_input(sc, id);
> + elantech->mt_filter = (1 << id);
> + }
> + }
>   break;
> 
>   case ELANTECH_V4_PKT_MOTION:
> - id = ((sc->packet[0] & 0xe0) >> 5) - 1;
> - if (id < 0)
> - return;
> -
> - sid = ((sc->packet[3] & 0xe0) >> 5) - 1;
>   weight = (sc->packet[0] & 0x10) ? ELANTECH_V4_WEIGHT_VALUE : 1;
> -
> - delta_x1 = (signed char)sc->packet[1];
> - delta_y1 = (signed char)sc->packet[2];
> - delta_x2 = (signed char)sc->packet[4];
> - delta_y2 = (signed char)sc->packet[5];
> -
> - elantech->mt[id].x += delta_x1 * weight;
> - elantech->mt[id].y -= delta_y1 * weight;
> -
> - for (i = 0; i < ELANTECH_MAX_FINGERS; i++)
> - if (elantech->fingers[i])
> - fingers++;
> -
> - elantech_send_input(sc, elantech->mt[id].x, elantech->mt[id].y,
> - 1, fingers);
> -
> - if (sid >= 0) {
> - elantech->mt[sid].x += delta_x2 * weight;
> - elantech->mt[sid].y -= delta_y2 * weight;
> - /* XXX: can only send one finger of input */
> - /*
> - elantech_send_input(sc, elantech->mt[sid].x,
> - elantech->mt[sid].y, 1, fingers);
> - */
> + for (n = 0; n < 6; n += 3) {
> + id = ((sc->packet[n] & 0xe0) >> 5) - 1;
> + if (id < 0 || id >= ELANTECH_MAX_FINGERS)
> + continue;
> + dx = weight * (signed char)sc->packet[n + 1];
> + dy = weight * (signed char)sc->packet[n + 2];
> + elantech->mt[id].x += dx;
> + elantech->mt[id].y += dy;
> + elantech->mt[id].z = 1;
> + if (elantech->mt_filter & (1 << id)) {
> + if ((dx | dy)
> + || elantech->mt_count !=
> + elantech->mt_lastcount
> + || (sc->packet[0] & 3) !=
> + elantech->mt_buttons)
> + elantech_send_mt_input(sc, id);
> +
> + elantech->mt_filter = (dx | dy) ?
> + (1 << id) : elantech->mt_slots;
> + }
>   }
> -
>   break;
> 
>   default:
> @@ -2296,6 +2294,37 @@ pms_proc_elantech_v4(struct pms_softc *sc)
>  }
> 
>  void
> +elantech_send_mt_input(struct pms_softc *sc, int id)
> +{
> + struct elantech_softc *elantech = sc->elantech;
> +
> + if (id != elantech->mt_lastid) {
> + /* Correct for compatibility mode, but not useful yet: */
> + elantech->old_x = elantech->mt[id].x;
> + elantech->old_y = elantech->mt[id].y;
> + /*
> +  * To avoid a jump of the cursor, simulate a change of the
> +  * number of touches (without producing tapping gestures
> +  * accidentally). It should suffice to do that only if
> +  * mt_count hasn't changed, but we cannot rely on the
> +  * synaptics driver, which alters its finger counts when
> +  * handling click-and-drag actions (see HandleTapProcessing
> +  * and ComputeDeltas in synaptics.c).
> +  */
> + if (elantech->mt_lastid > -1)
> + elantech_send_input(sc,
> + elantech->mt[id].x, elantech->mt[id].y,
> + elantech->mt[id].z, ELANTECH_MAX_FINGERS);
> + elantech->mt_lastid = id;
> + }
> + elantech->mt_lastcount = elantech->mt_count;
> + elantech->mt_buttons = sc->packet[0] & 3;
> + elantech_send_input(sc,
> + elantech->mt[id].x, elantech->mt[id].y,
> + elantech->mt[id].z, elantech->mt_count);
> +}
> +
> +void
>  elantech_send_input(struct pms_softc *sc, int x, int y, int z, int w)
>  {
>   struct elantech_softc *elantech = sc->elantech;
> 

-- 
Alexandr Shadchin



Re: Simplify wsmoused 2

2014-12-22 Thread Alexandr Shadchin
On Mon, Dec 22, 2014 at 06:05:48PM +0400, Vadim Zhukov wrote:
> 22 дек. 2014 г. 17:03 пользователь "Vadim Zhukov" 
> написал:
> >
> > 22 дек. 2014 г. 16:26 пользователь "Alexandr Shadchin" <
> alexandr.shadc...@gmail.com> написал:
> >
> > >
> > > On Mon, Dec 22, 2014 at 04:37:22PM +0400, Vadim Zhukov wrote:
> > > > 22 дек. 2014 г. 15:02 пользователь "Alexandr Shadchin" <
> > > > alexandr.shadc...@gmail.com> написал:
> > > > >
> > > > > On Mon, Dec 22, 2014 at 03:52:39PM +0400, Vadim Zhukov wrote:
> > > > > > 22 дек. 2014 г. 14:40 пользователь "Alexandr Shadchin" <
> > > > > > alexandr.shadc...@gmail.com> написал:
> > > > > > >
> > > > > > > Convert atoi -> strtonum. Plus more detailed error messages.
> > > > > > >
> > > > > > > OK ?
> > > > > > >
> > > > > > > --
> > > > > > > Alexandr Shadchin
> > > > > > >
> > > > > > > Index: wsmoused.c
> > > > > > >
> ===
> > > > > > > RCS file: /cvs/src/usr.sbin/wsmoused/wsmoused.c,v
> > > > > > > retrieving revision 1.34
> > > > > > > diff -u -p -r1.34 wsmoused.c
> > > > > > > --- wsmoused.c  22 Dec 2014 11:21:49 -  1.34
> > > > > > > +++ wsmoused.c  22 Dec 2014 11:29:36 -
> > > > > > > @@ -175,14 +175,6 @@ static int p2l[MOUSE_MAXBUTTON] = {
> > > > > > > MOUSE_BUTTON5,  MOUSE_BUTTON6,  MOUSE_BUTTON7,
> MOUSE_BUTTON8,
> > > > > > >  };
> > > > > > >
> > > > > > > -static char *
> > > > > > > -skipspace(char *s)
> > > > > > > -{
> > > > > > > -   while (isspace((unsigned char)*s))
> > > > > > > -   ++s;
> > > > > > > -   return s;
> > > > > > > -}
> > > > > > > -
> > > > > > >  /* mouse_installmap : install a map between physical and
> logical
> > > > buttons
> > > > > > */
> > > > > > >  static int
> > > > > > >  mouse_installmap(char *arg)
> > > > > > > @@ -190,29 +182,38 @@ mouse_installmap(char *arg)
> > > > > > > int pbutton;
> > > > > > > int lbutton;
> > > > > > > char *s;
> > > > > > > +   const char *errstr;
> > > > > > >
> > > > > > > while (*arg) {
> > > > > > > -   arg = skipspace(arg);
> > > > > > > s = arg;
> > > > > > > while (isdigit((unsigned char)*arg))
> > > > > > > ++arg;
> > > > > >
> > > > > > So now, if there is some whitespace before digits, arg won't get
> > > > > > incremented, and FALSE may be returned. This is behaviour change,
> is it
> > > > > > intended?
> > > > >
> > > > > No, getopt() eat extra spaces and skipspace() does nothing.
> > > >
> > > > No, getopt(3) doesn't eat spaces, neither when argument its separated
> or
> > > > written next to option letter.
> > > >
> > >
> > > Tests showed that optarg has no leading and trailing whitespace.
> >
> > $ cat g.c
> > #include 
> > #include 
> > #include 
> > int main(int argc, char **argv){
> > int opt;
> > while ((opt = (vector(argc, argv, "o:"))) != -1)
> 
> getopt instead of vector here, of course, - sorry, I have to retype things
> via phone.
> 
> > printf("o=%sEOF\n", optarg);
> > return 0;
> > }
> > $ make g && ./g -o " 1 "
> > cc -O2 -pipe-o g g.c
> > o= 1 EOF
> > $
> 

Yes, example is correct, but using quotes we consciously say to preserve spaces.

I do not think that the command - wsmoused -M "  3=1   " -M "   1=3  "
will be useful to someone.

> --
> Vadim Zhukov

-- 
Alexandr Shadchin



Re: Simplify wsmoused 2

2014-12-22 Thread Alexandr Shadchin
On Mon, Dec 22, 2014 at 04:37:22PM +0400, Vadim Zhukov wrote:
> 22 дек. 2014 г. 15:02 пользователь "Alexandr Shadchin" <
> alexandr.shadc...@gmail.com> написал:
> >
> > On Mon, Dec 22, 2014 at 03:52:39PM +0400, Vadim Zhukov wrote:
> > > 22 дек. 2014 г. 14:40 пользователь "Alexandr Shadchin" <
> > > alexandr.shadc...@gmail.com> написал:
> > > >
> > > > Convert atoi -> strtonum. Plus more detailed error messages.
> > > >
> > > > OK ?
> > > >
> > > > --
> > > > Alexandr Shadchin
> > > >
> > > > Index: wsmoused.c
> > > > ===
> > > > RCS file: /cvs/src/usr.sbin/wsmoused/wsmoused.c,v
> > > > retrieving revision 1.34
> > > > diff -u -p -r1.34 wsmoused.c
> > > > --- wsmoused.c  22 Dec 2014 11:21:49 -  1.34
> > > > +++ wsmoused.c  22 Dec 2014 11:29:36 -
> > > > @@ -175,14 +175,6 @@ static int p2l[MOUSE_MAXBUTTON] = {
> > > > MOUSE_BUTTON5,  MOUSE_BUTTON6,  MOUSE_BUTTON7,  MOUSE_BUTTON8,
> > > >  };
> > > >
> > > > -static char *
> > > > -skipspace(char *s)
> > > > -{
> > > > -   while (isspace((unsigned char)*s))
> > > > -   ++s;
> > > > -   return s;
> > > > -}
> > > > -
> > > >  /* mouse_installmap : install a map between physical and logical
> buttons
> > > */
> > > >  static int
> > > >  mouse_installmap(char *arg)
> > > > @@ -190,29 +182,38 @@ mouse_installmap(char *arg)
> > > > int pbutton;
> > > > int lbutton;
> > > > char *s;
> > > > +   const char *errstr;
> > > >
> > > > while (*arg) {
> > > > -   arg = skipspace(arg);
> > > > s = arg;
> > > > while (isdigit((unsigned char)*arg))
> > > > ++arg;
> > >
> > > So now, if there is some whitespace before digits, arg won't get
> > > incremented, and FALSE may be returned. This is behaviour change, is it
> > > intended?
> >
> > No, getopt() eat extra spaces and skipspace() does nothing.
> 
> No, getopt(3) doesn't eat spaces, neither when argument its separated or
> written next to option letter.
> 

Tests showed that optarg has no leading and trailing whitespace.

> > > > -   arg = skipspace(arg);
> > > > -   if ((arg <= s) || (*arg != '='))
> > > > +   if ((arg == s) || (*arg != '='))
> > > > return FALSE;
> > > > -   lbutton = atoi(s);
> > > > +   *arg = '\0';
> > > > +   lbutton = strtonum(s, 1, MOUSE_MAXBUTTON, &errstr);
> > > > +   if (errstr != NULL) {
> > > > +   warnx("logical button value `%s' is %s, "
> > > > +   "acceptable range is 1-%d",
> > > > +   s, errstr, MOUSE_MAXBUTTON);
> > > > +   *arg = '=';
> > > > +   return FALSE;
> > > > +   }
> > > > +   *arg = '=';
> > > >
> > > > -   arg = skipspace(++arg);
> > > > -   s = arg;
> > > > +   s = ++arg;
> > > > while (isdigit((unsigned char)*arg))
> > > > ++arg;
> > > > -   if (arg <= s || (!isspace((unsigned char)*arg) &&
> *arg !=
> > > '\0'))
> > > > -   return FALSE;
> > > > -   pbutton = atoi(s);
> > > > -
> > > > -   if (lbutton <= 0 || lbutton > MOUSE_MAXBUTTON)
> > > > +   if ((arg == s) || (*arg != '\0'))
> > > > return FALSE;
> > > > -   if (pbutton <= 0 || pbutton > MOUSE_MAXBUTTON)
> > > > +   pbutton = strtonum(s, 1, MOUSE_MAXBUTTON, &errstr);
> > > > +   if (errstr != NULL) {
> > > > +   warnx("physical button value `%s' is %s, "
> > > > +  

Re: Simplify wsmoused 2

2014-12-22 Thread Alexandr Shadchin
On Mon, Dec 22, 2014 at 03:52:39PM +0400, Vadim Zhukov wrote:
> 22 дек. 2014 г. 14:40 пользователь "Alexandr Shadchin" <
> alexandr.shadc...@gmail.com> написал:
> >
> > Convert atoi -> strtonum. Plus more detailed error messages.
> >
> > OK ?
> >
> > --
> > Alexandr Shadchin
> >
> > Index: wsmoused.c
> > ===
> > RCS file: /cvs/src/usr.sbin/wsmoused/wsmoused.c,v
> > retrieving revision 1.34
> > diff -u -p -r1.34 wsmoused.c
> > --- wsmoused.c  22 Dec 2014 11:21:49 -  1.34
> > +++ wsmoused.c  22 Dec 2014 11:29:36 -
> > @@ -175,14 +175,6 @@ static int p2l[MOUSE_MAXBUTTON] = {
> > MOUSE_BUTTON5,  MOUSE_BUTTON6,  MOUSE_BUTTON7,  MOUSE_BUTTON8,
> >  };
> >
> > -static char *
> > -skipspace(char *s)
> > -{
> > -   while (isspace((unsigned char)*s))
> > -   ++s;
> > -   return s;
> > -}
> > -
> >  /* mouse_installmap : install a map between physical and logical buttons
> */
> >  static int
> >  mouse_installmap(char *arg)
> > @@ -190,29 +182,38 @@ mouse_installmap(char *arg)
> > int pbutton;
> > int lbutton;
> > char *s;
> > +   const char *errstr;
> >
> > while (*arg) {
> > -   arg = skipspace(arg);
> > s = arg;
> > while (isdigit((unsigned char)*arg))
> > ++arg;
> 
> So now, if there is some whitespace before digits, arg won't get
> incremented, and FALSE may be returned. This is behaviour change, is it
> intended?

No, getopt() eat extra spaces and skipspace() does nothing.

> 
> > -   arg = skipspace(arg);
> > -   if ((arg <= s) || (*arg != '='))
> > +   if ((arg == s) || (*arg != '='))
> > return FALSE;
> > -   lbutton = atoi(s);
> > +   *arg = '\0';
> > +   lbutton = strtonum(s, 1, MOUSE_MAXBUTTON, &errstr);
> > +   if (errstr != NULL) {
> > +   warnx("logical button value `%s' is %s, "
> > +   "acceptable range is 1-%d",
> > +   s, errstr, MOUSE_MAXBUTTON);
> > +   *arg = '=';
> > +   return FALSE;
> > +   }
> > +   *arg = '=';
> >
> > -   arg = skipspace(++arg);
> > -   s = arg;
> > +   s = ++arg;
> > while (isdigit((unsigned char)*arg))
> > ++arg;
> > -   if (arg <= s || (!isspace((unsigned char)*arg) && *arg !=
> '\0'))
> > -   return FALSE;
> > -   pbutton = atoi(s);
> > -
> > -   if (lbutton <= 0 || lbutton > MOUSE_MAXBUTTON)
> > +   if ((arg == s) || (*arg != '\0'))
> > return FALSE;
> > -   if (pbutton <= 0 || pbutton > MOUSE_MAXBUTTON)
> > +   pbutton = strtonum(s, 1, MOUSE_MAXBUTTON, &errstr);
> > +   if (errstr != NULL) {
> > +   warnx("physical button value `%s' is %s, "
> > +   "acceptable range is 1-%d",
> > +   s, errstr, MOUSE_MAXBUTTON);
> > return FALSE;
> > +   }
> > +
> > p2l[pbutton - 1] = lbutton - 1;
> > }
> > return TRUE;
> > @@ -454,6 +455,7 @@ main(int argc, char **argv)
> > unsigned int type;
> > int opt;
> > int i;
> > +   const char *errstr;
> >
> >  #define GETOPT_STRING "2dfhip:t:C:D:I:M:"
> > while ((opt = (getopt(argc, argv, GETOPT_STRING))) != -1) {
> > @@ -498,11 +500,12 @@ main(int argc, char **argv)
> > break;
> > case 'C':
> >  #define MAX_CLICKTHRESHOLD 2000 /* max delay for double click */
> > -   mouse.clickthreshold = atoi(optarg);
> > -   if (mouse.clickthreshold < 0 ||
> > -   mouse.clickthreshold > MAX_CLICKTHRESHOLD) {
> > -   warnx("invalid threshold `%s': max value
> is %d",
> > -   optarg, MAX_CLICKTHRESHOLD);
> > +   mouse.clickthreshold = strtonum(optarg, 0,
> > +   MAX_CLICKTHRESHOLD, &errstr);
> > +   if (errstr != NULL) {
> > +   warnx("threshold value `%s' is %s, "
> > +   "acceptable range is 0-%d",
> > +   optarg, errstr, MAX_CLICKTHRESHOLD);
> > usage();
> > }
> > break;
> >
> 
> --
> Vadim Zhukov

-- 
Alexandr Shadchin



Simplify wsmoused 2

2014-12-22 Thread Alexandr Shadchin
Convert atoi -> strtonum. Plus more detailed error messages.

OK ?

-- 
Alexandr Shadchin

Index: wsmoused.c
===
RCS file: /cvs/src/usr.sbin/wsmoused/wsmoused.c,v
retrieving revision 1.34
diff -u -p -r1.34 wsmoused.c
--- wsmoused.c  22 Dec 2014 11:21:49 -  1.34
+++ wsmoused.c  22 Dec 2014 11:29:36 -
@@ -175,14 +175,6 @@ static int p2l[MOUSE_MAXBUTTON] = {
MOUSE_BUTTON5,  MOUSE_BUTTON6,  MOUSE_BUTTON7,  MOUSE_BUTTON8,
 };
 
-static char *
-skipspace(char *s)
-{
-   while (isspace((unsigned char)*s))
-   ++s;
-   return s;
-}
-
 /* mouse_installmap : install a map between physical and logical buttons */
 static int
 mouse_installmap(char *arg)
@@ -190,29 +182,38 @@ mouse_installmap(char *arg)
int pbutton;
int lbutton;
char *s;
+   const char *errstr;
 
while (*arg) {
-   arg = skipspace(arg);
s = arg;
while (isdigit((unsigned char)*arg))
++arg;
-   arg = skipspace(arg);
-   if ((arg <= s) || (*arg != '='))
+   if ((arg == s) || (*arg != '='))
return FALSE;
-   lbutton = atoi(s);
+   *arg = '\0';
+   lbutton = strtonum(s, 1, MOUSE_MAXBUTTON, &errstr);
+   if (errstr != NULL) {
+   warnx("logical button value `%s' is %s, "
+   "acceptable range is 1-%d",
+   s, errstr, MOUSE_MAXBUTTON);
+   *arg = '=';
+   return FALSE;
+   }
+   *arg = '=';
 
-   arg = skipspace(++arg);
-   s = arg;
+   s = ++arg;
while (isdigit((unsigned char)*arg))
++arg;
-   if (arg <= s || (!isspace((unsigned char)*arg) && *arg != '\0'))
-   return FALSE;
-   pbutton = atoi(s);
-
-   if (lbutton <= 0 || lbutton > MOUSE_MAXBUTTON)
+   if ((arg == s) || (*arg != '\0'))
return FALSE;
-   if (pbutton <= 0 || pbutton > MOUSE_MAXBUTTON)
+   pbutton = strtonum(s, 1, MOUSE_MAXBUTTON, &errstr);
+   if (errstr != NULL) {
+   warnx("physical button value `%s' is %s, "
+   "acceptable range is 1-%d",
+   s, errstr, MOUSE_MAXBUTTON);
return FALSE;
+   }
+
p2l[pbutton - 1] = lbutton - 1;
}
return TRUE;
@@ -454,6 +455,7 @@ main(int argc, char **argv)
unsigned int type;
int opt;
int i;
+   const char *errstr;
 
 #define GETOPT_STRING "2dfhip:t:C:D:I:M:"
while ((opt = (getopt(argc, argv, GETOPT_STRING))) != -1) {
@@ -498,11 +500,12 @@ main(int argc, char **argv)
break;
case 'C':
 #define MAX_CLICKTHRESHOLD 2000 /* max delay for double click */
-   mouse.clickthreshold = atoi(optarg);
-   if (mouse.clickthreshold < 0 ||
-   mouse.clickthreshold > MAX_CLICKTHRESHOLD) {
-   warnx("invalid threshold `%s': max value is %d",
-   optarg, MAX_CLICKTHRESHOLD);
+   mouse.clickthreshold = strtonum(optarg, 0,
+   MAX_CLICKTHRESHOLD, &errstr);
+   if (errstr != NULL) {
+   warnx("threshold value `%s' is %s, "
+   "acceptable range is 0-%d",
+   optarg, errstr, MAX_CLICKTHRESHOLD);
usage();
}
break;



Simplify wsmoused 1

2014-12-22 Thread Alexandr Shadchin
Remove function mouse_map. This function is redundant.

OK ?

-- 
Alexandr Shadchin

Index: wsmoused.c
===
RCS file: /cvs/src/usr.sbin/wsmoused/wsmoused.c,v
retrieving revision 1.33
diff -u -p -r1.33 wsmoused.c
--- wsmoused.c  21 Dec 2014 18:23:37 -  1.33
+++ wsmoused.c  21 Dec 2014 23:18:11 -
@@ -218,14 +218,6 @@ mouse_installmap(char *arg)
return TRUE;
 }
 
-/* mouse_map : converts physical buttons to logical buttons */
-static void
-mouse_map(struct wscons_event *orig, struct wscons_event *mapped)
-{
-   mapped->type = orig->type;
-   mapped->value = p2l[orig->value];
-}
-
 /* terminate signals handler */
 static void
 terminate(int sig)
@@ -262,7 +254,9 @@ mouse_click(struct wscons_event *event)
struct timeval max_date;
struct timeval now;
struct timeval delay;
-   int i = event->value; /* button number */
+   int i; /* button number */
+   
+   i = event->value = p2l[event->value];
 
gettimeofday(&now, NULL);
delay.tv_sec = mouse.clickthreshold / 1000;
@@ -332,14 +326,11 @@ normalize_event(struct wscons_event *eve
 static void
 treat_event(struct wscons_event *event)
 {
-   struct wscons_event mapped_event;
-
if (IS_MOTION_EVENT(event->type)) {
ioctl(mouse.cfd, WSDISPLAYIO_WSMOUSED, event);
} else if (IS_BUTTON_EVENT(event->type) &&
(uint)event->value < MOUSE_MAXBUTTON) {
-   mouse_map(event, &mapped_event);
-   mouse_click(&mapped_event);
+   mouse_click(event);
}
 }
 



Re: UPDATE: xkeyboard-config 2.13

2014-12-21 Thread Alexandr Shadchin
On Sun, Dec 21, 2014 at 11:12:36PM +, L.R. d S. wrote:
> >Comments ? OK ?
> I think you should put this in plain text, not on tgz.

This patch is large enough. You can download it from
http://koba.devio.us/distfiles/xkeyboard-config-2.13.diff

-- 
Alexandr Shadchin



Cleanup wsmoused 2

2014-12-21 Thread Alexandr Shadchin
Now does not need to be initialized event.value.
This not used anymore.

OK ?

-- 
Alexandr Shadchin

Index: wsmoused.c
===
RCS file: /cvs/src/usr.sbin/wsmoused/wsmoused.c,v
retrieving revision 1.33
diff -u -p -r1.33 wsmoused.c
--- wsmoused.c  21 Dec 2014 18:23:37 -  1.33
+++ wsmoused.c  21 Dec 2014 18:40:00 -
@@ -401,24 +401,9 @@ wsmoused(void)
struct pollfd pfd[1];
int res;
u_char b;
-   struct stat mdev_stat;
-
-   /* initialization */
-
-   event.type = WSCONS_EVENT_WSMOUSED_ON;
-   if (mouse.proto == P_WSCONS) {
-   /* get major and minor of mouse device */
-   res = stat(mouse.portname, &mdev_stat);
-   if (res != -1)
-   event.value = mdev_stat.st_rdev;
-   else
-   event.value = 0;
-   } else {
-   /* X11 won't start when using wsmoused(8) with a serial mouse */
-   event.value = 0;
-   }
 
/* notify kernel the start of wsmoused */
+   event.type = WSCONS_EVENT_WSMOUSED_ON;
res = ioctl(mouse.cfd, WSDISPLAYIO_WSMOUSED, &event);
if (res != 0) {
/* the display driver has no getchar() method */



Cleanup wsmousevar.h

2014-12-21 Thread Alexandr Shadchin
WSMOUSE_INPUT_WSMOUSED_CLOSE not used anymore.

OK ?

-- 
Alexandr Shadchin

Index: wsmousevar.h
===
RCS file: /cvs/src/sys/dev/wscons/wsmousevar.h,v
retrieving revision 1.7
diff -u -p -r1.7 wsmousevar.h
--- wsmousevar.h30 Oct 2013 18:00:57 -  1.7
+++ wsmousevar.h21 Dec 2014 17:48:28 -
@@ -71,9 +71,7 @@ int   wsmousedevprint(void *, const char *
 #define WSMOUSE_INPUT_ABSOLUTE_X   (1<<0)
 #define WSMOUSE_INPUT_ABSOLUTE_Y   (1<<1)
 #define WSMOUSE_INPUT_ABSOLUTE_Z   (1<<2)
-#define WSMOUSE_INPUT_WSMOUSED_CLOSE   (1<<3) /* notify wsmoused(8) to close
- mouse device */
-#define WSMOUSE_INPUT_ABSOLUTE_W   (1<<4)
+#define WSMOUSE_INPUT_ABSOLUTE_W   (1<<3)
 
 void   wsmouse_input(struct device *kbddev, u_int btns,
   int x, int y, int z, int w, u_int flags);



Cleanup wsmoused

2014-12-21 Thread Alexandr Shadchin
WSCONS_EVENT_WSMOUSED_SLEEP and WSCONS_EVENT_WSMOUSED_CLOSE not used anymore.

OK ?

-- 
Alexandr Shadchin

Index: wsconsio.h
===
RCS file: /cvs/src/sys/dev/wscons/wsconsio.h,v
retrieving revision 1.69
diff -u -p -r1.69 wsconsio.h
--- wsconsio.h  17 Nov 2013 13:41:26 -  1.69
+++ wsconsio.h  21 Dec 2014 17:25:21 -
@@ -87,9 +87,6 @@ struct wscons_event {
  */
 #define WSCONS_EVENT_WSMOUSED_ON   12  /* wsmoused(8) active */
 #define WSCONS_EVENT_WSMOUSED_OFF  13  /* wsmoused(8) inactive */
-#define WSCONS_EVENT_WSMOUSED_SLEEP14  /* wsmoused(8) sleeping */
-#define WSCONS_EVENT_WSMOUSED_CLOSE15  /* notify wsmoused(8) to close 
-  mouse device */
 
 #define IS_MOTION_EVENT(type) (((type) == WSCONS_EVENT_MOUSE_DELTA_X) || \
   ((type) == WSCONS_EVENT_MOUSE_DELTA_Y) || \
@@ -98,8 +95,7 @@ struct wscons_event {
 #define IS_BUTTON_EVENT(type) (((type) == WSCONS_EVENT_MOUSE_UP) || \
   ((type) == WSCONS_EVENT_MOUSE_DOWN))
 #define IS_CTRL_EVENT(type) ((type == WSCONS_EVENT_WSMOUSED_ON) || \
-(type == WSCONS_EVENT_WSMOUSED_OFF)|| \
-(type == WSCONS_EVENT_WSMOUSED_SLEEP))
+(type == WSCONS_EVENT_WSMOUSED_OFF))
 
 /*
  * Keyboard ioctls (0 - 31)
Index: wsmoused.c
===
RCS file: /cvs/src/usr.sbin/wsmoused/wsmoused.c,v
retrieving revision 1.32
diff -u -p -r1.32 wsmoused.c
--- wsmoused.c  14 May 2014 18:23:22 -  1.32
+++ wsmoused.c  21 Dec 2014 17:19:14 -
@@ -329,24 +329,18 @@ normalize_event(struct wscons_event *eve
 }
 
 /* send a wscons_event to the kernel */
-static int
+static void
 treat_event(struct wscons_event *event)
 {
struct wscons_event mapped_event;
 
if (IS_MOTION_EVENT(event->type)) {
ioctl(mouse.cfd, WSDISPLAYIO_WSMOUSED, event);
-   return 1;
} else if (IS_BUTTON_EVENT(event->type) &&
(uint)event->value < MOUSE_MAXBUTTON) {
mouse_map(event, &mapped_event);
mouse_click(&mapped_event);
-   return 1;
}
-   if (event->type == WSCONS_EVENT_WSMOUSED_CLOSE)
-   /* we have to close mouse fd */
-   return 0;
-   return 1;
 }
 
 /* split a full mouse event into multiples wscons events */
@@ -446,56 +440,7 @@ wsmoused(void)
if (mouse.proto == P_WSCONS) {
/* wsmouse supported mouse */
read(mouse.mfd, &event, sizeof(event));
-   res = treat_event(&event);
-   if (!res) {
-   /*
-* close mouse device and sleep until
-* the X server releases it
-*/
-
-   struct wscons_event sleeping;
-   unsigned int tries;
-
-   /* restore mouse resolution to default value */
-   res = WSMOUSE_RES_DEFAULT;
-   ioctl(mouse.mfd, WSMOUSEIO_SRES, &res);
-
-   close(mouse.mfd);
-   mouse.mfd = -1;
-
-   /* sleep until X server releases mouse device */
-   sleeping.type = WSCONS_EVENT_WSMOUSED_SLEEP;
-   sleeping.value = 0;
-   ioctl(mouse.cfd, WSDISPLAYIO_WSMOUSED,
-   &sleeping);
-
-   /*
-* Since the X server could still be running
-* (e.g. when switching from the graphics
-* screen to a virtual text console), it might
-* not have freed the device yet.
-*
-* Try to open the device until it succeeds.
-*/
-   tries = 0;
-   for (;;) {
-   if ((mouse.mfd = open(mouse.portname,
-   O_RDONLY | O_NONBLOCK, 0)) != -1)
-   break;
-
-   if (tries < 10) {
-   tries++;
-   sleep(1);
-   } else {
-   logwarn("unable to open %s, "
-

Re: audioctl: drop useless fields

2014-09-11 Thread Alexandr Shadchin
I like it. ok shadchin@

On Wed, Sep 10, 2014 at 10:31 PM, Alexandre Ratchov  wrote:

> audioctl output is full of useless, misleading and/or unreliable
> fields. Let's keep the usable ones only. The plan is to remove them
> from the kernel as well.
>
> OK?
>
> Index: audioctl.c
> ===
> RCS file: /cvs/src/usr.bin/audioctl/audioctl.c,v
> retrieving revision 1.23
> diff -u -p -u -p -r1.23 audioctl.c
> --- audioctl.c  13 Nov 2013 18:50:05 -  1.23
> +++ audioctl.c  10 Sep 2014 12:15:06 -
> @@ -80,17 +80,10 @@ struct field {
> u_int oldval;
>  } fields[] = {
> { "name",   &adev.name, STRING, READONLY
> },
> -   { "version",&adev.version,  STRING, READONLY },
> -   { "config", &adev.config,   STRING, READONLY },
> { "encodings",  encbuf, STRING, READONLY },
> { "properties", &properties,PROPS,  READONLY },
> -   { "full_duplex",&fullduplex,UINT,   0 },
> -   { "fullduplex", &fullduplex,UINT,   0 },
> -   { "blocksize",  &info.blocksize,UINT,   0 },
> { "hiwat",  &info.hiwat,UINT,   0 },
> { "lowat",  &info.lowat,UINT,   0 },
> -   { "output_muted",   &info.output_muted, UCHAR,  0 },
> -   { "monitor_gain",   &info.monitor_gain, UINT,   0 },
> { "mode",   &info.mode, P_R,READONLY },
> { "play.rate",  &info.play.sample_rate, UINT,   0 },
> { "play.sample_rate",   &info.play.sample_rate, UINT,   ALIAS },
> @@ -99,19 +92,9 @@ struct field {
> { "play.bps",   &info.play.bps, UINT,   0 },
> { "play.msb",   &info.play.msb, UINT,   0 },
> { "play.encoding",  &info.play.encoding,ENC,0 },
> -   { "play.gain",  &info.play.gain,UINT,   0 },
> -   { "play.balance",   &info.play.balance, UCHAR,  0 },
> -   { "play.port",  &info.play.port,XINT,   0 },
> -   { "play.avail_ports",   &info.play.avail_ports, XINT,   0 },
> -   { "play.seek",  &info.play.seek,UINT,   READONLY },
> { "play.samples",   &info.play.samples, UINT,   READONLY },
> -   { "play.eof",   &info.play.eof, UINT,   READONLY },
> { "play.pause", &info.play.pause,   UCHAR,  0 },
> -   { "play.error", &info.play.error,   UCHAR,  READONLY },
> -   { "play.waiting",   &info.play.waiting, UCHAR,  READONLY },
> -   { "play.open",  &info.play.open,UCHAR,  READONLY },
> { "play.active",&info.play.active,  UCHAR,  READONLY },
> -   { "play.buffer_size",   &info.play.buffer_size, UINT,   0 },
> { "play.block_size",&info.play.block_size,  UINT,   0 },
> { "play.errors",&perrors,   INT,READONLY },
> { "record.rate",&info.record.sample_rate,UINT,  0 },
> @@ -121,19 +104,9 @@ struct field {
> { "record.bps", &info.record.bps,   UINT,   0 },
> { "record.msb", &info.record.msb,   UINT,   0 },
> { "record.encoding",&info.record.encoding,  ENC,0 },
> -   { "record.gain",&info.record.gain,  UINT,   0 },
> -   { "record.balance", &info.record.balance,   UCHAR,  0 },
> -   { "record.port",&info.record.port,  XINT,   0 },
> -   { "record.avail_ports", &info.record.avail_ports,XINT,  0 },
> -   { "record.seek",&info.record.seek,  UINT,   READONLY },
> { "record.samples", &info.record.samples,   UINT,   READONLY },
> -   { "record.eof", &info.record.eof,   UINT,   READONLY },
> { "record.pause",   &info.record.pause, UCHAR,  0 },
> -   { "record.error",   &info.record.error, UCHAR,  READONLY },
> -   { "record.waiting", &info.record.waiting,   UCHAR,  READONLY },
> -   { "record.open",&info.record.open,  UCHAR,  READONLY },
> { "record.active",  &info.record.active,UCHAR,  READONLY },
> -   { "record.buffer_size", &info.record.buffer_size,UINT,  0 },
> { "record.block_size",  &info.record.block_size,UINT,   0 },
> { "record.errors",  &rerrors,   INT,READONLY },
> { 0 }
>
>


-- 
Alexandr Shadchin


cleanup wsmoused 5

2014-05-14 Thread Alexandr Shadchin
Remove second arg in SetMouseSpeed(), it is always 1200. OK ?

-- 
Alexandr Shadchin

diff --git mouse_protocols.c mouse_protocols.c
index 9ee1039..a41d618 100644
--- mouse_protocols.c
+++ mouse_protocols.c
@@ -184,7 +184,7 @@ mouse_name(int type)
 }
 
 void
-SetMouseSpeed(int old, int new, unsigned int cflag)
+SetMouseSpeed(int old, unsigned int cflag)
 {
struct termios tty;
char*c;
@@ -223,28 +223,9 @@ SetMouseSpeed(int old, int new, unsigned int cflag)
if (tcsetattr(mouse.mfd, TCSADRAIN, &tty) < 0)
logerr(1, "unable to get mouse status. Exiting...\n");
 
-   switch (new) {
-   case 9600:
-   c = "*q";
-   cfsetispeed(&tty, B9600);
-   cfsetospeed(&tty, B9600);
-   break;
-   case 4800:
-   c = "*p";
-   cfsetispeed(&tty, B4800);
-   cfsetospeed(&tty, B4800);
-   break;
-   case 2400:
-   c = "*o";
-   cfsetispeed(&tty, B2400);
-   cfsetospeed(&tty, B2400);
-   break;
-   case 1200:
-   default:
-   c = "*n";
-   cfsetispeed(&tty, B1200);
-   cfsetospeed(&tty, B1200);
-   }
+   c = "*n";
+   cfsetispeed(&tty, B1200);
+   cfsetospeed(&tty, B1200);
 
if (mouse.proto == P_LOGIMAN || mouse.proto == P_LOGI) {
if (write(mouse.mfd, c, 2) != 2)
@@ -316,7 +297,7 @@ pnpgets(int mouse_fd, char *buf)
goto disconnect_idle;
 
/* port setup, 1st phase (2.1.3) */
-   SetMouseSpeed(1200, 1200, (CS7 | CREAD | CLOCAL | HUPCL));
+   SetMouseSpeed(1200, (CS7 | CREAD | CLOCAL | HUPCL));
i = TIOCM_DTR | TIOCM_RTS;  /* DTR = 0, RTS = 0 */
ioctl(mouse_fd, TIOCMBIC, &i);
usleep(20);
@@ -350,7 +331,7 @@ pnpgets(int mouse_fd, char *buf)
/*
 * This is a simplified procedure; it simply toggles RTS.
 */
-   SetMouseSpeed(1200, 1200, (CS7 | CREAD | CLOCAL | HUPCL));
+   SetMouseSpeed(1200, (CS7 | CREAD | CLOCAL | HUPCL));
 
ioctl(mouse_fd, TIOCMGET, &i);
i |= TIOCM_DTR; /* DTR = 1 */
@@ -635,15 +616,15 @@ mouse_init(void)
 * The baud rate selection command must be sent at the current
 * baud rate; try all likely settings
 */
-   SetMouseSpeed(9600, 1200, mousecflags[mouse.proto]);
-   SetMouseSpeed(4800, 1200, mousecflags[mouse.proto]);
-   SetMouseSpeed(2400, 1200, mousecflags[mouse.proto]);
+   SetMouseSpeed(9600, mousecflags[mouse.proto]);
+   SetMouseSpeed(4800, mousecflags[mouse.proto]);
+   SetMouseSpeed(2400, mousecflags[mouse.proto]);
 #if 0
-   SetMouseSpeed(1200, 1200, mousecflags[mouse.proto]);
+   SetMouseSpeed(1200, mousecflags[mouse.proto]);
 #endif
/* select MM series data format */
write(mouse.mfd, "S", 1);
-   SetMouseSpeed(1200, 1200, mousecflags[P_MM]);
+   SetMouseSpeed(1200, mousecflags[P_MM]);
/* select report rate/frequency */
if (mouse.rate <= 0)
write(mouse.mfd, "O", 1);
@@ -665,13 +646,13 @@ mouse_init(void)
 
case P_LOGIMAN:
/* The command must always be sent at 1200 baud */
-   SetMouseSpeed(1200, 1200, mousecflags[mouse.proto]);
+   SetMouseSpeed(1200, mousecflags[mouse.proto]);
write(mouse.mfd, "*X", 2);
-   SetMouseSpeed(1200, 1200, mousecflags[mouse.proto]);
+   SetMouseSpeed(1200, mousecflags[mouse.proto]);
break;
 
case P_MMHIT:
-   SetMouseSpeed(1200, 1200, mousecflags[mouse.proto]);
+   SetMouseSpeed(1200, mousecflags[mouse.proto]);
 
/*
 * Initialize Hitachi PUMA Plus - Model 1212E to desired 
settings.
@@ -721,7 +702,7 @@ mouse_init(void)
break;
 
case P_THINKING:
-   SetMouseSpeed(1200, 1200, mousecflags[mouse.proto]);
+   SetMouseSpeed(1200, mousecflags[mouse.proto]);
/* the PnP ID string may be sent again, discard it */
usleep(20);
i = FREAD;
@@ -740,7 +721,7 @@ mouse_init(void)
break;
 
case P_MSC:
-   SetMouseSpeed(1200, 1200, mousecflags[mouse.proto]);
+   SetMouseSpeed(1200, mousecflags[mouse.proto]);
 #if 0
if (mouse.flags & ClearDTR) {
i = TIOCM_DTR;
@@ -754,7 +735,7 @@ mouse_init(void)
break;
 
default:
-   SetMouseSpeed(1200, 1200, mousecflags[mouse.proto]);
+   SetMouseSpeed(1200, mousecflags[mouse.proto]);
break;
}
 }



cleanup wsmoused 4

2014-05-14 Thread Alexandr Shadchin
Remove mouse.baudrate, it is always 1200. OK ?

-- 
Alexandr Shadchin

diff --git mouse_protocols.c mouse_protocols.c
index b250f65..9ee1039 100644
--- mouse_protocols.c
+++ mouse_protocols.c
@@ -635,16 +635,15 @@ mouse_init(void)
 * The baud rate selection command must be sent at the current
 * baud rate; try all likely settings
 */
-   SetMouseSpeed(9600, mouse.baudrate, mousecflags[mouse.proto]);
-   SetMouseSpeed(4800, mouse.baudrate, mousecflags[mouse.proto]);
-   SetMouseSpeed(2400, mouse.baudrate, mousecflags[mouse.proto]);
+   SetMouseSpeed(9600, 1200, mousecflags[mouse.proto]);
+   SetMouseSpeed(4800, 1200, mousecflags[mouse.proto]);
+   SetMouseSpeed(2400, 1200, mousecflags[mouse.proto]);
 #if 0
-   SetMouseSpeed(1200, mouse.baudrate, mousecflags[mouse.proto]);
+   SetMouseSpeed(1200, 1200, mousecflags[mouse.proto]);
 #endif
/* select MM series data format */
write(mouse.mfd, "S", 1);
-   SetMouseSpeed(mouse.baudrate, mouse.baudrate,
- mousecflags[P_MM]);
+   SetMouseSpeed(1200, 1200, mousecflags[P_MM]);
/* select report rate/frequency */
if (mouse.rate <= 0)
write(mouse.mfd, "O", 1);
@@ -668,11 +667,11 @@ mouse_init(void)
/* The command must always be sent at 1200 baud */
SetMouseSpeed(1200, 1200, mousecflags[mouse.proto]);
write(mouse.mfd, "*X", 2);
-   SetMouseSpeed(1200, mouse.baudrate, mousecflags[mouse.proto]);
+   SetMouseSpeed(1200, 1200, mousecflags[mouse.proto]);
break;
 
case P_MMHIT:
-   SetMouseSpeed(1200, mouse.baudrate, mousecflags[mouse.proto]);
+   SetMouseSpeed(1200, 1200, mousecflags[mouse.proto]);
 
/*
 * Initialize Hitachi PUMA Plus - Model 1212E to desired 
settings.
@@ -722,7 +721,7 @@ mouse_init(void)
break;
 
case P_THINKING:
-   SetMouseSpeed(1200, mouse.baudrate, mousecflags[mouse.proto]);
+   SetMouseSpeed(1200, 1200, mousecflags[mouse.proto]);
/* the PnP ID string may be sent again, discard it */
usleep(20);
i = FREAD;
@@ -741,7 +740,7 @@ mouse_init(void)
break;
 
case P_MSC:
-   SetMouseSpeed(1200, mouse.baudrate, mousecflags[mouse.proto]);
+   SetMouseSpeed(1200, 1200, mousecflags[mouse.proto]);
 #if 0
if (mouse.flags & ClearDTR) {
i = TIOCM_DTR;
@@ -755,7 +754,7 @@ mouse_init(void)
break;
 
default:
-   SetMouseSpeed(1200, mouse.baudrate, mousecflags[mouse.proto]);
+   SetMouseSpeed(1200, 1200, mousecflags[mouse.proto]);
break;
}
 }
diff --git wsmoused.c wsmoused.c
index aea621a..7875ce8 100644
--- wsmoused.c
+++ wsmoused.c
@@ -89,7 +89,6 @@ mouse_t mouse = {
.portname = NULL,
.ttyname = NULL,
.proto = P_UNKNOWN,
-   .baudrate = 1200,
.rate = MOUSE_RATE_UNKNOWN,
.resolution = MOUSE_RES_UNKNOWN,
.zmap = 0,
diff --git wsmoused.h wsmoused.h
index 2d62e2a..6cae5a2 100644
--- wsmoused.h
+++ wsmoused.h
@@ -98,7 +98,6 @@ typedef struct mouse_s {
char *portname; /* mouse device */
char *ttyname;  /* wsdisplay control tty device */
int proto;  /* MOUSE_PROTO_XXX */
-   int baudrate;
unsigned char rate; /* report rate */
unsigned int resolution;/* MOUSE_RES_XXX or a positive number */
int zmap;   /* MOUSE_{X|Y}AXIS or a button number */



cleanup wsmoused 3

2014-05-14 Thread Alexandr Shadchin
Remove unused code. OK ?

-- 
Alexandr Shadchin

Index: mouse_protocols.c
===
RCS file: /cvs/src/usr.sbin/wsmoused/mouse_protocols.c,v
retrieving revision 1.13
diff -u -p -r1.13 mouse_protocols.c
--- mouse_protocols.c   5 Jun 2009 03:37:10 -   1.13
+++ mouse_protocols.c   14 May 2014 13:34:14 -
@@ -194,24 +194,6 @@ SetMouseSpeed(int old, int new, unsigned
mouse.portname, strerror(errno));
return;
}
-   /* this will query the initial baudrate only once */
-   if (mouse.old_baudrate < 0) {
-   switch (cfgetispeed(&tty)) {
-   case B9600:
-   mouse.old_baudrate = 9600;
-   break;
-   case B4800:
-   mouse.old_baudrate = 4800;
-   break;
-   case B2400:
-   mouse.old_baudrate = 2400;
-   break;
-   case B1200:
-   default:
-   mouse.old_baudrate = 1200;
-   break;
-   }
-   }
tty.c_iflag = IGNBRK | IGNPAR;
tty.c_oflag = 0;
tty.c_lflag = 0;
Index: wsmoused.c
===
RCS file: /cvs/src/usr.sbin/wsmoused/wsmoused.c,v
retrieving revision 1.29
diff -u -p -r1.29 wsmoused.c
--- wsmoused.c  24 Nov 2013 01:06:19 -  1.29
+++ wsmoused.c  14 May 2014 13:34:14 -
@@ -90,7 +90,6 @@ mouse_t mouse = {
.ttyname = NULL,
.proto = P_UNKNOWN,
.baudrate = 1200,
-   .old_baudrate = 1200,
.rate = MOUSE_RATE_UNKNOWN,
.resolution = MOUSE_RES_UNKNOWN,
.zmap = 0,
Index: wsmoused.h
===
RCS file: /cvs/src/usr.sbin/wsmoused/wsmoused.h,v
retrieving revision 1.8
diff -u -p -r1.8 wsmoused.h
--- wsmoused.h  21 Jun 2009 16:13:18 -  1.8
+++ wsmoused.h  14 May 2014 13:34:14 -
@@ -99,7 +99,6 @@ typedef struct mouse_s {
char *ttyname;  /* wsdisplay control tty device */
int proto;  /* MOUSE_PROTO_XXX */
int baudrate;
-   int old_baudrate;
unsigned char rate; /* report rate */
unsigned int resolution;/* MOUSE_RES_XXX or a positive number */
int zmap;   /* MOUSE_{X|Y}AXIS or a button number */



cleanup wsmoused 2

2014-05-14 Thread Alexandr Shadchin
Remove unused variables. OK ?

-- 
Alexandr Shadchin

Index: wsmoused.c
===
RCS file: /cvs/src/usr.sbin/wsmoused/wsmoused.c,v
retrieving revision 1.29
diff -u -p -r1.29 wsmoused.c
--- wsmoused.c  24 Nov 2013 01:06:19 -  1.29
+++ wsmoused.c  14 May 2014 12:41:59 -
@@ -93,8 +93,6 @@ mouse_t mouse = {
.old_baudrate = 1200,
.rate = MOUSE_RATE_UNKNOWN,
.resolution = MOUSE_RES_UNKNOWN,
-   .zmap = 0,
-   .wmode = 0,
.mfd = -1,
.clickthreshold = 500,  /* 0.5 sec */
 };
Index: wsmoused.h
===
RCS file: /cvs/src/usr.sbin/wsmoused/wsmoused.h,v
retrieving revision 1.8
diff -u -p -r1.8 wsmoused.h
--- wsmoused.h  21 Jun 2009 16:13:18 -  1.8
+++ wsmoused.h  14 May 2014 12:41:59 -
@@ -102,8 +102,6 @@ typedef struct mouse_s {
int old_baudrate;
unsigned char rate; /* report rate */
unsigned int resolution;/* MOUSE_RES_XXX or a positive number */
-   int zmap;   /* MOUSE_{X|Y}AXIS or a button number */
-   int wmode;  /* wheel mode button number */
int mfd;/* mouse file descriptor */
int cfd;/* console file descriptor */
long clickthreshold;/* double click speed in msec */



cleanup wsmoused 1

2014-05-14 Thread Alexandr Shadchin
wsmoused() called if cmd == WSDISPLAYIO_WSMOUSED only,
don't need check cmd twice

Comment ? OK ?

note: diff cteated with 'cvs diff -w' for simplicity

-- 
Alexandr Shadchin

Index: wsdisplay.c
===
RCS file: /cvs/src/sys/dev/wscons/wsdisplay.c,v
retrieving revision 1.117
diff -u -p -w -r1.117 wsdisplay.c
--- wsdisplay.c 4 Nov 2013 05:45:04 -   1.117
+++ wsdisplay.c 14 May 2014 12:34:06 -
@@ -1319,7 +1319,7 @@ wsdisplay_cfg_ioctl(struct wsdisplay_sof
switch (cmd) {
 #ifdef HAVE_WSMOUSED_SUPPORT
case WSDISPLAYIO_WSMOUSED:
-   error = wsmoused(sc, cmd, data, flag, p);
+   error = wsmoused(sc, data, flag, p);
return (error);
 #endif
case WSDISPLAYIO_ADDSCREEN:
@@ -2381,12 +2381,10 @@ wsdisplay_burner(void *v)
  * Main function, called from wsdisplay_cfg_ioctl.
  */
 int
-wsmoused(struct wsdisplay_softc *sc, u_long cmd, caddr_t data,
-int flag, struct proc *p)
+wsmoused(struct wsdisplay_softc *sc, caddr_t data, int flag, struct proc *p)
 {
struct wscons_event mouse_event = *(struct wscons_event *)data;
 
-   if (cmd == WSDISPLAYIO_WSMOUSED) {
if (IS_MOTION_EVENT(mouse_event.type)) {
if (sc->sc_focus != NULL)
motion_event(sc->sc_focus, mouse_event.type,
@@ -2410,7 +2408,6 @@ wsmoused(struct wsdisplay_softc *sc, u_l
if (IS_CTRL_EVENT(mouse_event.type)) {
return ctrl_event(sc, mouse_event.type,
mouse_event.value, p);
-   }
}
return -1;
 }
Index: wsmoused.h
===
RCS file: /cvs/src/sys/dev/wscons/wsmoused.h,v
retrieving revision 1.8
diff -u -p -w -r1.8 wsmoused.h
--- wsmoused.h  31 May 2009 17:02:20 -  1.8
+++ wsmoused.h  14 May 2014 12:34:06 -
@@ -35,7 +35,7 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-intwsmoused(struct wsdisplay_softc *, u_long, caddr_t, int, struct proc *);
+intwsmoused(struct wsdisplay_softc *, caddr_t, int, struct proc *);
 
 void   motion_event(struct wsscreen *, u_int, int);
 void   button_event(struct wsscreen *, int, int);



Re: Stairstep mouse motion

2013-10-29 Thread Alexandr Shadchin
On Sun, Oct 27, 2013 at 04:31:37PM +0100, Matthieu Herrb wrote:
> On Sat, Oct 26, 2013 at 10:13:11PM +0600, Alexandr Shadchin wrote:
> > On Fri, Oct 25, 2013 at 11:41:25AM +0100, Edd Barrett wrote:
> > > On Thu, Oct 24, 2013 at 10:33:22PM +0300, Henri Kemppainen wrote:
> > > > What happens when priv->swap_axes is set, and the ax && ay branch is
> > > > taken along with the wsWheelEmuFilterMotion() branch.  Following
> > > > continue another event is processed and now the axes are swapped again
> > > > (ax and ay were not reset after use) and then what?  Not very likely
> > > > I know.
> > > 
> > > Ah, yes, there is the possibility of posting an inconsistent pointer 
> > > sample
> > > in this case. Perhaps we should only update the old_ax/old_ay if the
> > > wsWheelEmuFilterMotion branch is not taken?
> > > 
> > > What do you think? And yes, this is a very very unlikely case. You could
> > > argue it wouldn't matter even if it did happen.
> > > 
> > > -- 
> > > Best Regards
> > > Edd Barrett
> > > 
> > > http://www.theunixzoo.co.uk
> > > 
> > 
> > Alternative solution without extra magic (need rebuild kernel).
> > 
> > Before (on example pms(4)):
> > * user move mouse
> > * pms(4) read state mouse and process it
> > * pms(4) send dx, dy and buttons in wscons
> > * wscons generate simple events
> > * ws(4) reads one event and process it immediately
> > 
> > After applying diff:
> > * user move mouse
> > * pms(4) read state mouse and process it
> > * pms(4) send dx, dy and buttons in wscons
> > * wscons generate simple events and adds SYNC event
> > * ws(4) reads events until it receives SYNC, and only then begins processing
> > 
> > Tested on mouse.
> > 
> > Comments ?
> 
> Look good to me. However I've a concern about compatibility with
> NetBSD. The kernel change should be documented in the commit message
> for xf86-input-ws so that they can catch up with the kernel change
> before they update xf86-input-ws...
> 

Update diff (add small hack for NetBSD).

--
Alexandr Shadchin

Index: ws.c
===
RCS file: /cvs/xenocara/driver/xf86-input-ws/src/ws.c,v
retrieving revision 1.58
diff -u -p -r1.58 ws.c
--- ws.c20 Jul 2013 13:24:50 -  1.58
+++ ws.c29 Oct 2013 16:57:05 -
@@ -428,13 +428,6 @@ wsDeviceOn(DeviceIntPtr pWS)
}
}
}
-   priv->buffer = XisbNew(pInfo->fd,
-   sizeof(struct wscons_event) * NUMEVENTS);
-   if (priv->buffer == NULL) {
-   xf86IDrvMsg(pInfo, X_ERROR, "cannot alloc xisb buffer\n");
-   wsClose(pInfo);
-   return !Success;
-   }
xf86AddEnabledDevice(pInfo);
wsmbEmuOn(pInfo);
pWS->public.on = TRUE;
@@ -462,170 +455,157 @@ wsDeviceOff(DeviceIntPtr pWS)
xf86RemoveEnabledDevice(pInfo);
wsClose(pInfo);
}
-   if (priv->buffer) {
-   XisbFree(priv->buffer);
-   priv->buffer = NULL;
-   }
pWS->public.on = FALSE;
 }
 
-static void
-wsReadInput(InputInfoPtr pInfo)
+static Bool
+wsReadEvent(InputInfoPtr pInfo, struct wscons_event *event)
 {
-   WSDevicePtr priv = (WSDevicePtr)pInfo->private;
-   static struct wscons_event eventList[NUMEVENTS];
-   int n, c, dx, dy;
-   struct wscons_event *event = eventList;
-   unsigned char *pBuf;
-
-   XisbBlockDuration(priv->buffer, -1);
-   pBuf = (unsigned char *)eventList;
-   n = 0;
-   while (n < sizeof(eventList) && (c = XisbRead(priv->buffer)) >= 0) {
-   pBuf[n++] = (unsigned char)c;
+   Bool rc = TRUE;
+   ssize_t len;
+
+   len = read(pInfo->fd, event, sizeof(struct wscons_event));
+   if (len <= 0) {
+   if (errno != EAGAIN)
+   xf86IDrvMsg(pInfo, X_ERROR, "read error %s\n",
+   strerror(errno));
+   rc = FALSE;
+   } else if (len != sizeof(struct wscons_event)) {
+   xf86IDrvMsg(pInfo, X_ERROR,
+   "read error, invalid number of bytes\n");
+   rc = FALSE;
}
 
-   if (n == 0)
-   return;
+   return rc;
+}
 
-   dx = dy = 0;
-   n /= sizeof(struct wscons_event);
-   while (n--) {
-   int buttons = priv->lastButtons;
-   int newdx = 0, newdy = 0, dz = 0, dw = 0, ax = 0, ay = 0;
-   int zbutton = 0, wbutton = 0;
+static Bool
+wsReadHwState(InputInfoPtr pInfo, wsHwState *

Re: Stairstep mouse motion

2013-10-26 Thread Alexandr Shadchin
On Fri, Oct 25, 2013 at 11:41:25AM +0100, Edd Barrett wrote:
> On Thu, Oct 24, 2013 at 10:33:22PM +0300, Henri Kemppainen wrote:
> > What happens when priv->swap_axes is set, and the ax && ay branch is
> > taken along with the wsWheelEmuFilterMotion() branch.  Following
> > continue another event is processed and now the axes are swapped again
> > (ax and ay were not reset after use) and then what?  Not very likely
> > I know.
> 
> Ah, yes, there is the possibility of posting an inconsistent pointer sample
> in this case. Perhaps we should only update the old_ax/old_ay if the
> wsWheelEmuFilterMotion branch is not taken?
> 
> What do you think? And yes, this is a very very unlikely case. You could
> argue it wouldn't matter even if it did happen.
> 
> -- 
> Best Regards
> Edd Barrett
> 
> http://www.theunixzoo.co.uk
> 

Alternative solution without extra magic (need rebuild kernel).

Before (on example pms(4)):
* user move mouse
* pms(4) read state mouse and process it
* pms(4) send dx, dy and buttons in wscons
* wscons generate simple events
* ws(4) reads one event and process it immediately

After applying diff:
* user move mouse
* pms(4) read state mouse and process it
* pms(4) send dx, dy and buttons in wscons
* wscons generate simple events and adds SYNC event
* ws(4) reads events until it receives SYNC, and only then begins processing

Tested on mouse.

Comments ?

PS:
synaptics(4) is working on a similar basis

-- 
Alexandr Shadchin

Index: dev/pckbc/pms.c
===
RCS file: /cvs/src/sys/dev/pckbc/pms.c,v
retrieving revision 1.48
diff -u -p -r1.48 pms.c
--- dev/pckbc/pms.c 20 Sep 2013 14:07:30 -  1.48
+++ dev/pckbc/pms.c 26 Oct 2013 15:09:53 -
@@ -1155,8 +1155,7 @@ pms_proc_synaptics(struct pms_softc *sc)
if (syn->wsmode == WSMOUSE_NATIVE) {
wsmouse_input(sc->sc_wsmousedev, buttons, x, y, z, w,
WSMOUSE_INPUT_ABSOLUTE_X | WSMOUSE_INPUT_ABSOLUTE_Y |
-   WSMOUSE_INPUT_ABSOLUTE_Z | WSMOUSE_INPUT_ABSOLUTE_W |
-   WSMOUSE_INPUT_SYNC);
+   WSMOUSE_INPUT_ABSOLUTE_Z | WSMOUSE_INPUT_ABSOLUTE_W);
} else {
dx = dy = 0;
if (z > SYNAPTICS_PRESSURE) {
@@ -1470,8 +1469,7 @@ pms_proc_alps(struct pms_softc *sc)
 
wsmouse_input(sc->sc_wsmousedev, buttons, x, y, z, w,
WSMOUSE_INPUT_ABSOLUTE_X | WSMOUSE_INPUT_ABSOLUTE_Y |
-   WSMOUSE_INPUT_ABSOLUTE_Z | WSMOUSE_INPUT_ABSOLUTE_W |
-   WSMOUSE_INPUT_SYNC);
+   WSMOUSE_INPUT_ABSOLUTE_Z | WSMOUSE_INPUT_ABSOLUTE_W);
 
alps->old_fin = fin;
} else {
@@ -2321,8 +2319,7 @@ elantech_send_input(struct pms_softc *sc
WSMOUSE_INPUT_ABSOLUTE_X |
WSMOUSE_INPUT_ABSOLUTE_Y |
WSMOUSE_INPUT_ABSOLUTE_Z |
-   WSMOUSE_INPUT_ABSOLUTE_W |
-   WSMOUSE_INPUT_SYNC);
+   WSMOUSE_INPUT_ABSOLUTE_W);
} else {
dx = dy = 0;
 
Index: dev/wscons/wsmouse.c
===
RCS file: /cvs/src/sys/dev/wscons/wsmouse.c,v
retrieving revision 1.24
diff -u -p -r1.24 wsmouse.c
--- dev/wscons/wsmouse.c18 Oct 2013 13:54:09 -  1.24
+++ dev/wscons/wsmouse.c26 Oct 2013 15:09:55 -
@@ -452,13 +452,11 @@ wsmouse_input(struct device *wsmousedev,
ub ^= d;
}
 
-   if (flags & WSMOUSE_INPUT_SYNC) {
-   NEXT;
-   ev->type = WSCONS_EVENT_SYNC;
-   ev->value = 0;
-   TIMESTAMP;
-   ADVANCE;
-   }
+   NEXT;
+   ev->type = WSCONS_EVENT_SYNC;
+   ev->value = 0;
+   TIMESTAMP;
+   ADVANCE;
 
/* XXX fake wscons_event notifying wsmoused(8) to close mouse device */
if (flags & WSMOUSE_INPUT_WSMOUSED_CLOSE) {
Index: dev/wscons/wsmousevar.h
===
RCS file: /cvs/src/sys/dev/wscons/wsmousevar.h,v
retrieving revision 1.6
diff -u -p -r1.6 wsmousevar.h
--- dev/wscons/wsmousevar.h 22 Jul 2012 18:28:36 -  1.6
+++ dev/wscons/wsmousevar.h 26 Oct 2013 15:09:55 -
@@ -74,7 +74,6 @@ int   wsmousedevprint(void *, const char *
 #define WSMOUSE_INPUT_WSMOUSED_CLOSE   (1<<3) /* notify wsmoused(8) to close
  mouse device */
 #define WSMOUSE_INPUT_ABSOLUTE_W   (1<<4)
-#define WSMOUSE_INPUT_SYNC (1<<5)
 
 void   wsmouse_input(struct device *kbddev, u_int btns,
   int x, int y, int z, int w, u_int flags);
Index: ws.c
===
RCS file: /c

UPDATE: xkeyboard-config 2.10.1

2013-10-10 Thread Alexandr Shadchin
Hi,

This update xkeyboard-config to the latest release 2.10.1.
http://koba.devio.us/distfiles/xkeyboard-config-2.10.1.diff
or 
http://koba.devio.us/distfiles/xkeyboard-config.2.10.1.diff.tgz

Change:
* 10+ bugs fixed
* 37 cleanup commits by Benno Schulenberg
* Updated 12 translations

Tested on amd64.

>From previous patch for xkeyboard-config 2.8, Matthieu wrote:
--
I'm a bit worried that this update seem to remove all old Sun keyboard
definitions and only keep type 6 & 7.

We have users still using type 3 & 4, and a lot of type 5 keyboards.

I haven't tried it on an actual sparc  yet to confirm the issue.
--

I did an analysis of the changes and come to the conclusion that they
should not break type 3, 4 & 5 for OpenBSD, but it would be great if
someone would check these keyboards.

Comments ? OK ?

-- 
Alexandr Shadchin



Re: pms: synaptics touchpad resume fix

2013-09-02 Thread Alexandr Shadchin
On Mon, Sep 02, 2013 at 06:51:36PM +0200, Stefan Sperling wrote:
> On Mon, Sep 02, 2013 at 02:32:50PM +0200, Martin Pieuchot wrote:
> > You might also rely on the fact that if you have a "sc->synaptics"
> > already allocated to try harder.  Because in this case you know
> > that you have a synaptic touchpad.
> 
> That works. Here's a simpler diff that fixes my issue, too.
> 

Maybe it makes sense to try to increase the response time

Index: pckbc.c
===
RCS file: /cvs/src/sys/dev/ic/pckbc.c,v
retrieving revision 1.36
diff -u -p -r1.36 pckbc.c
--- pckbc.c 23 May 2013 18:29:51 -  1.36
+++ pckbc.c 2 Sep 2013 18:24:19 -
@@ -616,7 +616,7 @@ pckbc_poll_cmd1(struct pckbc_internal *t
 
while (cmd->responseidx < cmd->responselen) {
if (cmd->flags & KBC_CMDFLAG_SLOW)
-   i = 100; /* 10s ??? */
+   i = 1000; /* 100s ??? */
else
i = 10; /* 1s ??? */
while (i--) {


or

Index: pckbc.c
===
RCS file: /cvs/src/sys/dev/ic/pckbc.c,v
retrieving revision 1.36
diff -u -p -r1.36 pckbc.c
--- pckbc.c 23 May 2013 18:29:51 -  1.36
+++ pckbc.c 2 Sep 2013 18:28:43 -
@@ -144,8 +144,8 @@ pckbc_poll_data1(bus_space_tag_t iot, bu
int i;
u_char stat;
 
-   /* polls for ~100ms */
-   for (i = 100; i; i--, delay(1000)) {
+   /* polls for ~1s */
+   for (i = 100; i; i--, delay(1)) {
stat = bus_space_read_1(iot, ioh_c, 0);
if (stat & KBS_DIB) {
register u_char c;



> Index: pms.c
> ===
> RCS file: /cvs/src/sys/dev/pckbc/pms.c,v
> retrieving revision 1.45
> diff -u -p -r1.45 pms.c
> --- pms.c 16 Jul 2013 08:11:39 -  1.45
> +++ pms.c 2 Sep 2013 16:44:48 -
> @@ -937,15 +937,38 @@ pms_enable_synaptics(struct pms_softc *s
>   struct synaptics_softc *syn = sc->synaptics;
>   struct wsmousedev_attach_args a;
>   u_char resp[3];
> - int mode;
> + int mode, i;
>  
>   if (pms_set_resolution(sc, 0) ||
>   pms_set_resolution(sc, 0) ||
>   pms_set_resolution(sc, 0) ||
>   pms_set_resolution(sc, 0) ||
>   pms_get_status(sc, resp) ||
> - resp[1] != SYNAPTICS_ID_MAGIC)
> - goto err;
> + resp[1] != SYNAPTICS_ID_MAGIC) {
> + if (sc->synaptics == NULL)
> + goto err;
> + /* 
> +  * Some synaptics touchpads don't resume quickly.
> +  * Retry a few times.
> +  */
> + for (i = 10; i > 0; --i) {
> + printf("%s: device not resuming, retrying\n",
> + DEVNAME(sc));
> + pms_reset(sc);
> + if (pms_set_resolution(sc, 0) ||
> + pms_set_resolution(sc, 0) ||
> + pms_set_resolution(sc, 0) ||
> + pms_set_resolution(sc, 0) ||
> + pms_get_status(sc, resp) ||
> + resp[1] == SYNAPTICS_ID_MAGIC)
> + break;
> + delay(10);
> + }
> + if (i == 0) {
> + printf("%s: lost device\n", DEVNAME(sc));
> + goto err;
> + }
> + }
>  
>   if (sc->synaptics == NULL) {
>   sc->synaptics = syn = malloc(sizeof(struct synaptics_softc),
> 

-- 
Alexandr Shadchin



Re: UPDATE: xf86-input-synaptics 1.7.0

2013-05-20 Thread Alexandr Shadchin
On Thu, May 02, 2013 at 10:11:23PM +0600, Alexandr Shadchin wrote:
> Hi,
> 
> This update xf86-input-synaptics to the latest release 1.7.0.
> http://koba.devio.us/distfiles/xf86-input-synaptics-1.7.0.diff
> 
> Tested on amd64 and i386.
> 
> Comments ? OK ?
> 
> -- 
> Alexandr Shadchin
> 

Prepare diff for xf86-input-synaptics 1.7.1
http://koba.devio.us/distfiles/xf86-input-synaptics-1.7.1.diff

-- 
Alexandr Shadchin



UPDATE: xf86-input-synaptics 1.7.0

2013-05-02 Thread Alexandr Shadchin
Hi,

This update xf86-input-synaptics to the latest release 1.7.0.
http://koba.devio.us/distfiles/xf86-input-synaptics-1.7.0.diff

Tested on amd64 and i386.

Comments ? OK ?

-- 
Alexandr Shadchin



UPDATE: xkeyboard-config 2.8

2013-03-19 Thread Alexandr Shadchin
Hi,

This update xkeyboard-config to the latest release 2.8.
http://koba.devio.us/distfiles/xkeyboard-config-2.8.diff

Change:
* 18 bugs fixed
* Most important change: a lot of materials updated from Oracle (Sun keyboards)
* Updated translations

Tested on amd64.

Comments ? OK ?.

-- 
Alexandr Shadchin



Remove unnecessary dependencies for distrib/special/kbd

2013-01-08 Thread Alexandr Shadchin
for distrib/special/kbd defined NOKVM and library kvm does not need

OK ?

-- 
Alexandr Shadchin

Index: Makefile
===
RCS file: /cvs/src/distrib/special/kbd/Makefile,v
retrieving revision 1.16
diff -u -p -r1.16 Makefile
--- Makefile28 Oct 2009 07:36:49 -  1.16
+++ Makefile8 Jan 2013 14:28:28 -
@@ -7,10 +7,6 @@ PROG=  kbd
 SRCS=  main.c kbd_wscons.c
 CFLAGS+=-DNOKVM
 .PATH:  ${.CURDIR}/../../../sbin/kbd
-
-LDADD= -lkvm
-DPADD= ${LIBKVM}
-
 .else
 NOPROG=Yes
 .endif



Re: add support for elantech touchpads to pms(4)

2012-10-28 Thread Alexandr Shadchin
* The packet should be ignored. */
> + if (!memcmp(sc->packet, debounce_pkt, sizeof(debounce_pkt)))
> + return;
> +
> + w = (sc->packet[0] & 0xc0) >> 6;
> + if (w == 1 || w == 3) {
> + x = ((sc->packet[1] & 0x0f) << 8) | sc->packet[2];
> + y = ((sc->packet[4] & 0x0f) << 8) | sc->packet[5];
> + if (elantech->flags & ELANTECH_F_REPORTS_PRESSURE)
> + z = ((sc->packet[1] & 0xf0) |
> + (sc->packet[4] & 0xf0) >> 4); 
  ^^
 trailing space

> + else
> + z = SYNAPTICS_PRESSURE;
> + } else if (w == 2) {
> + x = (((sc->packet[0] & 0x10) << 4) | sc->packet[1]) << 2;
> + y = (((sc->packet[0] & 0x20) << 3) | sc->packet[2]) << 2;
> + z = SYNAPTICS_PRESSURE;
> + } else {
> + x = elantech->old_x;
> + y = elantech->old_y;
> + z = 0;
> + }
> +
> + buttons = ((sc->packet[0] & 0x01 ? WSMOUSE_BUTTON(1) : 0) |
> + ((sc->packet[0] & 0x02) ? WSMOUSE_BUTTON(3): 0));
> +
> + elantech_send_input(sc, buttons, x, y, z, w);
> +}
> +
> +void
> +pms_proc_elantech_v3(struct pms_softc *sc)
> +{
> + const u_char debounce_pkt[] = { 0xc4, 0xff, 0xff, 0x02, 0xff, 0xff };
> + struct elantech_softc *elantech = sc->elantech;
> + u_int buttons;
> + int x, y, w, z;
> +
> + /* The hardware sends this packet when in debounce state.
> +  * The packet should be ignored. */
> + if (!memcmp(sc->packet, debounce_pkt, sizeof(debounce_pkt)))
> + return;
> +
> + buttons = ((sc->packet[0] & 0x01 ? WSMOUSE_BUTTON(1) : 0) |
> + ((sc->packet[0] & 0x02) ? WSMOUSE_BUTTON(3): 0));
> + x = ((sc->packet[1] & 0x0f) << 8 | sc->packet[2]);
> + y = ((sc->packet[4] & 0x0f) << 8 | sc->packet[5]);
> + z = 0;
> + w = (sc->packet[0] & 0xc0) >> 6;
> + if (w == 2) {
> + /* Two-finger touch causes two packets -- a head packet
> +  * and a tail packet. We report a single event and ignore
> +  * the tail packet. */
> + if ((sc->packet[0] & 0x0c) != 0x04 &&
> + (sc->packet[3] & 0xfc) != 0x02) {
> + /* not the head packet -- ignore */
^
spaces

> + return;
> + }
> + }
> +
> + /* Prevent juming cursor if pad isn't touched or reports garbage. */
> + if (w == 0 ||
> + ((x == 0 || y == 0 || x == elantech->max_x || y == elantech->max_y)
> + && (x != elantech->old_x || y != elantech->old_y))) {
> + x = elantech->old_x;
> + y = elantech->old_y;
> + }
> +
> + if (elantech->flags & ELANTECH_F_REPORTS_PRESSURE)
> + z = (sc->packet[1] & 0xf0) | ((sc->packet[4] & 0xf0) >> 4);
> + else if (w)
> + z = SYNAPTICS_PRESSURE;
> +
> + elantech_send_input(sc, buttons, x, y, z, w);
> +}
> +
> +void
> +elantech_send_input(struct pms_softc *sc, u_int buttons, int x, int y, int z,
> +int w)
> + {
> + struct elantech_softc *elantech = sc->elantech;
> + int dx, dy;
> +
> + if (elantech->wsmode == WSMOUSE_NATIVE) {
> + wsmouse_input(sc->sc_wsmousedev, buttons, x, y, z, w,
> + WSMOUSE_INPUT_ABSOLUTE_X |
> +     WSMOUSE_INPUT_ABSOLUTE_Y |
> + WSMOUSE_INPUT_ABSOLUTE_Z |
> + WSMOUSE_INPUT_ABSOLUTE_W |
> + WSMOUSE_INPUT_SYNC);
> + } else {
> + dx = dy = 0;
> +
> + if ((elantech->flags & ELANTECH_F_REPORTS_PRESSURE) &&
> + z > SYNAPTICS_PRESSURE) {
> + dx = x - elantech->old_x;
> + dy = y - elantech->old_y;
> + dx /= SYNAPTICS_SCALE;
> + dy /= SYNAPTICS_SCALE;
> + }
> + if (dx || dy || buttons != elantech->old_buttons)
> + wsmouse_input(sc->sc_wsmousedev, buttons, dx, dy, 0, 0,
> + WSMOUSE_INPUT_DELTA);
> + elantech->old_buttons = buttons;
> + }
> +
> + elantech->old_x = x;
> + elantech->old_y = y;
>  }
> Index: pckbc/pmsreg.h
> ===
> RCS file: /cvs/src/sys/dev/pckbc/pmsreg.h,v
> retrieving revision 1.8
> diff -u -p -r1.8 pmsreg.h
> --- pckbc/pmsreg.h28 Apr 2012 09:43:24 -  1.8
> +++ pckbc/pmsreg.h28 Oct 2012 12:24:11 -
> @@ -43,6 +43,11 @@
>  #define PMS_ALPS_MAGIC3_280
>  #define PMS_ALPS_MAGIC3_3100
>  
> +#define PMS_ELANTECH_MAGIC1  0x3c
> +#define PMS_ELANTECH_MAGIC2  0x03
> +#define PMS_ELANTECH_MAGIC3_10xc8
> +#define PMS_ELANTECH_MAGIC3_20x00
> +
>  /*
>   * Checking for almost-standard PS/2 packet
>   * Note: ALPS devices never signal overflow condition
> @@ -151,5 +156,37 @@
>  #define ALPS_YSEC_BEZEL  512
>  
>  #define ALPS_Z_MAGIC 127
> +
> +/* Elantech queries */
> +#define ELANTECH_QUE_FW_ID   0
> +#define ELANTECH_QUE_FW_VER  1
> +#define ELANTECH_QUE_CAPABILITIES2
> +#define ELANTECH_QUE_SAMPLE  3
> +#define ELANTECH_QUE_RESOLUTION  4
> +
> +/* Elantech capabilities */
> +#define ELANTECH_CAP_HAS_ROCKER  4
> +
> +#define ELANTECH_PS2_CUSTOM_COMMAND  0xf8
> +
> +#define ELANTECH_CMD_READ_REG0x10
> +#define ELANTECH_CMD_WRITE_REG   0x11
> +#define ELANTECH_CMD_READ_WRITE_REG  0x00
> +
> +#define ELANTECH_ABSOLUTE_MODE   0x04
> +
> +/* Hardware version 1 has hard-coded axis range values.
> + * X axis range is 0 to 576, Y axis range is 0 to 384.
> + * Edge offset accounts for bezel around the touchpad. */
> +#define ELANTECH_V1_EDGE_OFFSET  32
> +#define ELANTECH_V1_X_MIN(0 + ELANTECH_V1_EDGE_OFFSET)
> +#define ELANTECH_V1_X_MAX(576 - ELANTECH_V1_EDGE_OFFSET)
> +#define ELANTECH_V1_Y_MIN(0 + ELANTECH_V1_EDGE_OFFSET)
> +#define ELANTECH_V1_Y_MAX(384 - ELANTECH_V1_EDGE_OFFSET)
> +
> +/* Older hardware version 2 variants lack ID query capability. */
> +#define ELANTECH_V2_X_MAX1152
> +#define ELANTECH_V2_Y_MAX768
> +
>  
>  #endif /* SYS_DEV_PCKBC_PMSREG_H */
> 
> 
> X driver patch:
> 
> Index: xf86-input-synaptics/src/wsconscomm.c
> ===
> RCS file: /cvs/xenocara/driver/xf86-input-synaptics/src/wsconscomm.c,v
> retrieving revision 1.6
> diff -u -p -r1.6 wsconscomm.c
> --- xf86-input-synaptics/src/wsconscomm.c 22 Jul 2012 18:33:01 -  
> 1.6
> +++ xf86-input-synaptics/src/wsconscomm.c 28 Oct 2012 14:07:37 -
> @@ -61,7 +61,8 @@ WSConsIsTouchpad(InputInfoPtr pInfo, con
>  }
>  
>  if (wsmouse_type == WSMOUSE_TYPE_SYNAPTICS ||
> -wsmouse_type == WSMOUSE_TYPE_ALPS)
> +wsmouse_type == WSMOUSE_TYPE_ALPS ||
> +wsmouse_type == WSMOUSE_TYPE_ELANTECH)
>  rc = TRUE;
>  
>  out:
> @@ -194,6 +195,13 @@ WSConsReadHwState(InputInfoPtr pInfo,
>  hw->z = event.value;
>  break;
>  case WSCONS_EVENT_MOUSE_ABSOLUTE_W:
> + if (priv->model == MODEL_ELANTECH) {
> + /* Elantech touchpads report number of fingers directly. */
> + hw->fingerWidth = 5;
> + hw->numFingers = event.value;
> + break;
> + }
> + /* XXX magic number mapping which is mirrored in pms driver */
>  switch (event.value) {
>  case 0:
>  hw->fingerWidth = 5;
> @@ -291,6 +299,12 @@ WSConsReadDevDimensions(InputInfoPtr pIn
>  priv->has_width = FALSE;
>  priv->has_double = FALSE;
>  priv->has_triple = FALSE;
> +break;
> +case WSMOUSE_TYPE_ELANTECH:
> +priv->model = MODEL_ELANTECH;
> +priv->has_width = TRUE;
> +priv->has_double = TRUE;
> +priv->has_triple = TRUE;
>  break;
>  }
>  }

-- 
Alexandr Shadchin



UPDATE: xkeyboard-config 2.7

2012-09-29 Thread Alexandr Shadchin
Hi,

This update xkeyboard-config to the latest release 2.7.
http://koba.devio.us/distfiles/xkeyboard-config-2.7.diff

Change:
8 bugs fixed, most important:
- Fxx fixed (CTRL+ALT type)
- *.dir files not produced any more

Also switch zaurus on sharp_vndr/sl-c3x00.

Tested on amd64.

Comments ? OK ? 

-- 
Alexandr Shadchin



UPDATE: xf86-input-mouse 1.8.1

2012-08-11 Thread Alexandr Shadchin
Hi,

This update xf86-input-mouse to the latest release 1.8.1.
http://koba.devio.us/distfiles/xf86-input-mouse-1.8.1.diff

Comments ? OK ?

-- 
Alexandr Shadchin



UPDATE: xf86-input-keyboard 1.6.2

2012-08-11 Thread Alexandr Shadchin
Hi,

This update xf86-input-keyboard to the latest release 1.6.2.
http://koba.devio.us/distfiles/xf86-input-keyboard-1.6.2.diff

Comments ? OK ? 

-- 
Alexandr Shadchin



Re: [Fwd: Re: Running OpenBSD on an Acer Aspire One 110L netbook]

2012-07-24 Thread Alexandr Shadchin
Hi,

I discussed about this with miod@. This code works correctly, but not optimal.
I need more tests to fix it.

IMHO this is not related to your original issue.

- Forwarded message from Alexandr Shadchin  
-

Date: Tue, 15 Nov 2011 02:52:30 +0600
From: Alexandr Shadchin 
To: Miod Vallat 
Subject: rewrite pckbd_set_xtscancode()

Hi,

I rewrote function pckbd_set_xtscancode() for pckbd(4).

Old behavior:
 * Try enabling translation
   * If succes, then N = 3
   * If failed, then N = 2
 * Try set begin with #N
   If N=3, then check correctly set #3
   But if translation enabled, then check set #3 return 3F (not 3) [1]
   So set #3 never used.

Also sets #1 and #3 are not recommended [2]

New behavior:
 * Try set #2
 * If success
   * Try enabling translation set #2 -> set #1
 * If success, then using hardware translation
 * If failed, then using software translation
 * If failed set #2, then try set #1

Comments ? OK ?

[1] - http://www.win.tue.nl/~aeb/linux/kbd/scancodes-10.html#ss10.3
(look section "Effects of translation" - "Origin of strange scan code set 
values")

[2] - http://www.win.tue.nl/~aeb/linux/kbd/scancodes-10.html#ss10.5

-- 
Alexandr Shadchin

Index: pckbd.c
===
RCS file: /cvs/src/sys/dev/pckbc/pckbd.c,v
retrieving revision 1.31
diff -u -p -r1.31 pckbd.c
--- pckbd.c 17 Mar 2011 15:42:05 -  1.31
+++ pckbd.c 14 Nov 2011 19:03:58 -
@@ -92,8 +92,7 @@ struct pckbd_internal {
pckbc_tag_t t_kbctag;
pckbc_slot_t t_kbcslot;
 
-   int t_translating;
-   int t_table;
+   int t_xt;
 
int t_lastchar;
int t_extended;
@@ -186,95 +185,39 @@ int
 pckbd_set_xtscancode(pckbc_tag_t kbctag, pckbc_slot_t kbcslot,
 struct pckbd_internal *id)
 {
-   /* default to have the 8042 translate the keyboard with table 3. */
-   int table = 3;
+   u_char cmd[2];
 
-   if (pckbc_xt_translation(kbctag, kbcslot, 1)) {
-   if (id != NULL)
-   id->t_translating = 1;
-   } else {
-#ifdef DEBUG
-   printf("pckbd: enabling of translation failed\n");
-#endif
-   /*
-* Since the keyboard controller can not translate scan
-* codes to the XT set (#1), we would like to request
-* this exact set. However it is likely that the
-* controller does not support it either.
-*
-* So try scan code set #2 as well, which this driver
-* knows how to translate.
-*/
-   table = 2;
-   if (id != NULL)
-   id->t_translating = 0;
-   }
+   if (id != NULL)
+   id->t_xt = 1;
 
-   /* keep falling back until we hit a table that looks usable. */
-   for (; table >= 1; table--) {
-   u_char cmd[2];
+   /* Let us try to set table 2 */
+   cmd[0] = KBC_SETTABLE;
+   cmd[1] = 2;
+   if (pckbc_poll_cmd(kbctag, kbcslot, cmd, 2, 0, NULL, 1)) {
 #ifdef DEBUG
-   printf("pckbd: trying table %d\n", table);
+   printf("pckbd: table set of 2 failed\n");
 #endif
-   cmd[0] = KBC_SETTABLE;
-   cmd[1] = table;
-   if (pckbc_poll_cmd(kbctag, kbcslot, cmd, 2, 0, NULL, 0)) {
-#ifdef DEBUG
-   printf("pckbd: table set of %d failed\n", table);
-#endif
-   if (table > 1) {
-   cmd[0] = KBC_RESET;
-   (void)pckbc_poll_cmd(kbctag, kbcslot, cmd,
-   1, 1, NULL, 1);
-   pckbc_flush(kbctag, kbcslot);
-
-   continue;
-   }
-   }
-
-   /*
-* the 8042 took the table set request, however, not all that
-* report they can work with table 3 actually work, so ask what
-* table it reports it's in.
-*/
-   if (table == 3) {
-   u_char resp[1];
+   cmd[0] = KBC_RESET;
+   pckbc_poll_cmd(kbctag, kbcslot, cmd, 1, 1, NULL, 1);
+   pckbc_flush(kbctag, kbcslot);
+   } else {
+   if (pckbc_xt_translation(kbctag, kbcslot, 1) == 0 && id != NULL)
+   id->t_xt = 0;
+   return (0);
+   }
 
-   cmd[0] = KBC_SETTABLE;
-   cmd[1] = 0;
-   if (pckbc_poll_cmd(kbctag, kbcslot, cmd, 2, 1, resp, 
0)) {
-   /*
-* query failed, step down to table 2 to be
-* safe.
-*/
-#ifdef DEBUG
-   pr

cleanup wsconsctl 4/4

2012-07-13 Thread Alexandr Shadchin
add options noinput and noyywrap

-- 
Alexandr Shadchin

Index: map_scan.l
===
RCS file: /cvs/src/sbin/wsconsctl/map_scan.l,v
retrieving revision 1.3
diff -u -p -r1.3 map_scan.l
--- map_scan.l  26 Jun 2008 05:42:06 -  1.3
+++ map_scan.l  13 Jul 2012 23:07:16 -
@@ -38,8 +38,6 @@
 #include "wsconsctl.h"
 #include "y.tab.h"
 
-#define yywrap()   1
-
 void
 map_scan_setinput(str)
char *str;
@@ -48,6 +46,9 @@ map_scan_setinput(str)
 }
 
 %}
+
+%option noyywrap
+%option noinput
 
 %%



cleanup wsconsctl 3/4

2012-07-13 Thread Alexandr Shadchin
ansify

-- 
Alexandr Shadchin

Index: map_scan.l
===
RCS file: /cvs/src/sbin/wsconsctl/map_scan.l,v
retrieving revision 1.3
diff -u -p -r1.3 map_scan.l
--- map_scan.l  26 Jun 2008 05:42:06 -  1.3
+++ map_scan.l  13 Jul 2012 21:20:13 -
@@ -41,8 +41,7 @@
 #define yywrap()   1
 
 void
-map_scan_setinput(str)
-   char *str;
+map_scan_setinput(char *str)
 {
yy_scan_string(str);
 }
Index: wsconsctl.c
===
RCS file: /cvs/src/sbin/wsconsctl/wsconsctl.c,v
retrieving revision 1.26
diff -u -p -r1.26 wsconsctl.c
--- wsconsctl.c 20 Aug 2010 00:20:55 -  1.26
+++ wsconsctl.c 13 Jul 2012 21:20:13 -
@@ -66,7 +66,7 @@ struct vartypesw {
 struct vartypesw *tab_by_name(const char *, int *);
 
 void
-usage()
+usage(void)
 {
fprintf(stderr,
"usage: %s [-an]\n"



cleanup wsconsctl 2/4

2012-07-13 Thread Alexandr Shadchin
fix typo

-- 
Alexandr Shadchin

Index: map_parse.y
===
RCS file: /cvs/src/sbin/wsconsctl/map_parse.y,v
retrieving revision 1.6
diff -u -p -r1.6 map_parse.y
--- map_parse.y 14 May 2012 06:19:51 -  1.6
+++ map_parse.y 13 Jul 2012 19:41:53 -
@@ -41,7 +41,7 @@
  * The first symbol may be a command.
  * The following symbols are assigned
  * to the normal and altgr groups.
- * Missing symbols are generated automacically
+ * Missing symbols are generated automatically
  * as either the upper case variant or the
  * normal group.
  */



cleanup wsconsctl 1/4

2012-07-13 Thread Alexandr Shadchin
zap whitespace

-- 
Alexandr Shadchin

Index: keysym.c
===
RCS file: /cvs/src/sbin/wsconsctl/keysym.c,v
retrieving revision 1.6
diff -u -p -r1.6 keysym.c
--- keysym.c28 Jun 2010 20:40:39 -  1.6
+++ keysym.c13 Jul 2012 21:32:18 -
@@ -160,7 +160,7 @@ ksym2name(int k)
 
if (first_time)
sort_ksym_tab();
-   
+
r = bsearch(&k, ksym_tab_by_ksym,
NUMKSYMS, sizeof(struct ksym), bcmp_ksym_enc);
 
Index: mouse.c
===
RCS file: /cvs/src/sbin/wsconsctl/mouse.c,v
retrieving revision 1.11
diff -u -p -r1.11 mouse.c
--- mouse.c 20 Aug 2010 00:20:55 -  1.11
+++ mouse.c 13 Jul 2012 21:32:18 -
@@ -44,7 +44,7 @@ static int resolution;
 static int samplerate;
 static int rawmode;
 
-struct wsmouse_calibcoords wmcoords, wmcoords_save; 
+struct wsmouse_calibcoords wmcoords, wmcoords_save;
 
 struct field mouse_field_tab[] = {
 { "resolution",&resolution,FMT_UINT,   FLG_WRONLY },
@@ -61,8 +61,8 @@ mouse_get_values(int fd)
if (field_by_value(mouse_field_tab, &mstype)->flags & FLG_GET)
if (ioctl(fd, WSMOUSEIO_GTYPE, &mstype) < 0)
warn("WSMOUSEIO_GTYPE");
-   
-   if (field_by_value(mouse_field_tab, &rawmode)->flags & FLG_GET) { 
+
+   if (field_by_value(mouse_field_tab, &rawmode)->flags & FLG_GET) {
if (ioctl(fd, WSMOUSEIO_GCALIBCOORDS, &wmcoords) < 0) {
if (errno == ENOTTY)
field_by_value(mouse_field_tab,
@@ -80,7 +80,7 @@ mouse_get_values(int fd)
&wmcoords)->flags |= FLG_DEAD;
else
warn("WSMOUSEIO_GCALIBCOORDS");
-   }   
+   }
 }
 
 int
@@ -98,7 +98,7 @@ mouse_put_values(int fd)
return 1;
}
}
-   if (field_by_value(mouse_field_tab, &rawmode)->flags & FLG_SET) { 
+   if (field_by_value(mouse_field_tab, &rawmode)->flags & FLG_SET) {
wmcoords.samplelen = rawmode;
if (ioctl(fd, WSMOUSEIO_SCALIBCOORDS, &wmcoords) < 0) {
if (errno == ENOTTY) {
Index: util.c
===
RCS file: /cvs/src/sbin/wsconsctl/util.c,v
retrieving revision 1.57
diff -u -p -r1.57 util.c
--- util.c  17 Apr 2012 14:53:47 -  1.57
+++ util.c  13 Jul 2012 21:32:18 -
@@ -45,7 +45,7 @@
 
 extern struct wskbd_map_data kbmap;/* from keyboard.c */
 extern struct wskbd_map_data newkbmap; /* from map_parse.y */
-extern struct wsmouse_calibcoords wmcoords;/* from mouse.c */
+extern struct wsmouse_calibcoords wmcoords;/* from mouse.c */
 
 struct nameint {
int value;
Index: wsconsctl.c
===
RCS file: /cvs/src/sbin/wsconsctl/wsconsctl.c,v
retrieving revision 1.26
diff -u -p -r1.26 wsconsctl.c
--- wsconsctl.c 20 Aug 2010 00:20:55 -  1.26
+++ wsconsctl.c 13 Jul 2012 21:32:18 -
@@ -125,7 +125,7 @@ main(int argc, char *argv[])
if (!device || errno != ENXIO) {
if (device && errno != ENOENT) {
warn("%s", device);
-   error = 1;  
+   error = 1;
}
break;
} else
@@ -319,7 +319,7 @@ tab_by_name(const char *var, int *idx)
}
} else
i = 0;
-   
+
*idx = i;
 
return (sw);



Re: Fix type of WSKBDIO_?ETENCODING in wsconsctl.

2012-07-13 Thread Alexandr Shadchin
more fix type

-- 
Alexandr Shadchin

Index: display.c
===
RCS file: /cvs/src/sbin/wsconsctl/display.c,v
retrieving revision 1.16
diff -u -p -r1.16 display.c
--- display.c   20 Aug 2010 00:20:55 -  1.16
+++ display.c   13 Jul 2012 22:09:02 -
@@ -40,7 +40,7 @@
 #include 
 #include "wsconsctl.h"
 
-int dpytype;
+u_int dpytype;
 u_int width, height, depth;
 int focus;
 struct field_pc brightness, contrast, backlight;
Index: keyboard.c
===
RCS file: /cvs/src/sbin/wsconsctl/keyboard.c,v
retrieving revision 1.10
diff -u -p -r1.10 keyboard.c
--- keyboard.c  20 Aug 2010 00:20:55 -  1.10
+++ keyboard.c  13 Jul 2012 22:09:02 -
@@ -40,7 +40,7 @@
 #include 
 #include "wsconsctl.h"
 
-static int kbtype;
+static u_int kbtype;
 static struct wskbd_bell_data bell;
 static struct wskbd_bell_data dfbell;
 static struct wscons_keymap mapdata[KS_NUMKEYCODES];
@@ -49,7 +49,7 @@ struct wskbd_map_data kbmap = { KS_NUMKE
 static struct wskbd_keyrepeat_data repeat;
 static struct wskbd_keyrepeat_data dfrepeat;
 static int ledstate;
-static int kbdencoding;
+static kbd_t kbdencoding;
 
 struct field keyboard_field_tab[] = {
 { "type",  &kbtype,FMT_KBDTYPE,FLG_RDONLY },
Index: mouse.c
===
RCS file: /cvs/src/sbin/wsconsctl/mouse.c,v
retrieving revision 1.11
diff -u -p -r1.11 mouse.c
--- mouse.c 20 Aug 2010 00:20:55 -  1.11
+++ mouse.c 13 Jul 2012 22:09:03 -
@@ -39,9 +39,9 @@
 #include 
 #include "wsconsctl.h"
 
-static int mstype;
-static int resolution;
-static int samplerate;
+static u_int mstype;
+static u_int resolution;
+static u_int samplerate;
 static int rawmode;
 
 struct wsmouse_calibcoords wmcoords, wmcoords_save; 



Fix type of WSKBDIO_?ETENCODING in wsconsctl.

2012-07-13 Thread Alexandr Shadchin
>From NetBSD

-- 
Alexandr Shadchin

Index: keyboard.c
===
RCS file: /cvs/src/sbin/wsconsctl/keyboard.c,v
retrieving revision 1.10
diff -u -p -r1.10 keyboard.c
--- keyboard.c  20 Aug 2010 00:20:55 -  1.10
+++ keyboard.c  13 Jul 2012 17:47:35 -
@@ -49,7 +49,7 @@ struct wskbd_map_data kbmap = { KS_NUMKE
 static struct wskbd_keyrepeat_data repeat;
 static struct wskbd_keyrepeat_data dfrepeat;
 static int ledstate;
-static int kbdencoding;
+static kbd_t kbdencoding;
 
 struct field keyboard_field_tab[] = {
 { "type",  &kbtype,FMT_KBDTYPE,FLG_RDONLY },



Simplify wsconsctl (mouse part)

2012-07-13 Thread Alexandr Shadchin
Not need call ioctl(WSMOUSEIO_GCALIBCOORDS or WSMOUSEIO_SCALIBCOORDS) twice,
enough once.

OK ?

-- 
Alexandr Shadchin

Index: mouse.c
===
RCS file: /cvs/src/sbin/wsconsctl/mouse.c,v
retrieving revision 1.11
diff -u -p -r1.11 mouse.c
--- mouse.c 20 Aug 2010 00:20:55 -  1.11
+++ mouse.c 13 Jul 2012 16:35:18 -
@@ -44,7 +44,7 @@ static int resolution;
 static int samplerate;
 static int rawmode;
 
-struct wsmouse_calibcoords wmcoords, wmcoords_save; 
+struct wsmouse_calibcoords wmcoords;
 
 struct field mouse_field_tab[] = {
 { "resolution",&resolution,FMT_UINT,   FLG_WRONLY },
@@ -61,26 +61,20 @@ mouse_get_values(int fd)
if (field_by_value(mouse_field_tab, &mstype)->flags & FLG_GET)
if (ioctl(fd, WSMOUSEIO_GTYPE, &mstype) < 0)
warn("WSMOUSEIO_GTYPE");
-   
-   if (field_by_value(mouse_field_tab, &rawmode)->flags & FLG_GET) { 
+
+   if ((field_by_value(mouse_field_tab, &rawmode)->flags & FLG_GET) ||
+   (field_by_value(mouse_field_tab, &wmcoords)->flags & FLG_GET)) {
if (ioctl(fd, WSMOUSEIO_GCALIBCOORDS, &wmcoords) < 0) {
-   if (errno == ENOTTY)
+   if (errno == ENOTTY) {
field_by_value(mouse_field_tab,
&rawmode)->flags |= FLG_DEAD;
-   else
+   field_by_value(mouse_field_tab,
+   &wmcoords)->flags |= FLG_DEAD;
+   } else
warn("WSMOUSEIO_GCALIBCOORDS");
}
rawmode = wmcoords.samplelen;
}
-
-   if (field_by_value(mouse_field_tab, &wmcoords)->flags & FLG_GET)
-   if (ioctl(fd, WSMOUSEIO_GCALIBCOORDS, &wmcoords) < 0) {
-   if (errno == ENOTTY)
-   field_by_value(mouse_field_tab,
-   &wmcoords)->flags |= FLG_DEAD;
-   else
-   warn("WSMOUSEIO_GCALIBCOORDS");
-   }   
 }
 
 int
@@ -98,29 +92,13 @@ mouse_put_values(int fd)
return 1;
}
}
-   if (field_by_value(mouse_field_tab, &rawmode)->flags & FLG_SET) { 
+   if ((field_by_value(mouse_field_tab, &rawmode)->flags & FLG_SET) ||
+   (field_by_value(mouse_field_tab, &wmcoords)->flags & FLG_SET)) {
wmcoords.samplelen = rawmode;
if (ioctl(fd, WSMOUSEIO_SCALIBCOORDS, &wmcoords) < 0) {
if (errno == ENOTTY) {
field_by_value(mouse_field_tab,
&rawmode)->flags |= FLG_DEAD;
-   } else {
-   warn("WSMOUSEIO_SCALIBCOORDS");
-   return 1;
-   }
-   }
-   }
-   if (field_by_value(mouse_field_tab, &wmcoords)->flags & FLG_SET) {
-   if (ioctl(fd, WSMOUSEIO_GCALIBCOORDS, &wmcoords_save) < 0) {
-   if (errno == ENOTTY)
-   field_by_value(mouse_field_tab,
-   &wmcoords)->flags |= FLG_DEAD;
-   else
-   warn("WSMOUSEIO_GCALIBCOORDS");
-   }
-   wmcoords.samplelen = wmcoords_save.samplelen;
-   if (ioctl(fd, WSMOUSEIO_SCALIBCOORDS, &wmcoords) < 0) {
-   if (errno == ENOTTY) {
field_by_value(mouse_field_tab,
&wmcoords)->flags |= FLG_DEAD;
} else {



kbd: Use NULL instead of 0 for pointers

2012-07-13 Thread Alexandr Shadchin
Use NULL instead of 0 for pointers

-- 
Alexandr Shadchin

Index: kbd_wscons.c
===
RCS file: /cvs/src/sbin/kbd/kbd_wscons.c,v
retrieving revision 1.25
diff -u -p -r1.25 kbd_wscons.c
--- kbd_wscons.c23 Jun 2008 17:41:21 -  1.25
+++ kbd_wscons.c13 Jul 2012 09:34:14 -
@@ -93,13 +93,13 @@ struct nameint {
 struct nameint kbdenc_tab[] = {
KB_ENCTAB
,
-   { 0, 0 }
+   { 0, NULL }
 };
 
 struct nameint kbdvar_tab[] = {
KB_VARTAB
,
-   { 0, 0 }
+   { 0, NULL }
 };
 
 extern char *__progname;
@@ -232,7 +232,7 @@ kbd_list(void)
}
 
 #ifndef NOKVM
-   if ((kd = kvm_openfiles(NULL, NULL, NULL, O_RDONLY, errbuf)) == 0)
+   if ((kd = kvm_openfiles(NULL, NULL, NULL, O_RDONLY, errbuf)) == NULL)
errx(1, "kvm_openfiles: %s", errbuf);
 
if (kvm_nlist(kd, nl) == -1)



Re: fix for ClickPad

2012-07-11 Thread Alexandr Shadchin
On Wed, Jul 11, 2012 at 05:51:53PM +0200, Matthieu Herrb wrote:
> On Wed, Jul 11, 2012 at 12:53:00AM +0600, Alexandr Shadchin wrote:
> > Now in clickpad mode the pointer moves to [1,1] (upper left corner)
> > even on a single tap. These patches fixes it.
> > 
> > On issue pointed gilles@ and matthieu@
> > 
> > * cd /sys
> > * patch < 01_kernel.diff
> > * build and install new kernel
> > * cd /usr/src
> > * (if need - make obj)
> > * make includes
> > * cd /usr/xenocara/driver/xf86-input-synaptics
> > * patch < 02_xenocara.diff
> > * make -f Makefile.bsd-wrapper obj build
> > * reboot and test
> > 
> > Also need check on other touchpad.
> > 
> > Comments ? OK ?
> > 
> 
> Fixes the issue here too (Thinkpad X200). Not yet tested on other
> touchpads I have. 
> ok for the X part A few comments inline on the kernel part. 
> 
> (and of course you need to commit the kernel part first).
> 
> > -- 
> > Alexandr Shadchin
> > 
> 
> > Index: dev/pckbc/pms.c
> > ===
> > RCS file: /cvs/src/sys/dev/pckbc/pms.c,v
> > retrieving revision 1.30
> > diff -u -p -r1.30 pms.c
> > --- dev/pckbc/pms.c 1 Jul 2012 12:59:34 -   1.30
> > +++ dev/pckbc/pms.c 10 Jul 2012 18:17:14 -
> > @@ -782,6 +782,9 @@ int
> >  synaptics_get_hwinfo(struct pms_softc *sc)
> >  {
> > struct synaptics_softc *syn = sc->synaptics;
> > +#ifdef DEBUG
> > +   int i, val;
> > +#endif
> >  
> > if (synaptics_query(sc, SYNAPTICS_QUE_IDENTIFY, &syn->identify))
> > return (-1);
> > @@ -817,6 +820,15 @@ synaptics_get_hwinfo(struct pms_softc *s
> > if (SYNAPTICS_EXT_MODEL_BUTTONS(syn->ext_model) > 8)
> > syn->ext_model &= ~0xf000;
> >  
> > +#ifdef DEBUG
> > +   for (i = 0; i < 16; i++) {
> > +   if (synaptics_query(sc, i, &val))
> > +   printf("%s: querie %2d: fail\n", DEVNAME(sc), i);
> > +   else
> > +   printf("%s: querie %2d: 0x%06x\n",
> > DEVNAME(sc), i, val);
> 
> > +   }
> > +#endif
> 'querie' is not correct. use "query" or drop the #ifdef DEBUG part
> completely. 
> 
> > +
> > return (0);
> >  }
> >  
> > @@ -1026,7 +1038,8 @@ pms_proc_synaptics(struct pms_softc *sc)
> > if (syn->wsmode == WSMOUSE_NATIVE) {
> > wsmouse_input(sc->sc_wsmousedev, buttons, x, y, z, w,
> > WSMOUSE_INPUT_ABSOLUTE_X | WSMOUSE_INPUT_ABSOLUTE_Y |
> > -   WSMOUSE_INPUT_ABSOLUTE_Z | WSMOUSE_INPUT_ABSOLUTE_W);
> > +   WSMOUSE_INPUT_ABSOLUTE_Z | WSMOUSE_INPUT_ABSOLUTE_W |
> > +   WSMOUSE_INPUT_SYNC);
> > } else {
> > dx = dy = 0;
> > if (z > SYNAPTICS_PRESSURE) {
> > @@ -1335,7 +1348,8 @@ pms_proc_alps(struct pms_softc *sc)
> >  
> > wsmouse_input(sc->sc_wsmousedev, buttons, x, y, z, w,
> > WSMOUSE_INPUT_ABSOLUTE_X | WSMOUSE_INPUT_ABSOLUTE_Y |
> > -   WSMOUSE_INPUT_ABSOLUTE_Z | WSMOUSE_INPUT_ABSOLUTE_W);
> > +   WSMOUSE_INPUT_ABSOLUTE_Z | WSMOUSE_INPUT_ABSOLUTE_W |
> > +   WSMOUSE_INPUT_SYNC);
> >  
> > alps->old_fin = fin;
> > } else {
> > Index: dev/wscons/wsconsio.h
> > ===
> > RCS file: /cvs/src/sys/dev/wscons/wsconsio.h,v
> > retrieving revision 1.65
> > diff -u -p -r1.65 wsconsio.h
> > --- dev/wscons/wsconsio.h   17 Apr 2012 08:51:24 -  1.65
> > +++ dev/wscons/wsconsio.h   10 Jul 2012 18:17:14 -
> > @@ -80,6 +80,7 @@ struct wscons_event {
> >  /* 12-15, see below */
> >  #defineWSCONS_EVENT_MOUSE_DELTA_W  16  /* W delta amount */
> >  #defineWSCONS_EVENT_MOUSE_ABSOLUTE_W   17  /* W location */
> > +#defineWSCONS_EVENT_SYNC   18
> >  /* 
> >   * Following events are not real wscons_event but are used as parameters 
> > of the
> >   * WSDISPLAYIO_WSMOUSED ioctl 
> > Index: dev/wscons/wsmouse.c
> > ===
> > RCS file: /cvs/src/sys/dev/wscons/wsmouse.c,v
> > retrieving revision 1.22
> > diff -u -p -r1.22 wsmouse.c
> > --- dev/wscons/wsmouse.c17 Aug 2011 16:10:27 -  1.22
> > +++ dev/wscons/wsmouse.c10 Jul 

Re: Support keyboards in xf86-input-ws

2012-07-11 Thread Alexandr Shadchin
On Tue, Jul 10, 2012 at 02:44:53AM +0600, Alexandr Shadchin wrote:
> On Mon, Jul 09, 2012 at 10:35:55PM +0600, Alexandr Shadchin wrote:
> > Add functional xf86-input-keyboard in xf86-input-ws (no new features)
> > 
> > For test add or rewrite xorg.conf:
> > 
> > Section "InputClass"
> > Identifier "keyboard defaults"
> > MatchIsKeyboard "on"
> > 
> > Driver "ws"
> > Option "Device" "/dev/wskbd"
> > 
> > Option "XkbModel" "your setting"
> > Option "XkbLayout" "your setting"
> > Option "XkbVariant" "your setting"
> > Option "XKbOptions" "your setting"
> > EndSection
> > 
> > Welcome any feedback.
> > 
> 
> Fix decode extra keys (ex. multimedia)
> 

Suggestion mpi@: 
allocate memory only for pointer device or keyboard
(but not both together)

-- 
Alexandr Shadchin

Index: man/ws.man
===
RCS file: /cvs/xenocara/driver/xf86-input-ws/man/ws.man,v
retrieving revision 1.13
diff -u -p -r1.13 ws.man
--- man/ws.man  12 Jun 2012 17:12:50 -  1.13
+++ man/ws.man  11 Jul 2012 12:28:19 -
@@ -199,6 +199,38 @@ is mapped to the negative W axis motion 
 .I N2
 is mapped to the positive W axis motion.
 Default:\ "6\ 7".
+.TP 4
+.BI "Option \*qXkbRules\*q \*q" rules \*q
+Specifies which XKB rules file to use for interpreting the
+.BR XkbModel ,
+.BR XkbLayout ,
+.BR XkbVariant ,
+and
+.B XkbOptions
+settings.
+Default:\ "base".
+.TP 4
+.BI "Option \*qXkbModel\*q \*q" modelname \*q
+Specifies the XKB keyboard model name.
+Default:\ "pc105".
+.TP 4
+.BI "Option \*qXkbLayout\*q \*q" layoutname \*q
+Specifies the XKB keyboard layout name.
+This is usually the country or language type of the keyboard.
+Default:\ "us".
+.TP 4
+.BI "Option \*qXkbVariant\*q \*q" variants \*q
+Specifies the XKB keyboard variant components.
+These can be used to enhance the keyboard layout details.
+Default:\ not\ set.
+.TP 4
+.BI "Option \*qXkbOptions\*q \*q" options \*q
+Specifies the XKB keyboard option components.
+These can be used to enhance the keyboard behaviour.
+Default:\ not\ set.
+.PP
+For a list of available XKB options, see
+.B xkeyboard-config(__miscmansuffix__).
 .SH "SUPPORTED PROPERTIES"
 The following properties are provided by the
 .B ws
Index: src/emumb.c
===
RCS file: /cvs/xenocara/driver/xf86-input-ws/src/emumb.c,v
retrieving revision 1.13
diff -u -p -r1.13 emumb.c
--- src/emumb.c 8 Jul 2012 14:22:03 -   1.13
+++ src/emumb.c 11 Jul 2012 12:28:19 -
@@ -54,7 +54,7 @@ enum {
MBEMU_AUTO
 };
 
-static Atom prop_mbemu;/* Middle button emulation on/off 
property */
+static Atom prop_mbemu;/* Middle button emulation on/off property */
 static Atom prop_mbtimeout;/* Middle button timeout property */
 
 /*
@@ -194,20 +194,21 @@ static signed char stateTab[11][5][3] = 
 int
 wsmbEmuTimer(InputInfoPtr pInfo)
 {
-   WSDevicePtr priv = (WSDevicePtr)pInfo->private;
+   WSPointerPtr cursor = ((WSDevicePtr)pInfo->private)->cursor;
int sigstate;
int id;
 
sigstate = xf86BlockSIGIO();
 
-   priv->emulateMB.pending = FALSE;
-   if ((id = stateTab[priv->emulateMB.state][4][0]) != 0) {
+   cursor->emulateMB.pending = FALSE;
+   if ((id = stateTab[cursor->emulateMB.state][4][0]) != 0) {
xf86PostButtonEvent(pInfo->dev, 0, abs(id), (id >= 0), 0, 0);
-   priv->emulateMB.state = stateTab[priv->emulateMB.state][4][2];
+   cursor->emulateMB.state =
+   stateTab[cursor->emulateMB.state][4][2];
} else {
xf86IDrvMsg(pInfo, X_ERROR,
"Got unexpected buttonTimer in state %d\n",
-   priv->emulateMB.state);
+   cursor->emulateMB.state);
}
 
xf86UnblockSIGIO(sigstate);
@@ -226,17 +227,17 @@ wsmbEmuTimer(InputInfoPtr pInfo)
 BOOL
 wsmbEmuFilterEvent(InputInfoPtr pInfo, int button, BOOL press)
 {
-   WSDevicePtr priv = (WSDevicePtr)pInfo->private;
+   WSPointerPtr cursor = ((WSDevicePtr)pInfo->private)->cursor;
int id;
int *btstate;
int ret = FALSE;
 
-   if (!priv->emulateMB.enabled)
+   if (!cursor->emulateMB.enabled)
return ret;
 
/* Disable emulation when middle button event is detected */
-   if (button == 2 && priv->emulateMB.enabled == MBEMU_AUTO) {
-   priv->emulateMB.enabled = FALSE;
+   if (button == 2 &

fix for ClickPad

2012-07-10 Thread Alexandr Shadchin
Now in clickpad mode the pointer moves to [1,1] (upper left corner)
even on a single tap. These patches fixes it.

On issue pointed gilles@ and matthieu@

* cd /sys
* patch < 01_kernel.diff
* build and install new kernel
* cd /usr/src
* (if need - make obj)
* make includes
* cd /usr/xenocara/driver/xf86-input-synaptics
* patch < 02_xenocara.diff
* make -f Makefile.bsd-wrapper obj build
* reboot and test

Also need check on other touchpad.

Comments ? OK ?

-- 
Alexandr Shadchin
Index: dev/pckbc/pms.c
===
RCS file: /cvs/src/sys/dev/pckbc/pms.c,v
retrieving revision 1.30
diff -u -p -r1.30 pms.c
--- dev/pckbc/pms.c 1 Jul 2012 12:59:34 -   1.30
+++ dev/pckbc/pms.c 10 Jul 2012 18:17:14 -
@@ -782,6 +782,9 @@ int
 synaptics_get_hwinfo(struct pms_softc *sc)
 {
struct synaptics_softc *syn = sc->synaptics;
+#ifdef DEBUG
+   int i, val;
+#endif
 
if (synaptics_query(sc, SYNAPTICS_QUE_IDENTIFY, &syn->identify))
return (-1);
@@ -817,6 +820,15 @@ synaptics_get_hwinfo(struct pms_softc *s
if (SYNAPTICS_EXT_MODEL_BUTTONS(syn->ext_model) > 8)
syn->ext_model &= ~0xf000;
 
+#ifdef DEBUG
+   for (i = 0; i < 16; i++) {
+   if (synaptics_query(sc, i, &val))
+   printf("%s: querie %2d: fail\n", DEVNAME(sc), i);
+   else
+   printf("%s: querie %2d: 0x%06x\n", DEVNAME(sc), i, val);
+   }
+#endif
+
return (0);
 }
 
@@ -1026,7 +1038,8 @@ pms_proc_synaptics(struct pms_softc *sc)
if (syn->wsmode == WSMOUSE_NATIVE) {
wsmouse_input(sc->sc_wsmousedev, buttons, x, y, z, w,
WSMOUSE_INPUT_ABSOLUTE_X | WSMOUSE_INPUT_ABSOLUTE_Y |
-   WSMOUSE_INPUT_ABSOLUTE_Z | WSMOUSE_INPUT_ABSOLUTE_W);
+   WSMOUSE_INPUT_ABSOLUTE_Z | WSMOUSE_INPUT_ABSOLUTE_W |
+   WSMOUSE_INPUT_SYNC);
} else {
dx = dy = 0;
if (z > SYNAPTICS_PRESSURE) {
@@ -1335,7 +1348,8 @@ pms_proc_alps(struct pms_softc *sc)
 
wsmouse_input(sc->sc_wsmousedev, buttons, x, y, z, w,
WSMOUSE_INPUT_ABSOLUTE_X | WSMOUSE_INPUT_ABSOLUTE_Y |
-   WSMOUSE_INPUT_ABSOLUTE_Z | WSMOUSE_INPUT_ABSOLUTE_W);
+   WSMOUSE_INPUT_ABSOLUTE_Z | WSMOUSE_INPUT_ABSOLUTE_W |
+   WSMOUSE_INPUT_SYNC);
 
alps->old_fin = fin;
} else {
Index: dev/wscons/wsconsio.h
===
RCS file: /cvs/src/sys/dev/wscons/wsconsio.h,v
retrieving revision 1.65
diff -u -p -r1.65 wsconsio.h
--- dev/wscons/wsconsio.h   17 Apr 2012 08:51:24 -  1.65
+++ dev/wscons/wsconsio.h   10 Jul 2012 18:17:14 -
@@ -80,6 +80,7 @@ struct wscons_event {
 /* 12-15, see below */
 #defineWSCONS_EVENT_MOUSE_DELTA_W  16  /* W delta amount */
 #defineWSCONS_EVENT_MOUSE_ABSOLUTE_W   17  /* W location */
+#defineWSCONS_EVENT_SYNC   18
 /* 
  * Following events are not real wscons_event but are used as parameters of the
  * WSDISPLAYIO_WSMOUSED ioctl 
Index: dev/wscons/wsmouse.c
===
RCS file: /cvs/src/sys/dev/wscons/wsmouse.c,v
retrieving revision 1.22
diff -u -p -r1.22 wsmouse.c
--- dev/wscons/wsmouse.c17 Aug 2011 16:10:27 -  1.22
+++ dev/wscons/wsmouse.c10 Jul 2012 18:17:14 -
@@ -455,6 +455,14 @@ wsmouse_input(struct device *wsmousedev,
ub ^= d;
}
 
+   if (flags & WSMOUSE_INPUT_SYNC) {
+   NEXT;
+   ev->type = WSCONS_EVENT_SYNC;
+   ev->value = 0;
+   TIMESTAMP;
+   ADVANCE;
+   }
+
/* XXX fake wscons_event notifying wsmoused(8) to close mouse device */
if (flags & WSMOUSE_INPUT_WSMOUSED_CLOSE) {
NEXT;
Index: dev/wscons/wsmousevar.h
===
RCS file: /cvs/src/sys/dev/wscons/wsmousevar.h,v
retrieving revision 1.5
diff -u -p -r1.5 wsmousevar.h
--- dev/wscons/wsmousevar.h 10 Apr 2007 22:37:17 -  1.5
+++ dev/wscons/wsmousevar.h 10 Jul 2012 18:17:14 -
@@ -72,6 +72,7 @@ int   wsmousedevprint(void *, const char *
 #define WSMOUSE_INPUT_ABSOLUTE_Y   (1<<1)
 #define WSMOUSE_INPUT_ABSOLUTE_Z   (1<<2)
 #define WSMOUSE_INPUT_ABSOLUTE_W   (1<<4)
+#define WSMOUSE_INPUT_SYNC (1<<5)
 #define WSMOUSE_INPUT_WSMOUSED_CLOSE   (1<<3) /* notify wsmoused(8) to close
  mouse device */
Index: src/wsconscomm.c
===
RCS file: /cvs/xe

Re: Support keyboards in xf86-input-ws

2012-07-09 Thread Alexandr Shadchin
On Mon, Jul 09, 2012 at 10:35:55PM +0600, Alexandr Shadchin wrote:
> Add functional xf86-input-keyboard in xf86-input-ws (no new features)
> 
> For test add or rewrite xorg.conf:
> 
> Section "InputClass"
>   Identifier "keyboard defaults"
>   MatchIsKeyboard "on"
> 
>   Driver "ws"
>   Option "Device" "/dev/wskbd"
> 
>   Option "XkbModel" "your setting"
>   Option "XkbLayout" "your setting"
>   Option "XkbVariant" "your setting"
>   Option "XKbOptions" "your setting"
> EndSection
> 
> Welcome any feedback.
> 

Fix decode extra keys (ex. multimedia)

-- 
Alexandr Shadchin

Index: man/ws.man
===
RCS file: /cvs/xenocara/driver/xf86-input-ws/man/ws.man,v
retrieving revision 1.13
diff -u -p -w -r1.13 ws.man
--- man/ws.man  12 Jun 2012 17:12:50 -  1.13
+++ man/ws.man  9 Jul 2012 20:36:45 -
@@ -199,6 +199,38 @@ is mapped to the negative W axis motion 
 .I N2
 is mapped to the positive W axis motion.
 Default:\ "6\ 7".
+.TP 4
+.BI "Option \*qXkbRules\*q \*q" rules \*q
+Specifies which XKB rules file to use for interpreting the
+.BR XkbModel ,
+.BR XkbLayout ,
+.BR XkbVariant ,
+and
+.B XkbOptions
+settings.
+Default:\ "base".
+.TP 4
+.BI "Option \*qXkbModel\*q \*q" modelname \*q
+Specifies the XKB keyboard model name.
+Default:\ "pc105".
+.TP 4
+.BI "Option \*qXkbLayout\*q \*q" layoutname \*q
+Specifies the XKB keyboard layout name.
+This is usually the country or language type of the keyboard.
+Default:\ "us".
+.TP 4
+.BI "Option \*qXkbVariant\*q \*q" variants \*q
+Specifies the XKB keyboard variant components.
+These can be used to enhance the keyboard layout details.
+Default:\ not\ set.
+.TP 4
+.BI "Option \*qXkbOptions\*q \*q" options \*q
+Specifies the XKB keyboard option components.
+These can be used to enhance the keyboard behaviour.
+Default:\ not\ set.
+.PP
+For a list of available XKB options, see
+.B xkeyboard-config(__miscmansuffix__).
 .SH "SUPPORTED PROPERTIES"
 The following properties are provided by the
 .B ws
Index: src/ws.c
===
RCS file: /cvs/xenocara/driver/xf86-input-ws/src/ws.c,v
retrieving revision 1.57
diff -u -p -w -r1.57 ws.c
--- src/ws.c8 Jul 2012 14:22:03 -   1.57
+++ src/ws.c9 Jul 2012 20:36:46 -
@@ -23,10 +23,10 @@
 #include 
 #include 
 #include 
-#include 
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -35,6 +35,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "ws.h"
 
@@ -42,25 +43,45 @@
 #include "ws-properties.h"
 #include 
 
+#define CAPSFLAG   (1 << 0)
+#define NUMFLAG(1 << 1)
+#define SCROLLFLAG (1 << 2)
+#define COMPOSEFLAG(1 << 4)
+
 static MODULESETUPPROTO(SetupProc);
 static MODULETEARDOWNPROTO(TearDownProc);
 
 static int wsPreInit(InputDriverPtr, InputInfoPtr, int);
+static int wsPreInitPointer(InputDriverPtr, InputInfoPtr, int);
+static int wsPreInitKeyboard(InputDriverPtr, InputInfoPtr, int);
 static void wsUnInit(InputDriverPtr, InputInfoPtr, int);
 static int wsProc(DeviceIntPtr, int);
 static int wsDeviceInit(DeviceIntPtr);
+static int wsDeviceInitPointer(DeviceIntPtr);
+static int wsDeviceInitKeyboard(DeviceIntPtr);
 static int wsDeviceOn(DeviceIntPtr);
+static int wsDeviceOnPointer(DeviceIntPtr);
+static int wsDeviceOnKeyboard(DeviceIntPtr);
 static void wsDeviceOff(DeviceIntPtr);
+static void wsDeviceOffPointer(DeviceIntPtr);
+static void wsDeviceOffKeyboard(DeviceIntPtr);
 static void wsReadInput(InputInfoPtr);
+static void ConsoleReadInput(InputInfoPtr);
 static void wsSendButtons(InputInfoPtr, int);
 static int wsSwitchMode(ClientPtr, DeviceIntPtr, int);
-static Bool wsOpen(InputInfoPtr);
-static void wsClose(InputInfoPtr);
+static int wsOpenPointer(InputInfoPtr);
+static int wsOpenKeyboard(InputInfoPtr);
+static void wsClosePointer(InputInfoPtr);
+static void wsCloseKeyboard(InputInfoPtr);
 static void wsControlProc(DeviceIntPtr , PtrCtrl *);
+static void wsKeyboardBell(int, DeviceIntPtr, pointer, int);
+static void wsKeyboardCtrl(DeviceIntPtr, KeybdCtrl *);
 
 static void wsInitCalibProperty(DeviceIntPtr);
 static int wsSetCalibProperty(DeviceIntPtr, Atom, XIPropertyValuePtr, BOOL);
 
+static Bool translate_XT_to_X(InputInfoPtr, int *);
+
 static Atom prop_calibration;
 static Atom prop_swap;
 
@@ -121,16 +142,10 @@ static int
 wsPreInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags)
 {
WSDevicePtr priv;
-   MessageType buttons_from = X_CONFIG;
-   char *s;
-   int i, phy_btn = 1, rc = BadValue;
 
-   priv = (WSDevicePtr)calloc(1, sizeof(

Support keyboards in xf86-input-ws

2012-07-09 Thread Alexandr Shadchin
Add functional xf86-input-keyboard in xf86-input-ws (no new features)

For test add or rewrite xorg.conf:

Section "InputClass"
Identifier "keyboard defaults"
MatchIsKeyboard "on"

Driver "ws"
Option "Device" "/dev/wskbd"

Option "XkbModel" "your setting"
Option "XkbLayout" "your setting"
Option "XkbVariant" "your setting"
Option "XKbOptions" "your setting"
EndSection

Welcome any feedback.

-- 
Alexandr Shadchin

Index: man/ws.man
===
RCS file: /cvs/xenocara/driver/xf86-input-ws/man/ws.man,v
retrieving revision 1.13
diff -u -p -w -r1.13 ws.man
--- man/ws.man  12 Jun 2012 17:12:50 -  1.13
+++ man/ws.man  9 Jul 2012 15:54:25 -
@@ -199,6 +199,38 @@ is mapped to the negative W axis motion 
 .I N2
 is mapped to the positive W axis motion.
 Default:\ "6\ 7".
+.TP 4
+.BI "Option \*qXkbRules\*q \*q" rules \*q
+Specifies which XKB rules file to use for interpreting the
+.BR XkbModel ,
+.BR XkbLayout ,
+.BR XkbVariant ,
+and
+.B XkbOptions
+settings.
+Default:\ "base".
+.TP 4
+.BI "Option \*qXkbModel\*q \*q" modelname \*q
+Specifies the XKB keyboard model name.
+Default:\ "pc105".
+.TP 4
+.BI "Option \*qXkbLayout\*q \*q" layoutname \*q
+Specifies the XKB keyboard layout name.
+This is usually the country or language type of the keyboard.
+Default:\ "us".
+.TP 4
+.BI "Option \*qXkbVariant\*q \*q" variants \*q
+Specifies the XKB keyboard variant components.
+These can be used to enhance the keyboard layout details.
+Default:\ not\ set.
+.TP 4
+.BI "Option \*qXkbOptions\*q \*q" options \*q
+Specifies the XKB keyboard option components.
+These can be used to enhance the keyboard behaviour.
+Default:\ not\ set.
+.PP
+For a list of available XKB options, see
+.B xkeyboard-config(__miscmansuffix__).
 .SH "SUPPORTED PROPERTIES"
 The following properties are provided by the
 .B ws
Index: src/ws.c
===
RCS file: /cvs/xenocara/driver/xf86-input-ws/src/ws.c,v
retrieving revision 1.57
diff -u -p -w -r1.57 ws.c
--- src/ws.c8 Jul 2012 14:22:03 -   1.57
+++ src/ws.c9 Jul 2012 15:54:25 -
@@ -23,10 +23,10 @@
 #include 
 #include 
 #include 
-#include 
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -35,6 +35,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "ws.h"
 
@@ -42,25 +43,45 @@
 #include "ws-properties.h"
 #include 
 
+#define CAPSFLAG   (1 << 0)
+#define NUMFLAG(1 << 1)
+#define SCROLLFLAG (1 << 2)
+#define COMPOSEFLAG(1 << 4)
+
 static MODULESETUPPROTO(SetupProc);
 static MODULETEARDOWNPROTO(TearDownProc);
 
 static int wsPreInit(InputDriverPtr, InputInfoPtr, int);
+static int wsPreInitPointer(InputDriverPtr, InputInfoPtr, int);
+static int wsPreInitKeyboard(InputDriverPtr, InputInfoPtr, int);
 static void wsUnInit(InputDriverPtr, InputInfoPtr, int);
 static int wsProc(DeviceIntPtr, int);
 static int wsDeviceInit(DeviceIntPtr);
+static int wsDeviceInitPointer(DeviceIntPtr);
+static int wsDeviceInitKeyboard(DeviceIntPtr);
 static int wsDeviceOn(DeviceIntPtr);
+static int wsDeviceOnPointer(DeviceIntPtr);
+static int wsDeviceOnKeyboard(DeviceIntPtr);
 static void wsDeviceOff(DeviceIntPtr);
+static void wsDeviceOffPointer(DeviceIntPtr);
+static void wsDeviceOffKeyboard(DeviceIntPtr);
 static void wsReadInput(InputInfoPtr);
+static void ConsoleReadInput(InputInfoPtr);
 static void wsSendButtons(InputInfoPtr, int);
 static int wsSwitchMode(ClientPtr, DeviceIntPtr, int);
-static Bool wsOpen(InputInfoPtr);
-static void wsClose(InputInfoPtr);
+static int wsOpenPointer(InputInfoPtr);
+static int wsOpenKeyboard(InputInfoPtr);
+static void wsClosePointer(InputInfoPtr);
+static void wsCloseKeyboard(InputInfoPtr);
 static void wsControlProc(DeviceIntPtr , PtrCtrl *);
+static void wsKeyboardBell(int, DeviceIntPtr, pointer, int);
+static void wsKeyboardCtrl(DeviceIntPtr, KeybdCtrl *);
 
 static void wsInitCalibProperty(DeviceIntPtr);
 static int wsSetCalibProperty(DeviceIntPtr, Atom, XIPropertyValuePtr, BOOL);
 
+static Bool translate_XT_to_X(InputInfoPtr, int *);
+
 static Atom prop_calibration;
 static Atom prop_swap;
 
@@ -121,16 +142,10 @@ static int
 wsPreInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags)
 {
WSDevicePtr priv;
-   MessageType buttons_from = X_CONFIG;
-   char *s;
-   int i, phy_btn = 1, rc = BadValue;
 
-   priv = (WSDevicePtr)calloc(1, sizeof(WSDeviceRec));
-   if (priv == NULL) {
-   rc = BadAlloc;
-   goto fail;
-   }
-   pInfo->private = priv;
+   pInfo->private = priv = (WSDev

UPDATE: xf86-input-synaptics 1.6.1

2012-06-10 Thread Alexandr Shadchin
Hi,

This update xf86-input-synaptics to the latest release 1.6.1.
http://koba.devio.us/distfiles/xf86-input-synaptics-1.6.1.diff

Comments ? OK ?

-- 
Alexandr Shadchin



UPDATE: xkeyboard-config 2.6

2012-06-02 Thread Alexandr Shadchin
Hi,

This update xkeyboard-config to the latest release 2.6.
http://koba.devio.us/distfiles/xkeyboard-config-2.6.diff

NOTE: Some old/unused material cleaned up

Tested on amd64.

Comments ? OK ? 

-- 
Alexandr Shadchin



UPDATE: xf86-input-synaptics

2012-03-28 Thread Alexandr Shadchin
Hi,

This update xf86-input-synaptics to the latest release 1.5.2.
http://koba.devio.us/distfiles/xf86-input-synaptics-1.5.2.diff

Tested on amd64.

Comments ? OK ?

-- 
Alexandr Shadchin



UPDATE: xf86-input-mouse

2012-03-28 Thread Alexandr Shadchin
Hi,

This update xf86-input-mouse to the latest release 1.7.2.
http://koba.devio.us/distfiles/xf86-input-mouse-1.7.2.diff

Tested on amd64.

Comments ? OK ?

-- 
Alexandr Shadchin



Re: enable/fix vt switching on sandybridge machines

2012-03-02 Thread Alexandr Shadchin
On Fri, Mar 02, 2012 at 09:27:52PM -0600, joshua stein wrote:
> hi friends,
> 
> this enables vt switching on my laptop (dell xps 13) with
> sandybridge video:
> 
>   vga1 at pci0 dev 2 function 0 "Intel GT2 Video" rev 0x09
> 
> previously it would do nothing on ctrl+alt+f1 and redraw the screen
> on ctrl+alt+f5.  now i am able to switch between the console and X
> multiple times without any problems or artifacts.
> 
> can i get some tests on other sandybridge systems like an x220 and
> on non-sandybridge intel video machines?
> 
> 
> diff --git a/driver/xf86-video-intel/src/intel_driver.c 
> b/driver/xf86-video-intel/src/intel_driver.c
> index 03b1586..8f04695 100644
> --- a/driver/xf86-video-intel/src/intel_driver.c
> +++ b/driver/xf86-video-intel/src/intel_driver.c
> @@ -1552,7 +1552,7 @@ static Bool I830PreInit(ScrnInfoPtr scrn, int flags)
>  
>   if (!intel->use_drm_mode) {
> /* console hack, stolen from G80 */
> -if (IS_GEN5(intel)) {
> +if (IS_GEN5(intel) || HAS_PCH_SPLIT(intel)) {
>  if (xf86LoadSubModule(scrn, "int10")) {
>  intel->int10 = xf86InitInt10(pEnt->index);
>  if (intel->int10) {
> @@ -1779,9 +1779,6 @@ static Bool RestoreHWState(ScrnInfoPtr scrn)
>   vgaRegPtr vgaReg = &hwp->SavedReg;
>   int i;
>  
> - if (HAS_PCH_SPLIT(intel))
> - return TRUE;
> -
>   DPRINTF(PFX, "RestoreHWState\n");
>  
>   /* Disable outputs */
> @@ -2600,7 +2597,8 @@ static void I830LeaveVT(int scrnIndex, int flags)
>   RestoreHWState(scrn);
>  
>   /* console restore hack */
> - if (IS_GEN5(intel) && intel->int10 && intel->int10Mode) {
> + if ((IS_GEN5(intel) || HAS_PCH_SPLIT(intel)) &&
> +   intel->int10 && intel->int10Mode) {
>   xf86Int10InfoPtr int10 = intel->int10;
>  
>   /* Use int10 to restore the console mode */
> @@ -2610,7 +2608,6 @@ static void I830LeaveVT(int scrnIndex, int flags)
>   int10->cx = int10->dx = 0;
>   xf86ExecX86int10(int10);
>   }
> -
>   }
>  
>   i830_unbind_all_memory(scrn);
> 

Works fine on X201(Core i5-540M).

-- 
Alexandr Shadchin



UPDATE: xenocara/xkeyboard-config

2012-01-21 Thread Alexandr Shadchin
Hi,

This update xkeyboard-config to the latest release 2.5.
http://koba.devio.us/distfiles/xkeyboard-config-2.5.diff

Tested on amd64.

Comments ? OK ? 

-- 
Alexandr Shadchin



cleanup wsfont 7

2012-01-09 Thread Alexandr Shadchin
Simplify function wsfont_map_unichar. OK ?

-- 
Alexandr Shadchin

Index: wsfont.c
===
RCS file: /cvs/src/sys/dev/wsfont/wsfont.c,v
retrieving revision 1.28
diff -u -p -r1.28 wsfont.c
--- wsfont.c8 Jan 2012 14:48:56 -   1.28
+++ wsfont.c9 Jan 2012 14:17:51 -
@@ -789,8 +789,6 @@ static struct wsfont_level1_glyphmap enc
{ iso7_level1, 0, 33 }, /* WSDISPLAY_FONTENC_ISO7 */
 };
 
-#define MAX_ENCODING (sizeof(encodings) / sizeof(encodings[0]))
-
 #endif /* !SMALL_KERNEL */
 
 /*
@@ -800,26 +798,23 @@ int
 wsfont_map_unichar(struct wsdisplay_font *font, int c)
 {
if (font->encoding == WSDISPLAY_FONTENC_ISO)
-   return c;
-   else
+   return (c);
+
 #if !defined(SMALL_KERNEL)
-   if (font->encoding < 0 || font->encoding > MAX_ENCODING)
-   return (-1);
-   else {
+   if (font->encoding >= 0 && font->encoding < nitems(encodings)) {
int hi = (c >> 8), lo = c & 255;
struct wsfont_level1_glyphmap *map1 =
-   &encodings[font->encoding];
+   &encodings[font->encoding];
 
-   if (hi >= map1->base && hi < map1->base + map1->size) {
-   struct wsfont_level2_glyphmap *map2 =
- map1->level2[hi - map1->base];
+   hi -= map1->base;
 
-   if (map2 != NULL &&
-   lo >= map2->base && lo < map2->base + map2->size) {
+   if (hi >= 0 && hi < map1->size) {
+   struct wsfont_level2_glyphmap *map2 = map1->level2[hi];
 
-   lo -= map2->base;
+   lo -= map2->base;
 
-   switch(map2->width) {
+   if (map2 != NULL && lo >= 0 && lo < map2->size) {
+   switch (map2->width) {
case 1:
c = (((u_int8_t *)map2->chars)[lo]);
break;
@@ -831,21 +826,12 @@ wsfont_map_unichar(struct wsdisplay_font
break;
}
 
-   if (c == 0 && lo != 0)
-   return (-1);
-   else
+   if (c)
return (c);
-
-   } else {
-   return (-1);
}
-
-   } else {
-   return (-1);
}
-
}
-#else
-   return (-1);
 #endif /* SMALL_KERNEL */
+
+   return (-1);
 }



cleanup wsfont 6

2012-01-09 Thread Alexandr Shadchin
Remove unused definition WSFONT_RDONLY. OK ?

-- 
Alexandr Shadchin

Index: wsfont.h
===
RCS file: /cvs/src/sys/dev/wsfont/wsfont.h,v
retrieving revision 1.6
diff -u -p -r1.6 wsfont.h
--- wsfont.h6 Jan 2012 14:55:38 -   1.6
+++ wsfont.h9 Jan 2012 12:58:19 -
@@ -63,7 +63,6 @@ struct wsdisplay_font;
 /* For wsfont_add() */
 #define WSFONT_BUILTIN (0x01)
 #define WSFONT_STATIC  (0x02)
-#define WSFONT_RDONLY  (0x04)
 
 /* wsfont.c */
 void   wsfont_init(void);



cleanup wsfont 5

2012-01-09 Thread Alexandr Shadchin
Remove unused function wsfont_getflg. OK ?

-- 
Alexandr Shadchin

Index: wsfont.c
===
RCS file: /cvs/src/sys/dev/wsfont/wsfont.c,v
retrieving revision 1.28
diff -u -p -r1.28 wsfont.c
--- wsfont.c8 Jan 2012 14:48:56 -   1.28
+++ wsfont.c9 Jan 2012 12:31:44 -
@@ -579,26 +579,6 @@ wsfont_lock(int cookie, struct wsdisplay
 }
 
 /*
- * Get font flags and lockcount.
- */
-int
-wsfont_getflg(int cookie, int *flg, int *lc)
-{
-   struct font *ent;
-   int s;
-
-   s = splhigh();
-
-   if ((ent = wsfont_find0(cookie)) != NULL) {
-   *flg = ent->flg;
-   *lc = ent->lockcount;
-   }
-
-   splx(s);
-   return (ent != NULL ? 0 : -1);
-}
-
-/*
  * Unlock a given font and return new lockcount.
  */
 int
Index: wsfont.h
===
RCS file: /cvs/src/sys/dev/wsfont/wsfont.h,v
retrieving revision 1.6
diff -u -p -r1.6 wsfont.h
--- wsfont.h6 Jan 2012 14:55:38 -   1.6
+++ wsfont.h9 Jan 2012 12:31:44 -
@@ -73,7 +73,6 @@ int   wsfont_remove(int);
 void   wsfont_enum(void (*)(char *, int, int, int));
 intwsfont_lock(int, struct wsdisplay_font **, int, int);
 intwsfont_unlock(int);
-intwsfont_getflg(int, int *, int *);
 intwsfont_map_unichar(struct wsdisplay_font *, int);
 intwsfont_rotate(int);



cleanup wsfont 4

2012-01-06 Thread Alexandr Shadchin
Remove unused definition null16. OK ?

-- 
Alexandr Shadchin

Index: wsfont.c
===
RCS file: /cvs/src/sys/dev/wsfont/wsfont.c,v
retrieving revision 1.26
diff -u -p -r1.26 wsfont.c
--- wsfont.c6 Jan 2012 14:55:38 -   1.26
+++ wsfont.c6 Jan 2012 16:21:18 -
@@ -660,12 +660,6 @@ struct wsfont_level2_glyphmap {
int width;  /* Size of each entry in bytes (1,2,4)  */
 };
 
-#define null16 \
-   NULL, NULL, NULL, NULL, \
-   NULL, NULL, NULL, NULL, \
-   NULL, NULL, NULL, NULL, \
-   NULL, NULL, NULL, NULL
-
 /*
  * IBM 437 maps
  */



cleanup wsfont 3

2012-01-06 Thread Alexandr Shadchin
Ansify non-ansified function definitions. No functional change.

OK ?

-- 
Alexandr Shadchin

Index: wsfont.c
===
RCS file: /cvs/src/sys/dev/wsfont/wsfont.c,v
retrieving revision 1.26
diff -u -p -r1.26 wsfont.c
--- wsfont.c6 Jan 2012 14:55:38 -   1.26
+++ wsfont.c6 Jan 2012 16:02:49 -
@@ -213,8 +213,7 @@ static struct font *wsfont_find0(int);
  */
 static voidwsfont_revbit(struct wsdisplay_font *);
 static void
-wsfont_revbit(font)
-   struct wsdisplay_font *font;
+wsfont_revbit(struct wsdisplay_font *font)
 {
u_char *p, *m;
 
@@ -234,8 +233,7 @@ wsfont_revbit(font)
  */
 static voidwsfont_revbyte(struct wsdisplay_font *);
 static void
-wsfont_revbyte(font)
-   struct wsdisplay_font *font;
+wsfont_revbyte(struct wsdisplay_font *font)
 {
int x, l, r, nr;
u_char *rp;
@@ -267,8 +265,7 @@ wsfont_revbyte(font)
  * Enumerate the list of fonts
  */
 void
-wsfont_enum(cb)
-   void (*cb)(char *, int, int, int);
+wsfont_enum(void (*cb)(char *, int, int, int))
 {
struct wsdisplay_font *f;
struct font *ent;
@@ -393,8 +390,7 @@ wsfont_init(void)
  * Find a font by cookie. Called at splhigh.
  */
 static struct font *
-wsfont_find0(cookie)
-   int cookie;
+wsfont_find0(int cookie)
 {
struct font *ent;
 
@@ -409,9 +405,7 @@ wsfont_find0(cookie)
  * Find a font.
  */
 int
-wsfont_find(name, width, height, stride)
-   char *name;
-   int width, height, stride;
+wsfont_find(char *name, int width, int height, int stride)
 {
struct font *ent;
int s;
@@ -443,9 +437,7 @@ wsfont_find(name, width, height, stride)
  * Add a font to the list.
  */
 int
-wsfont_add(font, copy)
-   struct wsdisplay_font *font;
-   int copy;
+wsfont_add(struct wsdisplay_font *font, int copy)
 {
static int cookiegen = 666;
struct font *ent;
@@ -496,8 +488,7 @@ wsfont_add(font, copy)
  */
 #ifdef notyet
 int
-wsfont_remove(cookie)
-   int cookie;
+wsfont_remove(int cookie)
 {
struct font *ent;
int s;
@@ -541,10 +532,8 @@ wsfont_remove(cookie)
  * requested by the caller differs.
  */
 int
-wsfont_lock(cookie, ptr, bitorder, byteorder)
-   int cookie;
-   struct wsdisplay_font **ptr;
-   int bitorder, byteorder;
+wsfont_lock(int cookie, struct wsdisplay_font **ptr, int bitorder,
+int byteorder)
 {
struct font *ent;
int s, lc;
@@ -593,8 +582,7 @@ wsfont_lock(cookie, ptr, bitorder, byteo
  * Get font flags and lockcount.
  */
 int
-wsfont_getflg(cookie, flg, lc)
-   int cookie, *flg, *lc;
+wsfont_getflg(int cookie, int *flg, int *lc)
 {
struct font *ent;
int s;
@@ -614,8 +602,7 @@ wsfont_getflg(cookie, flg, lc)
  * Unlock a given font and return new lockcount.
  */
 int
-wsfont_unlock(cookie)
-   int cookie;
+wsfont_unlock(int cookie)
 {
struct font *ent;
int s, lc;
@@ -752,7 +739,6 @@ static struct wsfont_level2_glyphmap *ib
NULL, &ibm437_level2_37
 };
 
-
 /*
  * ISO-8859-7 maps
  */
@@ -802,7 +788,6 @@ static struct wsfont_level2_glyphmap *is
&iso7_level2_32
 };
 
-
 static struct wsfont_level1_glyphmap encodings[] = {
{ NULL, 0, 0 }, /* WSDISPLAY_FONTENC_ISO */
{ ibm437_level1, 0, 38 },   /* WSDISPLAY_FONTENC_IBM */
@@ -818,9 +803,7 @@ static struct wsfont_level1_glyphmap enc
  * Remap Unicode character to glyph
  */
 int
-wsfont_map_unichar(font, c)
-   struct wsdisplay_font *font;
-   int c;
+wsfont_map_unichar(struct wsdisplay_font *font, int c)
 {
if (font->encoding == WSDISPLAY_FONTENC_ISO)
return c;



cleanup wsfont 2/2

2012-01-06 Thread Alexandr Shadchin
Remove extra and trailing spaces. OK ?

-- 
Alexandr Shadchin

Index: bold8x16-iso1.h
===
RCS file: /cvs/src/sys/dev/wsfont/bold8x16-iso1.h,v
retrieving revision 1.3
diff -u -p -r1.3 bold8x16-iso1.h
--- bold8x16-iso1.h 21 Jun 2009 20:30:35 -  1.3
+++ bold8x16-iso1.h 6 Jan 2012 10:59:40 -
@@ -35,7 +35,7 @@
  */
 static u_char bold8x16_iso1_data[];
 
-struct wsdisplay_font bold8x16_iso1 = { 
+struct wsdisplay_font bold8x16_iso1 = {
"Boldface.iso1",/* typeface name */
0,  /* index */
' ',/* firstchar */
Index: bold8x16.h
===
RCS file: /cvs/src/sys/dev/wsfont/bold8x16.h,v
retrieving revision 1.3
diff -u -p -r1.3 bold8x16.h
--- bold8x16.h  21 Jun 2009 20:30:35 -  1.3
+++ bold8x16.h  6 Jan 2012 10:59:41 -
@@ -1,5 +1,5 @@
 /* $OpenBSD: bold8x16.h,v 1.3 2009/06/21 20:30:35 jsg Exp $ */
-/*  $NetBSD: bold8x16.h,v 1.4 2000/01/05 18:44:22 ad Exp $ */
+/* $NetBSD: bold8x16.h,v 1.4 2000/01/05 18:44:22 ad Exp $ */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
  */
 static u_char bold8x16_data[];
 
-struct wsdisplay_font bold8x16 = { 
+struct wsdisplay_font bold8x16 = {
"Boldface", /* typeface name */
0,  /* index */
1,  /* firstchar */
Index: files.wsfont
===
RCS file: /cvs/src/sys/dev/wsfont/files.wsfont,v
retrieving revision 1.3
diff -u -p -r1.3 files.wsfont
--- files.wsfont15 Sep 2005 20:23:10 -  1.3
+++ files.wsfont6 Jan 2012 10:59:41 -
@@ -1,5 +1,5 @@
 #  $OpenBSD: files.wsfont,v 1.3 2005/09/15 20:23:10 miod Exp $
-#  $NetBSD: files.wsfont,v 1.7 2000/11/21 11:44:45 tsutsui Exp $
+#  $NetBSD: files.wsfont,v 1.7 2000/11/21 11:44:45 tsutsui Exp $
 
 # Note: `wsfont_glue' is only here to force the header file's name
 #  hence it must be mentioned first.
Index: gallant12x22.h
===
RCS file: /cvs/src/sys/dev/wsfont/gallant12x22.h,v
retrieving revision 1.4
diff -u -p -r1.4 gallant12x22.h
--- gallant12x22.h  21 Jun 2009 20:30:35 -  1.4
+++ gallant12x22.h  6 Jan 2012 10:59:41 -
@@ -1,5 +1,5 @@
 /* $OpenBSD: gallant12x22.h,v 1.4 2009/06/21 20:30:35 jsg Exp $ */
-/* $NetBSD: gallant12x22.h,v 1.2 1999/05/18 21:51:58 ad Exp $ */
+/* $NetBSD: gallant12x22.h,v 1.2 1999/05/18 21:51:58 ad Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -35,10 +35,10 @@
  *
  * Derived from: @(#)gallant19.h   8.1 (Berkeley) 6/11/93
  */
- 
+
 static u_char gallant12x22_data[];
 
-struct wsdisplay_font gallant12x22 = { 
+struct wsdisplay_font gallant12x22 = {
"Gallant",  /* typeface name */
0,  /* index */
' ',/* firstchar */
@@ -52,7 +52,7 @@ struct wsdisplay_font gallant12x22 = { 
NULL,   /* cookie */
gallant12x22_data   /* data */
 };
- 
+
 static u_char gallant12x22_data[] = {
/*   */
0x00, 0x00, /*  */
@@ -5429,6 +5429,4 @@ static u_char gallant12x22_data[] = {
0x78, 0x00, /* .... */
0x70, 0x00, /* .*** */
0x00, 0x00, /*  */
-
-
 };
Index: lucida16x29.h
===
RCS file: /cvs/src/sys/dev/wsfont/lucida16x29.h,v
retrieving revision 1.2
diff -u -p -r1.2 lucida16x29.h
--- lucida16x29.h   21 Jun 2009 20:30:35 -  1.2
+++ lucida16x29.h   6 Jan 2012 10:59:42 -
@@ -1,63 +1,63 @@
 /* $OpenBSD: lucida16x29.h,v 1.2 2009/06/21 20:30:35 jsg Exp $ */
-/*  $NetBSD: lucida16x29.h,v 1.3 1999/05/18 21:51:58 ad Exp $ */
+/* $NetBSD: lucida16x29.h,v 1.3 1999/05/18 21:51:58 ad Exp $ */
 
 /*
 
 This is the LEGAL NOTICE pertaining to the Lucida fonts from Bigelow & Holmes:
 
-   NOTICE TO USER: The source code, including the glyphs or icons 
-   forming a par of the OPEN LOOK TM Graphic User Interface, on this 
+   NOTICE TO USER: The source code, including the glyphs or icons
+   forming a par of the OPEN LOOK TM Graphic User Interface, on this
tape and in these files is copyrighted under U.S. and international
laws. Sun Microsystems, Inc. of Mountain View, California owns
-   the copyright and has design patents pending on many of the icons. 
+   the copyright and has design patents pending on many of the icons.
AT&T is the owner of the OPEN LOOK trademark associated with the
-   materials on this tape. Users and posse

cleanup wsfont 1/2

2012-01-06 Thread Alexandr Shadchin
Remove unused Makefile. OK ?

-- 
Alexandr Shadchin

Index: Makefile
===
RCS file: Makefile
diff -N Makefile
--- Makefile18 Mar 2001 04:30:23 -  1.1
+++ /dev/null   1 Jan 1970 00:00:00 -
@@ -1,8 +0,0 @@
-#  $OpenBSD: Makefile,v 1.1 2001/03/18 04:30:23 nate Exp $
-#  $NetBSD: Makefile,v 1.1 1998/06/12 23:22:55 cgd Exp $
-
-INCSDIR= /usr/include/dev/wsfont
-
-INCS=  wsfont.h
-
-.include 



Re: Moving WSKBDIO_SETLEDS and WSKBDIO_GETLEDS in wskbd

2011-11-30 Thread Alexandr Shadchin
On Wed, Jun 15, 2011 at 11:49:05PM +0600, Alexandr Shadchin wrote:
> On Sat, Apr 16, 2011 at 03:16:47AM +0600, Alexandr Shadchin wrote:
> > Hi,
> > 
> > No need to process WSKBDIO_SETLEDS and WSKBDIO_GETLEDS in each drivers,
> > when same can be done in wskbd.
> > 
> > Tested on i386 and amd64. Please test on other platforms.
> > 
> 
> * fix build if not defined WSDISPLAY_COMPAT_RAWKBD
> * tested on macppc/atkbd (thank Martin Pieuchot)
> 

Change:
* added a function wskbd_set_leds_noop()
* small cleanup

Comments ? OK ?

-- 
Alexandr Shadchin

Index: arch/arm/xscale/pxa27x_kpc.c
===
RCS file: /cvs/src/sys/arch/arm/xscale/pxa27x_kpc.c,v
retrieving revision 1.1
diff -u -p -r1.1 pxa27x_kpc.c
--- arch/arm/xscale/pxa27x_kpc.c9 Sep 2009 12:14:39 -   1.1
+++ arch/arm/xscale/pxa27x_kpc.c30 Nov 2011 22:19:36 -
@@ -27,7 +27,6 @@
 #include 
 
 int  pxa27x_kpc_enable(void *, int);
-void pxa27x_kpc_setleds(void *, int);
 int  pxa27x_kpc_ioctl(void *, u_long, caddr_t, int, struct proc *);
 
 inline void pxa27x_kpc_submit(struct pxa27x_kpc_softc *, int);
@@ -39,7 +38,7 @@ struct cfdriver pxa27x_kpc_cd = {
 
 struct wskbd_accessops pxa27x_kpc_accessops = {
pxa27x_kpc_enable,
-   pxa27x_kpc_setleds,
+   wskbd_set_leds_noop,
pxa27x_kpc_ioctl,
 };
 
@@ -178,11 +177,6 @@ pxa27x_kpc_enable(void *v, int power)
return 0;
 }
 
-void
-pxa27x_kpc_setleds(void *v, int power)
-{
-}
-
 int
 pxa27x_kpc_ioctl(void *v, u_long cmd, caddr_t data, int flag, struct proc *p)
 {
@@ -193,11 +187,6 @@ pxa27x_kpc_ioctl(void *v, u_long cmd, ca
switch (cmd) {
case WSKBDIO_GTYPE:
*(int *)data = WSKBD_TYPE_KPC;
-   return 0;
-   case WSKBDIO_SETLEDS:
-   return 0;
-   case WSKBDIO_GETLEDS:
-   *(int *)data = 0;
return 0;
 #ifdef WSDISPLAY_COMPAT_RAWKBD
case WSKBDIO_SETMODE:
Index: arch/hp300/dev/dnkbd.c
===
RCS file: /cvs/src/sys/arch/hp300/dev/dnkbd.c,v
retrieving revision 1.18
diff -u -p -r1.18 dnkbd.c
--- arch/hp300/dev/dnkbd.c  9 Nov 2011 14:22:37 -   1.18
+++ arch/hp300/dev/dnkbd.c  30 Nov 2011 22:19:36 -
@@ -165,12 +165,16 @@ struct cfattach dnkbd_ca = {
 };
 
 intdnkbd_enable(void *, int);
-void   dnkbd_set_leds(void *, int);
 intdnkbd_ioctl(void *, u_long, caddr_t, int, struct proc *);
 
+/*
+ * LED not supported. There is only one LED on this keyboard, and
+ * is hardware tied to the caps lock key.
+ */
+
 const struct wskbd_accessops dnkbd_accessops = {
dnkbd_enable,
-   dnkbd_set_leds,
+   wskbd_set_leds_noop,
dnkbd_ioctl
 };
 
@@ -884,15 +888,6 @@ dnkbd_enable(void *v, int on)
return (0);
 }
 
-void
-dnkbd_set_leds(void *v, int leds)
-{
-   /*
-* Not supported. There is only one LED on this keyboard, and
-* is hardware tied to the caps lock key.
-*/
-}
-
 int
 dnkbd_ioctl(void *v, u_long cmd, caddr_t data, int flag, struct proc *p)
 {
@@ -903,11 +898,6 @@ dnkbd_ioctl(void *v, u_long cmd, caddr_t
switch (cmd) {
case WSKBDIO_GTYPE:
*(int *)data = WSKBD_TYPE_DOMAIN;
-   return (0);
-   case WSKBDIO_SETLEDS:
-   return (ENXIO);
-   case WSKBDIO_GETLEDS:
-   *(int *)data = 0;
return (0);
case WSKBDIO_COMPLEXBELL:
 #defined   ((struct wskbd_bell_data *)data)
Index: arch/luna88k/dev/lunaws.c
===
RCS file: /cvs/src/sys/arch/luna88k/dev/lunaws.c,v
retrieving revision 1.7
diff -u -p -r1.7 lunaws.c
--- arch/luna88k/dev/lunaws.c   11 Sep 2008 11:30:14 -  1.7
+++ arch/luna88k/dev/lunaws.c   30 Nov 2011 22:19:37 -
@@ -70,7 +70,6 @@ struct ws_softc {
 void omkbd_input(void *, int);
 void omkbd_decode(void *, int, u_int *, int *);
 int  omkbd_enable(void *, int);
-void omkbd_set_leds(void *, int);
 int  omkbd_ioctl(void *, u_long, caddr_t, int, struct proc *);
 
 struct wscons_keydesc omkbd_keydesctab[];
@@ -86,7 +85,7 @@ const struct wskbd_mapdata omkbd_keymapd
 
 const struct wskbd_accessops omkbd_accessops = {
omkbd_enable,
-   omkbd_set_leds,
+   wskbd_set_leds_noop,
omkbd_ioctl,
 };
 
@@ -456,18 +455,18 @@ omkbd_enable(v, on)
return 0;
 }
 
+#if notyet
 void
 omkbd_set_leds(v, leds)
void *v;
int leds;
 {
-#if 0
syscnputc((dev_t)1, 0x10); /* kana LED on */
syscnputc((dev_t)1, 0x00); /* kana LED off */
syscnputc((dev_t)1, 0x11); /* caps LED on */
syscnputc((dev_t)1, 0x01); /* caps LED off */
-#endif
 }
+#endif
 
 int
 omkbd_ioctl(v, cmd, data, flag, p)
@@ -485,8 +484,6 @@ omkbd_ioctl(v, cmd, data, flag, p)
case WSKBDIO_GTYPE:
*(int *)data 

add wheel emulation for ws(4)

2011-11-19 Thread Alexandr Shadchin
Hi,

This port wheel emulation from evdev(4) (suggestion oga@)

Comments ? OK ?

-- 
Alexandr Shadchin

Index: include/ws-properties.h
===
RCS file: /cvs/xenocara/driver/xf86-input-ws/include/ws-properties.h,v
retrieving revision 1.2
diff -u -p -r1.2 ws-properties.h
--- include/ws-properties.h 27 Nov 2009 10:30:08 -  1.2
+++ include/ws-properties.h 19 Nov 2011 15:24:53 -
@@ -23,6 +23,18 @@
 /* CARD32 */
 #define WS_PROP_MIDBUTTON_TIMEOUT "WS Pointer Middle Button Timeout"
 
+/* Mouse wheel emulation */
+/* BOOL */
+#define WS_PROP_WHEEL "WS Pointer Wheel Emulation"
+/* CARD8, 4 values [x up, x down, y up, y down], 0 to disable a value */
+#define WS_PROP_WHEEL_AXES "WS Pointer Wheel Emulation Axes"
+/* CARD16 */
+#define WS_PROP_WHEEL_INERTIA "WS Pointer Wheel Emulation Inertia"
+/* CARD32 */
+#define WS_PROP_WHEEL_TIMEOUT "WS Pointer Wheel Emulation Timeout"
+/* CARD8, value range 0-32, 0 to always scroll */
+#define WS_PROP_WHEEL_BUTTON "WS Pointer Wheel Emulation Button"
+
 /* Run-time calibration */
 /* CARD32, 4 values [minx, maxx, miny, maxy], or no values for unset */
 #define WS_PROP_CALIBRATION "WS Pointer Axis Calibration"
Index: man/ws.man
===
RCS file: /cvs/xenocara/driver/xf86-input-ws/man/ws.man,v
retrieving revision 1.11
diff -u -p -r1.11 ws.man
--- man/ws.man  19 Nov 2011 12:28:10 -  1.11
+++ man/ws.man  19 Nov 2011 15:24:53 -
@@ -69,6 +69,51 @@ Sets the timeout (in milliseconds) that 
 if two buttons where pressed "simultaneously" when 3 button emulation is
 enabled. Default: 50.
 .TP 4
+.BI "Option \*qEmulateWheel\*q \*q" boolean \*q
+Enable/disable "wheel" emulation.
+Wheel emulation means emulating button press/release events when the mouse
+is moved while a specific real button is pressed.
+Wheel button events (typically buttons 4 and 5) are usually used for scrolling.
+Wheel emulation is useful for getting wheel-like behaviour with trackballs.
+It can also be useful for mice with 4 or more buttons but no wheel.
+See the description of the
+.BR EmulateWheelButton ,
+.BR EmulateWheelInertia ,
+.BR EmulateWheelTimeout ,
+.BR XAxisMapping ,
+and
+.B YAxisMapping
+options.
+Default: off.
+.TP 4
+.BI "Option \*qEmulateWheelButton\*q \*q" integer \*q
+Specifies which button must be held down to enable wheel emulation mode.
+While this button is down, X and/or Y pointer movement will generate button
+press/release events as specified for the
+.B XAxisMapping
+and
+.B YAxisMapping
+settings.
+If the button is 0 and
+.BR EmulateWheel
+is on, any motion of the device is converted into wheel events.
+Default:\ 4.
+.TP 4
+.BI "Option \*qEmulateWheelInertia\*q \*q" integer \*q
+Specifies how far (in pixels) the pointer must move to generate button
+press/release events in wheel emulation mode.
+Default:\ 10.
+.TP 4
+.BI "Option \*qEmulateWheelTimeout\*q \*q" integer \*q
+Specifies the time in milliseconds the
+.BR EmulateWheelButton
+must be pressed before wheel emulation is started.
+If the
+.BR EmulateWheelButton
+is released before this timeout, the original button press/release event
+is sent.
+Default:\ 200.
+.TP 4
 .BI "Option \*qDebugLevel\*q \*q" integer \*q
 This option sets the verbosity level of the driver.
 It defaults to 0, which means no extra debug output.
@@ -107,6 +152,26 @@ clockwise, counter-clockwise, or upside-
 .BI "Option \*qSwapXY\*q \*q" boolean \*q
 swaps the X and Y axis of the input device if set. Default: false.
 .TP 4
+.BI "Option \*qXAxisMapping\*q \*q" "N1 N2" \*q
+Specifies which buttons are mapped to motion in the X direction in wheel
+emulation mode.
+Button number
+.I N1
+is mapped to the negative X axis motion and button number
+.I N2
+is mapped to the positive X axis motion.
+Default: no mapping.
+.TP 4
+.BI "Option \*qYAxisMapping\*q \*q" "N1 N2" \*q
+Specifies which buttons are mapped to motion in the Y direction in wheel
+emulation mode.
+Button number
+.I N1
+is mapped to the negative Y axis motion and button number
+.I N2
+is mapped to the positive Y axis motion.
+Default:\ "4\ 5".
+.TP 4
 .BI "Option \*qZAxisMapping\*q \*q" "N1 N2" \*q
 Set the mapping for the Z axis (wheel) motion to buttons. Button
 number
@@ -134,6 +199,21 @@ driver.
 .TP 7
 .BI "WS Pointer Middle Button Timeout"
 1 32-bit positive value (unit: milliseconds)
+.TP 7
+.BI "WS Pointer Wheel Emulation"
+1 boolean value (8 bit, 0 or 1).
+.TP 7
+.BI "WS Pointer Wheel Emulation Axes"
+4 8-bit values, order X up, X down, Y up, Y down. 0 disables a value.
+.TP 7
+.BI "WS Pointer Wheel Emulation Button"
+1 8-bit value, allowed range 0-32, 0 to always scroll.
+.TP 7
+.BI "WS Po

Re: Clitmouse+pad/Dualpoint

2011-10-16 Thread Alexandr Shadchin
On Sun, Oct 16, 2011 at 11:57:43AM -0400, Okan Demirmen wrote:
> On Sun 2011.10.16 at 17:12 +0200, Martin Pieuchot wrote:
> > On 16/10/11(Sun) 16:05, Mathieu - wrote:
> > > Martin Pieuchot wrote:
> > > > If your touchpad/clitpad is recognized as an ALPS Dualpoint, like: 
> > > > 
> > > > $ dmesg |grep pms0
> > > > pms0: ALPS Dualpoint, version 0x6222
> > > > 
> > > > Please test the diff below and report me any breakage/improvement. It 
> > > > should
> > > > at least fix the "pms0: not in sync yet, discard input" error you may
> > > > have seen recently. 
> > > > 
> > > 
> > > 
> > > Yes that diff does improve things. Before I wasn't even able to move the
> > > cursor getting tons of "not int sync yet" messages.
> > > With this diff my touchpad works, including the scrolling part at the
> > > right of the touchpad.
> > 
> > Thanks for testings. Here's and improved version of the diff that should
> > really handle interleaved packets.
> > 
> > Can you tell me if you still see "not in sync yet" after applying this
> > diff. If yes, how often? I'm also interested in the number of "PS/2
> > interleaved packet" messages.
> 
> Hi Martin,
> 
> Both of these diffs allow the pad to work, but the clit remains
> unmovable.  Below is a dmesg with this last diff.
> 
> Cheers,
> Okan
> 

Small rework mpi@ diff. Test please.

-- 
Alexandr Shadchin

Index: pms.c
===
RCS file: /cvs/src/sys/dev/pckbc/pms.c,v
retrieving revision 1.22
diff -u -p -r1.22 pms.c
--- pms.c   4 Oct 2011 06:30:40 -   1.22
+++ pms.c   16 Oct 2011 20:34:24 -
@@ -39,6 +39,8 @@
 #include 
 #include 
 
+#define DEBUG
+
 #ifdef DEBUG
 #define DPRINTF(x...)  do { printf(x); } while (0);
 #else
@@ -87,6 +89,7 @@ struct synaptics_softc {
 
 struct alps_softc {
int model;
+   int mask;
int version;
 
int min_x, min_y;
@@ -141,28 +144,29 @@ static const u_int butmap[8] = {
 
 static const struct alps_model {
int version;
+   int mask;
int model;
 } alps_models[] = {
-   { 0x2021, ALPS_DUALPOINT | ALPS_PASSTHROUGH },
-   { 0x2221, ALPS_DUALPOINT | ALPS_PASSTHROUGH },
-   { 0x, ALPS_DUALPOINT | ALPS_PASSTHROUGH },
-   { 0x3222, ALPS_DUALPOINT | ALPS_PASSTHROUGH },
-   { 0x5212, ALPS_DUALPOINT | ALPS_PASSTHROUGH },
-   { 0x5321, ALPS_GLIDEPOINT },
-   { 0x5322, ALPS_GLIDEPOINT },
-   { 0x603b, ALPS_GLIDEPOINT },
-   { 0x6222, ALPS_DUALPOINT | ALPS_PASSTHROUGH },
-   { 0x6321, ALPS_GLIDEPOINT },
-   { 0x6322, ALPS_GLIDEPOINT },
-   { 0x6323, ALPS_GLIDEPOINT },
-   { 0x6324, ALPS_GLIDEPOINT },
-   { 0x6325, ALPS_GLIDEPOINT },
-   { 0x6326, ALPS_GLIDEPOINT },
-   { 0x633b, ALPS_DUALPOINT | ALPS_PASSTHROUGH },
-   { 0x7301, ALPS_DUALPOINT },
-   { 0x7321, ALPS_GLIDEPOINT },
-   { 0x7322, ALPS_GLIDEPOINT },
-   { 0x7325, ALPS_GLIDEPOINT },
+   { 0x2021, 0xf8, ALPS_DUALPOINT | ALPS_PASSTHROUGH },
+   { 0x2221, 0xf8, ALPS_DUALPOINT | ALPS_PASSTHROUGH },
+   { 0x, 0xff, ALPS_DUALPOINT | ALPS_PASSTHROUGH },
+   { 0x3222, 0xf8, ALPS_DUALPOINT | ALPS_PASSTHROUGH },
+   { 0x5212, 0xff, ALPS_DUALPOINT | ALPS_PASSTHROUGH | ALPS_INTERLEAVED },
+   { 0x5321, 0xf8, ALPS_GLIDEPOINT },
+   { 0x5322, 0xf8, ALPS_GLIDEPOINT },
+   { 0x603b, 0xf8, ALPS_GLIDEPOINT },
+   { 0x6222, 0xcf, ALPS_DUALPOINT | ALPS_PASSTHROUGH | ALPS_INTERLEAVED },
+   { 0x6321, 0xf8, ALPS_GLIDEPOINT },
+   { 0x6322, 0xf8, ALPS_GLIDEPOINT },
+   { 0x6323, 0xf8, ALPS_GLIDEPOINT },
+   { 0x6324, 0x8f, ALPS_GLIDEPOINT },
+   { 0x6325, 0xef, ALPS_GLIDEPOINT },
+   { 0x6326, 0xf8, ALPS_GLIDEPOINT },
+   { 0x633b, 0xf8, ALPS_DUALPOINT | ALPS_PASSTHROUGH },
+   { 0x7301, 0xf8, ALPS_DUALPOINT },
+   { 0x7321, 0xf8, ALPS_GLIDEPOINT },
+   { 0x7322, 0xf8, ALPS_GLIDEPOINT },
+   { 0x7325, 0xcf, ALPS_GLIDEPOINT },
 #if 0
{ 0x7326, 0 },  /* XXX Uses unknown v3 protocol */
 #endif
@@ -212,6 +216,7 @@ int synaptics_query(struct pms_softc *, 
 intsynaptics_get_hwinfo(struct pms_softc *);
 
 void   synaptics_pt_proc(struct pms_softc *);
+void   alps_pt_proc(struct pms_softc *);
 
 intsynaptics_pt_ioctl(void *, u_long, caddr_t, int, struct proc *);
 intsynaptics_pt_enable(void *);
@@ -698,8 +703,8 @@ pmsinput(void *vsc, int data)
if (sc->inputstate != sc->protocol->packetsize)
return;
 
-   sc->protocol->proc(sc);
sc->inputstate = 0;
+   sc->protocol->proc(sc);
 }
 
 int
@@ -1058,6 +1063,7 @@ alps_get_hwinfo(struct pms_softc *sc)
   

Re: UPDATE: usr.bin/less

2011-10-06 Thread Alexandr Shadchin
Option -E is different for "less" and "more".

for "less" - causes to automatically exit the first time it reaches
end-of-file.

for "more" - option -E and -e is equivalent and causes to automatically
exit the second time it reaches end-of-file.

Behaviour "exit the first time it reaches end-of-file" set on default for
"more", therefore was removed scan_option("-E").

This patch return the old behaviour:
Index: command.c
===
RCS file: /cvs/src/usr.bin/less/command.c,v
retrieving revision 1.10
diff -u -p -r1.10 command.c
--- command.c   21 Sep 2011 19:01:49 -  1.10
+++ command.c   6 Oct 2011 16:58:18 -
@@ -55,6 +55,8 @@ extern int shift_count;
 extern int oldbot;
 extern int forw_prompt;
 extern int be_helpful;
+extern int less_is_more;
+extern int quit_at_eof;
 
 #if SHELL_ESCAPE
 static char *shellcmd = NULL;  /* For holding last shell command for "!!" */
@@ -1232,6 +1234,8 @@ commands()
 */
if (sigs && !ABORT_SIGS())
newaction = A_F_FOREVER;
+   if (less_is_more)
+   quit_at_eof = OPT_ON;
break;
 
case A_F_SCROLL:


On Thu, Oct 06, 2011 at 03:26:10PM +0100, Nicholas Marriott wrote:
> Yep they seem to have actually changed the behaviour of -E, I've been
> looking to see if we can restore the old behaviour but haven't got it
> yet.
> 
> 
> 
> On Thu, Oct 06, 2011 at 02:46:27PM +0100, Stuart Henderson wrote:
> > Oh hmm I was slightly mistaken; G did actually exit more before,
> > so only the behaviour of F ^C has changed.
> > 
> > Thanks for pointing out -E, that changes behaviour of both G and
> > F^C (which I can quite imagine some people won't want) but I am happy
> > to set that in MORE for myself.
> > 
> > 
> > 
> > On 2011/10/06 13:51, Nicholas Marriott wrote:
> > > Does this restore the old behaviour?
> > > 
> > > I don't remember why -E was left out... Alexandr?
> > > 
> > > 
> > > Index: main.c
> > > ===
> > > RCS file: /cvs/src/usr.bin/less/main.c,v
> > > retrieving revision 1.11
> > > diff -u -p -r1.11 main.c
> > > --- main.c16 Sep 2011 18:12:09 -  1.11
> > > +++ main.c6 Oct 2011 12:50:24 -
> > > @@ -135,6 +135,7 @@ main(argc, argv)
> > >   init_prompt();
> > >  
> > >   if (less_is_more) {
> > > + scan_option("-E");
> > >   scan_option("-G");
> > >   scan_option("-L");
> > >   scan_option("-X");
> > > 
> > > 
> > > On Thu, Oct 06, 2011 at 11:07:30AM +0100, Stuart Henderson wrote:
> > > > With the old version of less, when called as either "more" or "less",
> > > > if you press either G or F ^C, you would be left at a prompt at the end
> > > > of the file.
> > > > 
> > > > In the updated version these differ; called as "less" this works fine,
> > > > but as "more" it exits.
> > > > 
> > > > Not sure if this is intentional but I'm finding it quite annoying as
> > > > I find it a lot easier to type "more" than "less"..
> > > 

-- 
Alexandr Shadchin



Re: UPDATE: xenocara/xkeyboard-config

2011-10-05 Thread Alexandr Shadchin
On Mon, Oct 03, 2011 at 02:00:33AM +0600, Alexandr Shadchin wrote:
> Hi,
> 
> This update xkeyboard-config to the latest release 2.4.
> http://koba.devio.us/distfiles/xkeyboard-config-2.4.diff
> 
> Tested on amd64.
> 
> Comments ? OK ? 
> 
> -- 
> Alexandr Shadchin
> 

New diff http://koba.devio.us/distfiles/xkeyboard-config-2.4.1.diff
* update to 2.4.1
* add pre-process manual page
* small rework Makefile

-- 
Alexandr Shadchin



UPDATE: xenocara/xkeyboard-config

2011-10-02 Thread Alexandr Shadchin
Hi,

This update xkeyboard-config to the latest release 2.4.
http://koba.devio.us/distfiles/xkeyboard-config-2.4.diff

Tested on amd64.

Comments ? OK ? 

-- 
Alexandr Shadchin



Re: sbin/wsconsctl/util.c (simple diff)

2011-09-14 Thread Alexandr Shadchin
Fixed. Thank you.

On Thu, Sep 15, 2011 at 10:20 AM, patrick keshishian
 wrote:
> diff before and after patch for wsconsctl output:
>
> B keyboard.repeat.deln.default=100
> B keyboard.ledstate=0
> B keyboard.encoding=us.swapctrlcaps
> -mouse.type=unknown_15
> +mouse.type=synaptics
> B mouse.rawmode=0
> B mouse.scale=1472,5888,1408,5012,0,88,143
> B mouse1.type=usb
>
>
> Index: util.c
> ===
> RCS file: /cvs/obsd/src/sbin/wsconsctl/util.c,v
> retrieving revision 1.53
> diff -u -p util.c
> --- util.c B  B  B 2 Jul 2010 15:47:58 - B  B  B  1.53
> +++ util.c B  B  B 15 Sep 2011 04:14:21 -
> @@ -87,7 +87,8 @@ static const struct nameint mstype_tab[] = {
> B  B  B  B { WSMOUSE_TYPE_LUNA, B  B "luna" },
> B  B  B  B { WSMOUSE_TYPE_DOMAIN, B "domain" },
> B  B  B  B { WSMOUSE_TYPE_BLUETOOTH, "bluetooth" },
> - B  B  B  { WSMOUSE_TYPE_SUN, B  B  "sun" }
> + B  B  B  { WSMOUSE_TYPE_SUN, B  B  "sun" },
> + B  B  B  { WSMOUSE_TYPE_SYNAPTICS, B  B  B  "synaptics" }
> B };
>
> B static const struct nameint dpytype_tab[] = {
>
>

--
Alexandr Shadchin



Re: Support for ALPS touchpads

2011-09-14 Thread Alexandr Shadchin
ms_set_scaling(sc, 1) ||
> + pms_set_scaling(sc, 1) ||
> + pms_set_scaling(sc, 1) ||
> + pms_dev_disable(sc))) {
> + DPRINTF("%s: alps: passthrough off error\n", DEVNAME(sc));
> + goto err;
> + }
> +
> + return (1);
> +
> +err:
> + pms_reset(sc);
> +
> + return (0);
> +}
> +
> +int
> +pms_ioctl_alps(struct pms_softc *sc, u_long cmd, caddr_t data, int flag,
> +struct proc *p)
> +{
> + struct alps_softc *alps = sc->alps;
> + struct wsmouse_calibcoords *wsmc = (struct wsmouse_calibcoords *)data;
> + int wsmode;
> +
> + switch (cmd) {
> + case WSMOUSEIO_GTYPE:
> + *(u_int *)data = WSMOUSE_TYPE_SYNAPTICS;
> + break;
> + case WSMOUSEIO_GCALIBCOORDS:
> + wsmc->minx = alps->min_x;
> + wsmc->maxx = alps->max_x;
> + wsmc->miny = alps->min_y;
> + wsmc->maxy = alps->max_y;
> + wsmc->swapxy = 0;
> + break;
> + case WSMOUSEIO_SETMODE:
> + wsmode = *(u_int *)data;
> + if (wsmode != WSMOUSE_COMPAT && wsmode != WSMOUSE_NATIVE)
> + return (EINVAL);
> + alps->wsmode = wsmode;
> + break;
> + default:
> + return (-1);
> + }
> + return (0);
> +}
> +
> +int
> +pms_sync_alps(struct pms_softc *sc, int data)
> +{
> + switch (sc->inputstate) {
> + case 0:
> + if ((data & 0xf8) != 0xf8)  /* XXX model dependant? */
> + return (-1);
> + break;
> + case 1:
> + case 2:
> + case 3:
> + case 4:
> + case 5:
> + if ((data & 0x80) != 0)
> + return (-1);
> + break;
> + }
> +
> + return (0);
> +}
> +
> +void
> +pms_proc_alps(struct pms_softc *sc)
> +{
> + struct alps_softc *alps = sc->alps;
> + int x, y, z, dx, dy;
> + u_int buttons;
> + int fin, ges;
> +
> + x = sc->packet[1] | ((sc->packet[2] & 0x78) << 4);
> + y = sc->packet[4] | ((sc->packet[3] & 0x70) << 3);
> + z = sc->packet[5];
> +
> + /*
> +  * XXX The Y-axis is in the oposit direction compared to
> +  * Synaptics touchpads and PS/2 mouses.
> +  * It's why we need to translate the y value here for both
> +  * NATIVE and COMPAT modes.
> +  */
> + y = ALPS_YMAX_BEZEL - y + ALPS_YMIN_BEZEL; 
> +
> + buttons = ((sc->packet[3] & 1) ? WSMOUSE_BUTTON(1) : 0) |
> + ((sc->packet[3] & 2) ? WSMOUSE_BUTTON(3) : 0) | 
> + ((sc->packet[3] & 4) ? WSMOUSE_BUTTON(2) : 0);
> +
> + if (alps->wsmode == WSMOUSE_NATIVE) {
> + if (z == 127) {
> + /* DualPoint touchpads are not absolute. */
> + wsmouse_input(sc->sc_wsmousedev, buttons, x, y, 0, 0,
> + WSMOUSE_INPUT_DELTA);
> + return;
> + }   
> +
> + ges = sc->packet[2] & 0x01;
> + fin = sc->packet[2] & 0x02;
> +
> + /* Simulate click (tap) */
> + if (ges && !fin)
> + z = 35;
> +
> + /* Generate a null pressure event (needed for tap & drag) */ 
> + if (ges && fin && !alps->old_fin)
> + z = 0;
> +
> + wsmouse_input(sc->sc_wsmousedev, buttons, x, y, z, 0,
> + WSMOUSE_INPUT_ABSOLUTE_X | WSMOUSE_INPUT_ABSOLUTE_Y |
> + WSMOUSE_INPUT_ABSOLUTE_Z);
> + 
> + alps->old_fin = fin;
> + } else {
> + dx = dy = 0;
> + if (z > ALPS_PRESSURE) {
> + dx = x - alps->old_x;
> + dy = y - alps->old_y;
> +
> + /* Prevent jump */
> + dx = abs(dx) > 50 ? 0 : dx;
> + dy = abs(dy) > 50 ? 0 : dy;
> + }
> +
> + if (dx || dy || buttons != alps->old_buttons)
> + wsmouse_input(sc->sc_wsmousedev, buttons, dx, dy, 0, 0,
> + WSMOUSE_INPUT_DELTA);
> +
> + alps->old_x = x;
> + alps->old_y = y;
> + alps->old_buttons = buttons;
> + }
>  }
> Index: pmsreg.h
> ===
> RCS file: /cvs/src/sys/dev/pckbc/pmsreg.h,v
> retrieving revision 1.4
> diff -u -p -r1.4 pmsreg.h
> --- pmsreg.h  24 Aug 2011 15:34:25 -  1.4
> +++ pmsreg.h  6 Sep 2011 07:32:05 -
> @@ -37,6 +37,11 @@
>  #define PMS_INTELLI_MAGIC3   80
>  #define PMS_INTELLI_ID   0x03
>  
> +#define PMS_ALPS_MAGIC1  0
> +#define PMS_ALPS_MAGIC2  0
> +#define PMS_ALPS_MAGIC3_110
> +#define PMS_ALPS_MAGIC3_2100
> +
>  /* Synaptics queries */
>  #define SYNAPTICS_QUE_IDENTIFY   0x00
>  #define SYNAPTICS_QUE_MODES  0x01
> @@ -120,5 +125,10 @@
>  #define SYNAPTICS_XMAX_BEZEL 5472
>  #define SYNAPTICS_YMIN_BEZEL 1408
>  #define SYNAPTICS_YMAX_BEZEL 4448
> +
> +#define ALPS_XMIN_BEZEL  130 
> +#define ALPS_XMAX_BEZEL  840
> +#define ALPS_YMIN_BEZEL  130
> +#define ALPS_YMAX_BEZEL  640
>  
>  #endif /* SYS_DEV_PCKBC_PMSREG_H */

-- 
Alexandr Shadchin



Re: UPDATE: usr.bin/less

2011-09-08 Thread Alexandr Shadchin
On Thu, Sep 08, 2011 at 06:31:24PM +0100, Nicholas Marriott wrote:
> I like dropping the configure goo.
> 
> - What about options -m and -E which the old less added for more?
> 
> - The more prompt is now --More-- which is a lot less useful than the
>   filename (and is not POSIX I believe).
> 

Section "Compatibility with more" in new less.1:
 If the environment variable LESS_IS_MORE is set to 1, or if the program
 is invoked via a file link named "more", less behaves (mostly) in
 conformance with the POSIX "more" command specification.  In this mode,
 less behaves differently in these ways:

 The -e option works differently.  If the -e option is not set, less
 behaves as if the -E option were set.  If the -e option is set, less
 behaves as if the -e and -F options were set.

 The -m option works differently.  If the -m option is not set, the medium
 prompt is used, and it is prefixed with the string "--More--".  If the -m
 option is set, the short prompt is used.

Hence we see:
 * For "more" options -m and -E set by default
 * With --More-- all a bit more complicated. From less.1, I realized that 
--More--
   is the correct behavior, but you made me doubt :)
   I have read POSIX 
(http://pubs.opengroup.org/onlinepubs/009695399/utilities/more.html)
   I found no hard requirements --More--. I agree with you that the old behavior
   is better. I fixed it.

New diff http://koba.devio.us/distfiles/less.v3.diff

-- 
Alexandr Shadchin



Re: UPDATE: usr.bin/less

2011-09-03 Thread Alexandr Shadchin
On Fri, Sep 02, 2011 at 05:24:52PM +0200, Matthieu Herrb wrote:
> On Fri, Sep 02, 2011 at 09:14:45PM +0600, Alexandr Shadchin wrote:
> > On Fri, Sep 02, 2011 at 10:25:49AM +0200, Martin Pieuchot wrote:
> > > On 30/08/11(Tue) 22:37, Alexandr Shadchin wrote:
> > > > Hi,
> > > > 
> > > > http://koba.devio.us/distfiles/less.diff
> > > > 
> > > > This update less to the latest release 444.
> > > > Tested on i386 and amd64.
> > > > 
> > > > Change build system ( or leave old ? ):
> > > > * no configure, used prepared define.h
> > > > * no Makefile.bsd-wrapper, used less/Makefile and lesskey/Makefile
> > > 
> > > I am in favor of the new and simple Makefiles, but do we need to keep
> > > the configure script in that case? 
> > > 
> > 
> > I not removed configure script. I have had in mind that it does not need to 
> > run.
> > 
> 
> It's generally easier for future imports of newer versions to keep all
> distributed files. 
> 

I would also like keep all distributed files. Someone will be against it?

> > > > Please test on other arch.
> > > > 
> > > > Comments ? OK ? 
> > > 
> > > This update fixes an issue for me here at work on amd64, I'll test on more
> > > archs this WE.
> > > 
> > > Martin
> > 
> > -- 
> > Alexandr Shadchin
> > 
> 
> -- 
> Matthieu Herrb

-- 
Alexandr Shadchin



Re: UPDATE: usr.bin/less

2011-09-03 Thread Alexandr Shadchin
On Tue, Aug 30, 2011 at 10:37:15PM +0600, Alexandr Shadchin wrote:
> Hi,
> 
> http://koba.devio.us/distfiles/less.diff
> 
> This update less to the latest release 444.
> Tested on i386 and amd64.
> 
> Change build system ( or leave old ? ):
> * no configure, used prepared define.h
> * no Makefile.bsd-wrapper, used less/Makefile and lesskey/Makefile
> 
> Please test on other arch.
> 
> Comments ? OK ? 
> 
> -- 
> Alexandr Shadchin
> 

New diff http://koba.devio.us/distfiles/less.v2.diff

Changes:
* for "more" added option -X (Don't use termcap init/deinit strings).
  This fixes:
   if you do "more /some/file" where the file is less than a screen-full,
   the display flashes but nothing is left on-screen.

-- 
Alexandr Shadchin



Re: UPDATE: usr.bin/less

2011-09-02 Thread Alexandr Shadchin
On Fri, Sep 02, 2011 at 10:25:49AM +0200, Martin Pieuchot wrote:
> On 30/08/11(Tue) 22:37, Alexandr Shadchin wrote:
> > Hi,
> > 
> > http://koba.devio.us/distfiles/less.diff
> > 
> > This update less to the latest release 444.
> > Tested on i386 and amd64.
> > 
> > Change build system ( or leave old ? ):
> > * no configure, used prepared define.h
> > * no Makefile.bsd-wrapper, used less/Makefile and lesskey/Makefile
> 
> I am in favor of the new and simple Makefiles, but do we need to keep
> the configure script in that case? 
> 

I not removed configure script. I have had in mind that it does not need to run.

> > Please test on other arch.
> > 
> > Comments ? OK ? 
> 
> This update fixes an issue for me here at work on amd64, I'll test on more
> archs this WE.
> 
> Martin

-- 
Alexandr Shadchin



UPDATE: usr.bin/less

2011-08-30 Thread Alexandr Shadchin
Hi,

http://koba.devio.us/distfiles/less.diff

This update less to the latest release 444.
Tested on i386 and amd64.

Change build system ( or leave old ? ):
* no configure, used prepared define.h
* no Makefile.bsd-wrapper, used less/Makefile and lesskey/Makefile

Please test on other arch.

Comments ? OK ? 

-- 
Alexandr Shadchin



fix man buffercache.9

2011-07-30 Thread Alexandr Shadchin
Hi,

cred argument was removed from bread() and breadn()
(http://marc.info/?l=openbsd-cvs&m=130975394527345&w=2)

Is this patch correct ? OK ?

-- 
Alexandr Shadchin

Index: buffercache.9
===
RCS file: /cvs/src/share/man/man9/buffercache.9,v
retrieving revision 1.7
diff -u -p -r1.7 buffercache.9
--- buffercache.9   24 Jul 2008 14:19:24 -  1.7
+++ buffercache.9   30 Jul 2011 15:06:18 -
@@ -125,11 +125,11 @@
 .In sys/buf.h
 .Ft int
 .Fn bread "struct vnode *vp" "daddr64_t blkno" "int size" \
-"struct ucred *cred" "struct buf **bpp"
+"struct buf **bpp"
 .Ft int
 .Fn breadn "struct vnode *vp" "daddr64_t blkno" "int size" \
 "daddr64_t rablks[]" "int rasizes[]" "int nrablks" \
-"struct ucred *cred" "struct buf **bpp"
+"struct buf **bpp"
 .Ft int
 .Fn bwrite "struct buf *bp"
 .Ft void
@@ -171,7 +171,7 @@ the disk driver interface.
 .\" 
 .Sh FUNCTIONS
 .Bl -tag -width compact
-.It Fn bread "vp" "blkno" "size" "cred" "bpp"
+.It Fn bread "vp" "blkno" "size" "bpp"
 Read a block corresponding to
 .Fa vp
 and
@@ -210,7 +210,6 @@ Otherwise, it should be unbusied using
 .Fa "rablks"
 .Fa "rasizes"
 .Fa "nrablks"
-.Fa "cred"
 .Fa "bpp"
 .Fc
 .Xc
@@ -370,9 +369,3 @@ The buffer cache subsystem is implemente
 .%I Addison Wesley
 .%D 1989
 .Re
-.\" 
-.Sh BUGS
-In the current implementation,
-.Fn bread
-and its variants
-don't use a specified credential.



Re: Synaptics touchpad

2011-07-20 Thread Alexandr Shadchin
On Tue, Jul 19, 2011 at 06:12:13PM -0400, Brynet wrote:
> Still works for me, will the wscons backend for xf86-input-synaptics be sent 
> upstream eventually? :-)
> 

Thanks for test. I plan to send patch after testing is complete.

> pms0: Synaptics touchpad, firmware 7.2
> ..
> 
> .xinitrc/.xsession:
> xinput set-int-prop /dev/wsmouse0 "Synaptics Tap Action" 8 3 0 2 0 1 0 0
> xinput set-int-prop /dev/wsmouse0 "Synaptics Edge Scrolling" 8 1 0 0
> xinput set-int-prop /dev/wsmouse0 "Synaptics Two-Finger Scrolling" 8 0 0
> syndaemon -d -t -K
> 
> This enables scrolling in xterm etc and left button tapping.
> 
> -Bryan.
> 

-- 
Alexandr Shadchin



Synaptics touchpad

2011-07-19 Thread Alexandr Shadchin
Hi,

Please test latest patch for support Synaptics touchpad
(or http://koba.devio.us/distfiles/synaptics.v5.diff)
Patch for snapshot from 18-Jul-2011 or newer.

It seems everything regression eliminated.

-- 
Alexandr Shadchin

Index: dev/pckbc/pms.c
===
RCS file: /cvs/src/sys/dev/pckbc/pms.c,v
retrieving revision 1.18
diff -u -p -r1.18 pms.c
--- dev/pckbc/pms.c 3 Jan 2011 19:46:34 -   1.18
+++ dev/pckbc/pms.c 6 Jul 2011 06:35:28 -
@@ -28,6 +28,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -40,12 +41,15 @@
 
 #define DEVNAME(sc)((sc)->sc_dev.dv_xname)
 
+#define WSMOUSE_BUTTON(x)  (1 << ((x) - 1))
+
 struct pms_softc;
 
 struct pms_protocol {
int type;
 #define PMS_STANDARD   0
 #define PMS_INTELLI1
+#define PMS_SYNAPTICS  2
u_int packetsize;
int (*enable)(struct pms_softc *);
int (*ioctl)(struct pms_softc *, u_long, caddr_t, int, struct proc *);
@@ -54,6 +58,26 @@ struct pms_protocol {
void (*disable)(struct pms_softc *);
 };
 
+struct synaptics_softc {
+   int identify;
+   int capabilities, ext_capabilities;
+   int model, ext_model;
+   int resolution, dimension;
+
+   int mode;
+
+   int res_x, res_y;
+   int min_x, min_y;
+   int max_x, max_y;
+
+   /* Compat mode */
+   int wsmode;
+   int old_x, old_y;
+   u_int old_buttons;
+#define SYNAPTICS_SCALE4
+#define SYNAPTICS_PRESSURE 30
+};
+
 struct pms_softc { /* driver status information */
struct device sc_dev;
 
@@ -64,56 +88,47 @@ struct pms_softc {  /* driver status inf
 #define PMS_STATE_ENABLED  1
 #define PMS_STATE_SUSPENDED2
 
+   int sc_dev_enable;
+#define PMS_DEV_IGNORE 0x00
+#define PMS_DEV_PRIMARY0x01
+#define PMS_DEV_SECONDARY  0x02
+
int poll;
int inputstate;
 
const struct pms_protocol *protocol;
+   struct synaptics_softc *synaptics;
 
u_char packet[8];
 
struct device *sc_wsmousedev;
+   struct device *sc_pt_wsmousedev;
 };
 
-#define PMS_BUTTON1DOWN0x0001  /* left */
-#define PMS_BUTTON2DOWN0x0002  /* middle */
-#define PMS_BUTTON3DOWN0x0004  /* right */
-
 static const u_int butmap[8] = {
0,
-   PMS_BUTTON1DOWN,
-   PMS_BUTTON3DOWN,
-   PMS_BUTTON1DOWN | PMS_BUTTON3DOWN,
-   PMS_BUTTON2DOWN,
-   PMS_BUTTON1DOWN | PMS_BUTTON2DOWN,
-   PMS_BUTTON2DOWN | PMS_BUTTON3DOWN,
-   PMS_BUTTON1DOWN | PMS_BUTTON2DOWN | PMS_BUTTON3DOWN
+   WSMOUSE_BUTTON(1),
+   WSMOUSE_BUTTON(3),
+   WSMOUSE_BUTTON(1) | WSMOUSE_BUTTON(3),
+   WSMOUSE_BUTTON(2),
+   WSMOUSE_BUTTON(1) | WSMOUSE_BUTTON(2),
+   WSMOUSE_BUTTON(2) | WSMOUSE_BUTTON(3),
+   WSMOUSE_BUTTON(1) | WSMOUSE_BUTTON(2) | WSMOUSE_BUTTON(3)
 };
 
-/* PS/2 mouse data packet */
-#define PMS_PS2_BUTTONSMASK0x07
-#define PMS_PS2_BUTTON10x01/* left */
-#define PMS_PS2_BUTTON20x04/* middle */
-#define PMS_PS2_BUTTON30x02/* right */
-#define PMS_PS2_XNEG   0x10
-#define PMS_PS2_YNEG   0x20
-
-#define PMS_INTELLI_MAGIC1 200
-#define PMS_INTELLI_MAGIC2 100
-#define PMS_INTELLI_MAGIC3 80
-#define PMS_INTELLI_ID 0x03
-
 intpmsprobe(struct device *, void *, void *);
 void   pmsattach(struct device *, struct device *, void *);
 intpmsactivate(struct device *, int);
 
 void   pmsinput(void *, int);
 
-intpms_change_state(struct pms_softc *, int);
+intpms_change_state(struct pms_softc *, int, int);
 intpms_ioctl(void *, u_long, caddr_t, int, struct proc *);
 intpms_enable(void *);
 void   pms_disable(void *);
 
 intpms_cmd(struct pms_softc *, u_char *, int, u_char *, int);
+intpms_spec_cmd(struct pms_softc *, int);
 intpms_get_devid(struct pms_softc *, u_char *);
 intpms_get_status(struct pms_softc *, u_char *);
 intpms_set_rate(struct pms_softc *, int);
@@ -129,6 +144,22 @@ intpms_ioctl_mouse(struct pms_softc *, 
 intpms_sync_mouse(struct pms_softc *, int);
 void   pms_proc_mouse(struct pms_softc *);
 
+intpms_enable_synaptics(struct pms_softc *);
+intpms_ioctl_synaptics(struct pms_softc *, u_long, caddr_t, int, struct 
proc *);
+intpms_sync_synaptics(struct pms_softc *, int);
+void   pms_proc_synaptics(struct pms_softc *);
+void   pms_disable_synaptics(struct pms_softc *);
+
+intsynaptics_set_mode(struct pms_softc *, int);
+intsynaptics_query(struct pms_softc *, int, int *);
+intsynaptics_get_hwinfo(struct pms_softc *);
+
+void   synaptics_pt_proc(struct pms_softc *);
+
+intsynaptics_pt_ioctl(void *, u_long, caddr_t, int, struct proc *);
+intsynaptics_pt_enable(void *);
+void   synaptics_pt_disable(void *);
+
 struct cfattach pms_ca = {
sizeof(struct 

Re: X configuration changes for synaptics - please test

2011-07-06 Thread Alexandr Shadchin
On Sat, Jun 18, 2011 at 01:40:56AM +0600, Alexandr Shadchin wrote:
> On Wed, Jun 15, 2011 at 09:11:43AM +0200, Matthieu Herrb wrote:
> > Hi,
> > 
> > here are a set of patches being worked on to add native synaptics
> > touch pad support to OpenBSD and Xenocara.
> > 
> > The xf86-input-synaptics driver itself is already committed and built
> > in Xenocara.
> > 
> > http://xenocara.org/wscons_config.2.diff is a diff that uses the X
> > hot-plug mechanism to configure you input drivers. It will setup
> > the xf86-input-synaptics driver for you if you have one, together with
> > a regular mouse driver that will handle any external PS/2 or USB mouse
> > attached in addition. Touchscreens will also be auto-configured this
> > way if one is detected.
> > 
> > This new code also takes care of the configuration of the keyboard
> > layout from the wscons layout. Thus a second diff:
> > http://xenocara.org/xf86-input-keyboard.diff removes that code from
> > the keyboard driver.
> > 
> > To apply those patches:
> > 
> > cd /usr/xenocara/xserver
> > patch -p0 -E < /path/to/wscons_config.2.diff
> > make -f Makefile.bsd-wrapper obj
> > make -f Makefile.bsd-wrapper build
> > cd /usr/xenocara/driver/xf86-input-keyboard
> > patch -p0 -E < /path/to/xf86-input-keyboard.diff
> > make -f Makefile.bsd-wrapper obj
> > make -f Makefile.bsd-wrapper build
> > 
> > Once X is ready, apply the kernel patch, and build a new kernel with
> > the synaptics support in pms(4):
> > http://xenocara.org/sys-synaptics.diff
> > 
> > cd /sys
> > patch -p0 -E < /path/to/sys-synaptics.diff
> > 
> > the new kernel will detect your synaptics touch pad if any, and  X
> > will be configured with the xf86-input-synaptics. Read the
> > synaptics(4) manual page to discover all its features.
> > 
> > You can check how the input drivers were configured by running the
> > command:
> > 
> >xinput list
> > 
> > If you are configuring input devices manually in xorg,conf you need to
> > add this to the ServerFlags section (but may be you should give a try
> > at auto-configuration and remove your InputDevice sections all together):
> > 
> > Section ServerFlags
> > Option "AutoAddDevices" "false"
> > EndSection
> > 
> > Please test, comment and report failures. Make sure to include
> > /var/log/Xorg.0.log and dmesg outputs in your reports.
> > 
> > Thanks to Alexandr Shadchin (shadchin@) for his work on this driver and
> > to all people who already tested these patches and suggested
> > enhancements.
> > 
> > -- 
> > Matthieu Herrb
> > 
> 
> New sys-synaptics.diff (http://koba.devio.us/distfiles/synaptics.v2.diff)
> * fix wrong detect clickpad
> * fix ignore buttons if no fingers on touchpad
> * if open directly /dev/wsmouseX, then remove this device from mux
>   (close device - get back in mux)
> 
> Thanks all for your feedback.
> 

New patches
kernel - http://koba.devio.us/distfiles/synaptics.v5.diff
xenocara - http://koba.devio.us/distfiles/xf86-input-synaptics.diff
 cd /usr/xenocara/driver/xf86-input-synaptics
 patch 

[Update] xenocara/xkeyboard-config

2011-06-23 Thread Alexandr Shadchin
Hi,

I prepared update package xkeyboard-config to the latest release 2.3.
Patch available on http://koba.devio.us/distfiles/xkeyboard-config-2.3.diff
Tested on amd64.

-- 
Alexandr Shadchin



Re: X configuration changes for synaptics - please test

2011-06-19 Thread Alexandr Shadchin
On Sun, Jun 19, 2011 at 08:16:12PM +0200, Dawe wrote:
> On Jun 18, 2011 01:40, Alexandr Shadchin wrote:
> > On Wed, Jun 15, 2011 at 09:11:43AM +0200, Matthieu Herrb wrote:
> > > Hi,
> > > 
> > > here are a set of patches being worked on to add native synaptics
> > > touch pad support to OpenBSD and Xenocara.
> > > 
> > > The xf86-input-synaptics driver itself is already committed and built
> > > in Xenocara.
> > > 
> > > http://xenocara.org/wscons_config.2.diff is a diff that uses the X
> > > hot-plug mechanism to configure you input drivers. It will setup
> > > the xf86-input-synaptics driver for you if you have one, together with
> > > a regular mouse driver that will handle any external PS/2 or USB mouse
> > > attached in addition. Touchscreens will also be auto-configured this
> > > way if one is detected.
> > > 
> > > This new code also takes care of the configuration of the keyboard
> > > layout from the wscons layout. Thus a second diff:
> > > http://xenocara.org/xf86-input-keyboard.diff removes that code from
> > > the keyboard driver.
> > > 
> > > To apply those patches:
> > > 
> > > cd /usr/xenocara/xserver
> > > patch -p0 -E < /path/to/wscons_config.2.diff
> > > make -f Makefile.bsd-wrapper obj
> > > make -f Makefile.bsd-wrapper build
> > > cd /usr/xenocara/driver/xf86-input-keyboard
> > > patch -p0 -E < /path/to/xf86-input-keyboard.diff
> > > make -f Makefile.bsd-wrapper obj
> > > make -f Makefile.bsd-wrapper build
> > > 
> > > Once X is ready, apply the kernel patch, and build a new kernel with
> > > the synaptics support in pms(4):
> > > http://xenocara.org/sys-synaptics.diff
> > > 
> > > cd /sys
> > > patch -p0 -E < /path/to/sys-synaptics.diff
> > > 
> > > the new kernel will detect your synaptics touch pad if any, and  X
> > > will be configured with the xf86-input-synaptics. Read the
> > > synaptics(4) manual page to discover all its features.
> > > 
> > > You can check how the input drivers were configured by running the
> > > command:
> > > 
> > >xinput list
> > > 
> > > If you are configuring input devices manually in xorg,conf you need to
> > > add this to the ServerFlags section (but may be you should give a try
> > > at auto-configuration and remove your InputDevice sections all together):
> > > 
> > > Section ServerFlags
> > >   Option "AutoAddDevices" "false"
> > > EndSection
> > > 
> > > Please test, comment and report failures. Make sure to include
> > > /var/log/Xorg.0.log and dmesg outputs in your reports.
> > > 
> > > Thanks to Alexandr Shadchin (shadchin@) for his work on this driver and
> > > to all people who already tested these patches and suggested
> > > enhancements.
> > > 
> > > -- 
> > > Matthieu Herrb
> > > 
> > 
> > New sys-synaptics.diff (http://koba.devio.us/distfiles/synaptics.v2.diff)
> > * fix wrong detect clickpad
> > * fix ignore buttons if no fingers on touchpad
> > * if open directly /dev/wsmouseX, then remove this device from mux
> >   (close device - get back in mux)
> > 
> > Thanks all for your feedback.
> > 
> > -- 
> > Alexandr Shadchin
> > 
> This breaks tapping for me on my T410i running amd64.
> The more advanced features like scrolling also don't work.
> Hitting the real buttons still works.
> 

Defaults tap and scrolling disabled.

Add in /etc/X11/xorg.conf:

Section "InputClass"
Identifier  "Touchpad defaults"
MatchIsTouchpad "on"
Option  "VertEdgeScroll" "true"
Option  "HorizEdgeScroll" "true"
Option  "TapButton1" "1"
EndSection

-- 
Alexandr Shadchin



Re: X configuration changes for synaptics - please test

2011-06-17 Thread Alexandr Shadchin
On Wed, Jun 15, 2011 at 09:11:43AM +0200, Matthieu Herrb wrote:
> Hi,
> 
> here are a set of patches being worked on to add native synaptics
> touch pad support to OpenBSD and Xenocara.
> 
> The xf86-input-synaptics driver itself is already committed and built
> in Xenocara.
> 
> http://xenocara.org/wscons_config.2.diff is a diff that uses the X
> hot-plug mechanism to configure you input drivers. It will setup
> the xf86-input-synaptics driver for you if you have one, together with
> a regular mouse driver that will handle any external PS/2 or USB mouse
> attached in addition. Touchscreens will also be auto-configured this
> way if one is detected.
> 
> This new code also takes care of the configuration of the keyboard
> layout from the wscons layout. Thus a second diff:
> http://xenocara.org/xf86-input-keyboard.diff removes that code from
> the keyboard driver.
> 
> To apply those patches:
> 
> cd /usr/xenocara/xserver
> patch -p0 -E < /path/to/wscons_config.2.diff
> make -f Makefile.bsd-wrapper obj
> make -f Makefile.bsd-wrapper build
> cd /usr/xenocara/driver/xf86-input-keyboard
> patch -p0 -E < /path/to/xf86-input-keyboard.diff
> make -f Makefile.bsd-wrapper obj
> make -f Makefile.bsd-wrapper build
> 
> Once X is ready, apply the kernel patch, and build a new kernel with
> the synaptics support in pms(4):
> http://xenocara.org/sys-synaptics.diff
> 
> cd /sys
> patch -p0 -E < /path/to/sys-synaptics.diff
> 
> the new kernel will detect your synaptics touch pad if any, and  X
> will be configured with the xf86-input-synaptics. Read the
> synaptics(4) manual page to discover all its features.
> 
> You can check how the input drivers were configured by running the
> command:
> 
>xinput list
> 
> If you are configuring input devices manually in xorg,conf you need to
> add this to the ServerFlags section (but may be you should give a try
> at auto-configuration and remove your InputDevice sections all together):
> 
> Section ServerFlags
>   Option "AutoAddDevices" "false"
> EndSection
> 
> Please test, comment and report failures. Make sure to include
> /var/log/Xorg.0.log and dmesg outputs in your reports.
> 
> Thanks to Alexandr Shadchin (shadchin@) for his work on this driver and
> to all people who already tested these patches and suggested
> enhancements.
> 
> -- 
> Matthieu Herrb
> 

New sys-synaptics.diff (http://koba.devio.us/distfiles/synaptics.v2.diff)
* fix wrong detect clickpad
* fix ignore buttons if no fingers on touchpad
* if open directly /dev/wsmouseX, then remove this device from mux
  (close device - get back in mux)

Thanks all for your feedback.

-- 
Alexandr Shadchin

Index: dev/pckbc/pms.c
===
RCS file: /cvs/src/sys/dev/pckbc/pms.c,v
retrieving revision 1.18
diff -u -p -r1.18 pms.c
--- dev/pckbc/pms.c 3 Jan 2011 19:46:34 -   1.18
+++ dev/pckbc/pms.c 17 Jun 2011 19:18:55 -
@@ -28,6 +28,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -40,12 +41,15 @@
 
 #define DEVNAME(sc)((sc)->sc_dev.dv_xname)
 
+#define WSMOUSE_BUTTON(x)  (1 << ((x) - 1))
+
 struct pms_softc;
 
 struct pms_protocol {
int type;
 #define PMS_STANDARD   0
 #define PMS_INTELLI1
+#define PMS_SYNAPTICS  2
u_int packetsize;
int (*enable)(struct pms_softc *);
int (*ioctl)(struct pms_softc *, u_long, caddr_t, int, struct proc *);
@@ -54,6 +58,29 @@ struct pms_protocol {
void (*disable)(struct pms_softc *);
 };
 
+struct synaptics_softc {
+   int identify;
+   int capabilities, ext_capabilities;
+   int model, ext_model;
+   int resolution, dimension;
+
+   int mode;
+
+   int res_x, res_y;
+   int min_x, min_y;
+   int max_x, max_y;
+
+   /* Compat mode */
+   int wsmode;
+   int old_x, old_y;
+   u_int old_buttons;
+   int count;
+#define SYNAPTICS_SCALE4
+#define SYNAPTICS_PRESSURE 30
+
+   int dev_pt_attach;
+};
+
 struct pms_softc { /* driver status information */
struct device sc_dev;
 
@@ -64,56 +91,48 @@ struct pms_softc {  /* driver status inf
 #define PMS_STATE_ENABLED  1
 #define PMS_STATE_SUSPENDED2
 
+   int sc_dev_enable;
+#define PMS_DEV_IGNORE 0x00
+#define PMS_DEV_PRIMARY0x01
+#define PMS_DEV_SECONDARY  0x02
+
int poll;
int inputstate;
+   int is_touchpad;
 
const struct pms_protocol *protocol;
+   struct synaptics_softc *synaptics;
 
u_char packet[8];
 
struct device *sc_wsmousedev;
+   struct device *sc_pt_wsmousedev;
 };
 
-#define PMS_BUTTON1DOWN0x

Re: Moving WSKBDIO_SETLEDS and WSKBDIO_GETLEDS in wskbd

2011-06-15 Thread Alexandr Shadchin
On Sat, Apr 16, 2011 at 03:16:47AM +0600, Alexandr Shadchin wrote:
> Hi,
> 
> No need to process WSKBDIO_SETLEDS and WSKBDIO_GETLEDS in each drivers,
> when same can be done in wskbd.
> 
> Tested on i386 and amd64. Please test on other platforms.
> 

* fix build if not defined WSDISPLAY_COMPAT_RAWKBD
* tested on macppc/atkbd (thank Martin Pieuchot)

Comments ? OK ?

-- 
Alexandr Shadchin

Index: arch/arm/xscale/pxa27x_kpc.c
===
RCS file: /cvs/src/sys/arch/arm/xscale/pxa27x_kpc.c,v
retrieving revision 1.1
diff -u -p -r1.1 pxa27x_kpc.c
--- arch/arm/xscale/pxa27x_kpc.c9 Sep 2009 12:14:39 -   1.1
+++ arch/arm/xscale/pxa27x_kpc.c15 Jun 2011 17:25:53 -
@@ -27,7 +27,6 @@
 #include 
 
 int  pxa27x_kpc_enable(void *, int);
-void pxa27x_kpc_setleds(void *, int);
 int  pxa27x_kpc_ioctl(void *, u_long, caddr_t, int, struct proc *);
 
 inline void pxa27x_kpc_submit(struct pxa27x_kpc_softc *, int);
@@ -39,7 +38,7 @@ struct cfdriver pxa27x_kpc_cd = {
 
 struct wskbd_accessops pxa27x_kpc_accessops = {
pxa27x_kpc_enable,
-   pxa27x_kpc_setleds,
+   NULL,
pxa27x_kpc_ioctl,
 };
 
@@ -178,11 +177,6 @@ pxa27x_kpc_enable(void *v, int power)
return 0;
 }
 
-void
-pxa27x_kpc_setleds(void *v, int power)
-{
-}
-
 int
 pxa27x_kpc_ioctl(void *v, u_long cmd, caddr_t data, int flag, struct proc *p)
 {
@@ -193,11 +187,6 @@ pxa27x_kpc_ioctl(void *v, u_long cmd, ca
switch (cmd) {
case WSKBDIO_GTYPE:
*(int *)data = WSKBD_TYPE_KPC;
-   return 0;
-   case WSKBDIO_SETLEDS:
-   return 0;
-   case WSKBDIO_GETLEDS:
-   *(int *)data = 0;
return 0;
 #ifdef WSDISPLAY_COMPAT_RAWKBD
case WSKBDIO_SETMODE:
Index: arch/hp300/dev/dnkbd.c
===
RCS file: /cvs/src/sys/arch/hp300/dev/dnkbd.c,v
retrieving revision 1.17
diff -u -p -r1.17 dnkbd.c
--- arch/hp300/dev/dnkbd.c  23 Jul 2009 21:05:56 -  1.17
+++ arch/hp300/dev/dnkbd.c  15 Jun 2011 17:25:54 -
@@ -170,12 +170,16 @@ struct cfattach dnkbd_ca = {
 };
 
 intdnkbd_enable(void *, int);
-void   dnkbd_set_leds(void *, int);
 intdnkbd_ioctl(void *, u_long, caddr_t, int, struct proc *);
 
+/*
+ * LED not supported. There is only one LED on this keyboard, and
+ * is hardware tied to the caps lock key.
+ */
+
 const struct wskbd_accessops dnkbd_accessops = {
dnkbd_enable,
-   dnkbd_set_leds,
+   NULL,
dnkbd_ioctl
 };
 
@@ -917,15 +921,6 @@ dnkbd_enable(void *v, int on)
return (0);
 }
 
-void
-dnkbd_set_leds(void *v, int leds)
-{
-   /*
-* Not supported. There is only one LED on this keyboard, and
-* is hardware tied to the caps lock key.
-*/
-}
-
 int
 dnkbd_ioctl(void *v, u_long cmd, caddr_t data, int flag, struct proc *p)
 {
@@ -936,11 +931,6 @@ dnkbd_ioctl(void *v, u_long cmd, caddr_t
switch (cmd) {
case WSKBDIO_GTYPE:
*(int *)data = WSKBD_TYPE_DOMAIN;
-   return (0);
-   case WSKBDIO_SETLEDS:
-   return (ENXIO);
-   case WSKBDIO_GETLEDS:
-   *(int *)data = 0;
return (0);
case WSKBDIO_COMPLEXBELL:
 #defined   ((struct wskbd_bell_data *)data)
Index: arch/luna88k/dev/lunaws.c
===
RCS file: /cvs/src/sys/arch/luna88k/dev/lunaws.c,v
retrieving revision 1.7
diff -u -p -r1.7 lunaws.c
--- arch/luna88k/dev/lunaws.c   11 Sep 2008 11:30:14 -  1.7
+++ arch/luna88k/dev/lunaws.c   15 Jun 2011 17:25:54 -
@@ -70,7 +70,6 @@ struct ws_softc {
 void omkbd_input(void *, int);
 void omkbd_decode(void *, int, u_int *, int *);
 int  omkbd_enable(void *, int);
-void omkbd_set_leds(void *, int);
 int  omkbd_ioctl(void *, u_long, caddr_t, int, struct proc *);
 
 struct wscons_keydesc omkbd_keydesctab[];
@@ -86,7 +85,7 @@ const struct wskbd_mapdata omkbd_keymapd
 
 const struct wskbd_accessops omkbd_accessops = {
omkbd_enable,
-   omkbd_set_leds,
+   NULL,
omkbd_ioctl,
 };
 
@@ -456,18 +455,18 @@ omkbd_enable(v, on)
return 0;
 }
 
+#if notyet
 void
 omkbd_set_leds(v, leds)
void *v;
int leds;
 {
-#if 0
syscnputc((dev_t)1, 0x10); /* kana LED on */
syscnputc((dev_t)1, 0x00); /* kana LED off */
syscnputc((dev_t)1, 0x11); /* caps LED on */
syscnputc((dev_t)1, 0x01); /* caps LED off */
-#endif
 }
+#endif
 
 int
 omkbd_ioctl(v, cmd, data, flag, p)
@@ -485,8 +484,6 @@ omkbd_ioctl(v, cmd, data, flag, p)
case WSKBDIO_GTYPE:
*(int *)data = WSKBD_TYPE_LUNA;
return 0;
-   case WSKBDIO_SETLEDS:
-   case WSKBDIO_GETLEDS:
case WSKBDIO_COMPLEXBELL:   /* XXX capable of complex bell */
return -1;
}
Index: arch

Re: Synaptics touchpad

2011-06-15 Thread Alexandr Shadchin
On Tue, Jun 14, 2011 at 09:35:04PM +0200, Matthieu Herrb wrote:
> On Mon, Jun 13, 2011 at 08:23:16PM -0500, joshua stein wrote:
> > > I find the mouse emulation code for synaptics touch pads in your patch 
> > > really weird. I've tried to understand what it does, and why it
> > > behaves badly for me on the first tap (move the pointer in the upper
> > > right direction every time), but I fail to understand the logic.
> > 
> > your change makes the problem worse on 2 laptops (samsung series 9
> > and thinkpad x220), where the cursor now jumps to the lower left
> > after every movement.  these seem to be due to events that come
> > through after removing all the fingers from the touchpad that need
> > to be ignored.  i checked linux and they also ignore these events:
> > 
> > http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=4f56ce929cab45a3a6e1a81700da52bb9bdbfc0f
> > 
> > this also adds support for "clickpads" where there is only one
> > physical button and it's the entire trackpad that moves down, which
> > both of those laptops have.  without this change, the click gets
> > ignored.
> 
> With your patch my synaptics driver is recognized as a clickpad, but I
> can't get no click from it. Otherwise the emulation works fine for
> me. 
> 
> Hopefully with the configuration changes I'm working on, most people
> will get the synaptics driver and thus won't need this emulation mode.
> 
> > 
> > 
> > --- pms.c.new   Mon Jun 13 16:26:39 2011
> > +++ pms.c   Mon Jun 13 20:06:59 2011
> > @@ -799,7 +799,9 @@
> > syn->wsmode = WSMOUSE_COMPAT;
> > syn->count = 0;
> >  
> > -   printf("%s: Synaptics touchpad, firmware %d.%d\n", DEVNAME(sc),
> > +   printf("%s: Synaptics %s, firmware %d.%d\n", DEVNAME(sc),
> > +   (syn->capabilities & SYNAPTICS_EXT_CAP_CLICKPAD ?
 ^
   should be syn->ext_capabilities ;-)

-- 
Alexandr Shadchin



Re: Remove unused code

2011-06-06 Thread Alexandr Shadchin
On Sun, Jun 05, 2011 at 09:30:38PM +, Miod Vallat wrote:
> > Hi,
> > 
> > Removing unused code:
> > * arch/mac68k/include/keyboard.h not used in kernel sources
> 
> ok miod@
> 
> > * not need define KEYBOARD_ARRAY (variable keyboard[] used only in
> >   dev/adb/akbd.c if defined WSDISPLAY_COMPAT_RAWKBD)
> 
> Not ok. arch/macppc/dev/akdb_machdep.c includes
> , and will include the definition of keyboard[].
> 
> The real fix would be to simply move the array from dev/adb/keyboard.h
> to dev/adb/akbdmap.h.
> 

Move the array from dev/adb/keyboard.h to dev/adb/akbdmap.h. OK ?

-- 
Alexandr Shadchin

Index: akbd.c
===
RCS file: /cvs/src/sys/dev/adb/akbd.c,v
retrieving revision 1.8
diff -u -p -r1.8 akbd.c
--- akbd.c  23 May 2010 15:09:38 -  1.8
+++ akbd.c  6 Jun 2011 12:43:32 -
@@ -48,10 +48,6 @@
 #include 
 #include 
 #include 
-
-#ifdef WSDISPLAY_COMPAT_RAWKBD
-#define KEYBOARD_ARRAY
-#endif
 #include 
 
 /*
Index: akbdmap.h
===
RCS file: /cvs/src/sys/dev/adb/akbdmap.h,v
retrieving revision 1.3
diff -u -p -r1.3 akbdmap.h
--- akbdmap.h   26 Jun 2008 05:42:14 -  1.3
+++ akbdmap.h   6 Jun 2011 12:43:32 -
@@ -30,6 +30,149 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
+#ifdef WSDISPLAY_COMPAT_RAWKBD
+#include 
+
+unsigned char keyboard[128] = {
+   RAWKEY_a,
+   RAWKEY_s,
+   RAWKEY_d,
+   RAWKEY_f,
+   RAWKEY_h,
+   RAWKEY_g,
+   RAWKEY_z,
+   RAWKEY_x,
+   RAWKEY_c,
+   RAWKEY_v,
+#ifdef FIX_SV_X_KBDBUG
+   RAWKEY_grave,
+#else
+   RAWKEY_less,
+#endif
+   RAWKEY_b,
+   RAWKEY_q,
+   RAWKEY_w,
+   RAWKEY_e,
+   RAWKEY_r,
+   RAWKEY_y,
+   RAWKEY_t,
+   RAWKEY_1,
+   RAWKEY_2,
+   RAWKEY_3,
+   RAWKEY_4,
+   RAWKEY_6,
+   RAWKEY_5,
+   RAWKEY_equal,
+   RAWKEY_9,
+   RAWKEY_7,
+   RAWKEY_minus,
+   RAWKEY_8,
+   RAWKEY_0,
+   RAWKEY_bracketright,
+   RAWKEY_o,
+   RAWKEY_u,
+   RAWKEY_bracketleft,
+   RAWKEY_i,
+   RAWKEY_p,
+   RAWKEY_Return,
+   RAWKEY_l,
+   RAWKEY_j,
+   RAWKEY_apostrophe,
+   RAWKEY_k,
+   RAWKEY_semicolon,
+   RAWKEY_backslash,
+   RAWKEY_comma,
+   RAWKEY_slash,
+   RAWKEY_n,
+   RAWKEY_m,
+   RAWKEY_period,
+   RAWKEY_Tab,
+   RAWKEY_space,
+#ifdef FIX_SV_X_KBDBUG
+   RAWKEY_less,
+#else
+   RAWKEY_grave,
+#endif
+   RAWKEY_Delete,
+   RAWKEY_KP_Enter,
+   RAWKEY_Escape,
+   RAWKEY_Control_L,
+   219,/* XXX */
+   RAWKEY_Shift_L,
+   RAWKEY_Caps_Lock,
+   RAWKEY_Alt_L,
+   RAWKEY_Left,
+   RAWKEY_Right,
+   RAWKEY_Down,
+   RAWKEY_Up,
+   0, /* Fn */
+   0,
+   RAWKEY_KP_Delete,
+   0,
+   RAWKEY_KP_Multiply,
+   0,
+   RAWKEY_KP_Add,
+   0,
+   RAWKEY_Num_Lock,
+   0,
+   0,
+   0,
+   RAWKEY_KP_Divide,
+   RAWKEY_KP_Enter,
+   0,
+   RAWKEY_KP_Subtract,
+   0,
+   0,
+   RAWKEY_KP_Equal,
+   RAWKEY_KP_Insert,
+   RAWKEY_KP_End,
+   RAWKEY_KP_Down,
+   RAWKEY_KP_Next,
+   RAWKEY_KP_Left,
+   RAWKEY_KP_Begin,
+   RAWKEY_KP_Right,
+   RAWKEY_KP_Home,
+   0,
+   RAWKEY_KP_Up,
+   RAWKEY_KP_Prior,
+   0,
+   0,
+   RAWKEY_KP_Delete,
+   RAWKEY_f5,
+   RAWKEY_f6,
+   RAWKEY_f7,
+   RAWKEY_f3,
+   RAWKEY_f8,
+   RAWKEY_f9,
+   0,
+   RAWKEY_f11,
+   0,
+   RAWKEY_Print_Screen,
+   RAWKEY_KP_Enter,
+   RAWKEY_Hold_Screen,
+   0,
+   RAWKEY_f10,
+   0,
+   RAWKEY_f12,
+   0,
+   RAWKEY_Pause,
+   RAWKEY_Insert,
+   RAWKEY_Home,
+   RAWKEY_Prior,
+   RAWKEY_Delete,
+   RAWKEY_f4,
+   RAWKEY_End,
+   RAWKEY_f2,
+   RAWKEY_Next,
+   RAWKEY_f1,
+   0,
+   0,
+   0,
+   0,
+   0
+};
+#endif /* WSDISPLAY_COMPAT_RAWKBD */
+
 /* XXX This list is incomplete. */
 
 #define KC(n) KS_KEYCODE(n)
Index: keyboard.h
===
RCS file: /cvs/src/sys/dev/adb/keyboard.h,v
retrieving revision 1.4
diff -u -p -r1.4 keyboard.h
--- keyboard.h  10 Mar 2006 20:13:50 -  1.4
+++ keyboard.h  6 Jun 2011 12:43:32 -
@@ -41,147 +41,3 @@
 #define ADBK_PRESS(key)(((key) & 0x80) == 0)
 #define ADBK_KEYDOWN(key)  (key)
 #define ADBK_KEYUP(key)((key) | 0x80)
-
-#ifndef KEYBOARD_ARRAY
-extern unsigned char keyboard[128];
-#else
-#include 
-unsigned char keyboard[128] = {
-   RAWKEY_a,
-   RAWKEY_s,
-   RAWKEY_d,
-   RAWKEY_f,
-   RAWKEY_h,
-   RAWKEY_g,
-   RAWKEY_z,
-   RAWKEY_x,
-   RAWKEY_c,
-   RAWKEY_v,
-#ifdef FIX

Remove autorepeat keys in WSKBD_RAW mode

2011-06-04 Thread Alexandr Shadchin
Hi,

If I'm not mistaken, the auto-repeat keys in WSKBD_RAW mode is not needed.
WSKBD_RAW mode used in X, but X independently implements auto-repeat keys.

Tested on usb keyboard, work fine.

OK ?

-- 
Alexandr Shadchin

Index: arch/hp300/dev/dnkbd.c
===
RCS file: /cvs/src/sys/arch/hp300/dev/dnkbd.c,v
retrieving revision 1.17
diff -u -p -r1.17 dnkbd.c
--- arch/hp300/dev/dnkbd.c  23 Jul 2009 21:05:56 -  1.17
+++ arch/hp300/dev/dnkbd.c  4 Jun 2011 12:24:10 -
@@ -150,11 +150,6 @@ struct dnkbd_softc {
 
 #ifdef WSDISPLAY_COMPAT_RAWKBD
int sc_rawkbd;
-   int sc_nrep;
-   charsc_rep[2];  /* at most, one key */
-   struct timeout  sc_rawrepeat_ch;
-#defineREP_DELAY1  400
-#defineREP_DELAYN  100
 #endif
 };
 
@@ -224,7 +219,6 @@ int dnkbd_intr(void *);
 intdnkbd_pollin(struct apciregs *, u_int);
 intdnkbd_pollout(struct apciregs *, int);
 intdnkbd_probe(struct dnkbd_softc *);
-void   dnkbd_rawrepeat(void *);
 intdnkbd_send(struct apciregs *, const u_int8_t *, size_t);
 intdnsubmatch_kbd(struct device *, void *, void *);
 intdnsubmatch_mouse(struct device *, void *, void *);
@@ -252,9 +246,6 @@ dnkbd_attach(struct device *parent, stru
sc->sc_regs = (struct apciregs *)IIOV(FRODO_BASE + fa->fa_offset);
 
timeout_set(&sc->sc_bellstop_tmo, dnkbd_bellstop, sc);
-#ifdef WSDISPLAY_COMPAT_RAWKBD
-   timeout_set(&sc->sc_rawrepeat_ch, dnkbd_rawrepeat, sc);
-#endif
 
/* reset the port */
apciinit(sc->sc_regs, 1200, CFCR_8BITS | CFCR_PEVEN | CFCR_PENAB);
@@ -667,20 +658,11 @@ dnevent_kbd_internal(struct dnkbd_softc 
cbuf[j] = c & 0x7f;
if (type == WSCONS_EVENT_KEY_UP)
cbuf[j] |= 0x80;
-   else {
-   /* remember pressed key for autorepeat */
-   bcopy(cbuf, sc->sc_rep, sizeof(sc->sc_rep));
-   }
j++;
-   }
 
-   if (j != 0) {
s = spltty();
wskbd_rawinput(sc->sc_wskbddev, cbuf, j);
splx(s);
-   timeout_del(&sc->sc_rawrepeat_ch);
-   sc->sc_nrep = j;
-   timeout_add_msec(&sc->sc_rawrepeat_ch, REP_DELAY1);
}
} else
 #endif
@@ -691,21 +673,6 @@ dnevent_kbd_internal(struct dnkbd_softc 
}
 }
 
-#ifdef WSDISPLAY_COMPAT_RAWKBD
-void
-dnkbd_rawrepeat(void *v)
-{
-   struct dnkbd_softc *sc = v;
-   int s;
-
-   s = spltty();
-   wskbd_rawinput(sc->sc_wskbddev, sc->sc_rep, sc->sc_nrep);
-   splx(s);
-
-   timeout_add_msec(&sc->sc_rawrepeat_ch, REP_DELAYN);
-}
-#endif
-
 #if NWSMOUSE > 0
 void
 dnevent_mouse(struct dnkbd_softc *sc, u_int8_t *dat)
@@ -950,7 +917,6 @@ dnkbd_ioctl(void *v, u_long cmd, caddr_t
 #ifdef WSDISPLAY_COMPAT_RAWKBD
case WSKBDIO_SETMODE:
sc->sc_rawkbd = *(int *)data == WSKBD_RAW;
-   timeout_del(&sc->sc_rawrepeat_ch);
return (0);
 #endif
}
Index: arch/zaurus/dev/zaurus_kbd.c
===
RCS file: /cvs/src/sys/arch/zaurus/dev/zaurus_kbd.c,v
retrieving revision 1.31
diff -u -p -r1.31 zaurus_kbd.c
--- arch/zaurus/dev/zaurus_kbd.c7 Sep 2010 16:21:41 -   1.31
+++ arch/zaurus/dev/zaurus_kbd.c4 Jun 2011 12:24:11 -
@@ -104,10 +104,7 @@ struct zkbd_softc {
int sc_rawkbd;
 #ifdef WSDISPLAY_COMPAT_RAWKBD
const char *sc_xt_keymap;
-   struct timeout sc_rawrepeat_ch;
 #define MAXKEYS 20
-   char sc_rep[MAXKEYS];
-   int sc_nrep;
 #endif
 };
 
@@ -137,7 +134,6 @@ struct cfdriver zkbd_cd = {
 int zkbd_enable(void *, int);
 void zkbd_set_leds(void *, int);
 int zkbd_ioctl(void *, u_long, caddr_t, int, struct proc *);
-void zkbd_rawrepeat(void *v);
 
 struct wskbd_accessops zkbd_accessops = {
zkbd_enable,
@@ -248,26 +244,8 @@ zkbd_attach(struct device *parent, struc
sc->sc_wskbddev = config_found(self, &a, wskbddevprint);
 
timeout_set(&(sc->sc_roll_to), zkbd_poll, sc);
-#ifdef WSDISPLAY_COMPAT_RAWKBD
-   timeout_set(&sc->sc_rawrepeat_ch, zkbd_rawrepeat, sc);
-#endif
-
 }
 
-#ifdef WSDISPLAY_COMPAT_RAWKBD
-void
-zkbd_rawrepeat(void *v)
-{
-   struct zkbd_softc *sc = v;
-   int s;
-   
-   s = spltty();
-   wskbd_rawinput(sc->sc_wskbddev, sc->sc_rep, sc->sc_nrep);
-   splx(s);
-   timeout_add(&sc->sc_rawrepeat_ch, hz * REP_DELAYN / 1000);
-}
-#endif
-
 /* XXX only deal with keys that can be pressed when display is open? */
 /* XXX are some not in t

Re: iwn(4) MSI

2011-06-02 Thread Alexandr Shadchin
On Thu, Jun 02, 2011 at 10:49:43PM +0100, Owain Ainsworth wrote:
> Been running with this for a couple of weeks, seems to work fine.
> 
> ok?
> 
> diff --git dev/pci/if_iwn.c dev/pci/if_iwn.c
> index 16765f4..a54556b 100644
> --- dev/pci/if_iwn.c
> +++ dev/pci/if_iwn.c
> @@ -338,7 +338,8 @@ iwn_attach(struct device *parent, struct device *self, 
> void *aux)
>   }
>  
>   /* Install interrupt handler. */
> - if (pci_intr_map(pa, &ih) != 0) {
> + if (pci_intr_map_msi(pa, &ih) != 0 &&
> + pci_intr_map(pa, &ih) != 0) {
>   printf(": can't map interrupt\n");
>   return;
>   }
> 
> -- 
> The idea is to die young as late as possible.
>   -- Ashley Montague
> 

work fine

iwn0 at pci3 dev 0 function 0 "Intel Centrino Ultimate-N 6300" rev 0x35: msi, 
MIMO 3T3R, MoW, address 00:24:d7:16:a9:80

-- 
Alexandr Shadchin



Remove unused code

2011-06-02 Thread Alexandr Shadchin
Hi,

Removing unused code:
* arch/mac68k/include/keyboard.h not used in kernel sources
* not need define KEYBOARD_ARRAY (variable keyboard[] used only in
  dev/adb/akbd.c if defined WSDISPLAY_COMPAT_RAWKBD)

OK ?

-- 
Alexandr Shadchin

Index: arch/mac68k/include/keyboard.h
===
RCS file: arch/mac68k/include/keyboard.h
diff -N arch/mac68k/include/keyboard.h
--- arch/mac68k/include/keyboard.h  4 Jan 2006 20:39:05 -   1.6
+++ /dev/null   1 Jan 1970 00:00:00 -
@@ -1,217 +0,0 @@
-/* $OpenBSD: keyboard.h,v 1.6 2006/01/04 20:39:05 miod Exp $   */
-/* $NetBSD: keyboard.h,v 1.1 1998/05/15 10:15:54 tsubai Exp $  */
-
-/*-
- * Copyright (C) 1993  Allen K. Briggs, Chris P. Caputo,
- * Michael L. Finch, Bradley A. Grantham, and
- * Lawrence A. Kesteloot
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *notice, this list of conditions and the following disclaimer in the
- *documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *must display the following acknowledgement:
- * This product includes software developed by the Alice Group.
- * 4. The names of the Alice Group or any of its members may not be used
- *to endorse or promote products derived from this software without
- *specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE ALICE GROUP ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE ALICE GROUP BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#define ADBK_LEFT  0x3B
-#define ADBK_RIGHT 0x3C
-#define ADBK_UP0x3E
-#define ADBK_DOWN  0x3D
-#define ADBK_PGUP  0x74
-#define ADBK_PGDN  0x79
-#define ADBK_HOME  0x73
-#define ADBK_END   0x77
-#define ADBK_CONTROL   0x36
-#define ADBK_FLOWER0x37
-#define ADBK_SHIFT 0x38
-#define ADBK_CAPSLOCK  0x39
-#define ADBK_OPTION0x3A
-#define ADBK_F 0x03
-#define ADBK_O 0x1F
-#define ADBK_P 0x23
-#define ADBK_Q 0x0C
-#define ADBK_V 0x09
-#define ADBK_1 0x12
-#define ADBK_2 0x13
-#define ADBK_3 0x14
-#define ADBK_4 0x15
-#define ADBK_5 0x17
-#define ADBK_6 0x16
-#define ADBK_7 0x1A
-#define ADBK_8 0x1C
-#define ADBK_9 0x19
-#define ADBK_0 0x1D
-
-#define ADBK_KEYVAL(key)   ((key) & 0x7f)
-#define ADBK_PRESS(key)(((key) & 0x80) == 0)
-#define ADBK_KEYDOWN(key)  (key)
-#define ADBK_KEYUP(key)((key) | 0x80)
-#define ADBK_MODIFIER(key) key) & 0x7f) == ADBK_SHIFT) || \
-(((key) & 0x7f) == ADBK_CONTROL) || \
-(((key) & 0x7f) == ADBK_FLOWER) || \
-(((key) & 0x7f) == ADBK_OPTION))
-
-#ifndef KEYBOARD_ARRAY
-extern unsigned char keyboard[128][4];
-#else
-unsigned char keyboard[128][4] = {
- /* Scan code  Normal Shifted Controlled   XT */
-   { /*   0x00, */   'a',   'A', 0x01,  30 },
-   { /*   0x01, */   's',   'S', 0x13,  31 },
-   { /*   0x02, */   'd',   'D', 0x04,  32 },
-   { /*   0x03, */   'f',   'F', 0x06,  33 },
-   { /*   0x04, */   'h',   'H', 0x08,  35 },
-   { /*   0x05, */   'g',   'G', 0x07,  34 },
-   { /*   0x06, */   'z',   'Z', 0x1A,  44 },
-   { /*   0x07, */   'x',   'X', 0x18,  45 },
-   { /*   0x08, */   'c',   'C', 0x03,  46 },
-   { /*   0x09, */   'v',   'V', 0x16,  

Re: Synaptics touchpad

2011-05-10 Thread Alexandr Shadchin
On Mon, May 09, 2011 at 11:29:14PM +0200, Matthieu Herrb wrote:
> On Mon, May 09, 2011 at 04:14:32PM -0400, Brynet wrote:
> > I noticed the following in my Xorg.0.log:
> > 
> > Touchpad0: invalid pressure range. defaulting to 0 - 256
> > Touchpad0: invalid finger width range. defaulting to 0 - 16
> > 
> > Just curious if that's normal.
> 
> More or less. The test and the error message are lame, to say that the 
> hw specific layer (wsconscomm.c) didn't set the values. 
> 
> Alexandr, I wonder if it's possible to get these filled from the pms
> driver (it probably means adding more ioctls :()
> -- 
> Matthieu Herrb

The ranges for pressure and width specified in datasheet.
I do not see a need for new ioctls. I think is better to explicitly 
define minp, maxp (etc.) in wsconscomm.c. This will remove confusing 
messages. 

-- 
Alexandr Shadchin

Index: wsconscomm.c
===
RCS file: /cvs/xenocara/driver/xf86-input-synaptics/src/wsconscomm.c,v
retrieving revision 1.2
diff -u -p -r1.2 wsconscomm.c
--- wsconscomm.c7 May 2011 17:30:31 -   1.2
+++ wsconscomm.c10 May 2011 07:09:20 -
@@ -243,6 +243,12 @@ WSConsReadDevDimensions(InputInfoPtr pIn
 xf86Msg(X_PROBED, "%s: y-axis range %d - %d resolution %d\n",
 pInfo->name, priv->miny, priv->maxy, priv->resy);
 
+priv->minp = 0;
+priv->maxp = 256;
+
+priv->minw = 0;
+priv->maxw = 16;
+
 priv->has_pressure = TRUE;
 priv->has_width = TRUE;
 priv->has_left = TRUE;



Re: Synaptics touchpad

2011-05-09 Thread Alexandr Shadchin
On Sun, May 08, 2011 at 11:16:40AM +0200, Matthieu Herrb wrote:
> Hi again,
> 
> I find the mouse emulation code for synaptics touch pads in your patch 
> really weird. I've tried to understand what it does, and why it
> behaves badly for me on the first tap (move the pointer in the upper
> right direction every time), but I fail to understand the logic.
> 
> So I've written a different code which produces better results and is
> simpler to understand. It computes relative motion events
> after the 2nd one, and sends any event with relative motion or button
> state changes.
> 
> This is a diff against the pms.c resulting of your previous patch to tech@
> 

I agree, my implementation weird, your best :-)
Thanks.

-- 
Alexandr Shadchin



Synaptics touchpad

2011-05-07 Thread Alexandr Shadchin
Hi,

Default touchpad behaves as mouse (compatible with xf86-input-mouse)
for full power need used xf86-input-synaptics. 

Please check work of touchpad in compat mode (xf86-input-mouse),
who are interested check xf86-input-synaptics.

Driver xf86-input-synaptics need to build manually:

update src and xenocara tree
cd /usr/src
make obj includes
cd /usr/xenocara/driver/xf86-input-synaptics
make -f Makefile.bsd-wrapper obj build

-- 
Alexandr Shadchin

Index: pms.c
===
RCS file: /cvs/src/sys/dev/pckbc/pms.c,v
retrieving revision 1.18
diff -u -p -r1.18 pms.c
--- pms.c   3 Jan 2011 19:46:34 -   1.18
+++ pms.c   7 May 2011 21:27:46 -
@@ -28,6 +28,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -40,12 +41,15 @@
 
 #define DEVNAME(sc)((sc)->sc_dev.dv_xname)
 
+#define WSMOUSE_BUTTON(x)  (1 << ((x) - 1))
+
 struct pms_softc;
 
 struct pms_protocol {
int type;
 #define PMS_STANDARD   0
 #define PMS_INTELLI1
+#define PMS_SYNAPTICS  2
u_int packetsize;
int (*enable)(struct pms_softc *);
int (*ioctl)(struct pms_softc *, u_long, caddr_t, int, struct proc *);
@@ -54,6 +58,30 @@ struct pms_protocol {
void (*disable)(struct pms_softc *);
 };
 
+struct synaptics_softc {
+   int identify;
+   int capabilities, ext_capabilities;
+   int model, ext_model;
+   int resolution, dimension;
+
+   int mode;
+
+   int res_x, res_y;
+   int min_x, min_y;
+   int max_x, max_y;
+
+   /* Compat mode */
+   int wsmode;
+   int old_x, old_y;
+   int count;
+#define SYNAPTICS_COUNT2
+#define SYNAPTICS_SCALE4
+#define SYNAPTICS_PRESSURE 30
+#define SYNAPTICS_MAXSPEED 30
+
+   int dev_pt_attach;
+};
+
 struct pms_softc { /* driver status information */
struct device sc_dev;
 
@@ -64,56 +92,48 @@ struct pms_softc {  /* driver status inf
 #define PMS_STATE_ENABLED  1
 #define PMS_STATE_SUSPENDED2
 
+   int sc_dev_enable;
+#define PMS_DEV_IGNORE 0x00
+#define PMS_DEV_PRIMARY0x01
+#define PMS_DEV_SECONDARY  0x02
+
int poll;
int inputstate;
+   int is_touchpad;
 
const struct pms_protocol *protocol;
+   struct synaptics_softc *synaptics;
 
u_char packet[8];
 
struct device *sc_wsmousedev;
+   struct device *sc_pt_wsmousedev;
 };
 
-#define PMS_BUTTON1DOWN0x0001  /* left */
-#define PMS_BUTTON2DOWN0x0002  /* middle */
-#define PMS_BUTTON3DOWN0x0004  /* right */
-
 static const u_int butmap[8] = {
0,
-   PMS_BUTTON1DOWN,
-   PMS_BUTTON3DOWN,
-   PMS_BUTTON1DOWN | PMS_BUTTON3DOWN,
-   PMS_BUTTON2DOWN,
-   PMS_BUTTON1DOWN | PMS_BUTTON2DOWN,
-   PMS_BUTTON2DOWN | PMS_BUTTON3DOWN,
-   PMS_BUTTON1DOWN | PMS_BUTTON2DOWN | PMS_BUTTON3DOWN
+   WSMOUSE_BUTTON(1),
+   WSMOUSE_BUTTON(3),
+   WSMOUSE_BUTTON(1) | WSMOUSE_BUTTON(3),
+   WSMOUSE_BUTTON(2),
+   WSMOUSE_BUTTON(1) | WSMOUSE_BUTTON(2),
+   WSMOUSE_BUTTON(2) | WSMOUSE_BUTTON(3),
+   WSMOUSE_BUTTON(1) | WSMOUSE_BUTTON(2) | WSMOUSE_BUTTON(3)
 };
 
-/* PS/2 mouse data packet */
-#define PMS_PS2_BUTTONSMASK0x07
-#define PMS_PS2_BUTTON10x01/* left */
-#define PMS_PS2_BUTTON20x04/* middle */
-#define PMS_PS2_BUTTON30x02/* right */
-#define PMS_PS2_XNEG   0x10
-#define PMS_PS2_YNEG   0x20
-
-#define PMS_INTELLI_MAGIC1 200
-#define PMS_INTELLI_MAGIC2 100
-#define PMS_INTELLI_MAGIC3 80
-#define PMS_INTELLI_ID 0x03
-
 intpmsprobe(struct device *, void *, void *);
 void   pmsattach(struct device *, struct device *, void *);
 intpmsactivate(struct device *, int);
 
 void   pmsinput(void *, int);
 
-intpms_change_state(struct pms_softc *, int);
+intpms_change_state(struct pms_softc *, int, int);
 intpms_ioctl(void *, u_long, caddr_t, int, struct proc *);
 intpms_enable(void *);
 void   pms_disable(void *);
 
 intpms_cmd(struct pms_softc *, u_char *, int, u_char *, int);
+intpms_spec_cmd(struct pms_softc *, int);
 intpms_get_devid(struct pms_softc *, u_char *);
 intpms_get_status(struct pms_softc *, u_char *);
 intpms_set_rate(struct pms_softc *, int);
@@ -129,6 +149,21 @@ intpms_ioctl_mouse(struct pms_softc *, 
 intpms_sync_mouse(struct pms_softc *, int);
 void   pms_proc_mouse(struct pms_softc *);
 
+intpms_enable_synaptics(struct pms_softc *);
+intpms_ioctl_synaptics(struct pms_softc *, u_long, caddr_t, int, struct 
proc *);
+intpms_sync_synaptics(struct pms_softc *, int);
+void   pms_proc_synaptics(struct pms_softc *);
+void   pms_disable_synaptics(struct pms_softc *);
+
+intsynaptics_set_mode(struct pms_softc *, int);
+intsynaptics_query(struct pms_softc *,

Re: Moving WSKBDIO_SETLEDS and WSKBDIO_GETLEDS in wskbd

2011-04-30 Thread Alexandr Shadchin
Anyone? 

On Sat, Apr 16, 2011 at 03:16:47AM +0600, Alexandr Shadchin wrote:
> Hi,
> 
> No need to process WSKBDIO_SETLEDS and WSKBDIO_GETLEDS in each drivers,
> when same can be done in wskbd.
> 
> Tested on i386 and amd64. Please test on other platforms.
> 
> OK?
> 
> -- 
> Alexandr Shadchin
> 
> Index: arch/arm/xscale/pxa27x_kpc.c
> ===
> RCS file: /cvs/src/sys/arch/arm/xscale/pxa27x_kpc.c,v
> retrieving revision 1.1
> diff -u -p -r1.1 pxa27x_kpc.c
> --- arch/arm/xscale/pxa27x_kpc.c  9 Sep 2009 12:14:39 -   1.1
> +++ arch/arm/xscale/pxa27x_kpc.c  15 Apr 2011 15:02:24 -
> @@ -27,7 +27,6 @@
>  #include 
>  
>  int  pxa27x_kpc_enable(void *, int);
> -void pxa27x_kpc_setleds(void *, int);
>  int  pxa27x_kpc_ioctl(void *, u_long, caddr_t, int, struct proc *);
>  
>  inline void pxa27x_kpc_submit(struct pxa27x_kpc_softc *, int);
> @@ -39,7 +38,7 @@ struct cfdriver pxa27x_kpc_cd = {
>  
>  struct wskbd_accessops pxa27x_kpc_accessops = {
>   pxa27x_kpc_enable,
> - pxa27x_kpc_setleds,
> + NULL,
>   pxa27x_kpc_ioctl,
>  };
>  
> @@ -178,11 +177,6 @@ pxa27x_kpc_enable(void *v, int power)
>   return 0;
>  }
>  
> -void
> -pxa27x_kpc_setleds(void *v, int power)
> -{
> -}
> -
>  int
>  pxa27x_kpc_ioctl(void *v, u_long cmd, caddr_t data, int flag, struct proc *p)
>  {
> @@ -193,11 +187,6 @@ pxa27x_kpc_ioctl(void *v, u_long cmd, ca
>   switch (cmd) {
>   case WSKBDIO_GTYPE:
>   *(int *)data = WSKBD_TYPE_KPC;
> - return 0;
> - case WSKBDIO_SETLEDS:
> - return 0;
> - case WSKBDIO_GETLEDS:
> - *(int *)data = 0;
>   return 0;
>  #ifdef WSDISPLAY_COMPAT_RAWKBD
>   case WSKBDIO_SETMODE:
> Index: arch/hp300/dev/dnkbd.c
> ===
> RCS file: /cvs/src/sys/arch/hp300/dev/dnkbd.c,v
> retrieving revision 1.17
> diff -u -p -r1.17 dnkbd.c
> --- arch/hp300/dev/dnkbd.c23 Jul 2009 21:05:56 -  1.17
> +++ arch/hp300/dev/dnkbd.c15 Apr 2011 15:02:24 -
> @@ -170,12 +170,11 @@ struct cfattach dnkbd_ca = {
>  };
>  
>  int  dnkbd_enable(void *, int);
> -void dnkbd_set_leds(void *, int);
>  int  dnkbd_ioctl(void *, u_long, caddr_t, int, struct proc *);
>  
>  const struct wskbd_accessops dnkbd_accessops = {
>   dnkbd_enable,
> - dnkbd_set_leds,
> + NULL,
>   dnkbd_ioctl
>  };
>  
> @@ -917,15 +916,6 @@ dnkbd_enable(void *v, int on)
>   return (0);
>  }
>  
> -void
> -dnkbd_set_leds(void *v, int leds)
> -{
> - /*
> -  * Not supported. There is only one LED on this keyboard, and
> -  * is hardware tied to the caps lock key.
> -  */
> -}
> -
>  int
>  dnkbd_ioctl(void *v, u_long cmd, caddr_t data, int flag, struct proc *p)
>  {
> @@ -936,11 +926,6 @@ dnkbd_ioctl(void *v, u_long cmd, caddr_t
>   switch (cmd) {
>   case WSKBDIO_GTYPE:
>   *(int *)data = WSKBD_TYPE_DOMAIN;
> - return (0);
> - case WSKBDIO_SETLEDS:
> - return (ENXIO);
> - case WSKBDIO_GETLEDS:
> - *(int *)data = 0;
>   return (0);
>   case WSKBDIO_COMPLEXBELL:
>  #define  d   ((struct wskbd_bell_data *)data)
> Index: arch/luna88k/dev/lunaws.c
> ===
> RCS file: /cvs/src/sys/arch/luna88k/dev/lunaws.c,v
> retrieving revision 1.7
> diff -u -p -r1.7 lunaws.c
> --- arch/luna88k/dev/lunaws.c 11 Sep 2008 11:30:14 -  1.7
> +++ arch/luna88k/dev/lunaws.c 15 Apr 2011 15:02:25 -
> @@ -70,7 +70,6 @@ struct ws_softc {
>  void omkbd_input(void *, int);
>  void omkbd_decode(void *, int, u_int *, int *);
>  int  omkbd_enable(void *, int);
> -void omkbd_set_leds(void *, int);
>  int  omkbd_ioctl(void *, u_long, caddr_t, int, struct proc *);
>  
>  struct wscons_keydesc omkbd_keydesctab[];
> @@ -86,7 +85,7 @@ const struct wskbd_mapdata omkbd_keymapd
>  
>  const struct wskbd_accessops omkbd_accessops = {
>   omkbd_enable,
> - omkbd_set_leds,
> + NULL,
>   omkbd_ioctl,
>  };
>  
> @@ -456,19 +455,6 @@ omkbd_enable(v, on)
>   return 0;
>  }
>  
> -void
> -omkbd_set_leds(v, leds)
> - void *v;
> - int leds;
> -{
> -#if 0
> - syscnputc((dev_t)1, 0x10); /* kana LED on */
> - syscnputc((dev_t)1, 0x00); /* kana LED off */
> - syscnputc((dev_t)1, 0x11); /* caps LED on */
> - syscnputc((dev_t)1, 0x01); /* caps LED off */
>

  1   2   >