Re: keyboard and mouse problems

2015-03-15 Thread Fred

On 03/14/15 21:48, Theo de Raadt wrote:

yes, can you try the next snapshot?
we are muddling our way through trying to find a series of fixes for
a problem :)



Laptop keyboard now working again, as expected with:

OpenBSD 5.7-current (RAMDISK_CD) #723: Sat Mar 14 14:51:43 MDT 2015

bsd.rd dmesg below.

Thanks

Fred

Script started on Sun Mar 15 10:53:03 2015
port:fred ~ cu -l /dev/cuaU0 -s115200
Connected to /dev/cuaU0 (speed 115200)
bsd.rd
/-\|/-\booting hd0a:bsd.rd: 
|/-\|6494084/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/+423044 
[72+243584-\|/-\|/-\|/-\|+233906/-\|/-\|/-\|/-]=0x70d720

entry point at 0x200120

Copyright (c) 1982, 1986, 1989, 1991, 1993
The Regents of the University of California.  All rights reserved.
Copyright (c) 1995-2015 OpenBSD. All rights reserved. 
http://www.OpenBSD.org


OpenBSD 5.7-current (RAMDISK_CD) #723: Sat Mar 14 14:51:43 MDT 2015
dera...@i386.openbsd.org:/usr/src/sys/arch/i386/compile/RAMDISK_CD
cpu0: Intel(R) Pentium(R) M processor 1.60GHz (GenuineIntel 686-class) 
1.60 GHz
cpu0: 
FPU,V86,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,TM,PBE,NXE,EST,TM2,PERF

real mem  = 1600516096 (1526MB)
avail mem = 1566670848 (1494MB)
mainbus0 at root
bios0 at mainbus0: date 03/14/06, BIOS32 rev. 0 @ 0xfd750, SMBIOS rev. 
2.33 @ 0xe0010 (59 entries)

bios0: vendor IBM version 74ET61WW (2.06 ) date 03/14/2006
bios0: IBM 2525FAG
acpi0 at bios0: rev 2
acpi0: tables DSDT FACP SSDT ECDT TCPA APIC MCFG BOOT
acpiec0 at acpi0
acpimadt0 at acpi0 addr 0xfee0: PC-AT compat
cpu0 at mainbus0: apid 0 (boot processor)
cpu0: apic clock running at 99MHz
ioapic0 at mainbus0: apid 1 pa 0xfec0, version 20, 24 pins
ioapic0: misconfigured as apic 0, remapped to apid 1
acpiprt0 at acpi0: bus 0 (PCI0)
acpiprt1 at acpi0: bus 2 (EXP0)
acpiprt2 at acpi0: bus -1 (EXP1)
acpiprt3 at acpi0: bus -1 (EXP2)
acpiprt4 at acpi0: bus -1 (EXP3)
acpiprt5 at acpi0: bus 4 (PCI1)
acpiprt6 at acpi0: bus -1 (DOCK)
bios0: ROM list: 0xc/0xe800! 0xce800/0x1600 0xd/0x1000 
0xdc000/0x4000! 0xe/0x1

pci0 at mainbus0 bus 0: configuration mode 1 (bios)
pchb0 at pci0 dev 0 function 0 Intel 82915GM Host rev 0x03
vga1 at pci0 dev 2 function 0 Intel 82915GM Video rev 0x03
wsdisplay0 at vga1 mux 1: console (80x25, vt100 emulation)
Intel 82915GM Video rev 0x03 at pci0 dev 2 function 1 not configured
ppb0 at pci0 dev 28 function 0 Intel 82801FB PCIE rev 0x03: apic 1 int 20
pci1 at ppb0 bus 2
bge0 at pci1 dev 0 function 0 Broadcom BCM5751M rev 0x11, BCM5750 B1 
(0x4101): apic 1 int 16, address 00:16:d3:2f:63:7c

brgphy0 at bge0 phy 1: BCM5750 10/100/1000baseT PHY, rev. 0
uhci0 at pci0 dev 29 function 0 Intel 82801FB USB rev 0x03: apic 1 int 16
uhci1 at pci0 dev 29 function 1 Intel 82801FB USB rev 0x03: apic 1 int 17
uhci2 at pci0 dev 29 function 2 Intel 82801FB USB rev 0x03: apic 1 int 18
uhci3 at pci0 dev 29 function 3 Intel 82801FB USB rev 0x03: apic 1 int 19
ehci0 at pci0 dev 29 function 7 Intel 82801FB USB rev 0x03: apic 1 int 19
usb0 at ehci0: USB revision 2.0
uhub0 at usb0 Intel EHCI root hub rev 2.00/1.00 addr 1
ppb1 at pci0 dev 30 function 0 Intel 82801BAM Hub-to-PCI rev 0xd3
pci2 at ppb1 bus 4
cbb0 at pci2 dev 0 function 0 Ricoh 5C476 CardBus rev 0x8d: apic 1 int 16
sdhc0 at pci2 dev 0 function 1 Ricoh 5C822 SD/MMC rev 0x13: apic 1 int 17
sdmmc0 at sdhc0
iwi0 at pci2 dev 2 function 0 Intel PRO/Wireless 2915ABG rev 0x05: 
apic 1 int 21, address 00:16:6f:c1:16:40

cardslot0 at cbb0 slot 0 flags 0
cardbus0 at cardslot0: bus 5 device 0 cacheline 0x0, lattimer 0xb0
pcmcia0 at cardslot0
Intel 82801FB AC97 rev 0x03 at pci0 dev 30 function 2 not configured
Intel 82801FB Modem rev 0x03 at pci0 dev 30 function 3 not configured
pcib0 at pci0 dev 31 function 0 Intel 82801FBM LPC rev 0x03
pciide0 at pci0 dev 31 function 2 Intel 82801FBM SATA rev 0x03: DMA, 
channel 0 wired to compatibility, channel 1 wired to compatibility

wd0 at pciide0 channel 0 drive 0: HTC426060G9AT00
wd0: 16-sector PIO, LBA, 57231MB, 117210240 sectors
wd0(pciide0:0:0): using PIO mode 4, Ultra-DMA mode 5
atapiscsi0 at pciide0 channel 1 drive 0
scsibus0 at atapiscsi0: 2 targets
cd0 at scsibus0 targ 0 lun 0: MATSHITA, DVD/CDRW UJDA775, CB03 ATAPI 
5/cdrom removable

cd0(pciide0:1:0): using PIO mode 4, Ultra-DMA mode 2
Intel 82801FB SMBus rev 0x03 at pci0 dev 31 function 3 not configured
usb1 at uhci0: USB revision 1.0
uhub1 at usb1 Intel UHCI root hub rev 1.00/1.00 addr 1
usb2 at uhci1: USB revision 1.0
uhub2 at usb2 Intel UHCI root hub rev 1.00/1.00 addr 1
usb3 at uhci2: USB revision 1.0
uhub3 at usb3 Intel UHCI root hub rev 1.00/1.00 addr 1
usb4 

Re: keyboard and mouse problems

2015-03-15 Thread Frederic Nowak

On 03/11/15 16:11, Theo de Raadt wrote:

Two related problems regarding mice and keyboards came to my attention
during s2k15 in Brisbane and I worked with jcs@ on solutions.

The first problem is some newer machines (such as the thinkpad x1)
have keyboard repeat or stuttering during install -- this issue only
happes on the RAMDISK kernel.  Eventually we figured out that this is
due to the large touchpad!  Even a light brush against it would mess
up the pckbc driver subtly, causing 10 second pauses.  This happens
because the RAMDISK media lacks the pms driver.

The solution is to forcibly reset the mouse port at attach.  We
  initially thought this change would only be needed for RAMDISK, but
it looks like this sequence was always missing in the past, and we
need it.


I also noticed the keyboard stutters on my Thinkpad Edge E130, but 
didn't make the connection to the touchpad. Great detective work!
The stutters are gone after upgrading to the snapshot from 14-Mar-2015 
and I don't notice any other issues with the keyboard.


Thank you!
Frederic




The second related issue is that boot -c on some machines has never
worked.  The keyboard would be unresponsive.  It turns out this is
also related to mouse ports which have not been reset.

These changes did not make the cut for 5.7, because there are a
plethora of keyboard contoller models, on PCs and non-PCs.  We need
lots of testing before it goes in.

