add smbus support VIA VT82C596 in viapm(4)

2010-02-13 Thread Alexandr Shadchin
Hi!

add smbus support VIA VT82C596A, VT82C596B and VT82C686A in viapm(4)

Tested VIA VT82C596A.

-- 
Alexandr Shadchin
Index: viapm.c
===
RCS file: /cvs/src/sys/dev/pci/viapm.c,v
retrieving revision 1.12
diff -u -p -r1.12 viapm.c
--- viapm.c 26 Jun 2009 02:46:27 -  1.12
+++ viapm.c 13 Feb 2010 16:54:51 -
@@ -36,11 +36,18 @@
 #include 
 
 /*
+ * VIA VT82C596 register definitions.
+ */
+
+/* PCI configuration registers */
+#define VIAPM_SMB_BASE10x90/* SMBus base address */
+
+/*
  * VIA VT8237 ISA register definitions.
  */
 
 /* PCI configuration registers */
-#define VIAPM_SMB_BASE 0xd0/* SMBus base address */
+#define VIAPM_SMB_BASE20xd0/* SMBus base address */
 #define VIAPM_SMB_HOSTC0xd2/* host configuration */
 #define VIAPM_SMB_HOSTC_HSTEN  (1 << 0)/* enable host controller */
 #define VIAPM_SMB_HOSTC_INTEN  (1 << 1)/* enable SCI/SMI */
@@ -124,7 +131,13 @@ struct cfdriver viapm_cd = {
NULL, "viapm", DV_DULL
 };
 
-const struct pci_matchid viapm_ids[] = {
+const struct pci_matchid viapm_smb_base1_ids[] = {
+   { PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT82C596 },
+   { PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT82C596B_PM },
+   { PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT82C686A_SMB }
+};
+
+const struct pci_matchid viapm_smb_base2_ids[] = {
{ PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT8233_ISA },
{ PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT8233A_ISA },
{ PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT8235_ISA },
@@ -140,8 +153,15 @@ const struct pci_matchid viapm_ids[] = {
 int
 viapm_match(struct device *parent, void *match, void *aux)
 {
-   return (pci_matchbyid(aux, viapm_ids,
-   sizeof(viapm_ids) / sizeof(viapm_ids[0])));
+   if (pci_matchbyid(aux, viapm_smb_base1_ids,
+   sizeof(viapm_smb_base1_ids) / sizeof(viapm_smb_base1_ids[0])))
+   return 1;
+
+   if (pci_matchbyid(aux, viapm_smb_base2_ids,
+   sizeof(viapm_smb_base2_ids) / sizeof(viapm_smb_base2_ids[0])))
+   return 1;
+
+   return 0;
 }
 
 void
@@ -151,14 +171,21 @@ viapm_attach(struct device *parent, stru
struct pci_attach_args *pa = aux;
struct i2cbus_attach_args iba;
pcireg_t conf, iobase;
+   int issmb_base1;
 #if 0
pci_intr_handle_t ih;
const char *intrstr = NULL;
 #endif
 
+   issmb_base1 = (pci_matchbyid(pa, viapm_smb_base1_ids,
+   sizeof(viapm_smb_base1_ids) / sizeof(viapm_smb_base1_ids[0])));
+
/* Map I/O space */
sc->sc_iot = pa->pa_iot;
-   iobase = pci_conf_read(pa->pa_pc, pa->pa_tag, VIAPM_SMB_BASE);
+   if (issmb_base1)
+   iobase = pci_conf_read(pa->pa_pc, pa->pa_tag, VIAPM_SMB_BASE1);
+   else
+   iobase = pci_conf_read(pa->pa_pc, pa->pa_tag, VIAPM_SMB_BASE2);
if (iobase == 0 ||
bus_space_map(sc->sc_iot, iobase & 0xfffe,
VIAPM_SMB_SIZE, 0, &sc->sc_ioh)) {
@@ -167,6 +194,8 @@ viapm_attach(struct device *parent, stru
}
 
/* Read configuration */
+   if (issmb_base1)
+   iobase = pci_conf_read(pa->pa_pc, pa->pa_tag, VIAPM_SMB_BASE2);
conf = (iobase >> 16);
DPRINTF((": conf 0x%x", conf));
OpenBSD 4.7-beta (GENERIC) #25: Sat Feb 13 14:37:57 YEKT 2010
k...@test.my.domain:/usr/src/sys/arch/i386/compile/GENERIC
cpu0: Intel Pentium III ("GenuineIntel" 686-class) 853 MHz
cpu0: 
FPU,V86,DE,PSE,TSC,MSR,PAE,MCE,CX8,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,SER,MMX,FXSR,SSE
real mem  = 670593024 (639MB)
avail mem = 641105920 (611MB)
mainbus0 at root
bios0 at mainbus0: AT/286+ BIOS, date 04/12/01, BIOS32 rev. 0 @ 0xfb300, SMBIOS 
rev. 2.2 @ 0xf0800 (39 entries)
bios0: vendor Award Software International, Inc. version "4.51 PG" date 04/12/01
bios0: VIA Technologies, Inc. VT82C693/A
apm0 at bios0: Power Management spec V1.2 (slowidle)
apm0: AC on, battery charge unknown
acpi at bios0 function 0x0 not configured
pcibios0 at bios0: rev 2.1 @ 0xf/0xb788
pcibios0: PCI IRQ Routing Table rev 1.0 @ 0xfdf00/144 (7 entries)
pcibios0: PCI Exclusive IRQs: 5 7 10 11
pcibios0: PCI Interrupt Router at 000:07:0 ("VIA VT82C596A ISA" rev 0x00)
pcibios0: PCI bus #1 is the last bus
bios0: ROM list: 0xc/0xc800
cpu0 at mainbus0: (uniprocessor)
pci0 at mainbus0 bus 0: configuration mode 1 (bios)
pchb0 at pci0 dev 0 function 0 "VIA VT82C691 PCI" rev 0x44
viaagp0 at pchb0: v2
agp0 at viaagp0: aperture at 0xe000, size 0x1000
ppb0 at pci0 dev 1 function 0 "VIA VT82C598 AGP" rev 0x00
pci1 at ppb0 bus 1
vga1 at pci1 dev 0 function 0 "NVIDIA GeForce2 MX" rev 0xb2
wsdisplay0 at vga1 mux 1: console (80x25, vt100 emulation)
wsdisplay0: screen 1-5 added (80

Re: add smbus support VIA VT82C596 in viapm(4)

2010-02-16 Thread Alexandr Shadchin
Hi!

Remade Brad diff taking into account comments.

In original code (function viapm_attach):
bus_space_map(sc->sc_iot, iobase & 0xfffe,
  ^
Mask 0xfffe, but datasheet's must beat 0xfff0

-- 
Alexandr Shadchin
OpenBSD 4.7-beta (GENERIC) #35: Tue Feb 16 20:22:47 YEKT 2010
k...@test.my.domain:/usr/src/sys/arch/i386/compile/GENERIC
cpu0: Intel Pentium III ("GenuineIntel" 686-class) 853 MHz
cpu0: 
FPU,V86,DE,PSE,TSC,MSR,PAE,MCE,CX8,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,SER,MMX,FXSR,SSE
real mem  = 670593024 (639MB)
avail mem = 641101824 (611MB)
mainbus0 at root
bios0 at mainbus0: AT/286+ BIOS, date 04/12/01, BIOS32 rev. 0 @ 0xfb300, SMBIOS 
rev. 2.2 @ 0xf0800 (39 entries)
bios0: vendor Award Software International, Inc. version "4.51 PG" date 04/12/01
bios0: VIA Technologies, Inc. VT82C693/A
apm0 at bios0: Power Management spec V1.2 (slowidle)
apm0: AC on, battery charge unknown
acpi at bios0 function 0x0 not configured
pcibios0 at bios0: rev 2.1 @ 0xf/0xb788
pcibios0: PCI IRQ Routing Table rev 1.0 @ 0xfdf00/144 (7 entries)
pcibios0: PCI Exclusive IRQs: 5 7 10 11
pcibios0: PCI Interrupt Router at 000:07:0 ("VIA VT82C596A ISA" rev 0x00)
pcibios0: PCI bus #1 is the last bus
bios0: ROM list: 0xc/0xc800
cpu0 at mainbus0: (uniprocessor)
pci0 at mainbus0 bus 0: configuration mode 1 (bios)
pchb0 at pci0 dev 0 function 0 "VIA VT82C691 PCI" rev 0x44
viaagp0 at pchb0: v2
agp0 at viaagp0: aperture at 0xe000, size 0x1000
ppb0 at pci0 dev 1 function 0 "VIA VT82C598 AGP" rev 0x00
pci1 at ppb0 bus 1
vga1 at pci1 dev 0 function 0 "NVIDIA GeForce2 MX" rev 0xb2
wsdisplay0 at vga1 mux 1: console (80x25, vt100 emulation)
wsdisplay0: screen 1-5 added (80x25, vt100 emulation)
pcib0 at pci0 dev 7 function 0 "VIA VT82C596A ISA" rev 0x23
pciide0 at pci0 dev 7 function 1 "VIA VT82C571 IDE" rev 0x10: ATA66, channel 0 
configured to compatibility, channel 1 configured to compatibility
atapiscsi0 at pciide0 channel 0 drive 0
scsibus0 at atapiscsi0: 2 targets
cd0 at scsibus0 targ 0 lun 0: <_NEC, DVD_RW ND-3500AG, 2.1B> ATAPI 5/cdrom 
removable
cd0(pciide0:0:0): using PIO mode 4, Ultra-DMA mode 2
wd0 at pciide0 channel 1 drive 0: 
wd0: 16-sector PIO, LBA, 39097MB, 80070686 sectors
wd1 at pciide0 channel 1 drive 1: 
wd1: 16-sector PIO, LBA, 38166MB, 78165360 sectors
wd0(pciide0:1:0): using PIO mode 4, Ultra-DMA mode 4
wd1(pciide0:1:1): using PIO mode 4, Ultra-DMA mode 4
uhci0 at pci0 dev 7 function 2 "VIA VT83C572 USB" rev 0x11: irq 10
viapm0 at pci0 dev 7 function 3 "VIA VT82C596 Power" rev 0x30
iic0 at viapm0
spdmem0 at iic0 addr 0x50: 128MB SDRAM non-parity PC133CL2
spdmem1 at iic0 addr 0x51: 256MB SDRAM non-parity PC133CL3
spdmem2 at iic0 addr 0x52: 256MB SDRAM non-parity PC133CL3
skc0 at pci0 dev 8 function 0 "D-Link Systems DGE-530T B1" rev 0x11, Yukon Lite 
(0x9): irq 11
sk0 at skc0 port A: address 00:17:9a:06:14:4f
eephy0 at sk0 phy 0: 88E1011 Gigabit PHY, rev. 5
envy0 at pci0 dev 9 function 0 "IC Ensemble Envy24PT/HT Audio" rev 0x01: irq 5
envy0: VIA Tremor 5.1, 2 inputs, 6 outputs
ac97: codec id 0x56494170 (VIA Technologies VT1617A)
ac97: codec features headphone, 18 bit DAC, 18 bit ADC, KS Waves 3D
audio0 at envy0
rl0 at pci0 dev 10 function 0 "Realtek 8139" rev 0x10: irq 7, address 
00:50:22:40:2b:23
rlphy0 at rl0 phy 0: RTL internal PHY
rl1 at pci0 dev 12 function 0 "D-Link Systems 530TX+" rev 0x10: irq 11, address 
00:55:d0:ca:12:21
rlphy1 at rl1 phy 0: RTL internal PHY
isa0 at pcib0
isadma0 at isa0
pckbc0 at isa0 port 0x60/5
pckbd0 at pckbc0 (kbd slot)
pckbc0: using irq 1 for kbd slot
wskbd0 at pckbd0: console keyboard, using wsdisplay0
pmsi0 at pckbc0 (aux slot)
pckbc0: using irq 12 for aux slot
wsmouse0 at pmsi0 mux 0
pcppi0 at isa0 port 0x61
midi0 at pcppi0: 
spkr0 at pcppi0
npx0 at isa0 port 0xf0/16: reported by CPUID; using exception 16
fdc0 at isa0 port 0x3f0/6 irq 6 drq 2
usb0 at uhci0: USB revision 1.0
uhub0 at usb0 "VIA UHCI root hub" rev 1.00/1.00 addr 1
biomask e75d netmask efdd ttymask ffdf
mtrr: Pentium Pro MTRR support
vscsi0 at root
scsibus1 at vscsi0: 256 targets
softraid0 at root
root on wd0a swap on wd0b dump on wd0b
pppoe0: received unexpected PADO
Index: viapm.c
===
RCS file: /cvs/src/sys/dev/pci/viapm.c,v
retrieving revision 1.12
diff -u -p -r1.12 viapm.c
--- viapm.c 26 Jun 2009 02:46:27 -  1.12
+++ viapm.c 16 Feb 2010 15:28:59 -
@@ -40,8 +40,11 @@
  */
 
 /* PCI configuration registers */
-#define VIAPM_SMB_BASE 0xd0/* SMBus base address */
-#define VIAPM_SMB_HOSTC0xd2/* host configuration */
+#define VIAPM_SMB_BASE10x90/* SMBus base address */
+#define VIAPM_SMB_BASE20x80
+#define VIAPM_SMB_BASE30xd0
+#define VIAPM_SMB_HOSTC1  

Patch for texinfo

2010-03-06 Thread Alexandr Shadchin
Hi!

makeinfo -html --css-include=foo.css bar.texinfo

Opens file foo.css, but not close it, which may lead to error:
Too many open files

I received this error when porting sbcl-1.0.36

-- 
Alexandr Shadchin
Index: makeinfo/html.c
===
RCS file: /cvs/src/gnu/usr.bin/texinfo/makeinfo/html.c,v
retrieving revision 1.2
diff -u -p -r1.2 html.c
--- makeinfo/html.c 17 Jul 2006 22:29:29 -  1.2
+++ makeinfo/html.c 6 Mar 2010 11:27:38 -
@@ -167,6 +167,9 @@ process_css_file (char *filename)
   lastchar = c;
 }
 
+  if (f != stdin)
+fclose(f);
+
   /* Reached the end of the file.  We should not be still in a comment.  */
   if (state == comment_state)
 warning (_("%s:%d: --css-file ended in comment"), filename, lineno);



viapm(4) and viaenv(4)

2010-05-06 Thread Alexandr Shadchin
Hi!

Combining code drivers viapm(4) and viaenv(4) + small tune.

Diff and info http://koba.devio.us/viapm/

Please test and thanks in advance :)

-- 
Alexandr Shadchin



style fix

2010-08-09 Thread Alexandr Shadchin
Hi!

zap whitespace and replace spaces on tab.

-- 
Alexandr Shadchin

[demime 1.01d removed an attachment of type application/octet-stream which had 
a name of style.diff]



Re: style fix

2010-08-09 Thread Alexandr Shadchin
> please, be a bit aware of the release schedule if you're thinking of
> sending diffs...
>

Sorry, I thought removing trailing whitespace can still be



pckbc_isa.c cleanup

2010-08-20 Thread Alexandr Shadchin
Hi!

nothing major, just some fluff here and there.

-- 
Alexandr Shadchin
Index: pckbc_isa.c
===
RCS file: /cvs/src/sys/dev/isa/pckbc_isa.c,v
retrieving revision 1.7
diff -u -p -r1.7 pckbc_isa.c
--- pckbc_isa.c 22 Jul 2010 14:27:46 -  1.7
+++ pckbc_isa.c 21 Aug 2010 00:34:16 -
@@ -28,17 +28,12 @@
 
 #include 
 #include 
-#include 
-#include 
 #include 
-#include  
-#include 
-#include 
-#include 
+#include 
 
 #include 
 
-#include   
+#include 
 #include 
 
 #include 
@@ -63,15 +58,12 @@ struct cfattach pckbc_isa_ca = {
 void   pckbc_isa_intr_establish(struct pckbc_softc *, pckbc_slot_t);
 
 int
-pckbc_isa_match(parent, match, aux)
-   struct device *parent;
-   void *match;
-   void *aux;
+pckbc_isa_match(struct device *parent, void *match, void *aux)
 {
struct isa_attach_args *ia = aux;
bus_space_tag_t iot = ia->ia_iot;
bus_space_handle_t ioh_d, ioh_c;
-   int res, ok = 1;
+   int res;
 
/* If values are hardwired to something that they can't be, punt. */
if ((ia->ia_iobase != IOBASEUNK && ia->ia_iobase != IO_KBD) ||
@@ -92,26 +84,26 @@ pckbc_isa_match(parent, match, aux)
(void) pckbc_poll_data1(iot, ioh_d, ioh_c, PCKBC_KBD_SLOT, 0);
 
/* KBC selftest */
-   if (pckbc_send_cmd(iot, ioh_c, KBC_SELFTEST) == 0) {
-   ok = 0;
+   if (pckbc_send_cmd(iot, ioh_c, KBC_SELFTEST) == 0)
goto out;
-   }
res = pckbc_poll_data1(iot, ioh_d, ioh_c, PCKBC_KBD_SLOT, 0);
if (res != 0x55) {
printf("kbc selftest: %x\n", res);
-   ok = 0;
+   goto out;
}
- out:
-   bus_space_unmap(iot, ioh_d, 1);
-   bus_space_unmap(iot, ioh_c, 1);
}
 
-   if (ok) {
-   ia->ia_iobase = IO_KBD;
-   ia->ia_iosize = 5;
-   ia->ia_msize = 0x0;
-   }
-   return (ok);
+   ia->ia_iobase = IO_KBD;
+   ia->ia_iosize = 5;
+   ia->ia_msize = 0;
+
+   return (1);
+
+ out:
+   bus_space_unmap(iot, ioh_d, 1);
+   bus_space_unmap(iot, ioh_c, 1);
+
+   return (0);
 }
 
 int
@@ -132,9 +124,7 @@ pckbc_isa_activate(struct device *self, 
 }
 
 void
-pckbc_isa_attach(parent, self, aux)
-   struct device *parent, *self;
-   void *aux;
+pckbc_isa_attach(struct device *parent, struct device *self, void *aux)
 {
struct pckbc_isa_softc *isc = (void *)self;
struct pckbc_softc *sc = &isc->sc_pckbc;
@@ -159,8 +149,6 @@ pckbc_isa_attach(parent, self, aux)
 
if (pckbc_is_console(iot, IO_KBD)) {
t = &pckbc_consdata;
-   ioh_d = t->t_ioh_d;
-   ioh_c = t->t_ioh_c;
pckbc_console_attached = 1;
/* t->t_cmdbyte was initialized by cnattach */
} else {
@@ -186,9 +174,7 @@ pckbc_isa_attach(parent, self, aux)
 }
 
 void
-pckbc_isa_intr_establish(sc, slot)
-   struct pckbc_softc *sc;
-   pckbc_slot_t slot;
+pckbc_isa_intr_establish(struct pckbc_softc *sc, pckbc_slot_t slot)
 {
struct pckbc_isa_softc *isc = (void *) sc;
void *rv;



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: 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: 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



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-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: 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


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);
}



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


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
+++

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 {



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);



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



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);



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 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 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 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;
}
 }



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

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, "
-

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 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 */



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



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);
}
 }
 



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;



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



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 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: 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: 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



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

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];
 



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



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: 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

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 *

Merge viapm and viaenv drivers

2011-04-06 Thread Alexandr Shadchin
Hi!

Merge viapm and viaenv

Pluse:
- Add support SMBus for VT82C596, VT82C596B, VT82C686A, VT8231
- Add support ACPI timer for all VIA South Bridges

Tested on:
- VT82C596B (Gigabyte GA-6VXE7+)
- VT82C686A (Neoware CA2)
- VT8231 (HP T5700)
- VT8235 (Neoware CA10)

OK?

-- 
Alexandr Shadchin

Index: share/man/man4/Makefile
===
RCS file: /cvs/src/share/man/man4/Makefile,v
retrieving revision 1.520
diff -u -p -r1.520 Makefile
--- share/man/man4/Makefile 28 Mar 2011 15:25:37 -  1.520
+++ share/man/man4/Makefile 6 Apr 2011 16:34:10 -
@@ -62,7 +62,7 @@ MAN=  aac.4 ac97.4 acphy.4 \
urndis.4 urtw.4 urtwn.4 usb.4  usbf.4 uscanner.4 uslcom.4 uthum.4 \
uticom.4 utrh.4 uts.4 uvideo.4 uvisor.4 uvscom.4 uyap.4 utwitch.4 \
vether.4 vga.4 vgafb.4 vge.4 \
-   viaenv.4 viapm.4 viasio.4 vic.4 video.4 vlan.4 vmt.4 vnd.4 vr.4 \
+   viapm.4 viasio.4 vic.4 video.4 vlan.4 vmt.4 vnd.4 vr.4 \
vscsi.4 vte.4 \
watchdog.4 wb.4 wbenv.4 wbng.4 wbsd.4 wbsio.4 wd.4 wdc.4 we.4 \
wi.4tbl wpi.4 wscons.4 wsdisplay.4 wskbd.4 wsmouse.4 wsmux.4 \
Index: share/man/man4/pci.4
===
RCS file: /cvs/src/share/man/man4/pci.4,v
retrieving revision 1.301
diff -u -p -r1.301 pci.4
--- share/man/man4/pci.415 Jan 2011 04:35:34 -  1.301
+++ share/man/man4/pci.46 Apr 2011 16:34:10 -
@@ -417,7 +417,7 @@ AMD K8 temperature sensor
 AMD K10 temperature sensor
 .It Xr pwdog 4
 Quancom PWDOG1 watchdog timer device
-.It Xr viaenv 4
+.It Xr viapm 4
 VIA VT82C686A/VT8231 hardware monitor
 .It Xr wdt 4
 ICS PCI-WDT500/501 watchdog timer device
Index: share/man/man4/viaenv.4
===
RCS file: share/man/man4/viaenv.4
diff -N share/man/man4/viaenv.4
--- share/man/man4/viaenv.4 31 May 2007 19:19:53 -  1.11
+++ /dev/null   1 Jan 1970 00:00:00 -
@@ -1,90 +0,0 @@
-.\"$OpenBSD: viaenv.4,v 1.11 2007/05/31 19:19:53 jmc Exp $
-.\"$NetBSD: viaenv.4,v 1.5 2001/09/11 23:18:55 wiz Exp $
-.\"
-.\" Copyright (c) 2000 Johan Danielsson
-.\" 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. Neither the name of author nor the names of any contributors may
-.\"be used to endorse or promote products derived from this
-.\"software without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS
-.\" ``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 FOUNDATION OR CONTRIBUTORS
-.\" 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.
-.Dd $Mdocdate: May 31 2007 $
-.Dt VIAENV 4
-.Os
-.Sh NAME
-.Nm viaenv
-.Nd VIA VT82C686A/VT8231 hardware monitor
-.Sh SYNOPSIS
-.Cd "viaenv* at pci?"
-.Sh DESCRIPTION
-The
-.Nm
-driver provides support for the hardware monitor and power management
-timer in the
-.Tn VIA
-VT82C686A and VT8231 South Bridges.
-The hardware monitor is used with the
-.Xr sysctl 8
-interface.
-.Pp
-The device has 10 sensors:
-.Bl -column "Sensor" "Units" "Typical" -offset indent
-.It Sy "Sensor" Ta Sy "Units" Ta Sy "Typical Use"
-.It Li "TSENS1" Ta "uK" Ta "CPU temperature"
-.It Li "TSENS2" Ta "uK" Ta "System temperature"
-.It Li "TSENS3" Ta "uK" Ta "Unknown"
-.It Li "FAN1" Ta "RPM" Ta "CPU fan"
-.It Li "FAN2" Ta "RPM" Ta "System fan"
-.It Li "VSENS1" Ta "uV DC" Ta "CPU core voltage (2.0V)"
-.It Li "VSENS2&qu

Remove odd code in wskbd.c

2011-04-13 Thread Alexandr Shadchin
Hi!

wskbd_holdscreen() is not needed and can be removed. ok?

-- 
Alexandr Shadchin

