Changeset 291b8bc in mainline for uspace/drv/usbkbd/kbddev.h


Ignore:
Timestamp:
2011-03-26T13:28:43Z (13 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
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.
Message:

Merge development/ changes

File:
1 moved

Legend:

Unmodified
Added
Removed
  • uspace/drv/usbkbd/kbddev.h

    r889e8e3 r291b8bc  
    3434 */
    3535
    36 #ifndef USBHID_KBDDEV_H_
    37 #define USBHID_KBDDEV_H_
     36#ifndef USB_KBDDEV_H_
     37#define USB_KBDDEV_H_
    3838
    3939#include <stdint.h>
     
    4545#include <ddf/driver.h>
    4646#include <usb/pipes.h>
     47#include <usb/devdrv.h>
    4748
    48 #include "hiddev.h"
     49#include "kbdrepeat.h"
    4950
    5051/*----------------------------------------------------------------------------*/
    51 /**
    52  * Structure for keeping information needed for auto-repeat of keys.
    53  */
    54 typedef struct {
    55         /** Last pressed key. */
    56         unsigned int key_new;
    57         /** Key to be repeated. */
    58         unsigned int key_repeated;
    59         /** Delay before first repeat in microseconds. */
    60         unsigned int delay_before;
    61         /** Delay between repeats in microseconds. */
    62         unsigned int delay_between;
    63 } usbhid_kbd_repeat_t;
    64 
    6552/**
    6653 * USB/HID keyboard device type.
     
    7562 *       being device-specific.
    7663 */
    77 typedef struct {
    78         /** Structure holding generic USB/HID device information. */
    79         usbhid_dev_t *hid_dev;
     64typedef struct usb_kbd_t {
     65        /** Structure holding generic USB device information. */
     66        //usbhid_dev_t *hid_dev;
     67        usb_device_t *usb_dev;
    8068       
    8169        /** Currently pressed keys (not translated to key codes). */
     
    9684       
    9785        /** Information for auto-repeat of keys. */
    98         usbhid_kbd_repeat_t repeat;
     86        usb_kbd_repeat_t repeat;
    9987       
    10088        /** Mutex for accessing the information about auto-repeat. */
    10189        fibril_mutex_t *repeat_mtx;
     90       
     91        /** Report descriptor. */
     92        uint8_t *report_desc;
     93
     94        /** Report descriptor size. */
     95        size_t report_desc_size;
     96
     97        /** HID Report parser. */
     98        usb_hid_report_parser_t *parser;
    10299       
    103100        /** State of the structure (for checking before use).
     
    108105         */
    109106        int initialized;
    110 } usbhid_kbd_t;
     107} usb_kbd_t;
    111108
    112109/*----------------------------------------------------------------------------*/
    113110
    114 int usbhid_kbd_try_add_device(ddf_dev_t *dev);
     111enum {
     112        USB_KBD_POLL_EP_NO = 0,
     113        USB_KBD_POLL_EP_COUNT = 1
     114};
    115115
    116 int usbhid_kbd_is_usable(const usbhid_kbd_t *kbd_dev);
     116usb_endpoint_description_t *usb_kbd_endpoints[USB_KBD_POLL_EP_COUNT + 1];
    117117
    118 void usbhid_kbd_free(usbhid_kbd_t **kbd_dev);
     118ddf_dev_ops_t keyboard_ops;
    119119
    120 void usbhid_kbd_push_ev(usbhid_kbd_t *kbd_dev, int type, unsigned int key);
     120/*----------------------------------------------------------------------------*/
    121121
    122 #endif /* USBHID_KBDDEV_H_ */
     122usb_kbd_t *usb_kbd_new(void);
     123
     124int usb_kbd_init(usb_kbd_t *kbd_dev, usb_device_t *dev);
     125
     126bool usb_kbd_polling_callback(usb_device_t *dev, uint8_t *buffer,
     127     size_t buffer_size, void *arg);
     128
     129void usb_kbd_polling_ended_callback(usb_device_t *dev, bool reason,
     130     void *arg);
     131
     132int usb_kbd_is_initialized(const usb_kbd_t *kbd_dev);
     133
     134int usb_kbd_is_ready_to_destroy(const usb_kbd_t *kbd_dev);
     135
     136void usb_kbd_free(usb_kbd_t **kbd_dev);
     137
     138void usb_kbd_push_ev(usb_kbd_t *kbd_dev, int type, unsigned int key);
     139
     140#endif /* USB_KBDDEV_H_ */
    123141
    124142/**
Note: See TracChangeset for help on using the changeset viewer.