Index: dev/ic/pckbc.c
===
RCS file: /cvs/src/sys/dev/ic/pckbc.c,v
retrieving revision 1.43
diff -u -r1.43 pckbc.c
--- dev/ic/pckbc.c  19 Dec 2014 07:23:57 -  1.43
+++ dev/ic/pckbc.c  11 Feb 2015 03:52:01 -
@@ -41,6 +41,7 @@

  #include dev/ic/i8042reg.h
  #include dev/ic/pckbcvar.h
+#include dev/pckbc/pmsreg.h

  #include pckbd.h

@@ -277,6 +278,12 @@
if (t-t_slotdata[slot] == NULL)
return 0;
pckbc_init_slotdata(t-t_slotdata[slot]);
+   } else if (!found  slot == PCKBC_AUX_SLOT) {
+   u_char cmd[1] = { PMS_RESET };
+
+   (void) pckbc_poll_cmd(t, PCKBC_AUX_SLOT, cmd, sizeof cmd,
+   0, NULL, 1);
+   pckbc_slot_enable(t, PCKBC_AUX_SLOT, 0);
}
return (found);
  }




Index: pckbd.c
===
RCS file: /cvs/src/sys/dev/pckbc/pckbd.c,v
retrieving revision 1.38
diff -u -p -u -r1.38 pckbd.c
--- pckbd.c 24 Jul 2014 22:38:19 -  1.38
+++ pckbd.c 11 Feb 2015 04:57:35 -
@@ -79,6 +79,7 @@
  #include dev/ic/pckbcvar.h
  #include dev/pckbc/pckbdreg.h
  #include dev/pckbc/pckbdvar.h
+#include dev/pckbc/pmsreg.h

  #include dev/wscons/wsconsio.h
  #include dev/wscons/wskbdvar.h
@@ -1033,6 +1034,8 @@ pckbd_cnpollc(void *v, int on)
/* Just to be sure. */
cmd[0] = KBC_ENABLE;
pckbc_poll_cmd(t-t_kbctag, PCKBC_KBD_SLOT, cmd, 1, 0, NULL, 0);
+   cmd[0] = PMS_RESET;
+   pckbc_poll_cmd(t-t_kbctag, PCKBC_AUX_SLOT, cmd, 1, 0, NULL, 0);
}
  }






Re: keyboard and mouse problems

2015-03-14 Thread Fred

On 03/11/15 15:11, Theo de Raadt wrote:

Two related problems regarding mice and keyboards came to my attention
during s2k15 in Brisbane and I worked with jcs@ on solutions.

The first problem is some newer machines (such as the thinkpad x1)
have keyboard repeat or stuttering during install -- this issue only
happes on the RAMDISK kernel.  Eventually we figured out that this is
due to the large touchpad!  Even a light brush against it would mess
up the pckbc driver subtly, causing 10 second pauses.  This happens
because the RAMDISK media lacks the pms driver.

The solution is to forcibly reset the mouse port at attach.  We
  initially thought this change would only be needed for RAMDISK, but
it looks like this sequence was always missing in the past, and we
need it.

The second related issue is that boot -c on some machines has never
worked.  The keyboard would be unresponsive.  It turns out this is
also related to mouse ports which have not been reset.

These changes did not make the cut for 5.7, because there are a
plethora of keyboard contoller models, on PCs and non-PCs.  We need
lots of testing before it goes in.



Hi Theo  tech@

I'm seeing an issue with bsd.rd on i386 snapshot from Fri Mar 13, the 
output from bsd.rd boot is shown at [1] on a ThinkPad X41.


My issue is that the built in laptop keyboard does not respond at all - 
but plugging in an external usb keyboard allowed me to complete the 
upgrade with no problems.


Is this fall out from this change, as I see a version of the above diff 
was commited on 12 Mar?


I am currently bring my src tree up todate and will try and build a 
ramdisk kernel with the 1.45 changes to pckbc.c to see if that solves 
the issue.


Thanks

Fred

[1]
Script started on Sat Mar 14 20:40:54 2015
Connected to /dev/cuaU1 (speed 115200)
bsd.rd
/-\|/-\booting hd0a:bsd.rd: 
|/-\|6494084/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/+423044 
[72+243584-\|/-\|/-\|/-\|+233906/-\|/-\|/-\|/-]=0x70d720

entry point at 0x200120