Index: wskbd.c
===
RCS file: /cvs/src/sys/dev/wscons/wskbd.c,v
retrieving revision 1.64
diff -u -p -r1.64 wskbd.c
--- wskbd.c 20 Nov 2010 20:52:11 -  1.64
+++ wskbd.c 13 Apr 2011 15:01:20 -
@@ -216,7 +216,6 @@ int wskbd_translate(struct wskbd_interna
 intwskbd_enable(struct wskbd_softc *, int);
 #if NWSDISPLAY > 0
 void   change_displayparam(struct wskbd_softc *, int, int, int);
-void   wskbd_holdscreen(struct wskbd_softc *, int);
 #endif
 
 intwskbd_do_ioctl_sc(struct wskbd_softc *, u_long, caddr_t, int,
@@ -710,28 +709,6 @@ wskbd_rawinput(struct device *dev, u_cha
 }
 #endif /* WSDISPLAY_COMPAT_RAWKBD */
 
-#if NWSDISPLAY > 0
-void
-wskbd_holdscreen(struct wskbd_softc *sc, int hold)
-{
-   int new_state;
-
-   if (sc->sc_displaydv != NULL) {
-   wsdisplay_kbdholdscreen(sc->sc_displaydv, hold);
-   new_state = sc->sc_ledstate;
-   if (hold)
-   new_state |= WSKBD_LED_SCROLL;
-   else
-   new_state &= ~WSKBD_LED_SCROLL;
-   if (new_state != sc->sc_ledstate) {
-   (*sc->sc_accessops->set_leds)(sc->sc_accesscookie,
- new_state);
-   sc->sc_ledstate = new_state;
-   }
-   }
-}
-#endif
-
 int
 wskbd_enable(struct wskbd_softc *sc, int on)
 {
@@ -1592,7 +1569,9 @@ wskbd_translate(struct wskbd_internal *i
case KS_Hold_Screen:
if (sc != NULL) {
update_modifier(id, type, 1, MOD_HOLDSCREEN);
-   wskbd_holdscreen(sc, id->t_modifiers & MOD_HOLDSCREEN);
+   if (sc->sc_displaydv != NULL)
+   wsdisplay_kbdholdscreen(sc->sc_displaydv,
+   id->t_modifiers & MOD_HOLDSCREEN);
}
break;



Re: Remove odd code in wskbd.c

2011-04-13 Thread Alexandr Shadchin
On Wed, Apr 13, 2011 at 09:31:42AM -0700, Matthew Dempsky wrote:
> On Wed, Apr 13, 2011 at 8:19 AM, Alexandr Shadchin
>  wrote:
> > wskbd_holdscreen() is not needed and can be removed. ok?
> 
> Why not?  It looks like at least a few keyboard controllers support
> WKSBD_LED_SCROLL.

ScrollLock LED will be set below in wskbd_translate()
(in wskbd_translate() are several calls update_leds())
Set LED in wskbd_holdscreen() no sense.

-- 
Alexandr Shadchin



Reducing number of call update_leds()

2011-04-13 Thread Alexandr Shadchin
Updating state LED only when necessary. ok?

-- 
Alexandr Shadchin

Index: wskbd.c
===
RCS file: /cvs/src/sys/dev/wscons/wskbd.c,v
retrieving revision 1.65
diff -u -p -r1.65 wskbd.c
--- wskbd.c 13 Apr 2011 18:16:33 -  1.65
+++ wskbd.c 13 Apr 2011 18:20:51 -
@@ -196,6 +196,8 @@ struct wskbd_softc {
 #define MOD_ANYSHIFT   (MOD_SHIFT_L | MOD_SHIFT_R | MOD_SHIFTLOCK)
 #define MOD_ANYCONTROL (MOD_CONTROL_L | MOD_CONTROL_R)
 #define MOD_ANYMETA(MOD_META_L | MOD_META_R)
+#define MOD_ANYLED (MOD_SHIFTLOCK | MOD_CAPSLOCK | MOD_NUMLOCK | \
+MOD_COMPOSE | MOD_HOLDSCREEN)
 
 #define MOD_ONESET(id, mask)   (((id)->t_modifiers & (mask)) != 0)
 #define MOD_ALLSET(id, mask)   (((id)->t_modifiers & (mask)) == (mask))
@@ -1319,6 +1321,8 @@ update_modifier(struct wskbd_internal *i
else
id->t_modifiers &= ~mask;
}
+   if (mask & MOD_ANYLED)
+   update_leds(id);
 }
 
 #if NWSDISPLAY > 0
@@ -1496,7 +1500,6 @@ wskbd_translate(struct wskbd_internal *i
MOD_META_L | MOD_META_R |
MOD_MODESHIFT | MOD_MODELOCK |
MOD_COMMAND | MOD_COMMAND1 | MOD_COMMAND2);
-   update_leds(id);
return (0);
}
 
@@ -1595,10 +1598,8 @@ wskbd_translate(struct wskbd_internal *i
 #endif
 
/* If this is a key release or we are in command mode, we are done */
-   if (type != WSCONS_EVENT_KEY_DOWN || iscommand) {
-   update_leds(id);
+   if (type != WSCONS_EVENT_KEY_DOWN || iscommand)
return (0);
-   }
 
/* Get the keysym */
if (id->t_modifiers & (MOD_MODESHIFT|MOD_MODELOCK) &&
@@ -1672,10 +1673,8 @@ wskbd_translate(struct wskbd_internal *i
break;
}
 
-   if (res == KS_voidSymbol) {
-   update_leds(id);
+   if (res == KS_voidSymbol)
return (0);
-   }
 
if (id->t_composelen > 0) {
/*
@@ -1698,8 +1697,6 @@ wskbd_translate(struct wskbd_internal *i
}
}
}
-
-   update_leds(id);
 
/* We are done, return the symbol */
if (KS_GROUP(res) == KS_GROUP_Ascii) {



Moving WSKBDIO_SETLEDS and WSKBDIO_GETLEDS in wskbd

2011-04-15 Thread Alexandr Shadchin
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.c9 Sep 2009 12:14:39 -   1.1
+++ arch/arm/xscale/pxa27x_kpc.c15 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.c  23 Jul 2009 21:05:56 -  1.17
+++ arch/hp300/dev/dnkbd.c  15 Apr 2011 15:02:24 -
@@ -170,12 +170,11 @@ struct cfattach dnkbd_ca = {
 };
 
 intdnkbd_enable(void *, int);
-void   dnkbd_set_leds(void *, int);
 intdnkbd_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:
 #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 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 */
-#endif
-}
-
 int
 omkbd_ioctl(v, cmd, data, flag, p)
void *v;
@@ -485,8 +471,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/sparc/dev/z8530kbd.c
===
RCS file: /cvs/src/sys/arch/sparc/dev/z8530kbd.c,v
retrieving revision 1.15
diff -u -p -r1.15 z8530kbd.c
--- arch/sparc/dev/z8530kbd.c   18 Mar 2011 21:01:17 -  1.15
+++ arch/sparc/dev/z8530kbd.c   15 Apr 2011 15:02:25 -
@@ -519,7 +519,6 @@ zskbd_init

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 */
>

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: 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



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;



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: 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 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: 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

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: 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: 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: 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



[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-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 

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: 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



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.



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



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



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-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-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: 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: 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



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: 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



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



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



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



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



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



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



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



merge pms and pmsi + added support for some of mouse

2010-09-21 Thread Alexandr Shadchin
Hi!

Merge pms and pmsi + added support for some of mouse.
Tested on i386 and amd64.

Please test, comment, commit, flame, etc ... :)

--
Alexandr Shadchin
Index: distrib/notes/sparc64/hardware
===
RCS file: /cvs/src/distrib/notes/sparc64/hardware,v
retrieving revision 1.151
diff -u -p -r1.151 hardware
--- distrib/notes/sparc64/hardware  9 Apr 2009 16:02:24 -   1.151
+++ distrib/notes/sparc64/hardware  21 Sep 2010 18:02:06 -
@@ -490,7 +490,7 @@ Supported devices {:-include-:}:
Sun mice on Zilog serial ports (zstty)
Sun mice on NS16550 serial ports (com)
USB mice (ums)
-   PS/2 mice (pms or pmsi)
+   PS/2 mice (pms)
 
Framebuffers
SBUS framebuffers:
Index: distrib/sets/lists/man/mi
===
RCS file: /cvs/src/distrib/sets/lists/man/mi,v
retrieving revision 1.1061
diff -u -p -r1.1061 mi
--- distrib/sets/lists/man/mi   25 Aug 2010 19:21:26 -  1.1061
+++ distrib/sets/lists/man/mi   21 Sep 2010 18:02:07 -
@@ -2002,7 +2002,6 @@
 ./usr/share/man/cat4/piixpm.0
 ./usr/share/man/cat4/pim.0
 ./usr/share/man/cat4/pms.0
-./usr/share/man/cat4/pmsi.0
 ./usr/share/man/cat4/pnp.0
 ./usr/share/man/cat4/ppb.0
 ./usr/share/man/cat4/ppp.0
Index: share/man/man4/Makefile
===
RCS file: /cvs/src/share/man/man4/Makefile,v
retrieving revision 1.514
diff -u -p -r1.514 Makefile
--- share/man/man4/Makefile 19 Aug 2010 15:45:35 -  1.514
+++ share/man/man4/Makefile 21 Sep 2010 18:03:27 -
@@ -79,7 +79,6 @@ MLINKS+=isa.4 isadma.4
 MLINKS+=isapnp.4 pnp.4
 MLINKS+=netintro.4 networking.4
 MLINKS+=pcmcia.4 pcic.4
-MLINKS+=pms.4 pmsi.4
 MLINKS+=pty.4 ptm.4
 MLINKS+=random.4 arandom.4
 MLINKS+=random.4 srandom.4 random.4 urandom.4
Index: share/man/man4/pckbc.4
===
RCS file: /cvs/src/share/man/man4/pckbc.4,v
retrieving revision 1.17
diff -u -p -r1.17 pckbc.4
--- share/man/man4/pckbc.4  22 Jul 2010 07:41:59 -  1.17
+++ share/man/man4/pckbc.4  21 Sep 2010 18:03:27 -
@@ -36,7 +36,6 @@
 .Cd "pckbc* at ebus? " Pq "sparc64"
 .Cd "pckbd* at pckbc?"
 .Cd "pms*   at pckbc?"
-.Cd "pmsi*  at pckbc?"
 .Sh DESCRIPTION
 The
 .Nm
@@ -69,5 +68,4 @@ device flags to 1.
 .Xr isa 4 ,
 .Xr pckbd 4 ,
 .Xr pms 4 ,
-.Xr pmsi 4 ,
 .Xr boot_config 8
Index: share/man/man4/pms.4
===
RCS file: /cvs/src/share/man/man4/pms.4,v
retrieving revision 1.11
diff -u -p -r1.11 pms.4
--- share/man/man4/pms.419 Oct 2007 06:29:36 -  1.11
+++ share/man/man4/pms.421 Sep 2010 18:03:28 -
@@ -37,16 +37,13 @@
 .Dt PMS 4
 .Os
 .Sh NAME
-.Nm pms ,
-.Nm pmsi
+.Nm pms
 .Nd PS/2 auxiliary port mouse driver
 .Sh SYNOPSIS
 .Cd "pms* at pckbc?"
 .Cd "pms* at gsckbc?" Pq "hppa"
 .Cd "pms* at mkbc?" Pq "sgi"
-.Cd "pmsi* at pckbc?"
 .Cd "wsmouse* at pms? mux 0"
-.Cd "wsmouse* at pmsi? mux 0"
 .Sh DESCRIPTION
 The
 .Nm pms
@@ -60,12 +57,13 @@ the PS/2 input port controller found on 
 .Xr pckbc 4 ,
 the standard PC keyboard controller found on most other machines.
 .Dq pms
-is a generic driver which supports 2 coordinate axes and 3 buttons.
-The
-.Dq pmsi
-variant provides specific support for wheel mice of the
+is a generic driver which supports mice using common variants of the PS/2
+protocol, including wheel mice of the
 .Dq IntelliMouse
-breed; wheel movements are mapped to a third (z-) axis.
+breed.
+Wheel movements are mapped to a third (z-) axis.
+The driver is
+believed to work with both 3-button and 5-button mice with scroll wheels.
 Mouse related data are accessed by
 .Xr wsmouse 4
 devices.
Index: share/man/man4/man4.i386/lms.4
===
RCS file: /cvs/src/share/man/man4/man4.i386/lms.4,v
retrieving revision 1.10
diff -u -p -r1.10 lms.4
--- share/man/man4/man4.i386/lms.4  31 May 2007 19:19:55 -  1.10
+++ share/man/man4/man4.i386/lms.4  21 Sep 2010 18:03:28 -
@@ -53,6 +53,5 @@ devices.
 .Xr isa 4 ,
 .Xr mms 4 ,
 .Xr pms 4 ,
-.Xr pmsi 4 ,
 .Xr ums 4 ,
 .Xr wsmouse 4
Index: share/man/man4/man4.i386/mms.4
===
RCS file: /cvs/src/share/man/man4/man4.i386/mms.4,v
retrieving revision 1.9
diff -u -p -r1.9 mms.4
--- share/man/man4/man4.i386/mms.4  31 May 2007 19:19:55 -  1.9
+++ share/man/man4/man4.i386/mms.4  21 Sep 2010 18:03:28 -
@@ -53,6 +53,5 @@ devices.
 .Xr isa 4 ,
 .Xr lms 4 ,
 .Xr pms 4 ,
-.Xr pmsi 4 ,
 .Xr ums 4 ,
 .Xr wsmouse 4
Index: sys/arch/alpha/conf/GENERIC
===

Re: merge pms and pmsi + added support for some of mouse

2010-09-21 Thread Alexandr Shadchin
  Sorry, forgot to fix previous diff. Attached correct diff
Index: distrib/notes/sparc64/hardware
===
RCS file: /cvs/src/distrib/notes/sparc64/hardware,v
retrieving revision 1.151
diff -u -p -r1.151 hardware
--- distrib/notes/sparc64/hardware  9 Apr 2009 16:02:24 -   1.151
+++ distrib/notes/sparc64/hardware  21 Sep 2010 18:02:06 -
@@ -490,7 +490,7 @@ Supported devices {:-include-:}:
Sun mice on Zilog serial ports (zstty)
Sun mice on NS16550 serial ports (com)
USB mice (ums)
-   PS/2 mice (pms or pmsi)
+   PS/2 mice (pms)
 
Framebuffers
SBUS framebuffers:
Index: distrib/sets/lists/man/mi
===
RCS file: /cvs/src/distrib/sets/lists/man/mi,v
retrieving revision 1.1061
diff -u -p -r1.1061 mi
--- distrib/sets/lists/man/mi   25 Aug 2010 19:21:26 -  1.1061
+++ distrib/sets/lists/man/mi   21 Sep 2010 18:02:07 -
@@ -2002,7 +2002,6 @@
 ./usr/share/man/cat4/piixpm.0
 ./usr/share/man/cat4/pim.0
 ./usr/share/man/cat4/pms.0
-./usr/share/man/cat4/pmsi.0
 ./usr/share/man/cat4/pnp.0
 ./usr/share/man/cat4/ppb.0
 ./usr/share/man/cat4/ppp.0
Index: share/man/man4/Makefile
===
RCS file: /cvs/src/share/man/man4/Makefile,v
retrieving revision 1.514
diff -u -p -r1.514 Makefile
--- share/man/man4/Makefile 19 Aug 2010 15:45:35 -  1.514
+++ share/man/man4/Makefile 21 Sep 2010 18:03:27 -
@@ -79,7 +79,6 @@ MLINKS+=isa.4 isadma.4
 MLINKS+=isapnp.4 pnp.4
 MLINKS+=netintro.4 networking.4
 MLINKS+=pcmcia.4 pcic.4
-MLINKS+=pms.4 pmsi.4
 MLINKS+=pty.4 ptm.4
 MLINKS+=random.4 arandom.4
 MLINKS+=random.4 srandom.4 random.4 urandom.4
Index: share/man/man4/pckbc.4
===
RCS file: /cvs/src/share/man/man4/pckbc.4,v
retrieving revision 1.17
diff -u -p -r1.17 pckbc.4
--- share/man/man4/pckbc.4  22 Jul 2010 07:41:59 -  1.17
+++ share/man/man4/pckbc.4  21 Sep 2010 18:03:27 -
@@ -36,7 +36,6 @@
 .Cd "pckbc* at ebus? " Pq "sparc64"
 .Cd "pckbd* at pckbc?"
 .Cd "pms*   at pckbc?"
-.Cd "pmsi*  at pckbc?"
 .Sh DESCRIPTION
 The
 .Nm
@@ -69,5 +68,4 @@ device flags to 1.
 .Xr isa 4 ,
 .Xr pckbd 4 ,
 .Xr pms 4 ,
-.Xr pmsi 4 ,
 .Xr boot_config 8
Index: share/man/man4/pms.4
===
RCS file: /cvs/src/share/man/man4/pms.4,v
retrieving revision 1.11
diff -u -p -r1.11 pms.4
--- share/man/man4/pms.419 Oct 2007 06:29:36 -  1.11
+++ share/man/man4/pms.421 Sep 2010 18:03:28 -
@@ -37,16 +37,13 @@
 .Dt PMS 4
 .Os
 .Sh NAME
-.Nm pms ,
-.Nm pmsi
+.Nm pms
 .Nd PS/2 auxiliary port mouse driver
 .Sh SYNOPSIS
 .Cd "pms* at pckbc?"
 .Cd "pms* at gsckbc?" Pq "hppa"
 .Cd "pms* at mkbc?" Pq "sgi"
-.Cd "pmsi* at pckbc?"
 .Cd "wsmouse* at pms? mux 0"
-.Cd "wsmouse* at pmsi? mux 0"
 .Sh DESCRIPTION
 The
 .Nm pms
@@ -60,12 +57,13 @@ the PS/2 input port controller found on 
 .Xr pckbc 4 ,
 the standard PC keyboard controller found on most other machines.
 .Dq pms
-is a generic driver which supports 2 coordinate axes and 3 buttons.
-The
-.Dq pmsi
-variant provides specific support for wheel mice of the
+is a generic driver which supports mice using common variants of the PS/2
+protocol, including wheel mice of the
 .Dq IntelliMouse
-breed; wheel movements are mapped to a third (z-) axis.
+breed.
+Wheel movements are mapped to a third (z-) axis.
+The driver is
+believed to work with both 3-button and 5-button mice with scroll wheels.
 Mouse related data are accessed by
 .Xr wsmouse 4
 devices.
Index: share/man/man4/man4.i386/lms.4
===
RCS file: /cvs/src/share/man/man4/man4.i386/lms.4,v
retrieving revision 1.10
diff -u -p -r1.10 lms.4
--- share/man/man4/man4.i386/lms.4  31 May 2007 19:19:55 -  1.10
+++ share/man/man4/man4.i386/lms.4  21 Sep 2010 18:03:28 -
@@ -53,6 +53,5 @@ devices.
 .Xr isa 4 ,
 .Xr mms 4 ,
 .Xr pms 4 ,
-.Xr pmsi 4 ,
 .Xr ums 4 ,
 .Xr wsmouse 4
Index: share/man/man4/man4.i386/mms.4
===
RCS file: /cvs/src/share/man/man4/man4.i386/mms.4,v
retrieving revision 1.9
diff -u -p -r1.9 mms.4
--- share/man/man4/man4.i386/mms.4  31 May 2007 19:19:55 -  1.9
+++ share/man/man4/man4.i386/mms.4  21 Sep 2010 18:03:28 -
@@ -53,6 +53,5 @@ devices.
 .Xr isa 4 ,
 .Xr lms 4 ,
 .Xr pms 4 ,
-.Xr pmsi 4 ,
 .Xr ums 4 ,
 .Xr wsmouse 4
Index: sys/arch/alpha/conf/GENERIC
===
RCS file: /cvs/src/sys/arch/alpha/conf/GENERIC,v
retrieving revision 1.215
diff -u -p -r1.215 GENERIC
--- sys/arch/alpha/conf/GENERIC 2 Aug 2010 14:13:23 -   1.215
+++ sys/ar

Re: merge pms and pmsi + added support for some of mouse

2010-09-23 Thread Alexandr Shadchin
2010/9/23 Kenneth R Westerback :
> I haven't confirmed w/o the diff, but with the diff I have a problem
> on my eeePC 1000HE. I boot, then suspend with FN-ZZ, then resume
> by hitting a key, then I type 'startx'. At this point I experience
> a long delay before X actually starts.
>
>  Ken
>

Try a new diff. I made adjustments to match the style(9).
Also found an error in function pms_change_state(...):
...
case PMS_STATE_ENABLED:
   ...
   cmd[0] = PMS_RESET;
   ...
   pckbc_slot_enable(sc->sc_kbctag, sc->sc_kbcslot, 1);

corrected for
...
case PMS_STATE_ENABLED:
   ...
   pckbc_slot_enable(sc->sc_kbctag, sc->sc_kbcslot, 1);
   ...
   cmd[0] = PMS_RESET;

-- 
Alexandr Shadchin

Index: distrib/notes/sparc64/hardware
===
RCS file: /cvs/src/distrib/notes/sparc64/hardware,v
retrieving revision 1.151
diff -u -p -r1.151 hardware
--- distrib/notes/sparc64/hardware  9 Apr 2009 16:02:24 -   1.151
+++ distrib/notes/sparc64/hardware  22 Sep 2010 19:07:58 -
@@ -490,7 +490,7 @@ Supported devices {:-include-:}:
Sun mice on Zilog serial ports (zstty)
Sun mice on NS16550 serial ports (com)
USB mice (ums)
-   PS/2 mice (pms or pmsi)
+   PS/2 mice (pms)

Framebuffers
SBUS framebuffers:
Index: distrib/sets/lists/man/mi
===
RCS file: /cvs/src/distrib/sets/lists/man/mi,v
retrieving revision 1.1061
diff -u -p -r1.1061 mi
--- distrib/sets/lists/man/mi   25 Aug 2010 19:21:26 -  1.1061
+++ distrib/sets/lists/man/mi   22 Sep 2010 19:07:59 -
@@ -2002,7 +2002,6 @@
 ./usr/share/man/cat4/piixpm.0
 ./usr/share/man/cat4/pim.0
 ./usr/share/man/cat4/pms.0
-./usr/share/man/cat4/pmsi.0
 ./usr/share/man/cat4/pnp.0
 ./usr/share/man/cat4/ppb.0
 ./usr/share/man/cat4/ppp.0
Index: share/man/man4/Makefile
===
RCS file: /cvs/src/share/man/man4/Makefile,v
retrieving revision 1.514
diff -u -p -r1.514 Makefile
--- share/man/man4/Makefile 19 Aug 2010 15:45:35 -  1.514
+++ share/man/man4/Makefile 22 Sep 2010 19:08:25 -
@@ -79,7 +79,6 @@ MLINKS+=isa.4 isadma.4
 MLINKS+=isapnp.4 pnp.4
 MLINKS+=netintro.4 networking.4
 MLINKS+=pcmcia.4 pcic.4
-MLINKS+=pms.4 pmsi.4
 MLINKS+=pty.4 ptm.4
 MLINKS+=random.4 arandom.4
 MLINKS+=random.4 srandom.4 random.4 urandom.4
Index: share/man/man4/pckbc.4
===
RCS file: /cvs/src/share/man/man4/pckbc.4,v
retrieving revision 1.17
diff -u -p -r1.17 pckbc.4
--- share/man/man4/pckbc.4  22 Jul 2010 07:41:59 -  1.17
+++ share/man/man4/pckbc.4  22 Sep 2010 19:08:25 -
@@ -36,7 +36,6 @@
 .Cd "pckbc* at ebus? " Pq "sparc64"
 .Cd "pckbd* at pckbc?"
 .Cd "pms*   at pckbc?"
-.Cd "pmsi*  at pckbc?"
 .Sh DESCRIPTION
 The
 .Nm
@@ -69,5 +68,4 @@ device flags to 1.
 .Xr isa 4 ,
 .Xr pckbd 4 ,
 .Xr pms 4 ,
-.Xr pmsi 4 ,
 .Xr boot_config 8
Index: share/man/man4/pms.4
===
RCS file: /cvs/src/share/man/man4/pms.4,v
retrieving revision 1.11
diff -u -p -r1.11 pms.4
--- share/man/man4/pms.419 Oct 2007 06:29:36 -  1.11
+++ share/man/man4/pms.422 Sep 2010 19:08:25 -
@@ -37,16 +37,13 @@
 .Dt PMS 4
 .Os
 .Sh NAME
-.Nm pms ,
-.Nm pmsi
+.Nm pms
 .Nd PS/2 auxiliary port mouse driver
 .Sh SYNOPSIS
 .Cd "pms* at pckbc?"
 .Cd "pms* at gsckbc?" Pq "hppa"
 .Cd "pms* at mkbc?" Pq "sgi"
-.Cd "pmsi* at pckbc?"
 .Cd "wsmouse* at pms? mux 0"
-.Cd "wsmouse* at pmsi? mux 0"
 .Sh DESCRIPTION
 The
 .Nm pms
@@ -60,12 +57,13 @@ the PS/2 input port controller found on
 .Xr pckbc 4 ,
 the standard PC keyboard controller found on most other machines.
 .Dq pms
-is a generic driver which supports 2 coordinate axes and 3 buttons.
-The
-.Dq pmsi
-variant provides specific support for wheel mice of the
+is a generic driver which supports mice using common variants of the PS/2
+protocol, including wheel mice of the
 .Dq IntelliMouse
-breed; wheel movements are mapped to a third (z-) axis.
+breed.
+Wheel movements are mapped to a third (z-) axis.
+The driver is
+believed to work with both 3-button and 5-button mice with scroll wheels.
 Mouse related data are accessed by
 .Xr wsmouse 4
 devices.
Index: share/man/man4/man4.i386/lms.4
===
RCS file: /cvs/src/share/man/man4/man4.i386/lms.4,v
retrieving revision 1.10
diff -u -p -r1.10 lms.4
--- share/man/man4/man4.i386/lms.4  31 May 2007 19:19:55 -  1.10
+++ share/man/man4/man4.i386/lms.4  22 Sep 2010 19:08:25 -
@@ -53,6 +53,5 @@ devices.
 .Xr isa 4 ,

Re: merge pms and pmsi + added support for some of mouse

2010-09-23 Thread Alexandr Shadchin
2010/9/23 Kenneth R Westerback :
>
> Doesn't apply. pckbc/pms.c and pms_intelli.c are rejected on -current.
>
>  Ken
>

Regen

-- 
Alexandr Shadchin

Index: distrib/notes/sparc64/hardware
===
RCS file: /cvs/src/distrib/notes/sparc64/hardware,v
retrieving revision 1.151
diff -u -p -r1.151 hardware
--- distrib/notes/sparc64/hardware  9 Apr 2009 16:02:24 -   1.151
+++ distrib/notes/sparc64/hardware  23 Sep 2010 09:41:30 -
@@ -490,7 +490,7 @@ Supported devices {:-include-:}:
Sun mice on Zilog serial ports (zstty)
Sun mice on NS16550 serial ports (com)
USB mice (ums)
-   PS/2 mice (pms or pmsi)
+   PS/2 mice (pms)

Framebuffers
SBUS framebuffers:
Index: distrib/sets/lists/man/mi
===
RCS file: /cvs/src/distrib/sets/lists/man/mi,v
retrieving revision 1.1062
diff -u -p -r1.1062 mi
--- distrib/sets/lists/man/mi   23 Sep 2010 04:55:48 -  1.1062
+++ distrib/sets/lists/man/mi   23 Sep 2010 09:41:31 -
@@ -2001,7 +2001,6 @@
 ./usr/share/man/cat4/piixpm.0
 ./usr/share/man/cat4/pim.0
 ./usr/share/man/cat4/pms.0
-./usr/share/man/cat4/pmsi.0
 ./usr/share/man/cat4/pnp.0
 ./usr/share/man/cat4/ppb.0
 ./usr/share/man/cat4/ppp.0
Index: share/man/man4/Makefile
===
RCS file: /cvs/src/share/man/man4/Makefile,v
retrieving revision 1.514
diff -u -p -r1.514 Makefile
--- share/man/man4/Makefile 19 Aug 2010 15:45:35 -  1.514
+++ share/man/man4/Makefile 23 Sep 2010 09:42:04 -
@@ -79,7 +79,6 @@ MLINKS+=isa.4 isadma.4
 MLINKS+=isapnp.4 pnp.4
 MLINKS+=netintro.4 networking.4
 MLINKS+=pcmcia.4 pcic.4
-MLINKS+=pms.4 pmsi.4
 MLINKS+=pty.4 ptm.4
 MLINKS+=random.4 arandom.4
 MLINKS+=random.4 srandom.4 random.4 urandom.4
Index: share/man/man4/pckbc.4
===
RCS file: /cvs/src/share/man/man4/pckbc.4,v
retrieving revision 1.17
diff -u -p -r1.17 pckbc.4
--- share/man/man4/pckbc.4  22 Jul 2010 07:41:59 -  1.17
+++ share/man/man4/pckbc.4  23 Sep 2010 09:42:04 -
@@ -36,7 +36,6 @@
 .Cd "pckbc* at ebus? " Pq "sparc64"
 .Cd "pckbd* at pckbc?"
 .Cd "pms*   at pckbc?"
-.Cd "pmsi*  at pckbc?"
 .Sh DESCRIPTION
 The
 .Nm
@@ -69,5 +68,4 @@ device flags to 1.
 .Xr isa 4 ,
 .Xr pckbd 4 ,
 .Xr pms 4 ,
-.Xr pmsi 4 ,
 .Xr boot_config 8
Index: share/man/man4/pms.4
===
RCS file: /cvs/src/share/man/man4/pms.4,v
retrieving revision 1.11
diff -u -p -r1.11 pms.4
--- share/man/man4/pms.419 Oct 2007 06:29:36 -  1.11
+++ share/man/man4/pms.423 Sep 2010 09:42:05 -
@@ -37,16 +37,13 @@
 .Dt PMS 4
 .Os
 .Sh NAME
-.Nm pms ,
-.Nm pmsi
+.Nm pms
 .Nd PS/2 auxiliary port mouse driver
 .Sh SYNOPSIS
 .Cd "pms* at pckbc?"
 .Cd "pms* at gsckbc?" Pq "hppa"
 .Cd "pms* at mkbc?" Pq "sgi"
-.Cd "pmsi* at pckbc?"
 .Cd "wsmouse* at pms? mux 0"
-.Cd "wsmouse* at pmsi? mux 0"
 .Sh DESCRIPTION
 The
 .Nm pms
@@ -60,12 +57,13 @@ the PS/2 input port controller found on
 .Xr pckbc 4 ,
 the standard PC keyboard controller found on most other machines.
 .Dq pms
-is a generic driver which supports 2 coordinate axes and 3 buttons.
-The
-.Dq pmsi
-variant provides specific support for wheel mice of the
+is a generic driver which supports mice using common variants of the PS/2
+protocol, including wheel mice of the
 .Dq IntelliMouse
-breed; wheel movements are mapped to a third (z-) axis.
+breed.
+Wheel movements are mapped to a third (z-) axis.
+The driver is
+believed to work with both 3-button and 5-button mice with scroll wheels.
 Mouse related data are accessed by
 .Xr wsmouse 4
 devices.
Index: share/man/man4/man4.i386/lms.4
===
RCS file: /cvs/src/share/man/man4/man4.i386/lms.4,v
retrieving revision 1.10
diff -u -p -r1.10 lms.4
--- share/man/man4/man4.i386/lms.4  31 May 2007 19:19:55 -  1.10
+++ share/man/man4/man4.i386/lms.4  23 Sep 2010 09:42:05 -
@@ -53,6 +53,5 @@ devices.
 .Xr isa 4 ,
 .Xr mms 4 ,
 .Xr pms 4 ,
-.Xr pmsi 4 ,
 .Xr ums 4 ,
 .Xr wsmouse 4
Index: share/man/man4/man4.i386/mms.4
===
RCS file: /cvs/src/share/man/man4/man4.i386/mms.4,v
retrieving revision 1.9
diff -u -p -r1.9 mms.4
--- share/man/man4/man4.i386/mms.4  31 May 2007 19:19:55 -  1.9
+++ share/man/man4/man4.i386/mms.4  23 Sep 2010 09:42:05 -
@@ -53,6 +53,5 @@ devices.
 .Xr isa 4 ,
 .Xr lms 4 ,
 .Xr pms 4 ,
-.Xr pmsi 4 ,
 .Xr ums 4 ,
 .Xr wsmouse 4
Index: sys/arch/alpha/conf/GENERIC
===

Re: merge pms and pmsi + added support for some of mouse

2010-09-24 Thread Alexandr Shadchin
Hi!

Paul Irofti proposed to split the diff in a few easy steps.
Step 1 - merge drivers pms and pmsi.

-- 
Alexandr Shadchin

Index: distrib/notes/sparc64/hardware
===
RCS file: /cvs/src/distrib/notes/sparc64/hardware,v
retrieving revision 1.151
diff -u -p -r1.151 hardware
--- distrib/notes/sparc64/hardware  9 Apr 2009 16:02:24 -   1.151
+++ distrib/notes/sparc64/hardware  24 Sep 2010 12:25:18 -
@@ -490,7 +490,7 @@ Supported devices {:-include-:}:
Sun mice on Zilog serial ports (zstty)
Sun mice on NS16550 serial ports (com)
USB mice (ums)
-   PS/2 mice (pms or pmsi)
+   PS/2 mice (pms)

Framebuffers
SBUS framebuffers:
Index: distrib/sets/lists/man/mi
===
RCS file: /cvs/src/distrib/sets/lists/man/mi,v
retrieving revision 1.1063
diff -u -p -r1.1063 mi
--- distrib/sets/lists/man/mi   23 Sep 2010 19:02:52 -  1.1063
+++ distrib/sets/lists/man/mi   24 Sep 2010 12:25:19 -
@@ -2000,7 +2000,6 @@
 ./usr/share/man/cat4/piixpm.0
 ./usr/share/man/cat4/pim.0
 ./usr/share/man/cat4/pms.0
-./usr/share/man/cat4/pmsi.0
 ./usr/share/man/cat4/pnp.0
 ./usr/share/man/cat4/ppb.0
 ./usr/share/man/cat4/ppp.0
Index: share/man/man4/Makefile
===
RCS file: /cvs/src/share/man/man4/Makefile,v
retrieving revision 1.515
diff -u -p -r1.515 Makefile
--- share/man/man4/Makefile 23 Sep 2010 14:35:13 -  1.515
+++ share/man/man4/Makefile 24 Sep 2010 12:25:47 -
@@ -79,7 +79,6 @@ MLINKS+=isa.4 isadma.4
 MLINKS+=isapnp.4 pnp.4
 MLINKS+=netintro.4 networking.4
 MLINKS+=pcmcia.4 pcic.4
-MLINKS+=pms.4 pmsi.4
 MLINKS+=pty.4 ptm.4
 MLINKS+=random.4 arandom.4
 MLINKS+=random.4 srandom.4 random.4 urandom.4
Index: share/man/man4/pckbc.4
===
RCS file: /cvs/src/share/man/man4/pckbc.4,v
retrieving revision 1.17
diff -u -p -r1.17 pckbc.4
--- share/man/man4/pckbc.4  22 Jul 2010 07:41:59 -  1.17
+++ share/man/man4/pckbc.4  24 Sep 2010 12:25:47 -
@@ -36,7 +36,6 @@
 .Cd "pckbc* at ebus? " Pq "sparc64"
 .Cd "pckbd* at pckbc?"
 .Cd "pms*   at pckbc?"
-.Cd "pmsi*  at pckbc?"
 .Sh DESCRIPTION
 The
 .Nm
@@ -69,5 +68,4 @@ device flags to 1.
 .Xr isa 4 ,
 .Xr pckbd 4 ,
 .Xr pms 4 ,
-.Xr pmsi 4 ,
 .Xr boot_config 8
Index: share/man/man4/pms.4
===
RCS file: /cvs/src/share/man/man4/pms.4,v
retrieving revision 1.11
diff -u -p -r1.11 pms.4
--- share/man/man4/pms.419 Oct 2007 06:29:36 -  1.11
+++ share/man/man4/pms.424 Sep 2010 12:25:47 -
@@ -37,16 +37,13 @@
 .Dt PMS 4
 .Os
 .Sh NAME
-.Nm pms ,
-.Nm pmsi
+.Nm pms
 .Nd PS/2 auxiliary port mouse driver
 .Sh SYNOPSIS
 .Cd "pms* at pckbc?"
 .Cd "pms* at gsckbc?" Pq "hppa"
 .Cd "pms* at mkbc?" Pq "sgi"
-.Cd "pmsi* at pckbc?"
 .Cd "wsmouse* at pms? mux 0"
-.Cd "wsmouse* at pmsi? mux 0"
 .Sh DESCRIPTION
 The
 .Nm pms
@@ -60,12 +57,11 @@ the PS/2 input port controller found on
 .Xr pckbc 4 ,
 the standard PC keyboard controller found on most other machines.
 .Dq pms
-is a generic driver which supports 2 coordinate axes and 3 buttons.
-The
-.Dq pmsi
-variant provides specific support for wheel mice of the
+is a generic driver which supports mice using common variants of the PS/2
+protocol, including wheel mice of the
 .Dq IntelliMouse
-breed; wheel movements are mapped to a third (z-) axis.
+breed.
+Wheel movements are mapped to a third (z-) axis.
 Mouse related data are accessed by
 .Xr wsmouse 4
 devices.
Index: share/man/man4/man4.i386/lms.4
===
RCS file: /cvs/src/share/man/man4/man4.i386/lms.4,v
retrieving revision 1.10
diff -u -p -r1.10 lms.4
--- share/man/man4/man4.i386/lms.4  31 May 2007 19:19:55 -  1.10
+++ share/man/man4/man4.i386/lms.4  24 Sep 2010 12:25:47 -
@@ -53,6 +53,5 @@ devices.
 .Xr isa 4 ,
 .Xr mms 4 ,
 .Xr pms 4 ,
-.Xr pmsi 4 ,
 .Xr ums 4 ,
 .Xr wsmouse 4
Index: share/man/man4/man4.i386/mms.4
===
RCS file: /cvs/src/share/man/man4/man4.i386/mms.4,v
retrieving revision 1.9
diff -u -p -r1.9 mms.4
--- share/man/man4/man4.i386/mms.4  31 May 2007 19:19:55 -  1.9
+++ share/man/man4/man4.i386/mms.4  24 Sep 2010 12:25:47 -
@@ -53,6 +53,5 @@ devices.
 .Xr isa 4 ,
 .Xr lms 4 ,
 .Xr pms 4 ,
-.Xr pmsi 4 ,
 .Xr ums 4 ,
 .Xr wsmouse 4
Index: sys/arch/alpha/conf/GENERIC
===
RCS file: /cvs/src/sys/arch/alpha/conf/GENERIC,v
retrieving revision 1.216
d

Re: merge pms and pmsi + added support for some of mouse

2010-09-25 Thread Alexandr Shadchin
New diff for the simple pms/pmsi merge.

-- 
Alexandr Shadchin


Index: distrib/notes/sparc64/hardware
===
RCS file: /cvs/src/distrib/notes/sparc64/hardware,v
retrieving revision 1.151
diff -u -p -r1.151 hardware
--- distrib/notes/sparc64/hardware  9 Apr 2009 16:02:24 -   1.151
+++ distrib/notes/sparc64/hardware  25 Sep 2010 08:12:38 -
@@ -490,7 +490,7 @@ Supported devices {:-include-:}:
Sun mice on Zilog serial ports (zstty)
Sun mice on NS16550 serial ports (com)
USB mice (ums)
-   PS/2 mice (pms or pmsi)
+   PS/2 mice (pms)
 
Framebuffers
SBUS framebuffers:
Index: distrib/sets/lists/man/mi
===
RCS file: /cvs/src/distrib/sets/lists/man/mi,v
retrieving revision 1.1064
diff -u -p -r1.1064 mi
--- distrib/sets/lists/man/mi   24 Sep 2010 12:48:26 -  1.1064
+++ distrib/sets/lists/man/mi   25 Sep 2010 08:12:39 -
@@ -1999,7 +1999,6 @@
 ./usr/share/man/cat4/piixpm.0
 ./usr/share/man/cat4/pim.0
 ./usr/share/man/cat4/pms.0
-./usr/share/man/cat4/pmsi.0
 ./usr/share/man/cat4/pnp.0
 ./usr/share/man/cat4/ppb.0
 ./usr/share/man/cat4/ppp.0
Index: share/man/man4/Makefile
===
RCS file: /cvs/src/share/man/man4/Makefile,v
retrieving revision 1.515
diff -u -p -r1.515 Makefile
--- share/man/man4/Makefile 23 Sep 2010 14:35:13 -  1.515
+++ share/man/man4/Makefile 25 Sep 2010 08:13:24 -
@@ -79,7 +79,6 @@ MLINKS+=isa.4 isadma.4
 MLINKS+=isapnp.4 pnp.4
 MLINKS+=netintro.4 networking.4
 MLINKS+=pcmcia.4 pcic.4
-MLINKS+=pms.4 pmsi.4
 MLINKS+=pty.4 ptm.4
 MLINKS+=random.4 arandom.4
 MLINKS+=random.4 srandom.4 random.4 urandom.4
Index: share/man/man4/pckbc.4
===
RCS file: /cvs/src/share/man/man4/pckbc.4,v
retrieving revision 1.17
diff -u -p -r1.17 pckbc.4
--- share/man/man4/pckbc.4  22 Jul 2010 07:41:59 -  1.17
+++ share/man/man4/pckbc.4  25 Sep 2010 08:13:24 -
@@ -36,7 +36,6 @@
 .Cd "pckbc* at ebus? " Pq "sparc64"
 .Cd "pckbd* at pckbc?"
 .Cd "pms*   at pckbc?"
-.Cd "pmsi*  at pckbc?"
 .Sh DESCRIPTION
 The
 .Nm
@@ -69,5 +68,4 @@ device flags to 1.
 .Xr isa 4 ,
 .Xr pckbd 4 ,
 .Xr pms 4 ,
-.Xr pmsi 4 ,
 .Xr boot_config 8
Index: share/man/man4/pms.4
===
RCS file: /cvs/src/share/man/man4/pms.4,v
retrieving revision 1.11
diff -u -p -r1.11 pms.4
--- share/man/man4/pms.419 Oct 2007 06:29:36 -  1.11
+++ share/man/man4/pms.425 Sep 2010 08:13:24 -
@@ -37,16 +37,13 @@
 .Dt PMS 4
 .Os
 .Sh NAME
-.Nm pms ,
-.Nm pmsi
+.Nm pms
 .Nd PS/2 auxiliary port mouse driver
 .Sh SYNOPSIS
 .Cd "pms* at pckbc?"
 .Cd "pms* at gsckbc?" Pq "hppa"
 .Cd "pms* at mkbc?" Pq "sgi"
-.Cd "pmsi* at pckbc?"
 .Cd "wsmouse* at pms? mux 0"
-.Cd "wsmouse* at pmsi? mux 0"
 .Sh DESCRIPTION
 The
 .Nm pms
@@ -60,12 +57,11 @@ the PS/2 input port controller found on 
 .Xr pckbc 4 ,
 the standard PC keyboard controller found on most other machines.
 .Dq pms
-is a generic driver which supports 2 coordinate axes and 3 buttons.
-The
-.Dq pmsi
-variant provides specific support for wheel mice of the
+is a generic driver which supports mice using common variants of the PS/2
+protocol, including wheel mice of the
 .Dq IntelliMouse
-breed; wheel movements are mapped to a third (z-) axis.
+breed.
+Wheel movements are mapped to a third (z-) axis.
 Mouse related data are accessed by
 .Xr wsmouse 4
 devices.
Index: share/man/man4/man4.i386/lms.4
===
RCS file: /cvs/src/share/man/man4/man4.i386/lms.4,v
retrieving revision 1.10
diff -u -p -r1.10 lms.4
--- share/man/man4/man4.i386/lms.4  31 May 2007 19:19:55 -  1.10
+++ share/man/man4/man4.i386/lms.4  25 Sep 2010 08:13:24 -
@@ -53,6 +53,5 @@ devices.
 .Xr isa 4 ,
 .Xr mms 4 ,
 .Xr pms 4 ,
-.Xr pmsi 4 ,
 .Xr ums 4 ,
 .Xr wsmouse 4
Index: share/man/man4/man4.i386/mms.4
===
RCS file: /cvs/src/share/man/man4/man4.i386/mms.4,v
retrieving revision 1.9
diff -u -p -r1.9 mms.4
--- share/man/man4/man4.i386/mms.4  31 May 2007 19:19:55 -  1.9
+++ share/man/man4/man4.i386/mms.4  25 Sep 2010 08:13:24 -
@@ -53,6 +53,5 @@ devices.
 .Xr isa 4 ,
 .Xr lms 4 ,
 .Xr pms 4 ,
-.Xr pmsi 4 ,
 .Xr ums 4 ,
 .Xr wsmouse 4
Index: sys/arch/alpha/conf/GENERIC
===
RCS file: /cvs/src/sys/arch/alpha/conf/GENERIC,v
retrieving revision 1.216
diff -u -p -r1.216 GENERIC
--- sys/arch/alpha/conf/GENERIC 2

Re: merge pms and pmsi + added support for some of mouse

2010-09-26 Thread Alexandr Shadchin
On Sun, Sep 26, 2010 at 04:04:45PM +, Miod Vallat wrote:
> > New diff for the simple pms/pmsi merge.
> 
> Whey did you get rid of the poll- vs interrupt-driven operation in
> pms_setintellimode()? It is necessary for proper suspend/resume
> operation.
> 
> Miod

In original pms_intelli.c function pmsi_setintellimode() 
called with the poll = 1 only in pmsiprobe() and pmsiattach().
In pmsi_change_state() poll = 0.

In new pms/pmsi function pms_setintellimode() called only in
pms_change_state(). That's why.

--
Alexandr Shadchin



Re: merge pms and pmsi + added support for some of mouse

2010-09-26 Thread Alexandr Shadchin
On Sun, Sep 26, 2010 at 08:39:23PM +, Miod Vallat wrote:
> Oh, right. For some reason I though you had kept the polling mode and
> not the queueing mode.
> 
> Diff commited. Thanks!
> 
> Miod

This intermediate version. If the poll is better to keep, 
I will correct in future.

--
Alexandr Shadchin



Re: merge pms and pmsi + added support for some of mouse

2010-09-27 Thread Alexandr Shadchin
On Sun, Sep 26, 2010 at 07:12:45PM -0400, Kenneth R Westerback wrote:
> The commmitted version breaks my eeePC, as I reported the last
> version I got via email did.
> 
> Suspend/resume in text mode seems ok, but after confirming that, I
> did 'startx' and the cursor is stuck in the right part of the screen
> and generates the same spurious  when I use the touch pad.
> 
> This is the same behaviour as I saw before the last round of fixes
> to the separate pms/pmsi drivers.
> 
>  Ken

1) restart
2) startx - mouse work ok, right?
3) suspend/resume
4) X - work ok?

1) restart
2) wsmoused - work ok?
3) suspen/resume
4) wsmoused - work ok?
5) startx - don't work?

