SAMA5 + HID Keyboard. Fixes to initialize the HID keyboard class

This commit is contained in:
Gregory Nutt
2013-09-20 15:23:00 -06:00
parent 34804c8ee7
commit 60bd791dec
2 changed files with 25 additions and 7 deletions
+19 -1
View File
@@ -309,7 +309,9 @@ int sam_usbhost_initialize(void)
int ret; int ret;
/* First, register all of the class drivers needed to support the drivers /* First, register all of the class drivers needed to support the drivers
* that we care about: * that we care about
*
* Register theUSB host Mass Storage Class:
*/ */
ret = usbhost_storageinit(); ret = usbhost_storageinit();
@@ -318,6 +320,22 @@ int sam_usbhost_initialize(void)
udbg("ERROR: Failed to register the mass storage class: %d\n", ret); udbg("ERROR: Failed to register the mass storage class: %d\n", ret);
} }
/* Register the USB host HID keyboard class driver */
ret = usbhost_kbdinit();
if (ret != OK)
{
udbg("ERROR: Failed to register the KBD class\n");
}
/* Then get an instance of the USB host interface.
*
* REVISIT: This logic needs to be modified. There must be a call-out to
* platform specific logic to get the connection hangle. usbhost_initialize()
* is not longer common to all platforms and is no longer prototyped in
* include/nuttx/usb/usbhost.h.
*/
#ifdef CONFIG_SAMA5_OHCI #ifdef CONFIG_SAMA5_OHCI
/* Get an instance of the USB OHCI interface */ /* Get an instance of the USB OHCI interface */
+6 -6
View File
@@ -354,7 +354,7 @@ static int usbhost_poll(FAR struct file *filep, FAR struct pollfd *fds,
* device. * device.
*/ */
static const const struct usbhost_id_s g_id = static const const struct usbhost_id_s g_hidkbd_id =
{ {
USB_CLASS_HID, /* base */ USB_CLASS_HID, /* base */
USBHID_SUBCLASS_BOOTIF, /* subclass */ USBHID_SUBCLASS_BOOTIF, /* subclass */
@@ -365,15 +365,15 @@ static const const struct usbhost_id_s g_id =
/* This is the USB host storage class's registry entry */ /* This is the USB host storage class's registry entry */
static struct usbhost_registry_s g_skeleton = static struct usbhost_registry_s g_hidkbd =
{ {
NULL, /* flink */ NULL, /* flink */
usbhost_create, /* create */ usbhost_create, /* create */
1, /* nids */ 1, /* nids */
&g_id /* id[] */ &g_hidkbd_id /* id[] */
}; };
static const struct file_operations usbhost_fops = static const struct file_operations g_hidkbd_fops =
{ {
usbhost_open, /* open */ usbhost_open, /* open */
usbhost_close, /* close */ usbhost_close, /* close */
@@ -1598,7 +1598,7 @@ static inline int usbhost_devinit(FAR struct usbhost_state_s *priv)
uvdbg("Register driver\n"); uvdbg("Register driver\n");
usbhost_mkdevname(priv, devname); usbhost_mkdevname(priv, devname);
ret = register_driver(devname, &usbhost_fops, 0666, priv); ret = register_driver(devname, &g_hidkbd_fops, 0666, priv);
/* We now have to be concerned about asynchronous modification of crefs /* We now have to be concerned about asynchronous modification of crefs
* because the driver has been registerd. * because the driver has been registerd.
@@ -2350,7 +2350,7 @@ int usbhost_kbdinit(void)
/* Advertise our availability to support (certain) devices */ /* Advertise our availability to support (certain) devices */
return usbhost_registerclass(&g_skeleton); return usbhost_registerclass(&g_hidkbd);
} }
#endif /* CONFIG_USBHOST)&& !CONFIG_USBHOST_INT_DISABLE && CONFIG_NFILE_DESCRIPTORS */ #endif /* CONFIG_USBHOST)&& !CONFIG_USBHOST_INT_DISABLE && CONFIG_NFILE_DESCRIPTORS */