Copyright (c) 1982, 1986, 1989, 1991, 1993
The Regents of the University of California.  All rights reserved.
Copyright (c) 1995-2015 OpenBSD. All rights reserved. 
http://www.OpenBSD.org


OpenBSD 5.7-current (RAMDISK_CD) #721: Fri Mar 13 18:01:01 MDT 2015
dera...@i386.openbsd.org:/usr/src/sys/arch/i386/compile/RAMDISK_CD
cpu0: Intel(R) Pentium(R) M processor 1.60GHz (GenuineIntel 686-class) 
1.60 GHz
cpu0: 
FPU,V86,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,TM,PBE,NXE,EST,TM2,PERF

real mem  = 1600516096 (1526MB)
avail mem = 1566670848 (1494MB)
mainbus0 at root
bios0 at mainbus0: date 03/14/06, BIOS32 rev. 0 @ 0xfd750, SMBIOS rev. 
2.33 @ 0xe0010 (59 entries)

bios0: vendor IBM version 74ET61WW (2.06 ) date 03/14/2006
bios0: IBM 2525FAG
acpi0 at bios0: rev 2
acpi0: tables DSDT FACP SSDT ECDT TCPA APIC MCFG BOOT
acpiec0 at acpi0
acpimadt0 at acpi0 addr 0xfee0: PC-AT compat
cpu0 at mainbus0: apid 0 (boot processor)
cpu0: apic clock running at 99MHz
ioapic0 at mainbus0: apid 1 pa 0xfec0, version 20, 24 pins
ioapic0: misconfigured as apic 0, remapped to apid 1
acpiprt0 at acpi0: bus 0 (PCI0)
acpiprt1 at acpi0: bus 2 (EXP0)
acpiprt2 at acpi0: bus -1 (EXP1)
acpiprt3 at acpi0: bus -1 (EXP2)
acpiprt4 at acpi0: bus -1 (EXP3)
acpiprt5 at acpi0: bus 4 (PCI1)
acpiprt6 at acpi0: bus -1 (DOCK)
bios0: ROM list: 0xc/0xe800! 0xce800/0x1600 0xd/0x1000 
0xdc000/0x4000! 0xe/0x1

pci0 at mainbus0 bus 0: configuration mode 1 (bios)
pchb0 at pci0 dev 0 function 0 Intel 82915GM Host rev 0x03
vga1 at pci0 dev 2 function 0 Intel 82915GM Video rev 0x03
wsdisplay0 at vga1 mux 1: console (80x25, vt100 emulation)
Intel 82915GM Video rev 0x03 at pci0 dev 2 function 1 not configured
ppb0 at pci0 dev 28 function 0 Intel 82801FB PCIE rev 0x03: apic 1 int 20
pci1 at ppb0 bus 2
bge0 at pci1 dev 0 function 0 Broadcom BCM5751M rev 0x11, BCM5750 B1 
(0x4101): apic 1 int 16, address 00:16:d3:2f:63:7c

brgphy0 at bge0 phy 1: BCM5750 10/100/1000baseT PHY, rev. 0
uhci0 at pci0 dev 29 function 0 Intel 82801FB USB rev 0x03: apic 1 int 16
uhci1 at pci0 dev 29 function 1 Intel 82801FB USB rev 0x03: apic 1 int 17
uhci2 at pci0 dev 29 function 2 Intel 82801FB USB rev 0x03: apic 1 int 18
uhci3 at pci0 dev 29 function 3 Intel 82801FB USB rev 0x03: apic 1 int 19
ehci0 at pci0 dev 29 function 7 Intel 82801FB USB rev 0x03: apic 1 int 19
usb0 at ehci0: USB revision 2.0
uhub0 at usb0 Intel EHCI root hub rev 2.00/1.00 addr 1
ppb1 at pci0 dev 30 function 0 Intel 82801BAM Hub-to-PCI rev 0xd3
pci2 at ppb1 bus 4
cbb0 at pci2 dev 0 function 0 Ricoh 5C476 CardBus rev 0x8d: apic 1 

Re: keyboard and mouse problems

2015-03-14 Thread Eivind Eide
On this rather older machine I cannot upgrade the system now with the
bsd.rd of 14. march 2015.
What happens is that when I press u I get uuu. All keypresses get
duplicated by seven.
Because I cannot upgrade (or at all use keyboard) with this ramdisk
kernel I can only contribute the dmesg from the existing (older)
installation on this machine.


