--- ukbd.c.70r	2007-11-13 01:09:45.000000000 +0900
+++ ukbd.c	2008-06-20 08:37:31.000000000 +0900
@@ -1414,18 +1414,32 @@
 probe_keyboard(struct usb_attach_arg *uaa, int flags)
 {
 	usb_interface_descriptor_t *id;
+	void *desc;
+	int size;
 
 	if (!uaa->iface)	/* we attach to ifaces only */
 		return EINVAL;
 
-	/* Check that this is a keyboard that speaks the boot protocol. */
+	/* Get interface descriptor. */
 	id = usbd_get_interface_descriptor(uaa->iface);
-	if (id
-	    && id->bInterfaceClass == UICLASS_HID
-	    && id->bInterfaceSubClass == UISUBCLASS_BOOT
-	    && id->bInterfaceProtocol == UPROTO_BOOT_KEYBOARD)
+	if (!id || id->bInterfaceClass != UICLASS_HID)
+		return EINVAL;	/* Abort if non-HID device. */
+
+	/* Get report descriptor. */
+	if (usbd_read_report_desc(uaa->iface, &desc, &size, M_TEMP))
+		return EINVAL;	/* HID device must have a report descriptor. */
+
+	/* Check the report descriptor contain a Usage Page (Keyboard). */
+	if (hid_locate(desc, size, HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_KEYBOARD), hid_collection, 0, 0))
 		return 0;	/* found it */
 
+	/* Check that this is a keyboard that speaks the boot protocol. */
+	if (   id->bInterfaceSubClass == UISUBCLASS_BOOT
+	    && id->bInterfaceProtocol == UPROTO_BOOT_KEYBOARD) {
+		printf("ukbd: It's HID boot keyboard, but new process miss it. Please report it!\n");
+		return 0;	/* rescue it by quirk process(-o-) */
+	}
+
 	return EINVAL;
 }
 
--- hid.c.70r	2007-06-20 14:10:52.000000000 +0900
+++ hid.c	2008-06-20 07:08:15.000000000 +0900
@@ -410,7 +410,8 @@
 		}
 	}
 	hid_end_parse(d);
-	loc->size = 0;
+	if (loc != NULL)
+		loc->size = 0;
 	return (0);
 }
 

