diff mbox series

Input: i8042 - disable KBD port on Late-2016 Razer Blade Stealth

Message ID 20190407213735.10658-1-lyude@redhat.com (mailing list archive)
State New, archived
Headers show
Series Input: i8042 - disable KBD port on Late-2016 Razer Blade Stealth | expand

Commit Message

Lyude Paul April 7, 2019, 9:37 p.m. UTC
The late 2016 model of the Razer Blade Stealth has a built-in USB
keyboard, but for some reason the BIOS exposes an i8042 controller with
a connected KBD port. While this fake AT Keyboard device doesn't appear
to report any events, attempting to change the state of the caps lock
LED on it from on to off causes the entire system to hang.

So, introduce a quirk table for disabling keyboard probing by default,
i8042_dmi_nokbd_table, and add this specific model of Razer laptop to
that table.

Signed-off-by: Lyude Paul <lyude@redhat.com>
Cc: stable@vger.kernel.org
---
 drivers/input/serio/i8042-x86ia64io.h | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

Comments

Dmitry Torokhov April 7, 2019, 10:10 p.m. UTC | #1
Hi Lyude,

On Sun, Apr 07, 2019 at 05:37:34PM -0400, Lyude Paul wrote:
> The late 2016 model of the Razer Blade Stealth has a built-in USB
> keyboard, but for some reason the BIOS exposes an i8042 controller with
> a connected KBD port. While this fake AT Keyboard device doesn't appear
> to report any events, attempting to change the state of the caps lock
> LED on it from on to off causes the entire system to hang.
> 
> So, introduce a quirk table for disabling keyboard probing by default,
> i8042_dmi_nokbd_table, and add this specific model of Razer laptop to
> that table.

What does dmesg show about i8042 for this device? Especially line "PNP:
PS/2 Controller  ..."?

Thanks.
Lyude Paul April 7, 2019, 10:54 p.m. UTC | #2
On Sun, 2019-04-07 at 15:10 -0700, Dmitry Torokhov wrote:
> Hi Lyude,
> 
> On Sun, Apr 07, 2019 at 05:37:34PM -0400, Lyude Paul wrote:
> > The late 2016 model of the Razer Blade Stealth has a built-in USB
> > keyboard, but for some reason the BIOS exposes an i8042 controller with
> > a connected KBD port. While this fake AT Keyboard device doesn't appear
> > to report any events, attempting to change the state of the caps lock
> > LED on it from on to off causes the entire system to hang.
> > 
> > So, introduce a quirk table for disabling keyboard probing by default,
> > i8042_dmi_nokbd_table, and add this specific model of Razer laptop to
> > that table.
> 
> What does dmesg show about i8042 for this device? Especially line "PNP:
> PS/2 Controller  ..."?
> 

