Bug 64811 - Microsoft Surface type cover 2 assigned to hid-multitouch, "No inputs registered"
Summary: Microsoft Surface type cover 2 assigned to hid-multitouch, "No inputs registe...
Status: RESOLVED CODE_FIX
Alias: None
Product: Drivers
Classification: Unclassified
Component: Input Devices (show other bugs)
Hardware: x86-64 Linux
: P1 normal
Assignee: drivers_input-devices
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-11-11 17:17 UTC by David Staer
Modified: 2014-03-24 19:51 UTC (History)
5 users (show)

See Also:
Kernel Version: 3.11.0-12-generic
Tree: Mainline
Regression: No


Attachments
[PATCH] Add Type Cover 2 ID to hid-microsoft (1.41 KB, patch)
2013-12-16 19:28 UTC, Reyad Attiyat
Details | Diff
Type Cover 2 Report List (74.59 KB, text/plain)
2013-12-20 08:54 UTC, Reyad Attiyat
Details
Add Type and Touch Cover 2 IDs to hid-microsoft (1.18 KB, patch)
2014-01-20 18:06 UTC, David Staer
Details | Diff

Description David Staer 2013-11-11 17:17:54 UTC
In previous kernel v3.4.66, this device was assigned to generic-usb:
[   61.954231] usb 2-3: USB disconnect, device number 4
[   61.960162] ACPI Error: [\SB__.IADP] Namespace lookup failure, AE_NOT_FOUND (20120320/psargs-359)
[   61.960182] ACPI Error: Method parse/execution failed [\_SB_.PCI0.LPCB.EC0_._Q41] (Node ffff880119a96438), AE_NOT_FOUND (20120320/psparse-536)
[   62.324511] usb 2-3: new full-speed USB device number 11 using xhci_hcd
[   62.337459] usb 2-3: New USB device found, idVendor=045e, idProduct=07a9
[   62.337469] usb 2-3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[   62.337474] usb 2-3: Product: SAM
[   62.337478] usb 2-3: Manufacturer: MICROSOFT
[   62.337482] usb 2-3: SerialNumber: 0.1.0000
[   62.342602] generic-usb 0003:045E:07A9.000A: logical range invalid 0 -1
[   62.342630] generic-usb 0003:045E:07A9.000A: item 0 1 0 11 parsing failed
[   62.342660] generic-usb: probe of 0003:045E:07A9.000A failed with error -22
[   62.345318] input: MICROSOFT SAM as /devices/pci0000:00/0000:00:14.0/usb2/2-3/2-3:1.1/input/input9
[   62.345710] generic-usb 0003:045E:07A9.000B: input,hidraw0: USB HID v1.11 Keyboard [MICROSOFT SAM] on usb-0000:00:14.0-3/input1
[   62.349718] input: MICROSOFT SAM as /devices/pci0000:00/0000:00:14.0/usb2/2-3/2-3:1.2/input/input10
[   62.350018] generic-usb 0003:045E:07A9.000C: input,hiddev0,hidraw7: USB HID v1.11 Keyboard [MICROSOFT SAM] on usb-0000:00:14.0-3/input2

In newer kernel v3.11.0:
[  124.249057] usb 2-3: USB disconnect, device number 5
[  124.259049] ACPI Error: [\SB__.IADP] Namespace lookup failure, AE_NOT_FOUND (20130517/psargs-359)
[  124.259072] ACPI Error: Method parse/execution failed [\_SB_.PCI0.LPCB.EC0_._Q41] (Node ffff880119ab1438), AE_NOT_FOUND (20130517/psparse-536)
[  124.619306] usb 2-3: new full-speed USB device number 12 using xhci_hcd
[  124.637245] usb 2-3: New USB device found, idVendor=045e, idProduct=07a9
[  124.637255] usb 2-3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[  124.637260] usb 2-3: Product: SAM
[  124.637264] usb 2-3: Manufacturer: MICROSOFT
[  124.637268] usb 2-3: SerialNumber: 0.1.0000
[  124.650270] input: MICROSOFT SAM as /devices/pci0000:00/0000:00:14.0/usb2/2-3/2-3:1.1/input/input18
[  124.650541] hid-generic 0003:045E:07A9.000B: input,hidraw1: USB HID v1.11 Keyboard [MICROSOFT SAM] on usb-0000:00:14.0-3/input1
[  124.654093] hid-multitouch 0003:045E:07A9.000C: HID_DG_INPUTMODE out of range
[  124.654151] hid-multitouch 0003:045E:07A9.000C: No inputs registered, leaving
[  124.654337] hid-multitouch 0003:045E:07A9.000C: hiddev0,hidraw8: USB HID v1.11 Keyboard [MICROSOFT SAM] on usb-0000:00:14.0-3/input2

HID device 0003:045E:07A9.000C does not register any inputs.

