Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 378bf85 in mainline


Ignore:
Timestamp:
2014-05-16T23:32:05Z (8 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master
Children:
7d68e5c7
Parents:
2040d5f
Message:

cstyle
(no change in functionality)

Location:
uspace/drv/bus/usb/usbhid
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/usbhid/generic/hiddev.c

    r2040d5f r378bf85  
    4949#include "usbhid.h"
    5050
    51 
    52 
    5351const usb_endpoint_description_t usb_hid_generic_poll_endpoint_description = {
    5452        .transfer_type = USB_TRANSFER_INTERRUPT,
     
    6159
    6260const char *HID_GENERIC_FUN_NAME = "hid";
    63 const char *HID_GENERIC_CLASS_NAME = "hid";
     61const char *HID_GENERIC_CATEGORY = "hid";
    6462
    6563
     
    226224        return true;
    227225}
     226
    228227/**
    229228 * @}
  • uspace/drv/bus/usb/usbhid/generic/hiddev.h

    r2040d5f r378bf85  
    3838
    3939#include <usb/dev/driver.h>
    40 
    41 struct usb_hid_dev;
     40#include "../usbhid.h"
    4241
    4342extern const usb_endpoint_description_t
    4443    usb_hid_generic_poll_endpoint_description;
    4544
    46 const char *HID_GENERIC_FUN_NAME;
    47 const char *HID_GENERIC_CLASS_NAME;
     45extern const char *HID_GENERIC_FUN_NAME;
     46extern const char *HID_GENERIC_CATEGORY;
    4847
    4948/** The USB HID generic 'hid' function softstate */
    5049typedef struct {
    51         struct usb_hid_dev *hid_dev;
     50        usb_hid_dev_t *hid_dev;
    5251} usb_hid_gen_fun_t;
    5352
    54 int usb_generic_hid_init(struct usb_hid_dev *hid_dev, void **data);
    55 
    56 void usb_generic_hid_deinit(struct usb_hid_dev *hid_dev, void *data);
    57 
    58 bool usb_generic_hid_polling_callback(struct usb_hid_dev *hid_dev, void *data);
     53extern int usb_generic_hid_init(usb_hid_dev_t *, void **);
     54extern void usb_generic_hid_deinit(usb_hid_dev_t *, void *);
     55extern bool usb_generic_hid_polling_callback(usb_hid_dev_t *, void *);
    5956
    6057#endif // USB_HID_HIDDDEV_H_
  • uspace/drv/bus/usb/usbhid/kbd/kbddev.c

    r2040d5f r378bf85  
    103103
    104104const char *HID_KBD_FUN_NAME = "keyboard";
    105 const char *HID_KBD_CATEGORY_NAME = "keyboard";
     105const char *HID_KBD_CATEGORY = "keyboard";
    106106
    107107static void usb_kbd_set_led(usb_hid_dev_t *hid_dev, usb_kbd_t *kbd_dev);
     
    513513
    514514        usb_log_debug("Adding DDF function to category %s...\n",
    515             HID_KBD_CLASS_NAME);
    516         rc = ddf_fun_add_to_category(fun, HID_KBD_CATEGORY_NAME);
     515            HID_KBD_CATEGORY);
     516        rc = ddf_fun_add_to_category(fun, HID_KBD_CATEGORY);
    517517        if (rc != EOK) {
    518518                usb_log_error(
    519519                    "Could not add DDF function to category %s: %s.\n",
    520                     HID_KBD_CLASS_NAME, str_error(rc));
     520                    HID_KBD_CATEGORY, str_error(rc));
    521521                if (ddf_fun_unbind(fun) == EOK) {
    522522                        ddf_fun_destroy(fun);
  • uspace/drv/bus/usb/usbhid/kbd/kbddev.h

    r2040d5f r378bf85  
    4545#include <usb/dev/pipes.h>
    4646#include <usb/dev/driver.h>
    47 
     47#include "../usbhid.h"
    4848#include "kbdrepeat.h"
    49 
    50 struct usb_hid_dev;
    51 
    5249
    5350/**
     
    6562typedef struct usb_kbd_t {
    6663        /** Link to HID device structure */
    67         struct usb_hid_dev *hid_dev;
    68 
     64        usb_hid_dev_t *hid_dev;
     65       
    6966        /** Previously pressed keys (not translated to key codes). */
    7067        int32_t *keys_old;
     
    7572        /** Currently pressed modifiers (bitmap). */
    7673        uint8_t modifiers;
    77 
     74       
    7875        /** Currently active modifiers including locks. Sent to the console. */
    79         unsigned mods;
    80 
     76        unsigned int mods;
     77       
    8178        /** Currently active lock keys. */
    82         unsigned lock_keys;
    83 
     79        unsigned int lock_keys;
     80       
    8481        /** IPC session to client (for sending key events). */
    8582        async_sess_t *client_sess;
    86 
     83       
    8784        /** Information for auto-repeat of keys. */
    8885        usb_kbd_repeat_t repeat;
    89 
     86       
    9087        /** Mutex for accessing the information about auto-repeat. */
    9188        fibril_mutex_t repeat_mtx;
    92 
     89       
    9390        uint8_t *output_buffer;
    94 
     91       
    9592        size_t output_size;
    96 
     93       
    9794        size_t led_output_size;
    98 
     95       
    9996        usb_hid_report_path_t *led_path;
    100 
     97       
    10198        int32_t *led_data;
    102 
     99       
    103100        /** State of the structure (for checking before use).
    104          * 
     101         *
    105102         * 0 - not initialized
    106103         * 1 - initialized
     
    108105         */
    109106        int initialized;
    110 
     107       
    111108        /** DDF function */
    112109        ddf_fun_t *fun;
    113110} usb_kbd_t;
    114111
    115 
    116 
    117112extern const usb_endpoint_description_t usb_hid_kbd_poll_endpoint_description;
    118113
    119 const char *HID_KBD_FUN_NAME;
    120 const char *HID_KBD_CLASS_NAME;
     114extern const char *HID_KBD_FUN_NAME;
     115extern const char *HID_KBD_CATEGORY;
    121116
    122 
    123 
    124 int usb_kbd_init(struct usb_hid_dev *hid_dev, void **data);
    125 
    126 bool usb_kbd_polling_callback(struct usb_hid_dev *hid_dev, void *data);
    127 
    128 int usb_kbd_is_initialized(const usb_kbd_t *kbd_dev);
    129 
    130 int usb_kbd_is_ready_to_destroy(const usb_kbd_t *kbd_dev);
    131 
    132 void usb_kbd_destroy(usb_kbd_t *kbd_dev);
    133 
    134 void usb_kbd_push_ev(usb_kbd_t *kbd_dev,
    135     int type, unsigned int key);
    136 
    137 void usb_kbd_deinit(struct usb_hid_dev *hid_dev, void *data);
    138 
    139 int usb_kbd_set_boot_protocol(struct usb_hid_dev *hid_dev);
     117extern int usb_kbd_init(usb_hid_dev_t *, void **);
     118extern bool usb_kbd_polling_callback(usb_hid_dev_t *, void *);
     119extern int usb_kbd_is_initialized(const usb_kbd_t *);
     120extern int usb_kbd_is_ready_to_destroy(const usb_kbd_t *);
     121extern void usb_kbd_destroy(usb_kbd_t *);
     122extern void usb_kbd_push_ev(usb_kbd_t *, int, unsigned int);
     123extern void usb_kbd_deinit(usb_hid_dev_t *, void *);
     124extern int usb_kbd_set_boot_protocol(usb_hid_dev_t *);
    140125
    141126#endif /* USB_HID_KBDDEV_H_ */
  • uspace/drv/bus/usb/usbhid/mouse/mousedev.c

    r2040d5f r378bf85  
    344344
    345345        if (hid_dev == NULL) {
    346                 usb_log_error("Failed to init keyboard structure: no structure"
     346                usb_log_error("Failed to init mouse structure: no structure"
    347347                    " given.\n");
    348348                return EINVAL;
  • uspace/drv/bus/usb/usbhid/mouse/mousedev.h

    r2040d5f r378bf85  
    3939#include <usb/dev/driver.h>
    4040#include <async.h>
    41 
    42 struct usb_hid_dev;
    43 
    44 
     41#include "../usbhid.h"
    4542
    4643/** Container for USB mouse device. */
     
    4845        /** IPC session to consumer. */
    4946        async_sess_t *mouse_sess;
    50 
    51         /* Mouse buttons statuses. */
     47       
     48        /** Mouse buttons statuses. */
    5249        int32_t *buttons;
    5350        size_t buttons_count;
    54 
    55         /* DDF mouse function */
     51       
     52        /** DDF mouse function */
    5653        ddf_fun_t *mouse_fun;
    5754} usb_mouse_t;
    5855
    59 
    60 
    6156extern const usb_endpoint_description_t usb_hid_mouse_poll_endpoint_description;
    6257
    63 const char *HID_MOUSE_FUN_NAME;
    64 const char *HID_MOUSE_CATEGORY;
     58extern const char *HID_MOUSE_FUN_NAME;
     59extern const char *HID_MOUSE_CATEGORY;
    6560
    66 
    67 
    68 int usb_mouse_init(struct usb_hid_dev *hid_dev, void **data);
    69 
    70 bool usb_mouse_polling_callback(struct usb_hid_dev *hid_dev, void *data);
    71 
    72 void usb_mouse_deinit(struct usb_hid_dev *hid_dev, void *data);
    73 
    74 int usb_mouse_set_boot_protocol(struct usb_hid_dev *hid_dev);
    75 
    76 
     61extern int usb_mouse_init(usb_hid_dev_t *, void **);
     62extern bool usb_mouse_polling_callback(usb_hid_dev_t *, void *);
     63extern void usb_mouse_deinit(usb_hid_dev_t *, void *);
     64extern int usb_mouse_set_boot_protocol(usb_hid_dev_t *);
    7765
    7866#endif // USB_HID_MOUSEDEV_H_
  • uspace/drv/bus/usb/usbhid/multimedia/multimedia.c

    r2040d5f r378bf85  
    11/*
    2  * Copyright (c) 2011 Lubos Slovak, Vojtech Horky
     2 * Copyright (c) 2011 Lubos Slovak
     3 * Copyright (c) 2011 Vojtech Horky
    34 * All rights reserved.
    45 *
  • uspace/drv/bus/usb/usbhid/multimedia/multimedia.h

    r2040d5f r378bf85  
    3838
    3939#include <usb/dev/driver.h>
     40#include "../usbhid.h"
    4041
    41 struct usb_hid_dev;
    42 
    43 
    44 
    45 int usb_multimedia_init(struct usb_hid_dev *hid_dev, void **data);
    46 
    47 void usb_multimedia_deinit(struct usb_hid_dev *hid_dev, void *data);
    48 
    49 bool usb_multimedia_polling_callback(struct usb_hid_dev *hid_dev, void *data);
    50 
    51 
     42extern int usb_multimedia_init(usb_hid_dev_t *, void **);
     43extern void usb_multimedia_deinit(usb_hid_dev_t *, void *);
     44extern bool usb_multimedia_polling_callback(usb_hid_dev_t *, void *);
    5245
    5346#endif // USB_HID_MULTIMEDIA_H_
  • uspace/drv/bus/usb/usbhid/subdrivers.h

    r2040d5f r378bf85  
    4040#include "kbd/kbddev.h"
    4141
    42 
    43 
    4442typedef struct usb_hid_subdriver_usage {
    4543        int usage_page;
     
    4745} usb_hid_subdriver_usage_t;
    4846
    49 
    50 
    51 /** Structure representing the mapping between device requirements and the
     47/** Structure representing the mapping between device requirements and the
    5248 *  subdriver supposed to handle this device.
    5349 *
     
    5551 * a new subdriver mapping will be created and used by the HID driver when it
    5652 * searches for appropriate subdrivers for a device.
     53 *
    5754 */
    5855typedef struct usb_hid_subdriver_mapping {
    59         /** Usage path that the device's Input reports must contain.
     56        /** Usage path that the device's input reports must contain.
    6057         *
    6158         * It is an array of pairs <usage_page, usage>, terminated by a <0, 0>
     
    6461         */
    6562        const usb_hid_subdriver_usage_t *usage_path;
    66 
     63       
    6764        /** Report ID for which the path should apply. */
    6865        int report_id;
    69 
    70         /** Compare type for the Usage path. */
     66       
     67        /** Compare type for the usage path. */
    7168        int compare;
    72 
     69       
    7370        /** Vendor ID (set to -1 if not specified). */
    7471        int vendor_id;
    75 
     72       
    7673        /** Product ID (set to -1 if not specified). */
    7774        int product_id;
    78 
     75       
    7976        /** Subdriver for controlling this device. */
    8077        const usb_hid_subdriver_t subdriver;
    8178} usb_hid_subdriver_mapping_t;
    8279
    83 
    84 
    8580extern const usb_hid_subdriver_mapping_t usb_hid_subdrivers[];
    8681extern const size_t USB_HID_MAX_SUBDRIVERS;
    87 
    88 
    8982
    9083#endif /* USB_HID_SUBDRIVERS_H_ */
  • uspace/drv/bus/usb/usbhid/usbhid.ma

    r2040d5f r378bf85  
    1 100 usb&interface&class=HID&subclass=0x01&protocol=0x01
     11000 usb&interface&class=HID&subclass=0x01&protocol=0x01
    221000 usb&interface&class=HID&subclass=0x01&protocol=0x02
    33100 usb&interface&class=HID
Note: See TracChangeset for help on using the changeset viewer.