Apr 07 18:42:46 malachite kernel: i8042: PNP: No PS/2 controller found.
Apr 07 18:42:46 malachite kernel: i8042: Probing ports directly.
Apr 07 18:42:46 malachite kernel: serio: i8042 KBD port at 0x60,0x64 irq 1
Apr 07 18:42:46 malachite kernel: serio: i8042 AUX port at 0x60,0x64 irq 12
Apr 07 18:42:46 malachite kernel: mousedev: PS/2 mouse device common for all
mice
Apr 07 18:42:46 malachite kernel: rtc_cmos 00:01: RTC can wake from S4
Apr 07 18:42:46 malachite kernel: rtc_cmos 00:01: registered as rtc0
Apr 07 18:42:46 malachite kernel: rtc_cmos 00:01: alarms up to one month, y3k,
242 bytes nvram, hpet irqs
Apr 07 18:42:46 malachite kernel: device-mapper: uevent: version 1.0.3
Apr 07 18:42:46 malachite kernel: device-mapper: ioctl: 4.39.0-ioctl (2018-04-
03) initialised: dm-devel@redhat.com
Apr 07 18:42:46 malachite kernel: intel_pstate: Intel P-state driver
initializing
Apr 07 18:42:46 malachite kernel: intel_pstate: HWP enabled
Apr 07 18:42:46 malachite kernel: hidraw: raw HID events driver (C) Jiri
Kosina
Apr 07 18:42:46 malachite kernel: usbcore: registered new interface driver
usbhid
Apr 07 18:42:46 malachite kernel: usbhid: USB HID core driver
Apr 07 18:42:46 malachite kernel: intel_pmc_core:  initialized
Apr 07 18:42:46 malachite kernel: drop_monitor: Initializing network drop
monitor service
Apr 07 18:42:46 malachite kernel: Initializing XFRM netlink socket
Apr 07 18:42:46 malachite kernel: NET: Registered protocol family 10
Apr 07 18:42:46 malachite kernel: Segment Routing with IPv6
Apr 07 18:42:46 malachite kernel: mip6: Mobile IPv6
Apr 07 18:42:46 malachite kernel: NET: Registered protocol family 17
Apr 07 18:42:46 malachite kernel: RAS: Correctable Errors collector
initialized.
Apr 07 18:42:46 malachite kernel: microcode: sig=0x806e9, pf=0x80,
revision=0x8e
Apr 07 18:42:46 malachite kernel: microcode: Microcode Update Driver: v2.2.
Apr 07 18:42:46 malachite kernel: AVX2 version of gcm_enc/dec engaged.
Apr 07 18:42:46 malachite kernel: AES CTR mode by8 optimization enabled
Apr 07 18:42:46 malachite kernel: battery: ACPI: Battery Slot [BAT0] (battery
present)
Apr 07 18:42:46 malachite kernel: sched_clock: Marking stable (1166896928,
-586991)->(1172494398, -6184461)
Apr 07 18:42:46 malachite kernel: registered taskstats version 1
Apr 07 18:42:46 malachite kernel: Loading compiled-in X.509 certificates
Apr 07 18:42:46 malachite kernel: Loaded X.509 cert 'Fedora kernel signing
key: eb55b2be431426c78789899a96d617d82132041e'
Apr 07 18:42:46 malachite kernel: zswap: loaded using pool lzo/zbud
Apr 07 18:42:46 malachite kernel: Key type big_key registered
Apr 07 18:42:46 malachite kernel: Key type encrypted registered
Apr 07 18:42:46 malachite kernel: integrity: Loading X.509 certificate:
UEFI:db
Apr 07 18:42:46 malachite kernel: integrity: Loaded X.509 cert 'Microsoft
Corporation UEFI CA 2011: 13adbf4309bd82709c8cd54f316ed522988a1bd4'
Apr 07 18:42:46 malachite kernel: integrity: Loading X.509 certificate:
UEFI:db
Apr 07 18:42:46 malachite kernel: integrity: Loaded X.509 cert 'Microsoft
Windows Production PCA 2011: a92902398e16c49778cd90f99e4f9ae17c55af53'
Apr 07 18:42:46 malachite kernel: ima: Allocated hash algorithm: sha1
Apr 07 18:42:46 malachite kernel: input: AT Raw Set 2 keyboard as
/devices/platform/i8042/serio0/input/input4

Also: After doing a bit more research on wikipedia I just noticed that
this laptop is actually a late 2017 model, so I'll respond with a respun
patch in just a sec.

> Thanks.
>
David Laight April 8, 2019, 9:55 a.m. UTC | #3
From: Lyude Paul
> Sent: 07 April 2019 23:55
> On Sun, 2019-04-07 at 15:10 -0700, Dmitry Torokhov wrote:
> > Hi Lyude,
> >
> > On Sun, Apr 07, 2019 at 05:37:34PM -0400, Lyude Paul wrote:
> > > The late 2016 model of the Razer Blade Stealth has a built-in USB
> > > keyboard, but for some reason the BIOS exposes an i8042 controller with
> > > a connected KBD port. While this fake AT Keyboard device doesn't appear
> > > to report any events, attempting to change the state of the caps lock
> > > LED on it from on to off causes the entire system to hang.
> > >
> > > So, introduce a quirk table for disabling keyboard probing by default,
> > > i8042_dmi_nokbd_table, and add this specific model of Razer laptop to
> > > that table.
> >
> > What does dmesg show about i8042 for this device? Especially line "PNP:
> > PS/2 Controller  ..."?
> >
> 
> Apr 07 18:42:46 malachite kernel: i8042: PNP: No PS/2 controller found.
> Apr 07 18:42:46 malachite kernel: i8042: Probing ports directly.
> Apr 07 18:42:46 malachite kernel: serio: i8042 KBD port at 0x60,0x64 irq 1
> Apr 07 18:42:46 malachite kernel: serio: i8042 AUX port at 0x60,0x64 irq 12
> Apr 07 18:42:46 malachite kernel: mousedev: PS/2 mouse device common for all mice

