Changeset 291b8bc in mainline for uspace/drv/usbkbd/kbdrepeat.h
- Timestamp:
- 2011-03-26T13:28:43Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- f62468c
- Parents:
- 889e8e3 (diff), c9f5e238 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/usbkbd/kbdrepeat.h
r889e8e3 r291b8bc 1 1 /* 2 * Copyright (c) 2010 Vojtech Horky3 2 * Copyright (c) 2011 Lubos Slovak 4 3 * All rights reserved. … … 31 30 * @{ 32 31 */ 33 /** 34 * @file 35 * Main routines of USB HID driver. 32 /** @file 33 * USB HID keyboard autorepeat facilities 36 34 */ 37 35 38 #include <ddf/driver.h> 39 #include <usb/debug.h> 40 #include <errno.h> 41 #include <str_error.h> 36 #ifndef USB_KBDREPEAT_H_ 37 #define USB_KBDREPEAT_H_ 42 38 43 #include "kbddev.h" 39 struct usb_kbd_t; 40 41 /*----------------------------------------------------------------------------*/ 42 /** 43 * Structure for keeping information needed for auto-repeat of keys. 44 */ 45 typedef struct { 46 /** Last pressed key. */ 47 unsigned int key_new; 48 /** Key to be repeated. */ 49 unsigned int key_repeated; 50 /** Delay before first repeat in microseconds. */ 51 unsigned int delay_before; 52 /** Delay between repeats in microseconds. */ 53 unsigned int delay_between; 54 } usb_kbd_repeat_t; 44 55 45 56 /*----------------------------------------------------------------------------*/ 46 57 47 #define NAME "usbhid" 58 int usb_kbd_repeat_fibril(void *arg); 48 59 49 /*----------------------------------------------------------------------------*/ 50 /** 51 * Callback for passing a new device to the driver. 52 * 53 * @note Currently, only boot-protocol keyboards are supported by this driver. 54 * 55 * @param dev Structure representing the new device. 56 * 57 * @retval EOK if successful. 58 * @retval EREFUSED if the device is not supported. 59 */ 60 static int usbhid_add_device(ddf_dev_t *dev) 61 { 62 usb_log_debug("usbhid_add_device()\n"); 63 64 int rc = usbhid_kbd_try_add_device(dev); 65 66 if (rc != EOK) { 67 usb_log_warning("Device is not a supported keyboard.\n"); 68 usb_log_error("Failed to add HID device: %s.\n", 69 str_error(rc)); 70 return rc; 71 } 72 73 usb_log_info("Keyboard `%s' ready to use.\n", dev->name); 60 void usb_kbd_repeat_start(struct usb_kbd_t *kbd, unsigned int key); 74 61 75 return EOK; 76 } 62 void usb_kbd_repeat_stop(struct usb_kbd_t *kbd, unsigned int key); 77 63 78 /*----------------------------------------------------------------------------*/ 79 80 static driver_ops_t kbd_driver_ops = { 81 .add_device = usbhid_add_device, 82 }; 83 84 /*----------------------------------------------------------------------------*/ 85 86 static driver_t kbd_driver = { 87 .name = NAME, 88 .driver_ops = &kbd_driver_ops 89 }; 90 91 /*----------------------------------------------------------------------------*/ 92 93 int main(int argc, char *argv[]) 94 { 95 printf(NAME ": HelenOS USB HID driver.\n"); 96 97 usb_log_enable(USB_LOG_LEVEL_DEFAULT, NAME); 98 99 return ddf_driver_main(&kbd_driver); 100 } 64 #endif /* USB_KBDREPEAT_H_ */ 101 65 102 66 /**
Note:
See TracChangeset
for help on using the changeset viewer.