Ticket #17699: hid_report_size_calc_fix.patch

File hid_report_size_calc_fix.patch, 3.0 KB (added by zelenoviy, 19 months ago)

one of the solutions to the problem

  • src/add-ons/kernel/drivers/input/hid_shared/HIDParser.cpp

    diff --git a/src/add-ons/kernel/drivers/input/hid_shared/HIDParser.cpp b/src/add-ons/kernel/drivers/input/hid_shared/HIDParser.cpp
    index aaef7dce68..a131a0d22f 100644
    a b HIDParser::ReportAt(uint8 type, uint8 index)  
    430430
    431431size_t
    432432HIDParser::MaxReportSize()
     433{
     434    return MaxReportSize(HID_REPORT_TYPE_ANY);
     435}
     436
     437size_t
     438HIDParser::MaxReportSize(uint8 type)
    433439{
    434440    size_t maxSize = 0;
    435441    for (int32 i = 0; i < fReports.Count(); i++) {
    436442        HIDReport *report = fReports[i];
    437443        if (report == NULL)
    438444            continue;
     445       
     446        if (type != HID_REPORT_TYPE_ANY && report->Type() != type)
     447            continue;
    439448
    440449        if (report->ReportSize() > maxSize)
    441450            maxSize = report->ReportSize();
  • src/add-ons/kernel/drivers/input/hid_shared/HIDParser.h

    diff --git a/src/add-ons/kernel/drivers/input/hid_shared/HIDParser.h b/src/add-ons/kernel/drivers/input/hid_shared/HIDParser.h
    index 75f1101158..b8523eb431 100644
    a b public:  
    3030        uint8                   CountReports(uint8 type);
    3131        HIDReport *             ReportAt(uint8 type, uint8 index);
    3232        size_t                  MaxReportSize();
     33        size_t                  MaxReportSize(uint8 type);
    3334
    3435        HIDCollection *         RootCollection() { return fRootCollection; };
    3536
  • src/add-ons/kernel/drivers/input/hid_shared/KeyboardProtocolHandler.cpp

    diff --git a/src/add-ons/kernel/drivers/input/hid_shared/KeyboardProtocolHandler.cpp b/src/add-ons/kernel/drivers/input/hid_shared/KeyboardProtocolHandler.cpp
    index ad3128b482..8df5750440 100644
    a b KeyboardProtocolHandler::KeyboardProtocolHandler(HIDReport &inputReport,  
    110110#ifdef USB_KDL
    111111        sDebugKeyboardPipe = fInputReport.Device()->InterruptPipe();
    112112#endif
    113         sDebugKeyboardReportSize = fInputReport.Parser()->MaxReportSize();
     113        sDebugKeyboardReportSize = fInputReport.Parser()->MaxReportSize(HID_REPORT_TYPE_INPUT);
    114114        if (outputReport != NULL)
    115115            sDebugKeyboardFound = true;
    116116    }
    KeyboardProtocolHandler::_ReadReport(bigtime_t timeout, uint32 *cookie)  
    794794                        = fInputReport.Device()->InterruptPipe();
    795795#endif
    796796                    sDebugKeyboardReportSize
    797                         = fInputReport.Parser()->MaxReportSize();
     797                        = fInputReport.Parser()->MaxReportSize(HID_REPORT_TYPE_INPUT);
    798798#endif
    799799
    800800                    char letter = current[i] - 4 + 'a';
  • src/add-ons/kernel/drivers/input/usb_hid/HIDDevice.cpp

    diff --git a/src/add-ons/kernel/drivers/input/usb_hid/HIDDevice.cpp b/src/add-ons/kernel/drivers/input/usb_hid/HIDDevice.cpp
    index cbce1e65ee..25b5806a83 100644
    a b HIDDevice::HIDDevice(usb_device device, const usb_configuration_info *config,  
    181181        return;
    182182    }
    183183
    184     fTransferBufferSize = fParser.MaxReportSize();
     184    fTransferBufferSize = fParser.MaxReportSize(HID_REPORT_TYPE_INPUT);
    185185    if (fTransferBufferSize == 0) {
    186186        TRACE_ALWAYS("report claims a report size of 0\n");
    187187        return;