Changeset 0a9ea4a in mainline for uspace/drv/usbkbd/main.c


Ignore:
Timestamp:
2011-01-14T14:28:57Z (14 years ago)
Author:
Lubos Slovak <lubos.slovak@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
1d7a74e, 6336b6e
Parents:
45019865 (diff), 2f60e57d (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 into lelian/hidd

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/usbkbd/main.c

    r45019865 r0a9ea4a  
    9090 * Callbacks for parser
    9191 */
    92 static void usbkbd_process_keycodes(const uint16_t *key_codes, size_t count,
    93                                     void *arg)
     92static void usbkbd_process_keycodes(const uint8_t *key_codes, size_t count,
     93                                    uint8_t modifiers, void *arg)
    9494{
    9595        printf("Got keys: ");
     
    190190       
    191191        usbkbd_print_config(kbd_dev->conf);
     192
     193        /*
     194         * TODO:
     195         * 1) select one configuration (lets say the first)
     196         * 2) how many interfaces?? how to select one??
     197     *    ("The default setting for an interface is always alternate setting zero.")
     198         * 3) find endpoint which is IN and INTERRUPT (parse), save its number
     199     *    as the endpoint for polling
     200         */
    192201       
    193202        return EOK;
     
    208217        // get phone to my HC and save it as my parent's phone
    209218        // TODO: maybe not a good idea if DDF will use parent_phone
    210         kbd_dev->device->parent_phone = usb_drv_hc_connect_auto(dev, 0);
    211 
    212         kbd_dev->address = usb_drv_get_my_address(dev->parent_phone,
    213             dev);
     219        int rc = kbd_dev->device->parent_phone = usb_drv_hc_connect_auto(dev, 0);
     220        if (rc < 0) {
     221                printf("Problem setting phone to HC.\n");
     222                free(kbd_dev);
     223                return NULL;
     224        }
     225
     226        rc = kbd_dev->address = usb_drv_get_my_address(dev->parent_phone, dev);
     227        if (rc < 0) {
     228                printf("Problem getting address of the device.\n");
     229                free(kbd_dev);
     230                return NULL;
     231        }
    214232
    215233        // doesn't matter now that we have no address
     
    239257                                        uint8_t *buffer, size_t actual_size)
    240258{
    241         /*
    242          * here, the parser will be called, probably with some callbacks
    243          * now only take last 6 bytes and process, i.e. send to kbd
    244          */
    245 
    246259        usb_hid_report_in_callbacks_t *callbacks =
    247260            (usb_hid_report_in_callbacks_t *)malloc(
     
    249262        callbacks->keyboard = usbkbd_process_keycodes;
    250263
    251         usb_hid_parse_report(kbd_dev->parser, buffer, actual_size, callbacks,
    252             NULL);
     264        //usb_hid_parse_report(kbd_dev->parser, buffer, actual_size, callbacks,
     265        //    NULL);
     266        printf("Calling usb_hid_boot_keyboard_input_report()...\n)");
     267        usb_hid_boot_keyboard_input_report(buffer, actual_size, callbacks, NULL);
    253268}
    254269
Note: See TracChangeset for help on using the changeset viewer.