That is the 'default' probe of the ps/2 serial ports.
Looks like the BIOS is correct in not exposing the ps/2 controller.
Usually they just fail to expose the mouse when it needs a ps/2 splitter :-(

I do wonder what they've connected it to though.
It is extremely unlikely they've found an x86 chipset that doesn't
have the ps/2 serial ports at the standard io addresses.

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
Dmitry Torokhov July 16, 2019, 8:28 p.m. UTC | #4
On Mon, Apr 08, 2019 at 09:55:00AM +0000, David Laight wrote:
> From: Lyude Paul
> > Sent: 07 April 2019 23:55
> > On Sun, 2019-04-07 at 15:10 -0700, Dmitry Torokhov wrote:
> > > Hi Lyude,
> > >
> > > On Sun, Apr 07, 2019 at 05:37:34PM -0400, Lyude Paul wrote:
> > > > The late 2016 model of the Razer Blade Stealth has a built-in USB
> > > > keyboard, but for some reason the BIOS exposes an i8042 controller with
> > > > a connected KBD port. While this fake AT Keyboard device doesn't appear
> > > > to report any events, attempting to change the state of the caps lock
> > > > LED on it from on to off causes the entire system to hang.
> > > >
> > > > So, introduce a quirk table for disabling keyboard probing by default,
> > > > i8042_dmi_nokbd_table, and add this specific model of Razer laptop to
> > > > that table.
> > >
> > > What does dmesg show about i8042 for this device? Especially line "PNP:
> > > PS/2 Controller  ..."?
> > >
> > 
> > Apr 07 18:42:46 malachite kernel: i8042: PNP: No PS/2 controller found.
> > Apr 07 18:42:46 malachite kernel: i8042: Probing ports directly.
> > Apr 07 18:42:46 malachite kernel: serio: i8042 KBD port at 0x60,0x64 irq 1
> > Apr 07 18:42:46 malachite kernel: serio: i8042 AUX port at 0x60,0x64 irq 12
> > Apr 07 18:42:46 malachite kernel: mousedev: PS/2 mouse device common for all mice
> 
> That is the 'default' probe of the ps/2 serial ports.
> Looks like the BIOS is correct in not exposing the ps/2 controller.
> Usually they just fail to expose the mouse when it needs a ps/2 splitter :-(
> 
> I do wonder what they've connected it to though.
> It is extremely unlikely they've found an x86 chipset that doesn't
> have the ps/2 serial ports at the standard io addresses.

I wonder if it is time to start trusting BIOS if it was released maybe
in Win7+ timeframe?

Thanks.
diff mbox series

Patch

diff --git a/drivers/input/serio/i8042-x86ia64io.h b/drivers/input/serio/i8042-x86ia64io.h
index 136f6e7bf797..888f5f6feebf 100644
--- a/drivers/input/serio/i8042-x86ia64io.h
+++ b/drivers/input/serio/i8042-x86ia64io.h
@@ -884,6 +884,22 @@  static const struct dmi_system_id __initconst i8042_dmi_kbdreset_table[] = {
 	{ }
 };
 
+static const struct dmi_system_id i8042_dmi_nokbd_table[] __initconst = {
+	{
+		/*
+		 * Razer Blade Stealth (Late 2016 model) - Keyboard is on USB
+		 * but the system exposes a fake AT keyboard that crashes the
+		 * system if the caps lock LED is changed
+		 */
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "Razer"),
+			DMI_MATCH(DMI_PRODUCT_NAME, "Blade Stealth"),
+			DMI_MATCH(DMI_PRODUCT_VERSION, "2.04"),
+		},
+	},
+	{ }
+};
+
 #endif /* CONFIG_X86 */
 
 #ifdef CONFIG_PNP
@@ -1040,6 +1056,9 @@  static int __init i8042_pnp_init(void)
 #ifdef CONFIG_X86
 	if (dmi_check_system(i8042_dmi_nopnp_table))
 		i8042_nopnp = true;
+
+	if (dmi_check_system(i8042_dmi_nokbd_table))
+		i8042_nokbd = true;
 #endif
 
 	if (i8042_nopnp) {