Ignore:
File:
1 edited

Legend:

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

    r5e07e2b5 r31cfee16  
    7575static int usb_hid_try_add_device(usb_device_t *dev)
    7676{
     77        assert(dev != NULL);
     78       
    7779        /*
    7880         * Initialize device (get and process descriptors, get address, etc.)
     
    9799        usb_log_debug("USB/HID device structure initialized.\n");
    98100       
    99         /* Create the function exposed under /dev/devices. */
    100         ddf_fun_t *hid_fun = ddf_fun_create(dev->ddf_dev, fun_exposed,
    101             usb_hid_get_function_name(hid_dev));
    102         if (hid_fun == NULL) {
    103                 usb_log_error("Could not create DDF function node.\n");
    104                 usb_hid_free(&hid_dev);
    105                 return ENOMEM;
    106         }
    107        
    108101        /*
    109          * Store the initialized HID device and HID ops
    110          * to the DDF function.
    111          */
    112         hid_fun->ops = &hid_dev->ops;
    113         hid_fun->driver_data = hid_dev;   // TODO: maybe change to hid_dev->data
    114 
    115         rc = ddf_fun_bind(hid_fun);
    116         if (rc != EOK) {
    117                 usb_log_error("Could not bind DDF function: %s.\n",
    118                     str_error(rc));
    119                 // TODO: Can / should I destroy the DDF function?
    120                 ddf_fun_destroy(hid_fun);
    121                 usb_hid_free(&hid_dev);
    122                 return rc;
    123         }
    124        
    125         rc = ddf_fun_add_to_class(hid_fun, usb_hid_get_class_name(hid_dev));
    126         if (rc != EOK) {
    127                 usb_log_error(
    128                     "Could not add DDF function to class 'hid': %s.\n",
    129                     str_error(rc));
    130                 // TODO: Can / should I destroy the DDF function?
    131                 ddf_fun_destroy(hid_fun);
    132                 usb_hid_free(&hid_dev);
    133                 return rc;
    134         }
     102         * 1) subdriver vytvori vlastnu ddf_fun, vlastne ddf_dev_ops, ktore da
     103         *    do nej.
     104         * 2) do tych ops do .interfaces[DEV_IFACE_USBHID (asi)] priradi
     105         *    vyplnenu strukturu usbhid_iface_t.
     106         * 3) klientska aplikacia - musi si rucne vytvorit telefon
     107         *    (devman_device_connect() - cesta k zariadeniu (/hw/pci0/...) az
     108         *    k tej fcii.
     109         *    pouzit usb/classes/hid/iface.h - prvy int je telefon
     110         */
    135111       
    136112        /* Start automated polling function.
     
    178154        usb_log_debug("usb_hid_add_device()\n");
    179155       
     156        if (dev == NULL) {
     157                usb_log_warning("Wrong parameter given for add_device().\n");
     158                return EINVAL;
     159        }
     160       
    180161        if (dev->interface_no < 0) {
    181162                usb_log_warning("Device is not a supported HID device.\n");
Note: See TracChangeset for help on using the changeset viewer.