hid: Add and detect a FIDO U2F HID group

This implements detection according to:

http://www.usb.org/developers/hidpage/HUTRR48.pdf

I haven't figured out the distinction between the parse and scan
stages, so I'm not sure I put the logic in the right place.

Signed-off-by: Andy Lutomirski <luto@amacapital.net>
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 3402033..71d1b75 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -702,6 +702,13 @@
 	if (((parser->global.usage_page << 16) == HID_UP_SENSOR) &&
 	    type == HID_COLLECTION_PHYSICAL)
 		hid->group = HID_GROUP_SENSOR_HUB;
+
+	if (parser->local.usage_index) {
+		u32 usage = (parser->global.usage_page << 16) |
+			parser->local.usage[parser->local.usage_index - 1];
+		if (type == HID_COLLECTION_APPLICATION && usage == HID_FIDO_U2F)
+			hid->group = HID_GROUP_FIDO_U2F;
+	}
 }
 
 static int hid_scan_main(struct hid_parser *parser, struct hid_item *item)
diff --git a/include/linux/hid.h b/include/linux/hid.h
index 78ea9bf..a631a03 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -162,6 +162,7 @@
 #define HID_UP_CONSUMER		0x000c0000
 #define HID_UP_DIGITIZER	0x000d0000
 #define HID_UP_PID		0x000f0000
+#define HID_UP_FIDO		0xf1d00000
 #define HID_UP_HPVENDOR         0xff7f0000
 #define HID_UP_HPVENDOR2        0xff010000
 #define HID_UP_MSVENDOR		0xff000000
@@ -245,6 +246,8 @@
 #define HID_DG_BARRELSWITCH2	0x000d005a
 #define HID_DG_TOOLSERIALNUMBER	0x000d005b
 
+#define HID_FIDO_U2F		0xf1d00001
+
 /*
  * HID report types --- Ouch! HID spec says 1 2 3!
  */
@@ -307,6 +310,7 @@
 #define HID_GROUP_MULTITOUCH			0x0002
 #define HID_GROUP_SENSOR_HUB			0x0003
 #define HID_GROUP_MULTITOUCH_WIN_8		0x0004
+#define HID_GROUP_FIDO_U2F			0x0005
 
 /*
  * Vendor specific HID device groups