Can I see your xorg.conf and Xorg.0.log ?

--
Alexandr Shadchin



Re: merge pms and pmsi + added support for some of mouse

2010-09-27 Thread Alexandr Shadchin
On Fri, Sep 24, 2010 at 05:40:37PM +0400, Alexandr Shadchin wrote:
> Hi!
> 
> Paul Irofti proposed to split the diff in a few easy steps.
> Step 1 - merge drivers pms and pmsi.
> 

Step 2 - cleanup, standardization of interfaces and preparation
for easy addition of new devices. Now the resume of work in polling mode.

--
Alexandr Shadchin


Index: pms.c
===
RCS file: /cvs/src/sys/dev/pckbc/pms.c,v
retrieving revision 1.4
diff -u -p -r1.4 pms.c
--- pms.c   26 Sep 2010 20:39:08 -  1.4
+++ pms.c   27 Sep 2010 16:42:50 -
@@ -38,41 +38,94 @@
 #include 
 #include 
 
+#ifdef PMS_DEBUG
+#define DPRINTF(...) do { if (pmsdebug) printf(__VA_ARGS__); } while(0)
+#define DPRINTFN(n, ...) do {  \
+   if (pmsdebug > (n)) printf(__VA_ARGS__);\
+} while(0)
+int pmsdebug = 1;
+#else
+#define DPRINTF(...)
+#define DPRINTFN(n, ...)
+#endif
+
+#define DEVNAME(sc) ((sc)->sc_dev.dv_xname)
+
+/* 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_BUTTON1DOWN0x01/* left */
+#define PMS_BUTTON2DOWN0x02/* middle */
+#define PMS_BUTTON3DOWN0x04/* right */
+
+struct pms_softc;
+
+struct pms_protocol {
+   int type;
+#define PMS_STANDARD   0
+#define PMS_INTELLI1
+   int packetsize;
+   int syncmask;
+   int sync;
+   int (*enable)(struct pms_softc *);
+};
+
 struct pms_softc { /* driver status information */
struct device sc_dev;
 
pckbc_tag_t sc_kbctag;
int sc_kbcslot;
 
+   int poll;
int sc_state;
 #define PMS_STATE_DISABLED 0
 #define PMS_STATE_ENABLED  1
 #define PMS_STATE_SUSPENDED2
 
-   int intelli;
+   struct pms_protocol protocol;
+   unsigned char packet[8];
+
int inputstate;
-   u_int buttons, oldbuttons;  /* mouse button status */
-   signed char dx, dy;
+   u_int buttons;  /* mouse button status */
 
struct device *sc_wsmousedev;
 };
 
