usb : usb_kbd : Populating 'priv' member of USB keyboard device_t structure
PATCH 1/1 usb : usb_kbd : Populating 'priv' member of USB keyboard device_t structure
This patch populates the 'priv' field of the USB keyboard device_t structure. The 'priv' field is populated with the address of the 'struct usb_device' structure that represents the USB device.
The 'priv' field can then be used in the 'usb_event_poll' function to determine the USB device that requires to be polled. An example of its usage in 'usb_event_poll' function is as below.
device_t *dev;
struct usb_device *usb_kbd_dev;
<snip>
dev = device_get_by_name("usbkbd");
usb_kbd_dev = (struct usb_device *)dev->priv;
iface = &usb_kbd_dev->config.if_desc[0];--- common/usb_kbd.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
common/usb_kbd.c +1 -0
@@ -183,6 +183,7 @@ int drv_usb_kbd_init(void) usb_kbd_dev.puts =NULL ; usb_kbd_dev.getc = usb_kbd_getc; usb_kbd_dev.tstc = usb_kbd_testc; + usb_kbd_dev.priv = (void *)dev; error =device_register (&usb_kbd_dev);if (error==0 ) {/* check if this is the standard input device */
Signature · 1 line
1.5.6
PATCH 1/1 usb : usb_kbd : Populating 'priv' member of USB keyboard device_t structure
Hello Thomas,
2009/1/4 Thomas Abraham <[email protected]>:
Quoted 17 lines
This patch populates the 'priv' field of the USB keyboard
device_tstructure. The 'priv' field is populated with the address of the 'structusb_device' structure that represents the USB device.The 'priv' field can then be used in the '
usb_event_poll' function to determine the USB device that requires to be polled. An example of its usage in 'usb_event_poll' function is as below.device_t *dev; struct usb_device *usb_kbd_dev; <snip> dev = device_get_by_name("usbkbd"); usb_kbd_dev = (struct usb_device *)dev->priv; iface = &usb_kbd_dev->config.if_desc[0];
Quoted 4 lines
Signed-off-by Thomas Abraham <[email protected]>--- common/usb_kbd.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
I applied this patch to the u-boot-usb 'testing' branch. When it compiles properly and no regressions are being detected, I move it to the 'next' branch for the next U-boot release.
Thanks.
Remy
Quoted 21 lines
common/usb_kbd.c +1
-1@@ -183,6 +183,7 @@ int drv_usb_kbd_init(void) usb_kbd_dev.puts =NULL ; usb_kbd_dev.getc = usb_kbd_getc; usb_kbd_dev.tstc = usb_kbd_testc; + usb_kbd_dev.priv = (void *)dev; error =device_register (&usb_kbd_dev);if (error==0 ) {/* check if this is the standard input device */ --1.5.6
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot