Ticket #5136: usb_hid.patch

File usb_hid.patch, 2.0 KB (added by bmkx, 12 years ago)
  • src/add-ons/kernel/drivers/input/usb_hid/MouseDevice.cpp

     
    1010#include "HIDDevice.h"
    1111#include "HIDReport.h"
    1212#include "HIDReportItem.h"
     13#include "HIDCollection.h"
    1314
    1415#include <new>
    1516#include <string.h>
     
    5556{
    5657    HIDParser *parser = device->Parser();
    5758
     59    HIDCollection *rootCollection = parser->RootCollection();
     60    if (rootCollection == NULL)
     61        return NULL;
     62
     63    uint32 usage = rootCollection->ExtendedUsage();
     64    if ((usage >> 16) != HID_USAGE_PAGE_GENERIC_DESKTOP)
     65        return NULL;
     66    if ((usage & 0xffff) != HID_USAGE_ID_MOUSE)
     67        return NULL;
     68
    5869    // try to find at least an x and y axis
    5970    HIDReport *report = NULL;
    6071    HIDReportItem *xAxis = NULL;
  • src/add-ons/kernel/drivers/input/usb_hid/HIDParser.cpp

     
    9999            {
    100100                main_item_data *mainData = (main_item_data *)&data;
    101101                if (item->tag == ITEM_TAG_MAIN_COLLECTION) {
     102                    localState.usage_stack = usageStack;
     103                    localState.usage_stack_used = usageStackUsed;
     104
    102105                    HIDCollection *newCollection
    103106                        = new(std::nothrow) HIDCollection(collection,
    104107                            (uint8)data, globalState, localState);
  • src/add-ons/kernel/drivers/input/usb_hid/HIDCollection.h

     
    2828
    2929        void                    PrintToStream(uint32 indentLevel = 0);
    3030
     31        uint32                  ExtendedUsage() { return fUsage; };
     32
    3133private:
    3234        HIDCollection *         fParent;
    3335