-int pmsprobe(struct device *, void *, void *);
-void pmsattach(struct device *, struct device *, void *);
-int pmsactivate(struct device *, int);
-void pmsinput(void *, int);
+intpmsprobe(struct device *, void *, void *);
+void   pmsattach(struct device *, struct device *, void *);
+intpmsactivate(struct device *, int);
 
-struct cfattach pms_ca = {
-   sizeof(struct pms_softc), pmsprobe, pmsattach, NULL,
-   pmsactivate
-};
+void   pmsinput(void *, int);
 
 intpms_change_state(struct pms_softc *, int);
 intpms_ioctl(void *, u_long, caddr_t, int, struct proc *);
 intpms_enable(void *);
 void   pms_disable(void *);
 
-intpms_setintellimode(pckbc_tag_t, pckbc_slot_t);
+intpms_cmd(struct pms_softc *, u_char *, int, u_char *, int);
+intpms_get_devid(struct pms_softc *, u_char *);
+intpms_get_status(struct pms_softc *, u_char *);
+intpms_set_rate(struct pms_softc *, int);
+intpms_set_resolution(struct pms_softc *, int);
+intpms_set_scaling(struct pms_softc *, int);
+intpms_dev_disable(struct pms_softc *);
+intpms_dev_enable(struct pms_softc *);
+
+intpms_enable_intelli(struct pms_softc *);
+
+struct cfattach pms_ca = {
+   sizeof(struct pms_softc), pmsprobe, pmsattach, NULL,
+   pmsactivate
+};
+
+struct cfdriver pms_cd = {
+   NULL, "pms", DV_DULL
+};
 
 const struct wsmouse_accessops pms_accessops = {
pms_enable,
@@ -80,104 +133,52 @@ const struct wsmouse_accessops pms_acces
pms_disable,
 };
 
