Changes in / [f8e8738:a82889e] in mainline


Ignore:
Files:
17 deleted
8 edited

Legend:

Unmodified
Added
Removed
  • boot/arch/amd64/Makefile.inc

    rf8e8738 ra82889e  
    5050        usbhub \
    5151        usbkbd \
    52         usbhid \
    5352        usbmid \
    5453        usbmouse \
  • uspace/Makefile

    rf8e8738 ra82889e  
    123123                drv/usbflbk \
    124124                drv/usbkbd \
    125                 drv/usbhid \
    126125                drv/usbhub \
    127126                drv/usbmid \
     
    144143                drv/usbflbk \
    145144                drv/usbkbd \
    146                 drv/usbhid \
    147145                drv/usbhub \
    148146                drv/usbmid \
  • uspace/drv/usbkbd/kbddev.c

    rf8e8738 ra82889e  
    265265static void usb_kbd_set_led(usb_kbd_t *kbd_dev)
    266266{
    267         if (kbd_dev->output_size == 0) {
    268                 return;
    269         }
    270        
    271267        unsigned i = 0;
    272268       
     
    292288       
    293289        int rc = usb_hid_report_output_translate(kbd_dev->parser,
    294             kbd_dev->led_path,
    295             USB_HID_PATH_COMPARE_END | USB_HID_PATH_COMPARE_USAGE_PAGE_ONLY,
    296             kbd_dev->output_buffer,
     290            kbd_dev->led_path, USB_HID_PATH_COMPARE_END, kbd_dev->output_buffer,
    297291            kbd_dev->output_size, kbd_dev->led_data, kbd_dev->led_output_size);
    298292       
     
    545539 *                  according to HID Usage Tables.
    546540 * @param count Number of key codes in report (size of the report).
    547  * @param report_id
     541 * @param modifiers Bitmap of modifiers (Ctrl, Alt, Shift, GUI).
    548542 * @param arg User-specified argument. Expects pointer to the keyboard device
    549543 *            structure representing the keyboard.
     
    552546 */
    553547static void usb_kbd_process_keycodes(const uint8_t *key_codes, size_t count,
    554     uint8_t report_id, void *arg)
     548    uint8_t modifiers, void *arg)
    555549{
    556550        if (arg == NULL) {
     
    563557        assert(kbd_dev != NULL);
    564558
    565         usb_log_debug("Got keys from parser (report id: %u): %s\n",
    566             report_id, usb_debug_str_buffer(key_codes, count, 0));
     559        usb_log_debug("Got keys from parser: %s\n",
     560            usb_debug_str_buffer(key_codes, count, 0));
    567561       
    568562        if (count != kbd_dev->key_count) {
     
    614608        usb_hid_report_path_t *path = usb_hid_report_path();
    615609        usb_hid_report_path_append_item(path, USB_HIDUT_PAGE_KEYBOARD, 0);
    616         usb_hid_report_path_set_report_id(path, 1);
    617610       
    618611        int rc = usb_hid_parse_report(kbd_dev->parser, buffer,
    619             actual_size, path,
    620             USB_HID_PATH_COMPARE_END | USB_HID_PATH_COMPARE_USAGE_PAGE_ONLY,
    621             callbacks, kbd_dev);
     612            actual_size, path, USB_HID_PATH_COMPARE_STRICT, callbacks, kbd_dev);
    622613
    623614        usb_hid_report_path_free (path);
     
    767758        usb_hid_report_path_t *path = usb_hid_report_path();
    768759        usb_hid_report_path_append_item(path, USB_HIDUT_PAGE_KEYBOARD, 0);
    769        
    770         usb_hid_report_path_set_report_id(path, 1);
    771        
    772760        kbd_dev->key_count = usb_hid_report_input_length(
    773             kbd_dev->parser, path,
    774             USB_HID_PATH_COMPARE_END | USB_HID_PATH_COMPARE_USAGE_PAGE_ONLY);
     761            kbd_dev->parser, path, USB_HID_PATH_COMPARE_STRICT);
    775762        usb_hid_report_path_free (path);
    776763       
     
    790777        kbd_dev->output_buffer = usb_hid_report_output(kbd_dev->parser,
    791778            &kbd_dev->output_size);
    792         if (kbd_dev->output_buffer == NULL && kbd_dev->output_size != 0) {
     779        if (kbd_dev->output_buffer == NULL) {
    793780                usb_log_warning("Error creating output report buffer.\n");
    794781                free(kbd_dev->keys);
     
    803790       
    804791        kbd_dev->led_output_size = usb_hid_report_output_size(kbd_dev->parser,
    805             kbd_dev->led_path,
    806             USB_HID_PATH_COMPARE_END | USB_HID_PATH_COMPARE_USAGE_PAGE_ONLY);
     792            kbd_dev->led_path, USB_HID_PATH_COMPARE_END);
    807793       
    808794        usb_log_debug("Output report size (in items): %zu\n",
  • uspace/drv/usbkbd/main.c

    rf8e8738 ra82889e  
    3333/**
    3434 * @file
    35  * Main routines of USB KBD driver.
     35 * Main routines of USB HID driver.
    3636 */
    3737
     
    7575 * @sa usb_kbd_fibril(), usb_kbd_repeat_fibril()
    7676 */
    77 static int usb_kbd_try_add_device(usb_device_t *dev)
     77static int usbhid_try_add_device(usb_device_t *dev)
    7878{
    7979        /* Create the function exposed under /dev/devices. */
     
    105105                usb_kbd_free(&kbd_dev);
    106106                return rc;
    107         }
     107        }       
    108108       
    109109        usb_log_debug("USB/HID KBD device structure initialized.\n");
     
    195195 * @retval EREFUSED if the device is not supported.
    196196 */
    197 static int usb_kbd_add_device(usb_device_t *dev)
     197static int usbhid_add_device(usb_device_t *dev)
    198198{
    199         usb_log_debug("usb_kbd_add_device()\n");
     199        usb_log_debug("usbhid_add_device()\n");
    200200       
    201201        if (dev->interface_no < 0) {
    202202                usb_log_warning("Device is not a supported keyboard.\n");
    203                 usb_log_error("Failed to add USB KBD device: endpoint not "
    204                     "found.\n");
     203                usb_log_error("Failed to add HID device: endpoint not found."
     204                    "\n");
    205205                return ENOTSUP;
    206206        }
    207207       
    208         int rc = usb_kbd_try_add_device(dev);
     208        int rc = usbhid_try_add_device(dev);
    209209       
    210210        if (rc != EOK) {
    211211                usb_log_warning("Device is not a supported keyboard.\n");
    212                 usb_log_error("Failed to add KBD device: %s.\n",
     212                usb_log_error("Failed to add HID device: %s.\n",
    213213                    str_error(rc));
    214214                return rc;
     
    224224/* Currently, the framework supports only device adding. Once the framework
    225225 * supports unplug, more callbacks will be added. */
    226 static usb_driver_ops_t usb_kbd_driver_ops = {
    227         .add_device = usb_kbd_add_device,
     226static usb_driver_ops_t usbhid_driver_ops = {
     227        .add_device = usbhid_add_device,
    228228};
    229229
    230230
    231231/* The driver itself. */
    232 static usb_driver_t usb_kbd_driver = {
     232static usb_driver_t usbhid_driver = {
    233233        .name = NAME,
    234         .ops = &usb_kbd_driver_ops,
     234        .ops = &usbhid_driver_ops,
    235235        .endpoints = usb_kbd_endpoints
    236236};
     
    238238/*----------------------------------------------------------------------------*/
    239239
     240//static driver_ops_t kbd_driver_ops = {
     241//      .add_device = usbhid_add_device,
     242//};
     243
     244///*----------------------------------------------------------------------------*/
     245
     246//static driver_t kbd_driver = {
     247//      .name = NAME,
     248//      .driver_ops = &kbd_driver_ops
     249//};
     250
     251/*----------------------------------------------------------------------------*/
     252
    240253int main(int argc, char *argv[])
    241254{
    242         printf(NAME ": HelenOS USB KBD driver.\n");
     255        printf(NAME ": HelenOS USB HID driver.\n");
    243256
    244257        usb_log_enable(USB_LOG_LEVEL_DEBUG, NAME);
    245258
    246         return usb_driver_main(&usb_kbd_driver);
     259        return usb_driver_main(&usbhid_driver);
    247260}
    248261
  • uspace/drv/usbkbd/usbkbd.ma

    rf8e8738 ra82889e  
    1 10 usb&interface&class=HID&subclass=0x01&protocol=0x01
     1100 usb&interface&class=HID&subclass=0x01&protocol=0x01
     210 usb&interface&class=HID
  • uspace/lib/usb/include/usb/classes/hidparser.h

    rf8e8738 ra82889e  
    8888        /** */ 
    8989        int depth;     
    90         uint8_t report_id;
    9190       
    9291        /** */ 
     
    156155        /** */ 
    157156        link_t feature;
    158        
    159         int use_report_id;
    160        
    161157} usb_hid_report_parser_t;     
    162158
     
    170166         * @param arg Custom argument.
    171167         */
    172         void (*keyboard)(const uint8_t *key_codes, size_t count, const uint8_t report_id, void *arg);
     168        void (*keyboard)(const uint8_t *key_codes, size_t count, const uint8_t modifiers, void *arg);
    173169} usb_hid_report_in_callbacks_t;
    174170
     
    273269
    274270/** */
    275 int usb_hid_report_path_set_report_id(usb_hid_report_path_t *usage_path, uint8_t report_id);
    276 
    277 /** */
    278271int usb_hid_report_path_append_item(usb_hid_report_path_t *usage_path, int32_t usage_page, int32_t usage);
    279272
  • uspace/lib/usb/src/hidparser.c

    rf8e8738 ra82889e  
    106106    list_initialize(&(parser->feature));
    107107
    108         parser->use_report_id = 0;
    109108    return EOK;   
    110109}
     
    187186                                        tmp_usage_path = NULL;
    188187
    189                                         usb_hid_report_path_set_report_id(report_item->usage_path, report_item->id);   
    190                                         if(report_item->id != 0){
    191                                                 parser->use_report_id = 1;
    192                                         }
    193188                                       
    194189                                        switch(tag) {
     
    652647        }
    653648
    654         parser->use_report_id = 0;
    655 
    656649        usb_hid_free_report_list(&parser->input);
    657650        usb_hid_free_report_list(&parser->output);
     
    683676        size_t i=0;
    684677        size_t j=0;
    685         uint8_t report_id = 0;
    686678
    687679        if(parser == NULL) {
     
    694686        if(!(keys = malloc(sizeof(uint8_t) * key_count))){
    695687                return ENOMEM;
    696         }
    697 
    698         if(parser->use_report_id != 0) {
    699                 report_id = data[0];
    700                 usb_hid_report_path_set_report_id(path, report_id);
    701688        }
    702689
     
    706693
    707694                item = list_get_instance(list_item, usb_hid_report_item_t, link);
    708 
    709695                if(!USB_HID_ITEM_FLAG_CONSTANT(item->item_flags) &&
    710696                   (usb_hid_report_compare_usage_path(item->usage_path, path, flags) == EOK)) {
     
    729715        }
    730716
    731         callbacks->keyboard(keys, key_count, report_id, arg);
     717        callbacks->keyboard(keys, key_count, 0, arg);
    732718           
    733719        free(keys);     
     
    753739        int32_t mask;
    754740        const uint8_t *foo;
    755 
     741       
    756742        // now only common numbers llowed
    757743        if(item->size > 32) {
     
    772758                (usb_pow(10,(item->unit_exponent))));
    773759        }
    774 
    775760        offset = item->offset + (j * item->size);
    776         if(item->id != 0) {
    777                 offset += 8;
    778                 usb_log_debug("MOVED OFFSET BY 1Byte, REPORT_ID(%d)\n", item->id);
    779         }
    780761       
    781762        // FIXME
     
    961942
    962943        int only_page;
    963 
    964         if(report_path->report_id != path->report_id) {
    965                 return 1;
    966         }
    967944
    968945        if(path->depth == 0){
     
    10611038        else {
    10621039                path->depth = 0;
    1063                 path->report_id = 0;
    10641040                list_initialize(&path->link);
    10651041                return path;
     
    11791155                return 0;
    11801156        }
    1181 
     1157       
    11821158        item = parser->output.next;
    11831159        while(&parser->output != item) {
     
    12191195        int length;
    12201196        int32_t tmp_value;
    1221         size_t offset_prefix = 0;
    12221197       
    12231198        if(parser == NULL) {
    12241199                return EINVAL;
    1225         }
    1226 
    1227         if(parser->use_report_id != 0) {
    1228                 buffer[0] = path->report_id;
    1229                 offset_prefix = 8;
    12301200        }
    12311201
     
    12481218//                              // variable item
    12491219                                value = usb_hid_translate_data_reverse(report_item, data[idx++]);
    1250                                 offset = report_item->offset + (i * report_item->size) + offset_prefix;
     1220                                offset = report_item->offset + (i * report_item->size);
    12511221                                length = report_item->size;
    12521222                        }
     
    12541224                                //bitmap
    12551225                                value += usb_hid_translate_data_reverse(report_item, data[idx++]);
    1256                                 offset = report_item->offset + offset_prefix;
     1226                                offset = report_item->offset;
    12571227                                length = report_item->size * report_item->count;
    12581228                        }
     
    13531323
    13541324
    1355 int usb_hid_report_path_set_report_id(usb_hid_report_path_t *path, uint8_t report_id)
    1356 {
    1357         if(path == NULL){
    1358                 return EINVAL;
    1359         }
    1360 
    1361         path->report_id = report_id;
    1362         return EOK;
    1363 }
    1364 
    13651325/**
    13661326 * @}
  • uspace/lib/usb/src/hidreport.c

    rf8e8738 ra82889e  
    8080                d = usb_dp_get_sibling_descriptor(&parser, &parser_data,
    8181                    dev->descriptors.configuration, d);
    82                 ++i;
    8382        }
    8483       
Note: See TracChangeset for help on using the changeset viewer.