Forcing the device to register with hid-generic by patching "drivers/hid/hid-generic.c" (see http://ubuntuforums.org/showthread.php?t=2183946&page=2&p=12844865#post12844865) enables input again.
Comment 1 Alexandr Popolitov 2013-12-03 10:30:25 UTC
I also experience this bug on ArchLinux using 3.12.0 kernel
Comment 2 Reyad Attiyat 2013-12-16 19:23:56 UTC
Simple fix is to add the hardware id's to the hid-microsoft driver. I've attached a patch that will do this. I have tested it on 3.12 and 3.13. I'm curious as to why this patch works as I understand the type cover 2 uses a multitouch toucpad and maybe should be fixed in hid-multitouch. I still have issues with the type cover 2 even with this fix. It will randomly reset while typing. I have even seen it reset the computer while being attached. Pro tip to switch the to and from function keys hit Fn + Caps
Comment 3 Reyad Attiyat 2013-12-16 19:28:26 UTC
Created attachment 118671 [details]
[PATCH] Add Type Cover 2 ID to hid-microsoft
Comment 4 Reyad Attiyat 2013-12-20 08:54:43 UTC
Created attachment 119141 [details]
Type Cover 2 Report List

This is the output from file rdesc on debugfs for the Type Cover 2 USB keyboard
Comment 5 Reyad Attiyat 2013-12-20 09:38:48 UTC
After reading the report list of the keyboard it has the usage field Digitizers.ContactID on one of its input reports.

This causes the device to get placed in the MULTITOUCH group which in turn makes the hid driver use hid-multitouch driver. This driver does not deal with Keyboard and Mouse inputs.
Comment 6 joakim verona 2014-01-16 09:48:42 UTC
Is there some other workaround than patching the kernel?
At the moment I use a patched fedora kernel, but I havent found a way to automate builds of patched kernels on fedora, so its a bit tedious to keep it up to date.
Comment 7 Reyad Attiyat 2014-01-17 01:46:23 UTC
(In reply to joakim verona from comment #6)
> Is there some other workaround than patching the kernel?
Not that I know of. Usually hid drivers can unbind and bind to other drivers by using sysfs.This doesn't work.


[root@localhost reyad]# cd /sys/bus/hid/drivers/hid-multitouch
[root@localhost hid-multitouch]# ls
0003:03EB:8209.0006  0003:045E:07A9.0005  bind  module  new_id  uevent  unbind
[root@localhost hid-multitouch]# echo -n 0003\:045E\:07A9.0005 > unbind
[root@localhost hid-multitouch]# echo -n 0003\:045E\:07A9.0005 > ../hid-generic/bind
bash: echo: write error: No such device
[root@localhost hid-multitouch]# echo -n 0003\:045E\:07A9.0


I think this happens because the device is part of the HID_GROUP_MULTITOUCH and that device group is not compatible with hid-generic or hid-microsoft drivers.

> At the moment I use a patched fedora kernel, but I havent found a way to
> automate builds of patched kernels on fedora, so its a bit tedious to keep
> it up to date.

The way I manage patches against the kernel is with git. I clone the kernel from git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git

Its a couple commands to pull kernel updates, rebase patches, compile, install. This could be done in a shell script.

I'll try to push this patch upstream.I was waiting for someone to test it. Do you experience any issues with this keyboard under Linux?
Comment 8 joakim verona 2014-01-17 22:26:59 UTC
The patch works well.

The keyboard has some oddities, but I dont think thats the responsibilty of this patch. The function keys seem inversed, but that might be by design, I dont know.
The kbd also seems to consume power even when suspended.
Comment 9 David Staer 2014-01-20 18:06:25 UTC
Created attachment 122801 [details]
Add Type and Touch Cover 2 IDs to hid-microsoft

A minor addition to Reyad Attiyat's patch to hid-microsoft to include support for the Touch cover 2 as well, see comment #23 at http://ubuntuforums.org/showthread.php?t=2183946&p=12849525#post12849525 . I'm happy if you'd like to submit this (or just your's) upstream.
Comment 10 Reyad Attiyat 2014-01-21 00:43:44 UTC
Thank you for the HID of the Touch Cover 2. I will try and get the new patch upstream.
Comment 11 David Staer 2014-01-29 18:32:03 UTC
Thanks for submitting that Reyad.
Comment 12 Javier S. Pedro 2014-03-24 19:51:18 UTC
Note that under Windows this HID device is actually used as a multitouch device. By setting some feature bits (according to http://msdn.microsoft.com/en-us/library/windows/desktop/dn467314%28v=vs.85%29.aspx ) the device can be configured to start generating finger events (including tracking/contactID) instead of mouse. 

It may be interesting to use this device in multitouch mode in the future.

Note You need to log in before you can comment on or make changes to this bug.