-int
-pms_setintellimode(pckbc_tag_t tag, pckbc_slot_t slot)
-{
-   u_char cmd[2], resp[1];
-   int i, res;
-   static const u_char rates[] = {200, 100, 80};
-
-   cmd[0] = PMS_SET_SAMPLE;
-   for (i = 0; i < 3; i++) {
-   cmd[1] = rates[i];
-   res = pckbc_enqueue_cmd(tag, slot, cmd, 2, 0, 0, NULL);
-   if (res)
-   return (0);
-   }
-
-   cmd[0] = PMS_SEND_DEV_ID;
-   res = pckbc_enqueue_cmd(tag, slot, cmd, 1, 1, 0, resp);
-   if (res || resp[0] != 3)
-   return (0);
-
-   return (1);
-}
+const struct pms_protocol pms_protocols[] = {
+   /* Generic PS/2 mouse */
+   {PMS_STANDARD, 3, 0xc0, 0x00, NULL},
+   /* Microsoft IntelliMouse */
+   {PMS_INTELLI, 4, 0x08, 0x08, pms_enable_intelli}
+};
 
 int
-pmsprobe(parent, match, aux)
-   struct device *parent;
-   void *match;
-   void *aux;
+pmsprobe(struct device *parent, void *match, void *aux)
 {
struct pckbc_attach_args *pa = aux;
-   u_char cmd[1], resp[2];
   

Re: merge pms and pmsi + added support for some of mouse

2010-09-28 Thread Alexandr Shadchin
On Mon, Sep 27, 2010 at 01:10:58PM -0700, Matthew Dempsky wrote:
> On Mon, Sep 27, 2010 at 10:42 AM, Alexandr Shadchin
>  wrote:
> >if (pa->pa_slot != PCKBC_AUX_SLOT)
> > -return (0);
> > +return 0;
> 
> "return (x)" is proper KNF.  Please don't undo it.

I have recently seen more often return without the brackets, so I decided 
that this is correct. For me, with or without the brackets do not matter.
So back braces or not?

-- 
Alexandr Shadchin



Re: merge pms and pmsi + added support for some of mouse

2010-09-29 Thread Alexandr Shadchin
On Mon, Sep 27, 2010 at 11:42:35PM +0600, Alexandr Shadchin wrote:
> On Fri, Sep 24, 2010 at 05:40:37PM +0400, Alexandr Shadchin wrote:
> > Hi!
> > 
> > Paul Irofti proposed to split the diff in a few easy steps.
> > Step 1 - merge drivers pms and pmsi.
> > 
> 
> Step 2 - cleanup, standardization of interfaces and preparation
> for easy addition of new devices. Now the resume of work in polling mode.
> 

Regen for -current.  Also small improvements:
1) add function pms_dev_reset()
2) in struct pms_protocol add function sync() - for check synchronization,
   proc () - for processing packet.
 
-- 
Alexandr Shadchin


Index: pms.c
===
RCS file: /cvs/src/sys/dev/pckbc/pms.c,v
retrieving revision 1.5
diff -u -p -r1.5 pms.c
--- pms.c   27 Sep 2010 18:16:25 -  1.5
+++ pms.c   29 Sep 2010 14:41:51 -
@@ -38,41 +38,100 @@
 #include 
 #include 
 
+#ifdef PMS_DEBUG
+#define DPRINTF(...) do { if (pmsdebug) printf(__VA_ARGS__); } while(0)
+#define DPRINTFN(n, ...) do {  \
+   if (pmsdebug > (n)) printf(__VA_ARGS__);\
+} while(0)
+int pmsdebug = 1;
+#else
+#define DPRINTF(...)
+#define DPRINTFN(n, ...)
+#endif
+
+#define DEVNAME(sc) ((sc)->sc_dev.dv_xname)
+
+/* 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_BUTTON1DOWN0x01/* left */
+#define PMS_BUTTON2DOWN0x02/* middle */
+#define PMS_BUTTON3DOWN0x04/* right */
+
+struct pms_softc;
+
+struct pms_protocol {
+   int type;
+#define PMS_STANDARD   0
+#define PMS_INTELLI1
+   int packetsize;
+   int syncmask;
+   int syncval;
+   int (*enable)(struct pms_softc *);
+   int (*sync)(struct pms_softc *, int);
+   void (*proc)(struct pms_softc *, int *, int *, int *, u_int *);
+};
+
 struct pms_softc { /* driver status information */
struct device sc_dev;
 
pckbc_tag_t sc_kbctag;
int sc_kbcslot;
 
+   int poll;
int sc_state;
 #define PMS_STATE_DISABLED 0
 #define PMS_STATE_ENABLED  1
 #define PMS_STATE_SUSPENDED2
 
-   int intelli;
+   struct pms_protocol protocol;
+   unsigned char packet[8];
+
int inputstate;
-   u_int buttons, oldbuttons;  /* mouse button status */
-   signed char dx, dy;
+   u_int buttons;  /* mouse button status */
 
struct device *sc_wsmousedev;
 };
 
-int pmsprobe(struct device *, void *, void *);
-void pmsattach(struct device *, struct device *, void *);
-int pmsactivate(struct device *, int);
-void pmsinput(void *, int);
+intpmsprobe(struct device *, void *, void *);
+void   pmsattach(struct device *, struct device *, void *);
+intpmsactivate(struct device *, int);
 
-struct cfattach pms_ca = {
-   sizeof(struct pms_softc), pmsprobe, pmsattach, NULL,
-   pmsactivate
-};
+void   pmsinput(void *, int);
 
 intpms_change_state(struct pms_softc *, int);
 intpms_ioctl(void *, u_long, caddr_t, int, struct proc *);
 intpms_enable(void *);
 void   pms_disable(void *);
 