OpenBSD 5.7-beta (GENERIC) #693: Sat Jan 31 12:12:33 MST 2015
dera...@i386.openbsd.org:/usr/src/sys/arch/i386/compile/GENERIC
cpu0: Intel(R) Pentium(R) 4 Mobile CPU 1.80GHz (GenuineIntel
686-class) 1.80 GHz
cpu0: 
FPU,V86,DE,PSE,TSC,MSR,PAE,MCE,CX8,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PERF
real mem  = 2146852864 (2047MB)
avail mem = 2099453952 (2002MB)
mpath0 at root
scsibus0 at mpath0: 256 targets
mainbus0 at root
bios0 at mainbus0: date 05/15/03, BIOS32 rev. 0 @ 0xffe90, SMBIOS rev.
2.3 @ 0xf7690 (61 entries)
bios0: vendor Dell Computer Corporation version A09 date 05/15/2003
bios0: Dell Computer Corporation Latitude C640
acpi0 at bios0: rev 0
acpi0: sleep states S0 S1 S3 S4 S5
acpi0: tables DSDT FACP
acpi0: wakeup devices LID_(S3) PBTN(S4) PCI0(S3) UAR1(S3) USB0(S1)
USB1(S1) USB2(S1) MODM(S3) PCIE(S3) MPCI(S3)
acpitimer0 at acpi0: 3579545 Hz, 24 bits
acpiprt0 at acpi0: bus 0 (PCI0)
acpiprt1 at acpi0: bus 1 (AGP_)
acpiprt2 at acpi0: bus 2 (PCIE)
acpiprt3 at acpi0: bus -1 (MPCI)
acpicpu0 at acpi0acpicpu0: struck PSS entry, core frequency equals  last
acpicpu0: struck PSS entry, core frequency equals  last
acpicpu0: invalid _PSS length
: C2
acpipwrres0 at acpi0: PADA, resource for ADPT
acpitz0 at acpi0: critical temperature is 99 degC
acpiac0 at acpi0: AC unit online
acpibat0 at acpi0: BAT0 model LIP8120DLP serial 5184 type LION oem
Sony Corp.
acpibat1 at acpi0: BAT1 not present
acpibtn0 at acpi0: LID_
acpibtn1 at acpi0: PBTN
acpibtn2 at acpi0: SBTN
acpidock0 at acpi0: GDCK not docked (0)
acpivideo0 at acpi0: VID_
bios0: ROM list: 0xc/0xf000 0xcf000/0x800! 0xcf800/0x800!
cpu0 at mainbus0: (uniprocessor)
mtrr: Pentium Pro MTRR support, 8 var ranges, 88 fixed ranges
pci0 at mainbus0 bus 0: configuration mode 1 (bios)
pchb0 at pci0 dev 0 function 0 Intel 82845 Host rev 0x04
intelagp0 at pchb0
agp0 at intelagp0: aperture at 0xe800, size 0x400
ppb0 at pci0 dev 1 function 0 Intel 82845 AGP rev 0x04
pci1 at ppb0 bus 1
radeondrm0 at pci1 dev 0 function 0 ATI Radeon Mobility M7 rev 0x00
drm0 at radeondrm0
radeondrm0: irq 11
uhci0 at pci0 dev 29 function 0 Intel 82801CA/CAM USB rev 0x02: irq 11
ppb1 at pci0 dev 30 function 0 Intel 82801BAM Hub-to-PCI rev 0x42
pci2 at ppb1 bus 2
xl0 at pci2 dev 0 function 0 3Com 3c905C 100Base-TX rev 0x78: irq
11, address 00:08:74:48:40:d6
exphy0 at xl0 phy 24: 3Com internal media interface
cbb0 at pci2 dev 1 function 0 TI PCI1420 CardBus rev 0x00: irq 11
cbb1 at pci2 dev 1 function 1 TI PCI1420 CardBus rev 0x00: irq 11
ath0 at pci2 dev 3 function 0 Atheros AR2413 rev 0x01: irq 11
ath0: AR2413 7.8 phy 4.5 rf 5.6 eeprom 5.2, WOR3W, address 00:16:cf:53:07:71
cardslot0 at cbb0 slot 0 flags 0
cardbus0 at cardslot0: bus 4 device 0 cacheline 0x8, lattimer 0x20
pcmcia0 at cardslot0
cardslot1 at cbb1 slot 1 flags 0
cardbus1 at cardslot1: bus 5 device 0 cacheline 0x8, lattimer 0x20
pcmcia1 at cardslot1
ichpcib0 at pci0 dev 31 function 0 Intel 82801CAM LPC rev 0x02
pciide0 at pci0 dev 31 function 1 Intel 82801CAM IDE rev 0x02: DMA,
channel 0 configured to compatibility, channel 1 configured to
compatibility
wd0 at pciide0 channel 0 drive 0: Hitachi HTS541080G9AT00
wd0: 16-sector PIO, LBA, 76319MB, 156301488 sectors
wd0(pciide0:0:0): using PIO mode 4, Ultra-DMA mode 5
atapiscsi0 at pciide0 channel 1 drive 0
scsibus1 at atapiscsi0: 2 targets
cd0 at scsibus1 targ 0 lun 0: TOSHIBA, DVD-ROM SD-C2612, 1D21 ATAPI
5/cdrom removable
cd0(pciide0:1:0): using PIO mode 4, Ultra-DMA mode 2
auich0 at pci0 dev 31 function 5 Intel 82801CA/CAM AC97 rev 0x02:
irq 11, ICH3 AC97
ac97: codec id 0x4352595b (Cirrus Logic CS4205 rev 3)
ac97: codec features mic channel, tone, simulated stereo, bass boost,
20 bit DAC, 18 bit ADC, SRS 3D
audio0 at auich0
Intel 82801CA/CAM Modem rev 0x02 at pci0 dev 31 function 6 not configured
usb0 at uhci0: USB revision 1.0
uhub0 at usb0 Intel UHCI root hub rev 1.00/1.00 addr 1
isa0 at ichpcib0
isadma0 at isa0
fdc0 at isa0 port 0x3f0/6 irq 6 drq 2
com0 at isa0 port 0x3f8/8 irq 4: ns16550a, 16 byte fifo
pckbc0 at isa0 port 0x60/5
pckbd0 at pckbc0 (kbd slot)
pckbc0: using irq 1 for kbd slot
wskbd0 at pckbd0: console keyboard
pms0 at pckbc0 (aux slot)
pckbc0: using irq 12 for aux slot
wsmouse0 at pms0 mux 0
wsmouse1 at pms0 mux 0
pms0: Synaptics touchpad, firmware 5.9
pcppi0 at isa0 port 0x61
spkr0 at pcppi0
lpt0 at isa0 port 0x378/4 irq 7
npx0 at isa0 port 0xf0/16: reported by CPUID; using exception 16
vscsi0 at root
scsibus2 at vscsi0: 256 targets
softraid0 at root
scsibus3 at softraid0: 256 targets
softraid0: sd0 was not shutdown properly
sd0 at scsibus3 targ 1 lun 0: OPENBSD, SR CRYPTO, 

keyboard and mouse problems

2015-03-12 Thread Theo de Raadt
Two related problems regarding mice and keyboards came to my attention
during s2k15 in Brisbane and I worked with jcs@ on solutions.

The first problem is some newer machines (such as the thinkpad x1)
have keyboard repeat or stuttering during install -- this issue only
happes on the RAMDISK kernel.  Eventually we figured out that this is
due to the large touchpad!  Even a light brush against it would mess
up the pckbc driver subtly, causing 10 second pauses.  This happens
because the RAMDISK media lacks the pms driver.

The solution is to forcibly reset the mouse port at attach.  We
 initially thought this change would only be needed for RAMDISK, but
it looks like this sequence was always missing in the past, and we
need it.

The second related issue is that boot -c on some machines has never
worked.  The keyboard would be unresponsive.  It turns out this is
also related to mouse ports which have not been reset.

These changes did not make the cut for 5.7, because there are a
plethora of keyboard contoller models, on PCs and non-PCs.  We need
lots of testing before it goes in.

Index: dev/ic/pckbc.c
===
RCS file: /cvs/src/sys/dev/ic/pckbc.c,v
retrieving revision 1.43
diff -u -r1.43 pckbc.c
--- dev/ic/pckbc.c  19 Dec 2014 07:23:57 -  1.43
+++ dev/ic/pckbc.c  11 Feb 2015 03:52:01 -
@@ -41,6 +41,7 @@
 
 #include dev/ic/i8042reg.h
 #include dev/ic/pckbcvar.h
+#include dev/pckbc/pmsreg.h
 
 #include pckbd.h
 
@@ -277,6 +278,12 @@
if (t-t_slotdata[slot] == NULL)
return 0;
pckbc_init_slotdata(t-t_slotdata[slot]);
+   } else if (!found  slot == PCKBC_AUX_SLOT) {
+   u_char cmd[1] = { PMS_RESET };
+
+   (void) pckbc_poll_cmd(t, PCKBC_AUX_SLOT, cmd, sizeof cmd,
+   0, NULL, 1);
+   pckbc_slot_enable(t, PCKBC_AUX_SLOT, 0);
}
return (found);
 }




Index: pckbd.c
===
RCS file: /cvs/src/sys/dev/pckbc/pckbd.c,v
retrieving revision 1.38
diff -u -p -u -r1.38 pckbd.c
--- pckbd.c 24 Jul 2014 22:38:19 -  1.38
+++ pckbd.c 11 Feb 2015 04:57:35 -
@@ -79,6 +79,7 @@
 #include dev/ic/pckbcvar.h
 #include dev/pckbc/pckbdreg.h
 #include dev/pckbc/pckbdvar.h
+#include dev/pckbc/pmsreg.h
 
 #include dev/wscons/wsconsio.h
 #include dev/wscons/wskbdvar.h
@@ -1033,6 +1034,8 @@ pckbd_cnpollc(void *v, int on)
/* Just to be sure. */
cmd[0] = KBC_ENABLE;
pckbc_poll_cmd(t-t_kbctag, PCKBC_KBD_SLOT, cmd, 1, 0, NULL, 0);
+   cmd[0] = PMS_RESET;
+   pckbc_poll_cmd(t-t_kbctag, PCKBC_AUX_SLOT, cmd, 1, 0, NULL, 0);
}
 }
 



Re: keyboard and mouse problems

2015-03-12 Thread Carlin Bingham
On Thu, 12 Mar 2015, at 04:11 AM, Theo de Raadt wrote:
 Two related problems regarding mice and keyboards came to my attention
 during s2k15 in Brisbane and I worked with jcs@ on solutions.
 
 The first problem is some newer machines (such as the thinkpad x1)
 have keyboard repeat or stuttering during install -- this issue only
 happes on the RAMDISK kernel.  Eventually we figured out that this is
 due to the large touchpad!  Even a light brush against it would mess
 up the pckbc driver subtly, causing 10 second pauses.  This happens
 because the RAMDISK media lacks the pms driver.
 

Had a similar problem with the ramdisk kernel on my Thinkpad T440p; any
slight bump of the nipple mouse in the centre of the keyboard would
cause the keyboard to start repeating characters.

With this patch applied the problem goes away.

Thanks a lot :-)


dmesg, in case it's useful to see the hardware I tested it on:


OpenBSD 5.7-current (GENERIC.MP) #6: Fri Mar 13 04:30:46 NZDT 2015
car...@vorpal.my.domain:/usr/src/sys/arch/amd64/compile/GENERIC.MP
real mem = 16835846144 (16055MB)
avail mem = 16321662976 (15565MB)
mpath0 at root
scsibus0 at mpath0: 256 targets
mainbus0 at root
bios0 at mainbus0: SMBIOS rev. 2.7 @ 0xacd3d000 (66 entries)
bios0: vendor LENOVO version GLET70WW (2.24 ) date 05/21/2014
bios0: LENOVO 20ANCTO1WW
acpi0 at bios0: rev 2
acpi0: sleep states S0 S3 S4 S5
acpi0: tables DSDT FACP DBGP ECDT HPET APIC MCFG SSDT SSDT SSDT SSDT
SSDT SSDT SSDT PCCT SSDT TCPA UEFI MSDM ASF! BATB FPDT UEFI
acpi0: wakeup devices LID_(S4) SLPB(S3) IGBE(S4) EXP2(S4) EXP3(S4)
XHCI(S3) EHC1(S3) EHC2(S3)
acpitimer0 at acpi0: 3579545 Hz, 24 bits
acpiec0 at acpi0
acpihpet0 at acpi0: 14318179 Hz
acpimadt0 at acpi0 addr 0xfee0: PC-AT compat
cpu0 at mainbus0: apid 0 (boot processor)
cpu0: Intel(R) Core(TM) i7-4710MQ CPU @ 2.50GHz, 2494.55 MHz
cpu0:
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,EST,TM2,SSSE3,FMA3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,MOVBE,POPCNT,DEADLINE,AES,XSAVE,AVX,F16C,RDRAND,NXE,PAGE1GB,LONG,LAHF,ABM,PERF,ITSC,FSGSBASE,BMI1,AVX2,SMEP,BMI2,ERMS,INVPCID
cpu0: 256KB 64b/line 8-way L2 cache
cpu0: smt 0, core 0, package 0
mtrr: Pentium Pro MTRR support, 10 var ranges, 88 fixed ranges
cpu0: apic clock running at 99MHz
cpu0: mwait min=64, max=64, C-substates=0.2.1.2.4, IBE
cpu1 at mainbus0: apid 1 (application processor)
cpu1: Intel(R) Core(TM) i7-4710MQ CPU @ 2.50GHz, 2494.22 MHz
cpu1:
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,EST,TM2,SSSE3,FMA3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,MOVBE,POPCNT,DEADLINE,AES,XSAVE,AVX,F16C,RDRAND,NXE,PAGE1GB,LONG,LAHF,ABM,PERF,ITSC,FSGSBASE,BMI1,AVX2,SMEP,BMI2,ERMS,INVPCID
cpu1: 256KB 64b/line 8-way L2 cache
cpu1: smt 1, core 0, package 0
cpu2 at mainbus0: apid 2 (application processor)
cpu2: Intel(R) Core(TM) i7-4710MQ CPU @ 2.50GHz, 2494.22 MHz
cpu2:
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,EST,TM2,SSSE3,FMA3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,MOVBE,POPCNT,DEADLINE,AES,XSAVE,AVX,F16C,RDRAND,NXE,PAGE1GB,LONG,LAHF,ABM,PERF,ITSC,FSGSBASE,BMI1,AVX2,SMEP,BMI2,ERMS,INVPCID
cpu2: 256KB 64b/line 8-way L2 cache
cpu2: smt 0, core 1, package 0
cpu3 at mainbus0: apid 3 (application processor)
cpu3: Intel(R) Core(TM) i7-4710MQ CPU @ 2.50GHz, 2494.23 MHz
cpu3:
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,EST,TM2,SSSE3,FMA3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,MOVBE,POPCNT,DEADLINE,AES,XSAVE,AVX,F16C,RDRAND,NXE,PAGE1GB,LONG,LAHF,ABM,PERF,ITSC,FSGSBASE,BMI1,AVX2,SMEP,BMI2,ERMS,INVPCID
cpu3: 256KB 64b/line 8-way L2 cache
cpu3: smt 1, core 1, package 0
cpu4 at mainbus0: apid 4 (application processor)
cpu4: Intel(R) Core(TM) i7-4710MQ CPU @ 2.50GHz, 2494.22 MHz
cpu4:
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,EST,TM2,SSSE3,FMA3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,MOVBE,POPCNT,DEADLINE,AES,XSAVE,AVX,F16C,RDRAND,NXE,PAGE1GB,LONG,LAHF,ABM,PERF,ITSC,FSGSBASE,BMI1,AVX2,SMEP,BMI2,ERMS,INVPCID
cpu4: 256KB 64b/line 8-way L2 cache
cpu4: smt 0, core 2, package 0
cpu5 at mainbus0: apid 5 (application processor)
cpu5: Intel(R) Core(TM) i7-4710MQ CPU @ 2.50GHz, 2494.23 MHz
cpu5:
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,EST,TM2,SSSE3,FMA3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,MOVBE,POPCNT,DEADLINE,AES,XSAVE,AVX,F16C,RDRAND,NXE,PAGE1GB,LONG,LAHF,ABM,PERF,ITSC,FSGSBASE,BMI1,AVX2,SMEP,BMI2,ERMS,INVPCID
cpu5: 256KB 64b/line 8-way L2 cache
cpu5: smt 1, core 2, package 0