Ticket #7649: JProtocol.diff

File JProtocol.diff, 1.8 KB (added by caz_haiku, 8 years ago)
  • src/add-ons/kernel/drivers/input/usb_hid/HIDWriter.cpp

     
    4242    SetReportSize(bitLength);
    4343    SetReportCount(count);
    4444
    45     main_item_data data;
     45    main_item_data data = { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
    4646    data.data_constant = 1;
    4747    return Input(data);
    4848}
  • src/add-ons/kernel/drivers/input/usb_hid/JoystickProtocolHandler.cpp

     
    3838    memset(&fJoystickModuleInfo, 0, sizeof(joystick_module_info));
    3939    memset(&fCurrentValues, 0, sizeof(variable_joystick));
    4040
     41    // Make the first 2 axes reserved, usb_joy made the first 2 axes reserved
     42    // this allows a legacy app to at least be able to use a gamepad
     43    // With this modification i can use an xbox360 controller's first stick
     44    // in a legacy application such as BeS9x.
     45   
     46    fAxis = (HIDReportItem **)malloc(2 * sizeof(HIDReportItem *));
     47    fAxis[0] = report.FindItem(B_HID_USAGE_PAGE_GENERIC_DESKTOP,
     48        B_HID_UID_GD_X);
     49    fAxis[1] = report.FindItem(B_HID_USAGE_PAGE_GENERIC_DESKTOP,
     50        B_HID_UID_GD_Y);
     51    fAxisCount = 2;
     52   
    4153    for (uint32 i = 0; i < report.CountItems(); i++) {
    4254        HIDReportItem *item = report.ItemAt(i);
    4355        if (!item->HasData())
     
    89101                } else
    90102                    break;
    91103
     104                if(item == fAxis[0] || item == fAxis[1])
     105                    continue;
     106                   
    92107                HIDReportItem **newAxis = (HIDReportItem **)realloc(fAxis,
    93108                    ++fAxisCount * sizeof(HIDReportItem *));
    94109                if (newAxis == NULL) {