-intpms_setintellimode(pckbc_tag_t, pckbc_slot_t);
+intpms_cmd(struct pms_softc *, u_char *, int, u_char *, int);
+intpms_get_devid(struct pms_softc *, u_char *);
+intpms_get_status(struct pms_softc *, u_char *);
+intpms_set_rate(struct pms_softc *, int);
+intpms_set_resolution(struct pms_softc *, int);
+intpms_set_scaling(struct pms_softc *, int);
+void   pms_dev_reset(struct pms_softc *);
+void   pms_dev_disable(struct pms_softc *);
+void   pms_dev_enable(struct pms_softc *);
+
+intpms_enable_intelli(struct pms_softc *);
+
+intpms_sync_generic(struct pms_softc *, int);
+void   pms_proc_generic(struct pms_softc *, int *, int *, int *, u_int *);
+
+struct cfattach pms_ca = {
+   sizeof(struct pms_softc), pmsprobe, pmsattach, NULL,
+   pmsactivate
+};
+
+struct cfdriver pms_cd = {
+   NULL, "pms", DV_DULL
+};
 
 const struct wsmouse_accessops pms_accessops = {
pms_enable,
@@ -80,104 +139,54 @@ const struct wsmouse_accessops pms_acces
pms_disable,
 };
 
-int
-pms_setintellimode(pckbc_tag_t tag, pckbc_slot_t slot)
-{
-   u_char cmd[2], resp[1];
-   int i, res;
-   static const u_char rates[] = {200, 100, 80};
-
-   cmd[0] = PMS_SET_SAMPLE;
-   for (i = 0; i < 3; i++) {
-   cmd[1] = rates[i];
-   res = pckbc_enqueue_cmd(tag, slot, cmd, 2, 0, 0, NULL);
-   if (res)
-   return (0);
-   }
-
-   cmd[0] = PMS_SEND_DEV_ID;
-   res = p

Re: merge pms and pmsi + added support for some of mouse

2010-09-29 Thread Alexandr Shadchin
On Thu, Sep 30, 2010 at 02:50:54AM +0600, Alexandr Shadchin wrote:
> On Mon, Sep 27, 2010 at 11:42:35PM +0600, Alexandr Shadchin wrote:
> > On Fri, Sep 24, 2010 at 05:40:37PM +0400, Alexandr Shadchin wrote:
> > > Hi!
> > > 
> > > Paul Irofti proposed to split the diff in a few easy steps.
> > > Step 1 - merge drivers pms and pmsi.
> > > 
> > 
> > Step 2 - cleanup, standardization of interfaces and preparation
> > for easy addition of new devices. Now the resume of work in polling mode.
> > 
> 
> Regen for -current.  Also small improvements:
> 1) add function pms_dev_reset()
> 2) in struct pms_protocol add function sync() - for check synchronization,
>proc () - for processing packet.
>  

That diff is way too big to commit in one piece. I'll try to split it into 
several pieces.

Pieces 1 - cleanup code

-- 
Alexandr Shadchin


Index: pms.c
===
RCS file: /cvs/src/sys/dev/pckbc/pms.c,v
retrieving revision 1.5
diff -u -p -r1.5 pms.c
--- pms.c   27 Sep 2010 18:16:25 -  1.5
+++ pms.c   29 Sep 2010 16:05:58 -
@@ -57,15 +57,11 @@ struct pms_softc {  /* driver status inf
struct device *sc_wsmousedev;
 };
 
-int pmsprobe(struct device *, void *, void *);
-void pmsattach(struct device *, struct device *, void *);
-int pmsactivate(struct device *, int);
-void pmsinput(void *, int);
+intpmsprobe(struct device *, void *, void *);
+void   pmsattach(struct device *, struct device *, void *);
+intpmsactivate(struct device *, int);
 
-struct cfattach pms_ca = {
-   sizeof(struct pms_softc), pmsprobe, pmsattach, NULL,
-   pmsactivate
-};
+void   pmsinput(void *, int);
 
 intpms_change_state(struct pms_softc *, int);
 intpms_ioctl(void *, u_long, caddr_t, int, struct proc *);
@@ -74,6 +70,15 @@ void pms_disable(void *);
 
 intpms_setintellimode(pckbc_tag_t, pckbc_slot_t);
 
+struct cfattach pms_ca = {
+   sizeof(struct pms_softc), pmsprobe, pmsattach, NULL,
+   pmsactivate
+};
+
+struct cfdriver pms_cd = {
+   NULL, "pms", DV_DULL
+};
+
 const struct wsmouse_accessops pms_accessops = {
pms_enable,
pms_ioctl,
@@ -92,31 +97,28 @@ pms_setintellimode(pckbc_tag_t tag, pckb
cmd[1] = rates[i];
res = pckbc_enqueue_cmd(tag, slot, cmd, 2, 0, 0, NULL);
if (res)
-   return (0);
+   return 0;
}
 
cmd[0] = PMS_SEND_DEV_ID;
res = pckbc_enqueue_cmd(tag, slot, cmd, 1, 1, 1, resp);
if (res || resp[0] != 3)
-   return (0);
+   return 0;
 
-   return (1);
+   return 1;
 }
 
 int
-pmsprobe(parent, match, aux)
-   struct device *parent;
-   void *match;
-   void *aux;
+pmsprobe(struct device *parent, void *match, void *aux)
 {
struct pckbc_attach_args *pa = aux;
u_char cmd[1], resp[2];
int res;
 
if (pa->pa_slot != PCKBC_AUX_SLOT)
-   return (0);
+   return 0;
 
-   /* Flush any garbage. */
+   /* flush any garbage */
pckbc_flush(pa->pa_tag, pa->pa_slot);
 
/* reset the device */
@@ -126,11 +128,11 @@ pmsprobe(parent, match, aux)
 #ifdef DEBUG
printf("pmsprobe: reset error %d\n", res);
 #endif
-   return (0);
+   return 0;
}
if (resp[0] != PMS_RSTDONE) {
printf("pmsprobe: reset response 0x%x\n", resp[0]);
-   return (0);
+   return 0;
}
 
/* get type number (0 = mouse) */
@@ -138,21 +140,19 @@ pmsprobe(parent, match, aux)
 #ifdef DEBUG
printf("pmsprobe: type 0x%x\n", resp[1]);
 #endif
-   return (0);
+   return 0;
}
 
-   return (10);
+   return 1;
 }
 
 void
-pmsattach(parent, self, aux)
-   struct device *parent, *self;
-   void *aux;
+pmsattach(struct device *parent, struct device *self, void *aux)
 {
struct pms_softc *sc = (void *)self;
struct pckbc_attach_args *pa = aux;
struct wsmousedev_attach_args a;
-   u_char cmd[1], resp[2];
+   u_char cmd[1];
int res;
 
sc->sc_kbctag = pa->pa_tag;
@@ -160,24 +160,8 @@ pmsattach(parent, self, aux)
 
printf("\n");
 
-   /* Flush any garbage. */
-   pckbc_flush(pa->pa_tag, pa->pa_slot);
-
-   /* reset the device */
-   cmd[0] = PMS_RESET;
-   res = pckbc_poll_cmd(pa->pa_tag, pa->pa_slot, cmd, 1, 2, resp, 1);
-#ifdef DEBUG
-   if (res || resp[0] != PMS_RSTDONE || resp[1] != 0) {
-   printf("pmsattach: reset error\n");
-   return;
-   }
-#endif
-
-   sc->inputstate = 0;
-   sc->oldbuttons = 0;
-
pckbc_set_inp

Re: merge pms and pmsi + added support for some of mouse

2010-09-29 Thread Alexandr Shadchin
On Wed, Sep 29, 2010 at 08:45:48PM -0400, Kenneth R Westerback wrote:
> On Thu, Sep 30, 2010 at 04:12:20AM +0600, Alexandr Shadchin wrote:
> > On Thu, Sep 30, 2010 at 02:50:54AM +0600, Alexandr Shadchin wrote:
> > > On Mon, Sep 27, 2010 at 11:42:35PM +0600, Alexandr Shadchin wrote:
> > > > On Fri, Sep 24, 2010 at 05:40:37PM +0400, Alexandr Shadchin wrote:
> > > > > Hi!
> > > > > 
> > > > > Paul Irofti proposed to split the diff in a few easy steps.
> > > > > Step 1 - merge drivers pms and pmsi.
> > > > > 
> > > > 
> > > > Step 2 - cleanup, standardization of interfaces and preparation
> > > > for easy addition of new devices. Now the resume of work in polling 
> > > > mode.
> > > > 
> > > 
> > > Regen for -current.  Also small improvements:
> > > 1) add function pms_dev_reset()
> > > 2) in struct pms_protocol add function sync() - for check synchronization,
> > >proc () - for processing packet.
> > >  
> > 
> > That diff is way too big to commit in one piece. I'll try to split it into 
> > several pieces.
> > 
> > Pieces 1 - cleanup code
> > 
> > -- 
> > Alexandr Shadchin
> 
> All the return (); -> return ; just clutters the diff up. I don't
> see the point since both are considered valid style. I think the
> ansification is a valid change but that should be an easy separate
> diff. Many of the other changes seem to be whitespace because I
> can't see any real changes. I would recommend avoiding such changes
> while you are attempting to make functional changes, unless the
> code is really hard to read. I don't see that here.
> 
> The smaller and more focused the diff, the easier to read and more
> likely to get commentary. We like single purpose diffs. :-).
> 
>  Ken
> 

Ok. I'll try to make small diff, which will not include unrelated changes.

-- 
Alexandr Shadchin



update pms driver

2010-09-30 Thread Alexandr Shadchin
I'll try to start over, I'll make a small diff. They will be easier for you
to check and I did not mix everything in one pile.

Removed unnecessary code, as the same thing does pms_change_state() when 
the device enters a state of PMS_STATE_ENABLED

-- 
Alexandr Shadchin


Index: pms.c
===
RCS file: /cvs/src/sys/dev/pckbc/pms.c,v
retrieving revision 1.6
diff -u -p -r1.6 pms.c
--- pms.c   29 Sep 2010 19:39:18 -  1.6
+++ pms.c   30 Sep 2010 07:40:39 -
@@ -173,9 +173,6 @@ pmsattach(parent, self, aux)
}
 #endif
 
-   sc->inputstate = 0;
-   sc->oldbuttons = 0;
-
pckbc_set_inputhandler(sc->sc_kbctag, sc->sc_kbcslot,
   pmsinput, sc, sc->sc_dev.dv_xname);



Re: update pms driver

2010-09-30 Thread Alexandr Shadchin
On Thu, Sep 30, 2010 at 08:04:44PM -0400, Kenneth R Westerback wrote:
> 
> This is a bit too small. :-). I've copied mikeb@ in to ensure we
> are not losing too much in translation.
> 
> The primary focus right now has to be to fix the regressions Ian@
> and no doubt others are experiencing. If we can't fix those regressions
> we will have to revert your diffs and figure out what was wrong
> before putting them back into the tree. The philosophy here is to
> commit early but un-commit quickly if something regresses. Especially
> when Theo is completely buried in something and will neither respond
> to queries about other stuff or suffer any lengthy periods of
> breakage that would distract him.
> 
> We also face a bit of a deadline as the person who understands this
> code and these devices the most (miod@) will shortly vanish for a
> couple of months of moving. There would be reluctance to make big
> changes in those months. Code cleanup and formatting, etc. would
> be ideal for that time period.
> 
> But first, the regressions. Do you have enough information from
> ian@ to suggest a test plan or code to tweak?
> 
>  Ken

OK. This diff resolves Ian problem, Ian has already checked it out.

-- 
Alexandr Shadchin

