Changeset 662da50 in mainline


Ignore:
Timestamp:
2011-06-16T10:21:33Z (13 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
d022500
Parents:
854eddd6 (diff), bbfa425 (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 last-minute USB changes

Location:
uspace
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/ohci/root_hub.c

    r854eddd6 r662da50  
    251251        int opResult;
    252252        if (request->ep->transfer_type == USB_TRANSFER_CONTROL) {
    253                 usb_log_info("Root hub got CONTROL packet\n");
     253                usb_log_debug("Root hub got CONTROL packet\n");
    254254                opResult = process_ctrl_request(instance, request);
    255255                usb_transfer_batch_finish_error(request, opResult);
    256256        } else if (request->ep->transfer_type == USB_TRANSFER_INTERRUPT) {
    257                 usb_log_info("Root hub got INTERRUPT packet\n");
     257                usb_log_debug("Root hub got INTERRUPT packet\n");
    258258                create_interrupt_mask_in_instance(instance);
    259259                if (is_zeros(instance->interrupt_buffer,
  • uspace/drv/usbhid/generic/hiddev.c

    r854eddd6 r662da50  
    231231/*----------------------------------------------------------------------------*/
    232232
    233 bool usb_generic_hid_polling_callback(usb_hid_dev_t *hid_dev, void *data,
    234     uint8_t *buffer, size_t buffer_size)
    235 {
    236         usb_log_debug2("usb_hid_polling_callback(%p, %p, %zu)\n",
    237             hid_dev, buffer, buffer_size);
    238         usb_debug_str_buffer(buffer, buffer_size, 0);
     233bool usb_generic_hid_polling_callback(usb_hid_dev_t *hid_dev, void *data/*,
     234    uint8_t *buffer, size_t buffer_size*/)
     235{
     236//      usb_log_debug2("usb_hid_polling_callback(%p, %p, %zu)\n",
     237//          hid_dev, buffer, buffer_size);
     238//      usb_debug_str_buffer(buffer, buffer_size, 0);
    239239        return true;
    240240}
  • uspace/drv/usbhid/generic/hiddev.h

    r854eddd6 r662da50  
    5050int usb_generic_hid_init(struct usb_hid_dev *hid_dev, void **data);
    5151
    52 bool usb_generic_hid_polling_callback(struct usb_hid_dev *hid_dev, void *data,
    53     uint8_t *buffer, size_t buffer_size);
     52bool usb_generic_hid_polling_callback(struct usb_hid_dev *hid_dev, void *data/*,
     53    uint8_t *buffer, size_t buffer_size*/);
    5454
    5555#endif // USB_HID_HIDDDEV_H_
  • uspace/drv/usbhid/kbd/kbddev.c

    r854eddd6 r662da50  
    434434 *     usb_hid_parse_report().
    435435 */
    436 static void usb_kbd_process_data(usb_hid_dev_t *hid_dev, usb_kbd_t *kbd_dev,
    437                                  uint8_t *buffer, size_t actual_size)
     436static void usb_kbd_process_data(usb_hid_dev_t *hid_dev, usb_kbd_t *kbd_dev/*,
     437                                 uint8_t *buffer, size_t actual_size*/)
    438438{
    439439        assert(hid_dev->report != NULL);
     
    441441        assert(kbd_dev != NULL);
    442442
    443         usb_log_debug("Calling usb_hid_parse_report() with "
    444             "buffer %s\n", usb_debug_str_buffer(buffer, actual_size, 0));
     443//      usb_log_debug("Calling usb_hid_parse_report() with "
     444//          "buffer %s\n", usb_debug_str_buffer(buffer, actual_size, 0));
    445445       
    446446        usb_hid_report_path_t *path = usb_hid_report_path();
    447447        usb_hid_report_path_append_item(path, USB_HIDUT_PAGE_KEYBOARD, 0);
    448448
    449         uint8_t report_id;
    450         int rc = usb_hid_parse_report(hid_dev->report, buffer, actual_size,
    451             &report_id);
    452        
    453         if (rc != EOK) {
    454                 usb_log_warning("Error in usb_hid_parse_report():"
    455                     "%s\n", str_error(rc));
    456         }
    457        
    458         usb_hid_report_path_set_report_id (path, report_id);
     449//      uint8_t report_id;
     450//      int rc = usb_hid_parse_report(hid_dev->report, buffer, actual_size,
     451//          &report_id);
     452       
     453//      if (rc != EOK) {
     454//              usb_log_warning("Error in usb_hid_parse_report():"
     455//                  "%s\n", str_error(rc));
     456//      }
     457       
     458        usb_hid_report_path_set_report_id (path, hid_dev->report_id);
    459459       
    460460        // fill in the currently pressed keys
     
    756756/*----------------------------------------------------------------------------*/
    757757
    758 bool usb_kbd_polling_callback(usb_hid_dev_t *hid_dev, void *data,
    759      uint8_t *buffer, size_t buffer_size)
    760 {
    761         if (hid_dev == NULL || buffer == NULL || data == NULL) {
     758bool usb_kbd_polling_callback(usb_hid_dev_t *hid_dev, void *data/*,
     759     uint8_t *buffer, size_t buffer_size*/)
     760{
     761        if (hid_dev == NULL/* || buffer == NULL*/ || data == NULL) {
    762762                // do not continue polling (???)
    763763                return false;
     
    768768       
    769769        // TODO: add return value from this function
    770         usb_kbd_process_data(hid_dev, kbd_dev, buffer, buffer_size);
     770        usb_kbd_process_data(hid_dev, kbd_dev/*, buffer, buffer_size*/);
    771771       
    772772        return true;
  • uspace/drv/usbhid/kbd/kbddev.h

    r854eddd6 r662da50  
    125125int usb_kbd_init(struct usb_hid_dev *hid_dev, void **data);
    126126
    127 bool usb_kbd_polling_callback(struct usb_hid_dev *hid_dev, void *data,
    128                               uint8_t *buffer, size_t buffer_size);
     127bool usb_kbd_polling_callback(struct usb_hid_dev *hid_dev, void *data/*,
     128                              uint8_t *buffer, size_t buffer_size*/);
    129129
    130130int usb_kbd_is_initialized(const usb_kbd_t *kbd_dev);
  • uspace/drv/usbhid/mouse/mousedev.c

    r854eddd6 r662da50  
    230230
    231231static bool usb_mouse_process_report(usb_hid_dev_t *hid_dev,
    232                                      usb_mouse_t *mouse_dev, uint8_t *buffer,
    233                                      size_t buffer_size)
     232                                     usb_mouse_t *mouse_dev/*, uint8_t *buffer,
     233                                     size_t buffer_size*/)
    234234{
    235235        assert(mouse_dev != NULL);
    236236       
    237         usb_log_debug2("got buffer: %s.\n",
    238             usb_debug_str_buffer(buffer, buffer_size, 0));
     237//      usb_log_debug2("got buffer: %s.\n",
     238//          usb_debug_str_buffer(buffer, buffer_size, 0));
    239239       
    240240        if (mouse_dev->mouse_phone < 0) {
     
    247247         */
    248248       
    249         usb_log_debug(NAME " Calling usb_hid_parse_report() with "
    250             "buffer %s\n", usb_debug_str_buffer(buffer, buffer_size, 0));
    251        
    252         uint8_t report_id;
    253        
    254         int rc = usb_hid_parse_report(hid_dev->report, buffer, buffer_size,
    255             &report_id);
    256        
    257         if (rc != EOK) {
    258                 usb_log_warning(NAME "Error in usb_hid_parse_report(): %s\n",
    259                     str_error(rc));
    260                 return true;
    261         }
     249//      usb_log_debug(NAME " Calling usb_hid_parse_report() with "
     250//          "buffer %s\n", usb_debug_str_buffer(buffer, buffer_size, 0));
     251       
     252//      uint8_t report_id;
     253       
     254//      int rc = usb_hid_parse_report(hid_dev->report, buffer, buffer_size,
     255//          &report_id);
     256       
     257//      if (rc != EOK) {
     258//              usb_log_warning(NAME "Error in usb_hid_parse_report(): %s\n",
     259//                  str_error(rc));
     260//              return true;
     261//      }
    262262       
    263263        /*
     
    270270            USB_HIDUT_USAGE_GENERIC_DESKTOP_X);
    271271
    272         usb_hid_report_path_set_report_id(path, report_id);
     272        usb_hid_report_path_set_report_id(path, hid_dev->report_id);
    273273
    274274        usb_hid_report_field_t *field = usb_hid_report_get_sibling(
     
    293293            USB_HIDUT_USAGE_GENERIC_DESKTOP_Y);
    294294
    295         usb_hid_report_path_set_report_id(path, report_id);
     295        usb_hid_report_path_set_report_id(path, hid_dev->report_id);
    296296
    297297        field = usb_hid_report_get_sibling(
     
    321321            USB_HIDUT_USAGE_GENERIC_DESKTOP_WHEEL);
    322322
    323         usb_hid_report_path_set_report_id(path, report_id);
     323        usb_hid_report_path_set_report_id(path, hid_dev->report_id);
    324324       
    325325        field = usb_hid_report_get_sibling(
     
    345345        path = usb_hid_report_path();
    346346        usb_hid_report_path_append_item(path, USB_HIDUT_PAGE_BUTTON, 0);
    347         usb_hid_report_path_set_report_id(path, report_id);
     347        usb_hid_report_path_set_report_id(path, hid_dev->report_id);
    348348       
    349349        field = usb_hid_report_get_sibling(
     
    510510/*----------------------------------------------------------------------------*/
    511511
    512 bool usb_mouse_polling_callback(usb_hid_dev_t *hid_dev, void *data,
    513      uint8_t *buffer, size_t buffer_size)
     512bool usb_mouse_polling_callback(usb_hid_dev_t *hid_dev, void *data/*,
     513     uint8_t *buffer, size_t buffer_size*/)
    514514{
    515515        usb_log_debug("usb_mouse_polling_callback()\n");
    516         usb_debug_str_buffer(buffer, buffer_size, 0);
     516//      usb_debug_str_buffer(buffer, buffer_size, 0);
    517517       
    518518        if (hid_dev == NULL || data == NULL) {
     
    524524        usb_mouse_t *mouse_dev = (usb_mouse_t *)data;
    525525               
    526         return usb_mouse_process_report(hid_dev, mouse_dev, buffer,
    527                                         buffer_size);
     526        return usb_mouse_process_report(hid_dev, mouse_dev/*, buffer,
     527                                        buffer_size*/);
    528528}
    529529
  • uspace/drv/usbhid/mouse/mousedev.h

    r854eddd6 r662da50  
    6565int usb_mouse_init(struct usb_hid_dev *hid_dev, void **data);
    6666
    67 bool usb_mouse_polling_callback(struct usb_hid_dev *hid_dev, void *data,
    68     uint8_t *buffer, size_t buffer_size);
     67bool usb_mouse_polling_callback(struct usb_hid_dev *hid_dev, void *data/*,
     68    uint8_t *buffer, size_t buffer_size*/);
    6969
    7070void usb_mouse_deinit(struct usb_hid_dev *hid_dev, void *data);
  • uspace/drv/usbhid/multimedia/multimedia.c

    r854eddd6 r662da50  
    274274/*----------------------------------------------------------------------------*/
    275275
    276 bool usb_multimedia_polling_callback(struct usb_hid_dev *hid_dev, void *data,
    277     uint8_t *buffer, size_t buffer_size)
     276bool usb_multimedia_polling_callback(struct usb_hid_dev *hid_dev, void *data/*,
     277    uint8_t *buffer, size_t buffer_size*/)
    278278{
    279279        // TODO: checks
    280         if (hid_dev == NULL || data == NULL || buffer == NULL) {
     280        if (hid_dev == NULL || data == NULL/* || buffer == NULL*/) {
    281281                return false;
    282282        }
    283283       
    284         usb_log_debug(NAME " usb_lgtch_polling_callback(%p, %p, %zu)\n",
    285             hid_dev, buffer, buffer_size);
     284//      usb_log_debug(NAME " usb_lgtch_polling_callback(%p, %p, %zu)\n",
     285//          hid_dev, buffer, buffer_size);
    286286       
    287287        usb_multimedia_t *multim_dev = (usb_multimedia_t *)data;
    288288
    289         usb_log_debug(NAME " Calling usb_hid_parse_report() with "
    290             "buffer %s\n", usb_debug_str_buffer(buffer, buffer_size, 0));
     289//      usb_log_debug(NAME " Calling usb_hid_parse_report() with "
     290//          "buffer %s\n", usb_debug_str_buffer(buffer, buffer_size, 0));
    291291       
    292292        usb_hid_report_path_t *path = usb_hid_report_path();
    293293        usb_hid_report_path_append_item(path, USB_HIDUT_PAGE_CONSUMER, 0);
    294294
    295         uint8_t report_id;
    296        
    297         int rc = usb_hid_parse_report(hid_dev->report, buffer, buffer_size,
    298             &report_id);
    299        
    300         if (rc != EOK) {
    301                 usb_log_warning(NAME "Error in usb_hid_parse_report(): %s\n",
    302                     str_error(rc));
    303                 return true;
    304         }
    305        
    306         usb_hid_report_path_set_report_id(path, report_id);
     295//      uint8_t report_id;
     296       
     297//      int rc = usb_hid_parse_report(hid_dev->report, buffer, buffer_size,
     298//          &report_id);
     299       
     300//      if (rc != EOK) {
     301//              usb_log_warning(NAME "Error in usb_hid_parse_report(): %s\n",
     302//                  str_error(rc));
     303//              return true;
     304//      }
     305       
     306        usb_hid_report_path_set_report_id(path, hid_dev->report_id);
    307307
    308308        usb_hid_report_field_t *field = usb_hid_report_get_sibling(
  • uspace/drv/usbhid/multimedia/multimedia.h

    r854eddd6 r662da50  
    4747void usb_multimedia_deinit(struct usb_hid_dev *hid_dev, void *data);
    4848
    49 bool usb_multimedia_polling_callback(struct usb_hid_dev *hid_dev, void *data,
    50     uint8_t *buffer, size_t buffer_size);
     49bool usb_multimedia_polling_callback(struct usb_hid_dev *hid_dev, void *data/*,
     50    uint8_t *buffer, size_t buffer_size*/);
    5151
    5252/*----------------------------------------------------------------------------*/
  • uspace/drv/usbhid/subdrivers.h

    r854eddd6 r662da50  
    4949/*----------------------------------------------------------------------------*/
    5050
    51 /* TODO: This mapping must contain some other information to get the proper
    52  *       interface.
     51/** Structure representing the mapping between device requirements and the
     52 *  subdriver supposed to handle this device.
     53 *
     54 * By filling in this structure and adding it to the usb_hid_subdrivers array,
     55 * a new subdriver mapping will be created and used by the HID driver when it
     56 * searches for appropriate subdrivers for a device.
    5357 */
    5458typedef struct usb_hid_subdriver_mapping {
     59        /** Usage path that the device's Input reports must contain.
     60         *
     61         * It is an array of pairs <usage_page, usage>, terminated by a <0, 0>
     62         * pair. If you do not wish to specify the device in this way, set this
     63         * to NULL.
     64         */
    5565        const usb_hid_subdriver_usage_t *usage_path;
     66       
     67        /** Report ID for which the path should apply. */
    5668        int report_id;
     69       
     70        /** Compare type for the Usage path. */
    5771        int compare;
     72       
     73        /** Vendor ID (set to -1 if not specified). */
    5874        int vendor_id;
     75       
     76        /** Product ID (set to -1 if not specified). */
    5977        int product_id;
     78       
     79        /** Subdriver for controlling this device. */
    6080        usb_hid_subdriver_t subdriver;
    6181} usb_hid_subdriver_mapping_t;
  • uspace/drv/usbhid/usbhid.c

    r854eddd6 r662da50  
    582582        }
    583583       
     584        // parse the input report
     585       
     586        int rc = usb_hid_parse_report(hid_dev->report, buffer, buffer_size,
     587            &hid_dev->report_id);
     588       
     589        if (rc != EOK) {
     590                usb_log_warning("Error in usb_hid_parse_report():"
     591                    "%s\n", str_error(rc));
     592        }       
     593       
    584594        bool cont = false;
    585595       
     
    588598                if (hid_dev->subdrivers[i].poll != NULL
    589599                    && hid_dev->subdrivers[i].poll(hid_dev,
    590                         hid_dev->subdrivers[i].data, buffer, buffer_size)) {
     600                        hid_dev->subdrivers[i].data/*, buffer, buffer_size*/)) {
    591601                        cont = true;
    592602                }
  • uspace/drv/usbhid/usbhid.h

    r854eddd6 r662da50  
    5050typedef int (*usb_hid_driver_init_t)(struct usb_hid_dev *, void **data);
    5151typedef void (*usb_hid_driver_deinit_t)(struct usb_hid_dev *, void *data);
    52 typedef bool (*usb_hid_driver_poll)(struct usb_hid_dev *, void *data, uint8_t *,
    53                                     size_t);
    54 typedef int (*usb_hid_driver_poll_ended)(struct usb_hid_dev *, void *data,
     52typedef bool (*usb_hid_driver_poll_t)(struct usb_hid_dev *, void *data);
     53typedef int (*usb_hid_driver_poll_ended_t)(struct usb_hid_dev *, void *data,
    5554                                         bool reason);
    5655
     
    6160        usb_hid_driver_deinit_t deinit;
    6261        /** Function to be called when data arrives from the device. */
    63         usb_hid_driver_poll poll;
     62        usb_hid_driver_poll_t poll;
    6463        /** Function to be called when polling ends. */
    65         usb_hid_driver_poll_ended poll_end;
     64        usb_hid_driver_poll_ended_t poll_end;
    6665        /** Arbitrary data needed by the subdriver. */
    6766        void *data;
     
    9392        /** HID Report parser. */
    9493        usb_hid_report_t *report;
     94       
     95        uint8_t report_id;
    9596       
    9697        uint8_t *input_report;
  • uspace/lib/usbhid/src/hidreq.c

    r854eddd6 r662da50  
    8282        value |= (type << 8);
    8383
    84         usb_log_debug("Sending Set_Report request to the device.\n");
     84        usb_log_debug("Sending Set Report request to the device.\n");
    8585       
    8686        rc = usb_control_request_set(ctrl_pipe,
     
    8989
    9090        if (rc != EOK) {
    91                 usb_log_warning("Error sending output report to the keyboard: "
    92                     "%s.\n", str_error(rc));
     91                usb_log_warning("Error sending Set Report request to the "
     92                    "device: %s.\n", str_error(rc));
    9393                return rc;
    9494        }
     
    129129        int rc;
    130130
    131         usb_log_debug("Sending Set_Protocol request to the device ("
     131        usb_log_debug("Sending Set Protocol request to the device ("
    132132            "protocol: %d, iface: %d).\n", protocol, iface_no);
    133133       
     
    137137
    138138        if (rc != EOK) {
    139                 usb_log_warning("Error sending output report to the keyboard: "
    140                     "%s.\n", str_error(rc));
     139                usb_log_warning("Error sending Set Protocol request to the "
     140                    "device: %s.\n", str_error(rc));
    141141                return rc;
    142142        }
     
    177177        int rc;
    178178
    179         usb_log_debug("Sending Set_Idle request to the device ("
     179        usb_log_debug("Sending Set Idle request to the device ("
    180180            "duration: %u, iface: %d).\n", duration, iface_no);
    181181       
     
    187187
    188188        if (rc != EOK) {
    189                 usb_log_warning("Error sending output report to the keyboard: "
     189                usb_log_warning("Error sending Set Idle request to the device: "
    190190                    "%s.\n", str_error(rc));
    191191                return rc;
     
    235235        value |= (type << 8);
    236236       
    237         usb_log_debug("Sending Get_Report request to the device.\n");
     237        usb_log_debug("Sending Get Report request to the device.\n");
    238238       
    239239        rc = usb_control_request_get(ctrl_pipe,
     
    243243
    244244        if (rc != EOK) {
    245                 usb_log_warning("Error sending output report to the keyboard: "
     245                usb_log_warning("Error sending Get Report request to the device: "
    246246                    "%s.\n", str_error(rc));
    247247                return rc;
     
    283283        int rc;
    284284
    285         usb_log_debug("Sending Get_Protocol request to the device ("
     285        usb_log_debug("Sending Get Protocol request to the device ("
    286286            "iface: %d).\n", iface_no);
    287287       
     
    294294
    295295        if (rc != EOK) {
    296                 usb_log_warning("Error sending output report to the keyboard: "
    297                     "%s.\n", str_error(rc));
     296                usb_log_warning("Error sending Get Protocol request to the "
     297                    "device: %s.\n", str_error(rc));
    298298                return rc;
    299299        }
     
    344344        int rc;
    345345
    346         usb_log_debug("Sending Get_Idle request to the device ("
     346        usb_log_debug("Sending Get Idle request to the device ("
    347347            "iface: %d).\n", iface_no);
    348348       
     
    357357
    358358        if (rc != EOK) {
    359                 usb_log_warning("Error sending output report to the keyboard: "
     359                usb_log_warning("Error sending Get Idle request to the device: "
    360360                    "%s.\n", str_error(rc));
    361361                return rc;
Note: See TracChangeset for help on using the changeset viewer.