Index: pms.c
===
RCS file: /cvs/src/sys/dev/pckbc/pms.c,v
retrieving revision 1.6
diff -u -p -r1.6 pms.c
--- pms.c   29 Sep 2010 19:39:18 -  1.6
+++ pms.c   30 Sep 2010 19:47:12 -
@@ -49,6 +49,7 @@ struct pms_softc {/* driver status inf
 #define PMS_STATE_ENABLED  1
 #define PMS_STATE_SUSPENDED2
 
+   int poll;
int intelli;
int inputstate;
u_int buttons, oldbuttons;  /* mouse button status */
@@ -72,7 +73,9 @@ int   pms_ioctl(void *, u_long, caddr_t, i
 intpms_enable(void *);
 void   pms_disable(void *);
 
-intpms_setintellimode(pckbc_tag_t, pckbc_slot_t);
+intpms_cmd(struct pms_softc *, u_char *, int, u_char *, int);
+
+intpms_setintellimode(struct pms_softc *sc);
 
 const struct wsmouse_accessops pms_accessops = {
pms_enable,
@@ -81,7 +84,19 @@ const struct wsmouse_accessops pms_acces
 };
 
 int
-pms_setintellimode(pckbc_tag_t tag, pckbc_slot_t slot)
+pms_cmd(struct pms_softc *sc, u_char *cmd, int len, u_char *resp, int resplen)
+{
+   if (sc->poll) {
+   return pckbc_poll_cmd(sc->sc_kbctag, sc->sc_kbcslot,
+   cmd, len, resplen, resp, 1);
+   } else {
+   return pckbc_enqueue_cmd(sc->sc_kbctag, sc->sc_kbcslot,
+   cmd, len, resplen, 1, resp);
+   }
+}
+
+int
+pms_setintellimode(struct pms_softc *sc)
 {
u_char cmd[2], resp[1];
int i, res;
@@ -90,13 +105,13 @@ pms_setintellimode(pckbc_tag_t tag, pckb
cmd[0] = PMS_SET_SAMPLE;
for (i = 0; i < 3; i++) {
cmd[1] = rates[i];
-   res = pckbc_enqueue_cmd(tag, slot, cmd, 2, 0, 0, NULL);
+   res = pms_cmd(sc, cmd, 2, NULL, 0);
if (res)
return (0);
}
 
cmd[0] = PMS_SEND_DEV_ID;
-   res = pckbc_enqueue_cmd(tag, slot, cmd, 1, 1, 1, resp);
+   res = pms_cmd(sc, cmd, 1, resp, 1);
if (res || resp[0] != 3)
return (0);
 
@@ -191,11 +206,8 @@ pmsattach(parent, self, aux)
sc->sc_wsmousedev = config_found(self, &a, wsmousedevprint);
 
/* no interrupts until enabled */
-   cmd[0] = PMS_DEV_DISABLE;
-   res = pckbc_poll_cmd(pa->pa_tag, pa->pa_slot, cmd, 1, 0, NULL, 0);
-   if (res)
-   printf("pmsattach: disable error\n");
-   pckbc_slot_enable(sc->sc_kbctag, sc->sc_kbcslot, 0);
+   sc->poll = 1;
+   pms_change_state(sc, PMS_STATE_DISABLED);
 }
 
 int
@@ -219,7 +231,7 @@ pmsactivate(struct device *self, int act
 int
 pms_change_state(struct pms_softc *sc, int newstate)
 {
-   u_char cmd[1];
+   u_char cmd[1], resp[2];
int res;
 
switch (newstate) {
@@ -231,12 +243,13 @@ pms_change_state(struct pms_softc *sc, i
 
pckbc_slot_enable(sc->sc_kbctag, sc->sc_kbcslot, 1);
 
-   pckbc_flush(sc->sc_kbctag, sc->sc_kbcslot);
-   sc->intelli = pms_setintellimode(sc->sc_kbctag, sc->sc_kbcslot);
+   cmd[0] = PMS_RESET;
+   res = pms_cmd(sc, cmd, 1, resp, 2);
+
+   sc->intelli = pms_setintellimode(sc);
 
cmd[0] = PMS_DEV_ENABLE;
-   res = pckbc_enqueue_cmd(sc->sc_kbctag, sc->sc_kbcslot,
-   cmd, 1, 0, 1, 0);
+   res = pms_cmd(sc, cmd, 1, NULL, 0);
if (res)
printf("pms_enable: command error\n");
 #if 0
@@ -265,18 +278,19 @@ pms_change_state(struct pms_softc *sc, i

Re: update pms driver

2010-10-01 Thread Alexandr Shadchin
On Fri, Oct 01, 2010 at 01:23:17AM -0400, Kenneth R Westerback wrote:
> 
> And it keeps my eeePC 1000HE working. Excellent!!
> 
> Anyone else have problems left after this diff? If not, then let's get it
> in and go forward from here.
> 
>  Ken

I was having problems with pckbc_flush() in pms_change_state(), 
but now everything is normal. Try this diff.

-- 
Alexandr Shadchin

Index: pms.c
===
RCS file: /cvs/src/sys/dev/pckbc/pms.c,v
retrieving revision 1.6
diff -u -p -r1.6 pms.c
--- pms.c   29 Sep 2010 19:39:18 -  1.6
+++ pms.c   1 Oct 2010 14:00:35 -
@@ -49,6 +49,7 @@ struct pms_softc {/* driver status inf
 #define PMS_STATE_ENABLED  1
 #define PMS_STATE_SUSPENDED2
 
+   int poll;
int intelli;
int inputstate;
u_int buttons, oldbuttons;  /* mouse button status */
@@ -72,7 +73,9 @@ int   pms_ioctl(void *, u_long, caddr_t, i
 intpms_enable(void *);
 void   pms_disable(void *);
 
-intpms_setintellimode(pckbc_tag_t, pckbc_slot_t);
+intpms_cmd(struct pms_softc *, u_char *, int, u_char *, int);
+
+intpms_setintellimode(struct pms_softc *sc);
 
 const struct wsmouse_accessops pms_accessops = {
pms_enable,
@@ -81,7 +84,19 @@ const struct wsmouse_accessops pms_acces
 };
 
 int
-pms_setintellimode(pckbc_tag_t tag, pckbc_slot_t slot)
+pms_cmd(struct pms_softc *sc, u_char *cmd, int len, u_char *resp, int resplen)
+{
+   if (sc->poll) {
+   return pckbc_poll_cmd(sc->sc_kbctag, sc->sc_kbcslot,
+   cmd, len, resplen, resp, 1);
+   } else {
+   return pckbc_enqueue_cmd(sc->sc_kbctag, sc->sc_kbcslot,
+   cmd, len, resplen, 1, resp);
+   }
+}
+
+int
+pms_setintellimode(struct pms_softc *sc)
 {
u_char cmd[2], resp[1];
int i, res;
@@ -90,13 +105,13 @@ pms_setintellimode(pckbc_tag_t tag, pckb
cmd[0] = PMS_SET_SAMPLE;
for (i = 0; i < 3; i++) {
cmd[1] = rates[i];
-   res = pckbc_enqueue_cmd(tag, slot, cmd, 2, 0, 0, NULL);
+   res = pms_cmd(sc, cmd, 2, NULL, 0);
if (res)
return (0);
}
 
cmd[0] = PMS_SEND_DEV_ID;
-   res = pckbc_enqueue_cmd(tag, slot, cmd, 1, 1, 1, resp);
+   res = pms_cmd(sc, cmd, 1, resp, 1);
if (res || resp[0] != 3)
return (0);
 
@@ -191,11 +206,8 @@ pmsattach(parent, self, aux)
sc->sc_wsmousedev = config_found(self, &a, wsmousedevprint);
 
/* no interrupts until enabled */
-   cmd[0] = PMS_DEV_DISABLE;
-   res = pckbc_poll_cmd(pa->pa_tag, pa->pa_slot, cmd, 1, 0, NULL, 0);
-   if (res)
-   printf("pmsattach: disable error\n");
-   pckbc_slot_enable(sc->sc_kbctag, sc->sc_kbcslot, 0);
+   sc->poll = 1;
+   pms_change_state(sc, PMS_STATE_DISABLED);
 }
 
 int
@@ -219,7 +231,7 @@ pmsactivate(struct device *self, int act
 int
 pms_change_state(struct pms_softc *sc, int newstate)
 {
-   u_char cmd[1];
+   u_char cmd[1], resp[2];
int res;
 
switch (newstate) {
@@ -232,11 +244,14 @@ pms_change_state(struct pms_softc *sc, i
pckbc_slot_enable(sc->sc_kbctag, sc->sc_kbcslot, 1);
 
pckbc_flush(sc->sc_kbctag, sc->sc_kbcslot);
-   sc->intelli = pms_setintellimode(sc->sc_kbctag, sc->sc_kbcslot);
+
+   cmd[0] = PMS_RESET;
+   res = pms_cmd(sc, cmd, 1, resp, 2);
+
+   sc->intelli = pms_setintellimode(sc);
 
cmd[0] = PMS_DEV_ENABLE;
-   res = pckbc_enqueue_cmd(sc->sc_kbctag, sc->sc_kbcslot,
-   cmd, 1, 0, 1, 0);
+   res = pms_cmd(sc, cmd, 1, NULL, 0);
if (res)
printf("pms_enable: command error\n");
 #if 0
@@ -265,18 +280,19 @@ pms_change_state(struct pms_softc *sc, i
}
 #endif
sc->sc_state = newstate;
+   sc->poll = 0;
break;
case PMS_STATE_DISABLED:
 
/* FALLTHROUGH */
case PMS_STATE_SUSPENDED:
cmd[0] = PMS_DEV_DISABLE;
-   res = pckbc_enqueue_cmd(sc->sc_kbctag, sc->sc_kbcslot,
-   cmd, 1, 0, 1, 0);
+   res = pms_cmd(sc, cmd, 1, NULL, 0);
if (res)
printf("pms_disable: command error\n");
pckbc_slot_enable(sc->sc_kbctag, sc->sc_kbcslot, 0);
sc->sc_state = newstate;
+   sc->poll = (newstate == PMS_STATE_SUSPENDED) ? 1 : 0;
break;
}
return 0;



Re: update pms driver

2010-10-05 Thread Alexandr Shadchin
Hi!

Try new diff. Fix for me (Lenovo X201)
1) reboot and login (text-mode)
2) wsmoused
3) the behavior is as if I'm holding down Enter 

Also found a new bug:
wsmoused + X don't work (suspend/resume)

1) wsmoused
2) startx
3) suspend/resume
4) in X mouse don't work
5) suspend/resume
6) in X mouse work

this error does not pms driver. Check the job pms driver separately:
1) wsmoused only
2) X only
 
-- 
Alexandr Shadchin

Index: pms.c
===
RCS file: /cvs/src/sys/dev/pckbc/pms.c,v
retrieving revision 1.7
diff -u -p -r1.7 pms.c
--- pms.c   2 Oct 2010 00:28:57 -   1.7
+++ pms.c   5 Oct 2010 05:54:01 -
@@ -243,7 +243,8 @@ pms_change_state(struct pms_softc *sc, i
 
pckbc_slot_enable(sc->sc_kbctag, sc->sc_kbcslot, 1);
 
-   pckbc_flush(sc->sc_kbctag, sc->sc_kbcslot);
+   if (sc->poll)
+   pckbc_flush(sc->sc_kbctag, sc->sc_kbcslot);
 
cmd[0] = PMS_RESET;
res = pms_cmd(sc, cmd, 1, resp, 2);



Re: update pms driver

2010-10-07 Thread Alexandr Shadchin
On Wed, Oct 06, 2010 at 11:40:45PM -0400, Ian Darwin wrote:
> > > Also found a new bug:
> > > wsmoused + X don't work (suspend/resume)
> > > 
> > > 1) wsmoused
> > > 2) startx
> > > 3) suspend/resume
> > > 4) in X mouse don't work
> > > 5) suspend/resume
> > > 6) in X mouse work
> 
> Urm, I did say I'd test it later today, and I did so - just after
> the diff got committed :-(  So, I just updated pms.c to the committed
> version and built a kernel. Fortunately, as reported in my earlier test,
> I do not have the above problems on the Dell Studio 1558 laptop.
> 
> However, in the process of this testing, I found two problems,
> one related and one maybe related. Both have to do with running
> two X sessions one after another.
> 
> 1) (might or might not be related to pms) When I terminate X and
> try to re-start it (either under XDM or by running sudo startx
> twice), the second X does not always start - it tries, but it hangs
> just after the basket weave background and the X cursor, before any
> apps or the XDM login screen. Other times it works fine.  Since 
> restarting X is not something I normally do (I'm usually the only
> user of this machine, and I usually either suspend or power it off
> when not using), I cannot say if this started when the pms/pmsi
> merger went in. The last time I can be sure that I had several X's
> in a row without rebooting is Sept 20, according to last(1).  So I
> can try triaging (actually we're bisecting, not triaging, when we
> do this :-) ) on the weekend when I am home and have a cvsync repo
> to build multiple kernels against, and time to do so.
> 
> 2) (probably related to pms) With wsmoused running, the second X session
> (as above) fails to get /dev/wsmouse. Sadly I captured the wrong
> Xorg.log on this one so I'll have to replicate, but I'm out of time
> for tonight.
>

this error does not pms driver, but failure mechanism is similar to 
one that I found. At first I will finish with pms, and then take over 
these problems. I think the objection would not be? :)
 
> This machine is Intel core i7, amd64 mode, and running -current
> (userland + X updated earlier today to Oct 6 userland, Oct 3 X
> snapshot).  BIOS is up to date.  Dmesg below; longer dmesg with
> ACPI_DEBUG, and acpidump, on request.
> 
> More later, sorry...
> 
> Ian
> 

-- 
Alexandr Shadchin



Re: update pms driver

2010-10-07 Thread Alexandr Shadchin
On Wed, Oct 06, 2010 at 09:53:47PM -0400, Kenneth R Westerback wrote:
> 
> Committed. Next? :-)
> 
>  Ken

Removed unnecessary code, as the same thing does pms_change_state() when 
the device enters a state of PMS_STATE_ENABLED

-- 
Alexandr Shadchin

Index: pms.c
===
RCS file: /cvs/src/sys/dev/pckbc/pms.c,v
retrieving revision 1.8
diff -u -p -r1.8 pms.c
--- pms.c   7 Oct 2010 01:52:25 -   1.8
+++ pms.c   7 Oct 2010 18:46:59 -
@@ -167,29 +167,11 @@ pmsattach(parent, self, aux)
struct pms_softc *sc = (void *)self;
struct pckbc_attach_args *pa = aux;
struct wsmousedev_attach_args a;
-   u_char cmd[1], resp[2];
-   int res;
 
sc->sc_kbctag = pa->pa_tag;
sc->sc_kbcslot = pa->pa_slot;
 
printf("\n");
-
-   /* Flush any garbage. */
-   pckbc_flush(pa->pa_tag, pa->pa_slot);
-
-   /* reset the device */
-   cmd[0] = PMS_RESET;
-   res = pckbc_poll_cmd(pa->pa_tag, pa->pa_slot, cmd, 1, 2, resp, 1);
-#ifdef DEBUG
-   if (res || resp[0] != PMS_RSTDONE || resp[1] != 0) {
-   printf("pmsattach: reset error\n");
-   return;
-   }
-#endif
-
-   sc->inputstate = 0;
-   sc->oldbuttons = 0;
 
pckbc_set_inputhandler(sc->sc_kbctag, sc->sc_kbcslot,
   pmsinput, sc, sc->sc_dev.dv_xname);



  1   2   >